diff --git a/app/catchall.tsx b/app/catchall.tsx index 1d07c97e..d0773650 100644 --- a/app/catchall.tsx +++ b/app/catchall.tsx @@ -2,16 +2,16 @@ import Section from "@packages/components/Section"; import { LocalizedText } from "@packages/locale/context"; function PageNotFound() { - return ( -
-
-

- -

-

(╯°□°)╯︵ ┻━┻

-
-
- ); + return ( +
+
+

+ +

+

(╯°□°)╯︵ ┻━┻

+
+
+ ); } export default PageNotFound; diff --git a/app/cookies.server.ts b/app/cookies.server.ts index d23cd861..447204bc 100644 --- a/app/cookies.server.ts +++ b/app/cookies.server.ts @@ -2,6 +2,6 @@ import { MAX_COOKIE_AGE } from "@packages/contants"; import { createCookie } from "react-router"; export const selectedTheme = createCookie("selected-theme", { - path: "/", - maxAge: MAX_COOKIE_AGE, + path: "/", + maxAge: MAX_COOKIE_AGE, }); diff --git a/app/entry.server.tsx b/app/entry.server.tsx index 1701765b..492fd8c1 100644 --- a/app/entry.server.tsx +++ b/app/entry.server.tsx @@ -1,45 +1,45 @@ import { isbot } from "isbot"; import { renderToReadableStream } from "react-dom/server"; import { - type AppLoadContext, - type EntryContext, - ServerRouter, + type AppLoadContext, + type EntryContext, + ServerRouter, } from "react-router"; const ABORT_DELAY = 5000; export default async function handleRequest( - request: Request, - status: number, - headers: Headers, - routerContext: EntryContext, - // This is ignored so we can keep it in the template for visibility. Feel - // free to delete this parameter in your app if you're not using it! - _loadContext: AppLoadContext, + request: Request, + status: number, + headers: Headers, + routerContext: EntryContext, + // This is ignored so we can keep it in the template for visibility. Feel + // free to delete this parameter in your app if you're not using it! + _loadContext: AppLoadContext, ) { - const controller = new AbortController(); - const timeoutId = setTimeout(() => controller.abort(), ABORT_DELAY); + const controller = new AbortController(); + const timeoutId = setTimeout(() => controller.abort(), ABORT_DELAY); - const body = await renderToReadableStream( - , - { - signal: controller.signal, - onError(error: unknown) { - if (!controller.signal.aborted) { - // Log streaming rendering errors from inside the shell - console.error(error); - } - status = 500; - }, - }, - ); + const body = await renderToReadableStream( + , + { + signal: controller.signal, + onError(error: unknown) { + if (!controller.signal.aborted) { + // Log streaming rendering errors from inside the shell + console.error(error); + } + status = 500; + }, + }, + ); - body.allReady.then(() => clearTimeout(timeoutId)); + body.allReady.then(() => clearTimeout(timeoutId)); - if (isbot(request.headers.get("user-agent") || "")) { - await body.allReady; - } + if (isbot(request.headers.get("user-agent") || "")) { + await body.allReady; + } - headers.set("Content-Type", "text/html"); - return new Response(body, { headers, status }); + headers.set("Content-Type", "text/html"); + return new Response(body, { headers, status }); } diff --git a/app/root.tsx b/app/root.tsx index 43b17024..4b4ce547 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -1,17 +1,17 @@ import type { Theme } from "@packages/utils/theme"; import { - type ActionFunctionArgs, - Links, - type LinksFunction, - type LoaderFunctionArgs, - Meta, - Outlet, - Scripts, - ScrollRestoration, - isRouteErrorResponse, - redirect, - useLoaderData, - useRouteError, + type ActionFunctionArgs, + Links, + type LinksFunction, + type LoaderFunctionArgs, + Meta, + Outlet, + Scripts, + ScrollRestoration, + isRouteErrorResponse, + redirect, + useLoaderData, + useRouteError, } from "react-router"; import "./tailwind.css"; @@ -20,91 +20,91 @@ import Providers from "@packages/components/Providers"; import { selectedTheme } from "./cookies.server"; export const links: LinksFunction = () => [ - // NOTE: Example of blocking scripts - // - //{ rel: "preconnect", href: "https://fonts.googleapis.com" }, - //{ - // rel: "preconnect", - // href: "https://fonts.gstatic.com", - // crossOrigin: "anonymous", - //}, - //{ - // rel: "stylesheet", - // href: "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap", - //}, + // NOTE: Example of blocking scripts + // + //{ rel: "preconnect", href: "https://fonts.googleapis.com" }, + //{ + // rel: "preconnect", + // href: "https://fonts.gstatic.com", + // crossOrigin: "anonymous", + //}, + //{ + // rel: "stylesheet", + // href: "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap", + //}, ]; export async function loader({ request }: LoaderFunctionArgs) { - const cookieHeader = request.headers.get("Cookie"); - const rawTheme = await selectedTheme.parse(cookieHeader); - const theme: Theme = rawTheme ?? "system"; + const cookieHeader = request.headers.get("Cookie"); + const rawTheme = await selectedTheme.parse(cookieHeader); + const theme: Theme = rawTheme ?? "system"; - return { theme }; + return { theme }; } export async function action({ request }: ActionFunctionArgs) { - const formData = await request.formData(); - const theme = (formData.get("theme") ?? "system") as Theme; + const formData = await request.formData(); + const theme = (formData.get("theme") ?? "system") as Theme; - const redirectUrl = request.headers.get("referer") ?? "/"; + const redirectUrl = request.headers.get("referer") ?? "/"; - return redirect(redirectUrl, { - headers: { - "Set-Cookie": await selectedTheme.serialize(theme), - }, - }); + return redirect(redirectUrl, { + headers: { + "Set-Cookie": await selectedTheme.serialize(theme), + }, + }); } export function Layout({ children }: React.PropsWithChildren) { - const { theme } = useLoaderData(); + const { theme } = useLoaderData(); - return ( - - - - - - + return ( + + + + + + - - - - {children} - - - - - ); + + + + {children} + + + + + ); } export default function App() { - return ; + return ; } export function ErrorBoundary() { - const error = useRouteError(); + const error = useRouteError(); - if (isRouteErrorResponse(error)) { - return ( -
-

- {error.status} {error.statusText} -

-

{error.data}

-
- ); - } + if (isRouteErrorResponse(error)) { + return ( +
+

+ {error.status} {error.statusText} +

+

{error.data}

+
+ ); + } - if (error instanceof Error) { - return ( -
-

Error

-

{error.message}

-

The stack trace is:

-
{error.stack}
-
- ); - } + if (error instanceof Error) { + return ( +
+

Error

+

{error.message}

+

The stack trace is:

+
{error.stack}
+
+ ); + } - return

