This commit is contained in:
2025-02-21 14:04:17 -03:00
parent f0b840b8e8
commit a8d0667b89
26 changed files with 197 additions and 252 deletions

View File

@@ -1,4 +1,4 @@
import type { Route } from "./+types/root";
import type { Route } from './+types/root'
import {
isRouteErrorResponse,
Links,
@@ -6,27 +6,27 @@ import {
Outlet,
Scripts,
ScrollRestoration,
} from "react-router";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { Amplify } from "aws-amplify";
import { AuthProvider } from "~/hooks/use-auth";
import amplifyconfig from "./amplifyconfiguration.json";
} from 'react-router'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { Amplify } from 'aws-amplify'
import { AuthProvider } from '~/hooks/use-auth'
import amplifyconfig from './amplifyconfiguration.json'
Amplify.configure(amplifyconfig);
const queryClient = new QueryClient();
Amplify.configure(amplifyconfig)
const queryClient = new QueryClient()
export const links: Route.LinksFunction = () => [
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
{
rel: "preconnect",
href: "https://fonts.gstatic.com",
crossOrigin: "anonymous",
rel: 'preconnect',
href: 'https://fonts.gstatic.com',
crossOrigin: 'anonymous',
},
{
rel: "stylesheet",
href: "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap",
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap',
},
];
]
export function Layout({ children }: { children: React.ReactNode }) {
return (
@@ -44,7 +44,7 @@ export function Layout({ children }: { children: React.ReactNode }) {
<Scripts />
</body>
</html>
);
)
}
export default function App() {
@@ -54,7 +54,7 @@ export default function App() {
<Outlet />
</AuthProvider>
</QueryClientProvider>
);
)
}
export function HydrateFallback() {
@@ -69,23 +69,23 @@ export function HydrateFallback() {
}
`}</style>
</div>
);
)
}
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
let message = "Oops!";
let details = "An unexpected error occurred.";
let stack: string | undefined;
let message = 'Oops!'
let details = 'An unexpected error occurred.'
let stack: string | undefined
if (isRouteErrorResponse(error)) {
message = error.status === 404 ? "404" : "Error";
message = error.status === 404 ? '404' : 'Error'
details =
error.status === 404
? "The requested page could not be found."
: error.statusText || details;
? 'The requested page could not be found.'
: error.statusText || details
} else if (import.meta.env.DEV && error && error instanceof Error) {
details = error.message;
stack = error.stack;
details = error.message
stack = error.stack
}
return (
@@ -99,5 +99,5 @@ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
</pre>
)}
</main>
);
)
}