Establish the visual-redesign foundation (task group 1): a single shared source of design tokens both apps consume, so Planner and Journal read from one palette/typography layer instead of drifting per-app. - New @trails-cool/ui package exporting theme.css: Tailwind v4 @theme tokens (warm off-white surfaces, one sage accent, earthy overnight tones, elevation-gradient colors, shadows) extracted from the visual-redesign mockup. - Self-hosted Outfit (body) + Geist Mono (stats) via @fontsource-variable — privacy-first, no Google Fonts CDN. - Both apps import the theme and set the base canvas to the warm off-white token + Outfit as the default font. Foundation only: tokens are now available as Tailwind utilities (bg-bg-raised, text-accent, font-mono, …) and raw CSS vars. Wiring them into specific surfaces (topbar, sidebar, markers, elevation chart) is later task groups. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
67 lines
2.3 KiB
TypeScript
67 lines
2.3 KiB
TypeScript
import { Links, Meta, Outlet, Scripts, ScrollRestoration, isRouteErrorResponse } from "react-router";
|
|
import type { LinksFunction } from "react-router";
|
|
import type { Route } from "./+types/root";
|
|
import * as Sentry from "@sentry/react";
|
|
import { useTranslation } from "react-i18next";
|
|
import stylesheet from "./styles.css?url";
|
|
|
|
export const links: LinksFunction = () => [{ rel: "stylesheet", href: stylesheet }];
|
|
|
|
export function Layout({ children }: { children: React.ReactNode }) {
|
|
const { i18n } = useTranslation();
|
|
return (
|
|
<html lang={i18n.language}>
|
|
<head>
|
|
<meta charSet="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover" />
|
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
<Meta />
|
|
<Links />
|
|
</head>
|
|
<body className="h-screen w-screen overflow-hidden bg-bg">
|
|
{children}
|
|
<ScrollRestoration />
|
|
<Scripts />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|
|
|
|
export default function App() {
|
|
return <Outlet />;
|
|
}
|
|
|
|
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
|
if (!(isRouteErrorResponse(error) && error.status < 500)) {
|
|
Sentry.captureException(error);
|
|
}
|
|
const { t } = useTranslation();
|
|
|
|
if (isRouteErrorResponse(error)) {
|
|
return (
|
|
<div className="flex h-full items-center justify-center">
|
|
<div className="text-center">
|
|
<h1 className="text-4xl font-bold text-gray-900">{error.status}</h1>
|
|
<p className="mt-2 text-gray-600">
|
|
{error.status === 404 && t("pageNotFound")}
|
|
{error.status === 503 && t("serviceUnavailable")}
|
|
{error.status !== 404 && error.status !== 503 && (error.statusText || t("error"))}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="flex h-full items-center justify-center">
|
|
<div className="text-center">
|
|
<h1 className="text-4xl font-bold text-gray-900">{t("error")}</h1>
|
|
<p className="mt-2 text-gray-600">
|
|
{error instanceof Error ? error.message : t("error")}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|