Unknown Error

; + return

Unknown Error

; } diff --git a/app/routes.ts b/app/routes.ts index a4c86c3b..e9b86c31 100644 --- a/app/routes.ts +++ b/app/routes.ts @@ -3,4 +3,9 @@ import { flatRoutes } from "@react-router/fs-routes"; const routes = await flatRoutes(); -export default [...routes, route("/*", "./catchall.tsx")] satisfies RouteConfig; +const allRoutes = [ + ...routes, + route("/*", "./catchall.tsx"), +] satisfies RouteConfig; + +export default allRoutes; diff --git a/app/routes/[robots.txt].tsx b/app/routes/[robots.txt].tsx index 2bbfffb4..a2602eb6 100644 --- a/app/routes/[robots.txt].tsx +++ b/app/routes/[robots.txt].tsx @@ -11,10 +11,10 @@ Sitemap: ${SITEMAP_URL} `; export function loader() { - return new Response(ROBOT_CONTENT, { - status: 200, - headers: { - "Content-Type": "text/plain", - }, - }); + return new Response(ROBOT_CONTENT, { + status: 200, + headers: { + "Content-Type": "text/plain", + }, + }); } diff --git a/app/routes/[sitemap.xml].tsx b/app/routes/[sitemap.xml].tsx index cc1c6825..4fec7423 100644 --- a/app/routes/[sitemap.xml].tsx +++ b/app/routes/[sitemap.xml].tsx @@ -4,7 +4,7 @@ const SITEMAP_CONTENT = ` ${SITEMAP_URLS.map( - (url) => ` + (url) => ` ${url.loc} ${url.lastmod} ${url.priority} @@ -15,12 +15,12 @@ ${SITEMAP_URLS.map( `; export function loader() { - return new Response(SITEMAP_CONTENT, { - status: 200, - headers: { - "Content-Type": "application/xml", - "xml-version": "1.0", - encoding: "UTF-8", - }, - }); + return new Response(SITEMAP_CONTENT, { + status: 200, + headers: { + "Content-Type": "application/xml", + "xml-version": "1.0", + encoding: "UTF-8", + }, + }); } diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index a2b0f1ae..da2bedda 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -1,5 +1,5 @@ -import CallToActionSection from "@packages/components/CallToActionSection"; import Footer from "@packages/components/Footer"; +import HeroSection from "@packages/components/HeroSection"; import MentoringSection from "@packages/components/MentoringSection"; import RoadmapSection from "@packages/components/RoadmapSection"; import TechSection from "@packages/components/TechSection"; @@ -9,35 +9,35 @@ import WhyItWorksSection from "@packages/components/WhyItWorksSection"; import { description, title } from "@packages/config/site"; import { Database } from "@packages/repositories/db"; import { - type LoaderFunctionArgs, - type MetaFunction, - useLoaderData, + type LoaderFunctionArgs, + type MetaFunction, + useLoaderData, } from "react-router"; export const meta: MetaFunction = () => { - return [{ title }, { name: "description", content: description }]; + return [{ title }, { name: "description", content: description }]; }; export async function loader({ context }: LoaderFunctionArgs) { - const db = new Database( - context.cloudflare.env.TURSO_CONNECTION_URL, - context.cloudflare.env.TURSO_AUTH_TOKEN, - ); - const testimonials = await db.testimonials; - return { testimonials }; + const db = new Database( + context.cloudflare.env.TURSO_CONNECTION_URL, + context.cloudflare.env.TURSO_AUTH_TOKEN, + ); + const testimonials = await db.testimonials; + return { testimonials }; } export default function Index() { - const { testimonials } = useLoaderData(); - return ( - <> - - - - - - -