2025-10-10 23:04:50 -07:00
|
|
|
import {
|
|
|
|
|
isRouteErrorResponse,
|
|
|
|
|
Links,
|
|
|
|
|
Meta,
|
|
|
|
|
Outlet,
|
|
|
|
|
Scripts,
|
|
|
|
|
ScrollRestoration,
|
2025-10-25 18:25:26 -07:00
|
|
|
useLocation,
|
2025-10-10 23:04:50 -07:00
|
|
|
} from "react-router";
|
|
|
|
|
|
|
|
|
|
import type { Route } from "./+types/root";
|
|
|
|
|
import "./app.css";
|
2025-10-13 09:44:59 -07:00
|
|
|
import { clerkMiddleware, rootAuthLoader, getAuth } from "@clerk/react-router/server";
|
2025-10-10 23:30:26 -07:00
|
|
|
import { Navbar } from "~/components/navbar";
|
2026-03-11 22:02:48 -07:00
|
|
|
import { NavigationProgress } from "~/components/NavigationProgress";
|
2025-10-10 23:30:26 -07:00
|
|
|
import { ClerkProvider } from "@clerk/react-router";
|
2026-02-20 19:26:11 -08:00
|
|
|
import { dark } from "@clerk/themes";
|
2025-10-11 00:29:04 -07:00
|
|
|
import { Toaster } from "~/components/ui/sonner";
|
New design (#309)
* Redesign home page with new layout and component system
- Two-column layout (My Leagues 2/3, Upcoming Events 1/3) with mobile stack
- LeagueRow: square avatar, gradient draft highlight, rank/points display, progress bar
- MyLeaguesCard, CreateLeagueCard with shared SectionCardHeader
- UpcomingEventsCard: vertical timeline with grouped multi-league events
- Shared gradient system: BracktGradients SVG defs, GradientIcon wrapper, brand.ts constants
- Button default variant updated to green→cyan gradient
- Navbar: plain nav links with gradient hover, support/admin icon buttons
- Accessibility fixes: semantic h2 headings, aria-label on LeagueAvatar and nav elements
- Storybook stories for all new components
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Responsive league row layout and mobile polish
- League rows stack avatar+name on top, stats full-width below on mobile
- Stats spread to right side on sm+ screens with border separator on mobile
- Tighter padding on mobile (px-3/py-3), full padding on sm+
- Card headers and content use px-3 sm:px-6 to reduce mobile gutters
- Two-column home layout deferred to lg breakpoint (tablet gets stacked)
- Active leagues sorted by completion percentage descending
- Default rank 1 / 0 points for active leagues with no scoring events yet
- Fix ordinal bug for 11th/12th/13th; add aria-labels to rank change indicators
- Remove dead StatDivider className prop
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Improve claude file.
* Add StandingsPreview card component with podium row styling
- New StandingsPreview component with gold/silver/bronze row tints for
top 3, team avatar, and LeagueRow-style stat columns (Ranking + Points)
with rank and 7-day point change indicators
- Fix GradientIcon in Storybook by adding BracktGradients decorator to
preview.tsx (renamed from .ts to support JSX)
- Fix degenerate SVG gradient on horizontal strokes by switching
BracktGradients to gradientUnits="userSpaceOnUse" with Lucide-space
coordinates (0→24)
- Revert erroneous fill: url(#gradient) from GradientIcon; stroke-only
fix was sufficient once gradientUnits was corrected
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update components on league homepage.
* Finish up league page styling.
* Work on standings page.
* Add story for RecentScoresCard
* Update Point Progression Chart.
* Sort point progression legend by ranking and add team links to standings rows
* Fix standings discrepancy on change.
* Create draft cell component.
* Update draft board page
* Draft room improvements.
* Update some draft room styling.
* Fix context menu missing.
* Move tab navigation and autodraft to header row, narrow sidebar
* Virtualize available participants list, memoize draft room props
Adds @tanstack/react-virtual to replace separate mobile/desktop lists
with a single unified virtual scroll loop. Also memoizes miniDraftGrid
and availableParticipantsSectionProps, and switches pick lookup from
Array.find to a Map for O(1) access.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update draft room UI.
* More draft room fixes.
* Draft room tweaks.
* Fix Rosters page.
* Queue Section fixes.
* Mobile Draft fixes.
* Fix draft board page.
* Create bracket look.
* Bracket work.
* Finish bracket page.
* Homepage initial styling
* homepage copy
* Add privacy policy. Fixes #88.
* how to play copy
* rules copy
* Fix brackets on homepage.
* Add footer to website.
* Glow on dots.
* Landing page copy.
* Fix sidebar.
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 13:14:55 -07:00
|
|
|
import { BracktGradients } from "~/components/ui/BracktGradients";
|
|
|
|
|
import { Footer } from "~/components/marketing/Footer";
|
2025-10-13 09:44:59 -07:00
|
|
|
import { isUserAdminByClerkId } from "~/models/user";
|
2026-02-21 23:47:42 -08:00
|
|
|
import { AlertCircle, FileQuestion, Lock, ShieldOff, ServerCrash } from "lucide-react";
|
2025-10-10 23:18:16 -07:00
|
|
|
|
2025-10-11 20:56:00 -07:00
|
|
|
export const middleware: Route.MiddlewareFunction[] = [clerkMiddleware()];
|
|
|
|
|
|
2025-10-10 23:18:16 -07:00
|
|
|
export async function loader(args: Route.LoaderArgs) {
|
2025-10-13 09:44:59 -07:00
|
|
|
return rootAuthLoader(args, async () => {
|
|
|
|
|
const { userId } = await getAuth(args);
|
|
|
|
|
|
|
|
|
|
let isAdmin = false;
|
|
|
|
|
if (userId) {
|
|
|
|
|
isAdmin = await isUserAdminByClerkId(userId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return { isAdmin };
|
|
|
|
|
});
|
2025-10-10 23:18:16 -07:00
|
|
|
}
|
2025-10-10 23:04:50 -07:00
|
|
|
|
|
|
|
|
export const links: Route.LinksFunction = () => [
|
New design (#309)
* Redesign home page with new layout and component system
- Two-column layout (My Leagues 2/3, Upcoming Events 1/3) with mobile stack
- LeagueRow: square avatar, gradient draft highlight, rank/points display, progress bar
- MyLeaguesCard, CreateLeagueCard with shared SectionCardHeader
- UpcomingEventsCard: vertical timeline with grouped multi-league events
- Shared gradient system: BracktGradients SVG defs, GradientIcon wrapper, brand.ts constants
- Button default variant updated to green→cyan gradient
- Navbar: plain nav links with gradient hover, support/admin icon buttons
- Accessibility fixes: semantic h2 headings, aria-label on LeagueAvatar and nav elements
- Storybook stories for all new components
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Responsive league row layout and mobile polish
- League rows stack avatar+name on top, stats full-width below on mobile
- Stats spread to right side on sm+ screens with border separator on mobile
- Tighter padding on mobile (px-3/py-3), full padding on sm+
- Card headers and content use px-3 sm:px-6 to reduce mobile gutters
- Two-column home layout deferred to lg breakpoint (tablet gets stacked)
- Active leagues sorted by completion percentage descending
- Default rank 1 / 0 points for active leagues with no scoring events yet
- Fix ordinal bug for 11th/12th/13th; add aria-labels to rank change indicators
- Remove dead StatDivider className prop
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Improve claude file.
* Add StandingsPreview card component with podium row styling
- New StandingsPreview component with gold/silver/bronze row tints for
top 3, team avatar, and LeagueRow-style stat columns (Ranking + Points)
with rank and 7-day point change indicators
- Fix GradientIcon in Storybook by adding BracktGradients decorator to
preview.tsx (renamed from .ts to support JSX)
- Fix degenerate SVG gradient on horizontal strokes by switching
BracktGradients to gradientUnits="userSpaceOnUse" with Lucide-space
coordinates (0→24)
- Revert erroneous fill: url(#gradient) from GradientIcon; stroke-only
fix was sufficient once gradientUnits was corrected
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update components on league homepage.
* Finish up league page styling.
* Work on standings page.
* Add story for RecentScoresCard
* Update Point Progression Chart.
* Sort point progression legend by ranking and add team links to standings rows
* Fix standings discrepancy on change.
* Create draft cell component.
* Update draft board page
* Draft room improvements.
* Update some draft room styling.
* Fix context menu missing.
* Move tab navigation and autodraft to header row, narrow sidebar
* Virtualize available participants list, memoize draft room props
Adds @tanstack/react-virtual to replace separate mobile/desktop lists
with a single unified virtual scroll loop. Also memoizes miniDraftGrid
and availableParticipantsSectionProps, and switches pick lookup from
Array.find to a Map for O(1) access.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update draft room UI.
* More draft room fixes.
* Draft room tweaks.
* Fix Rosters page.
* Queue Section fixes.
* Mobile Draft fixes.
* Fix draft board page.
* Create bracket look.
* Bracket work.
* Finish bracket page.
* Homepage initial styling
* homepage copy
* Add privacy policy. Fixes #88.
* how to play copy
* rules copy
* Fix brackets on homepage.
* Add footer to website.
* Glow on dots.
* Landing page copy.
* Fix sidebar.
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 13:14:55 -07:00
|
|
|
{ rel: "icon", href: "/favicon.ico?v=20260402", sizes: "48x48" },
|
|
|
|
|
{ rel: "icon", href: "/favicon.svg?v=20260402", type: "image/svg+xml" },
|
|
|
|
|
{ rel: "icon", href: "/favicon-96x96.png?v=20260402", type: "image/png", sizes: "96x96" },
|
|
|
|
|
{ rel: "apple-touch-icon", href: "/apple-touch-icon.png?v=20260402" },
|
|
|
|
|
{ rel: "manifest", href: "/site.webmanifest?v=20260402" },
|
2025-10-10 23:04:50 -07:00
|
|
|
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
|
|
|
|
|
{
|
|
|
|
|
rel: "preconnect",
|
|
|
|
|
href: "https://fonts.gstatic.com",
|
|
|
|
|
crossOrigin: "anonymous",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
rel: "stylesheet",
|
New design (#309)
* Redesign home page with new layout and component system
- Two-column layout (My Leagues 2/3, Upcoming Events 1/3) with mobile stack
- LeagueRow: square avatar, gradient draft highlight, rank/points display, progress bar
- MyLeaguesCard, CreateLeagueCard with shared SectionCardHeader
- UpcomingEventsCard: vertical timeline with grouped multi-league events
- Shared gradient system: BracktGradients SVG defs, GradientIcon wrapper, brand.ts constants
- Button default variant updated to green→cyan gradient
- Navbar: plain nav links with gradient hover, support/admin icon buttons
- Accessibility fixes: semantic h2 headings, aria-label on LeagueAvatar and nav elements
- Storybook stories for all new components
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Responsive league row layout and mobile polish
- League rows stack avatar+name on top, stats full-width below on mobile
- Stats spread to right side on sm+ screens with border separator on mobile
- Tighter padding on mobile (px-3/py-3), full padding on sm+
- Card headers and content use px-3 sm:px-6 to reduce mobile gutters
- Two-column home layout deferred to lg breakpoint (tablet gets stacked)
- Active leagues sorted by completion percentage descending
- Default rank 1 / 0 points for active leagues with no scoring events yet
- Fix ordinal bug for 11th/12th/13th; add aria-labels to rank change indicators
- Remove dead StatDivider className prop
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Improve claude file.
* Add StandingsPreview card component with podium row styling
- New StandingsPreview component with gold/silver/bronze row tints for
top 3, team avatar, and LeagueRow-style stat columns (Ranking + Points)
with rank and 7-day point change indicators
- Fix GradientIcon in Storybook by adding BracktGradients decorator to
preview.tsx (renamed from .ts to support JSX)
- Fix degenerate SVG gradient on horizontal strokes by switching
BracktGradients to gradientUnits="userSpaceOnUse" with Lucide-space
coordinates (0→24)
- Revert erroneous fill: url(#gradient) from GradientIcon; stroke-only
fix was sufficient once gradientUnits was corrected
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update components on league homepage.
* Finish up league page styling.
* Work on standings page.
* Add story for RecentScoresCard
* Update Point Progression Chart.
* Sort point progression legend by ranking and add team links to standings rows
* Fix standings discrepancy on change.
* Create draft cell component.
* Update draft board page
* Draft room improvements.
* Update some draft room styling.
* Fix context menu missing.
* Move tab navigation and autodraft to header row, narrow sidebar
* Virtualize available participants list, memoize draft room props
Adds @tanstack/react-virtual to replace separate mobile/desktop lists
with a single unified virtual scroll loop. Also memoizes miniDraftGrid
and availableParticipantsSectionProps, and switches pick lookup from
Array.find to a Map for O(1) access.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update draft room UI.
* More draft room fixes.
* Draft room tweaks.
* Fix Rosters page.
* Queue Section fixes.
* Mobile Draft fixes.
* Fix draft board page.
* Create bracket look.
* Bracket work.
* Finish bracket page.
* Homepage initial styling
* homepage copy
* Add privacy policy. Fixes #88.
* how to play copy
* rules copy
* Fix brackets on homepage.
* Add footer to website.
* Glow on dots.
* Landing page copy.
* Fix sidebar.
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 13:14:55 -07:00
|
|
|
href: "https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&display=swap",
|
2025-10-10 23:04:50 -07:00
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export function Layout({ children }: { children: React.ReactNode }) {
|
|
|
|
|
return (
|
2026-02-20 19:26:11 -08:00
|
|
|
<html lang="en" className="dark">
|
2025-10-10 23:04:50 -07:00
|
|
|
<head>
|
|
|
|
|
<meta charSet="utf-8" />
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
|
<Meta />
|
|
|
|
|
<Links />
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
New design (#309)
* Redesign home page with new layout and component system
- Two-column layout (My Leagues 2/3, Upcoming Events 1/3) with mobile stack
- LeagueRow: square avatar, gradient draft highlight, rank/points display, progress bar
- MyLeaguesCard, CreateLeagueCard with shared SectionCardHeader
- UpcomingEventsCard: vertical timeline with grouped multi-league events
- Shared gradient system: BracktGradients SVG defs, GradientIcon wrapper, brand.ts constants
- Button default variant updated to green→cyan gradient
- Navbar: plain nav links with gradient hover, support/admin icon buttons
- Accessibility fixes: semantic h2 headings, aria-label on LeagueAvatar and nav elements
- Storybook stories for all new components
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Responsive league row layout and mobile polish
- League rows stack avatar+name on top, stats full-width below on mobile
- Stats spread to right side on sm+ screens with border separator on mobile
- Tighter padding on mobile (px-3/py-3), full padding on sm+
- Card headers and content use px-3 sm:px-6 to reduce mobile gutters
- Two-column home layout deferred to lg breakpoint (tablet gets stacked)
- Active leagues sorted by completion percentage descending
- Default rank 1 / 0 points for active leagues with no scoring events yet
- Fix ordinal bug for 11th/12th/13th; add aria-labels to rank change indicators
- Remove dead StatDivider className prop
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Improve claude file.
* Add StandingsPreview card component with podium row styling
- New StandingsPreview component with gold/silver/bronze row tints for
top 3, team avatar, and LeagueRow-style stat columns (Ranking + Points)
with rank and 7-day point change indicators
- Fix GradientIcon in Storybook by adding BracktGradients decorator to
preview.tsx (renamed from .ts to support JSX)
- Fix degenerate SVG gradient on horizontal strokes by switching
BracktGradients to gradientUnits="userSpaceOnUse" with Lucide-space
coordinates (0→24)
- Revert erroneous fill: url(#gradient) from GradientIcon; stroke-only
fix was sufficient once gradientUnits was corrected
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update components on league homepage.
* Finish up league page styling.
* Work on standings page.
* Add story for RecentScoresCard
* Update Point Progression Chart.
* Sort point progression legend by ranking and add team links to standings rows
* Fix standings discrepancy on change.
* Create draft cell component.
* Update draft board page
* Draft room improvements.
* Update some draft room styling.
* Fix context menu missing.
* Move tab navigation and autodraft to header row, narrow sidebar
* Virtualize available participants list, memoize draft room props
Adds @tanstack/react-virtual to replace separate mobile/desktop lists
with a single unified virtual scroll loop. Also memoizes miniDraftGrid
and availableParticipantsSectionProps, and switches pick lookup from
Array.find to a Map for O(1) access.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update draft room UI.
* More draft room fixes.
* Draft room tweaks.
* Fix Rosters page.
* Queue Section fixes.
* Mobile Draft fixes.
* Fix draft board page.
* Create bracket look.
* Bracket work.
* Finish bracket page.
* Homepage initial styling
* homepage copy
* Add privacy policy. Fixes #88.
* how to play copy
* rules copy
* Fix brackets on homepage.
* Add footer to website.
* Glow on dots.
* Landing page copy.
* Fix sidebar.
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 13:14:55 -07:00
|
|
|
<BracktGradients />
|
2025-10-10 23:04:50 -07:00
|
|
|
{children}
|
|
|
|
|
<ScrollRestoration />
|
|
|
|
|
<Scripts />
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-10 23:18:16 -07:00
|
|
|
export default function App({ loaderData }: Route.ComponentProps) {
|
2025-10-25 18:25:26 -07:00
|
|
|
const location = useLocation();
|
|
|
|
|
const isDraftRoute = location.pathname.includes('/draft');
|
|
|
|
|
|
2025-10-10 23:18:16 -07:00
|
|
|
return (
|
2026-02-20 19:26:11 -08:00
|
|
|
<ClerkProvider loaderData={loaderData} appearance={{ baseTheme: dark }}>
|
2026-03-11 22:02:48 -07:00
|
|
|
<NavigationProgress />
|
2025-10-25 18:25:26 -07:00
|
|
|
{!isDraftRoute && <Navbar isAdmin={loaderData?.isAdmin ?? false} />}
|
|
|
|
|
{isDraftRoute ? (
|
2025-10-10 23:18:16 -07:00
|
|
|
<Outlet />
|
2025-10-25 18:25:26 -07:00
|
|
|
) : (
|
New design (#309)
* Redesign home page with new layout and component system
- Two-column layout (My Leagues 2/3, Upcoming Events 1/3) with mobile stack
- LeagueRow: square avatar, gradient draft highlight, rank/points display, progress bar
- MyLeaguesCard, CreateLeagueCard with shared SectionCardHeader
- UpcomingEventsCard: vertical timeline with grouped multi-league events
- Shared gradient system: BracktGradients SVG defs, GradientIcon wrapper, brand.ts constants
- Button default variant updated to green→cyan gradient
- Navbar: plain nav links with gradient hover, support/admin icon buttons
- Accessibility fixes: semantic h2 headings, aria-label on LeagueAvatar and nav elements
- Storybook stories for all new components
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Responsive league row layout and mobile polish
- League rows stack avatar+name on top, stats full-width below on mobile
- Stats spread to right side on sm+ screens with border separator on mobile
- Tighter padding on mobile (px-3/py-3), full padding on sm+
- Card headers and content use px-3 sm:px-6 to reduce mobile gutters
- Two-column home layout deferred to lg breakpoint (tablet gets stacked)
- Active leagues sorted by completion percentage descending
- Default rank 1 / 0 points for active leagues with no scoring events yet
- Fix ordinal bug for 11th/12th/13th; add aria-labels to rank change indicators
- Remove dead StatDivider className prop
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Improve claude file.
* Add StandingsPreview card component with podium row styling
- New StandingsPreview component with gold/silver/bronze row tints for
top 3, team avatar, and LeagueRow-style stat columns (Ranking + Points)
with rank and 7-day point change indicators
- Fix GradientIcon in Storybook by adding BracktGradients decorator to
preview.tsx (renamed from .ts to support JSX)
- Fix degenerate SVG gradient on horizontal strokes by switching
BracktGradients to gradientUnits="userSpaceOnUse" with Lucide-space
coordinates (0→24)
- Revert erroneous fill: url(#gradient) from GradientIcon; stroke-only
fix was sufficient once gradientUnits was corrected
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update components on league homepage.
* Finish up league page styling.
* Work on standings page.
* Add story for RecentScoresCard
* Update Point Progression Chart.
* Sort point progression legend by ranking and add team links to standings rows
* Fix standings discrepancy on change.
* Create draft cell component.
* Update draft board page
* Draft room improvements.
* Update some draft room styling.
* Fix context menu missing.
* Move tab navigation and autodraft to header row, narrow sidebar
* Virtualize available participants list, memoize draft room props
Adds @tanstack/react-virtual to replace separate mobile/desktop lists
with a single unified virtual scroll loop. Also memoizes miniDraftGrid
and availableParticipantsSectionProps, and switches pick lookup from
Array.find to a Map for O(1) access.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Update draft room UI.
* More draft room fixes.
* Draft room tweaks.
* Fix Rosters page.
* Queue Section fixes.
* Mobile Draft fixes.
* Fix draft board page.
* Create bracket look.
* Bracket work.
* Finish bracket page.
* Homepage initial styling
* homepage copy
* Add privacy policy. Fixes #88.
* how to play copy
* rules copy
* Fix brackets on homepage.
* Add footer to website.
* Glow on dots.
* Landing page copy.
* Fix sidebar.
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 13:14:55 -07:00
|
|
|
<>
|
|
|
|
|
<main>
|
|
|
|
|
<Outlet />
|
|
|
|
|
</main>
|
|
|
|
|
<Footer />
|
|
|
|
|
</>
|
2025-10-25 18:25:26 -07:00
|
|
|
)}
|
2025-10-11 00:29:04 -07:00
|
|
|
<Toaster />
|
2025-10-10 23:18:16 -07:00
|
|
|
</ClerkProvider>
|
|
|
|
|
);
|
2025-10-10 23:04:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
2026-02-21 23:47:42 -08:00
|
|
|
let status = 500;
|
|
|
|
|
let title = "Something Went Wrong";
|
|
|
|
|
let message = "An unexpected error occurred. Please try again later.";
|
2025-10-10 23:04:50 -07:00
|
|
|
let stack: string | undefined;
|
2026-02-21 23:47:42 -08:00
|
|
|
let showSignInHint = false;
|
2025-10-10 23:04:50 -07:00
|
|
|
if (isRouteErrorResponse(error)) {
|
2026-02-21 23:47:42 -08:00
|
|
|
status = error.status;
|
|
|
|
|
switch (error.status) {
|
|
|
|
|
case 401:
|
|
|
|
|
title = "Sign In Required";
|
|
|
|
|
message = "You need to be signed in to access this page.";
|
|
|
|
|
showSignInHint = true;
|
|
|
|
|
break;
|
|
|
|
|
case 403:
|
|
|
|
|
title = "Access Denied";
|
|
|
|
|
message = "You don't have permission to view this page.";
|
|
|
|
|
break;
|
|
|
|
|
case 404:
|
|
|
|
|
title = "Page Not Found";
|
|
|
|
|
message = "The page you're looking for doesn't exist or has been moved.";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
title = `Error ${error.status}`;
|
|
|
|
|
message =
|
|
|
|
|
typeof error.data === "string" && error.data
|
|
|
|
|
? error.data
|
|
|
|
|
: error.statusText || "Something went wrong.";
|
|
|
|
|
}
|
|
|
|
|
} else if (error instanceof Error) {
|
|
|
|
|
title = "Unexpected Error";
|
|
|
|
|
message = import.meta.env.DEV ? error.message : "An unexpected error occurred. Please try again later.";
|
|
|
|
|
stack = import.meta.env.DEV ? error.stack : undefined;
|
2025-10-10 23:04:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2026-02-21 23:47:42 -08:00
|
|
|
<div className="min-h-screen bg-background text-foreground flex flex-col">
|
|
|
|
|
<header className="border-b border-border/40 bg-background/95 backdrop-blur">
|
|
|
|
|
<div className="flex h-16 items-center px-4 md:px-6 lg:px-8">
|
2026-03-04 00:23:45 -08:00
|
|
|
<a href="/">
|
|
|
|
|
<img src="/logo.svg" alt="Brackt" className="h-6" />
|
2026-02-21 23:47:42 -08:00
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
|
|
|
|
|
|
|
|
|
<main className="flex-1 flex items-center justify-center p-6">
|
|
|
|
|
<div className="max-w-md w-full text-center space-y-6">
|
|
|
|
|
<div className="text-8xl font-bold text-muted-foreground/40 select-none">
|
|
|
|
|
{status}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="flex justify-center">
|
|
|
|
|
{statusIcon(status)}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
|
|
|
|
|
<p className="text-muted-foreground">{message}</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="flex justify-center pt-2">
|
|
|
|
|
<a
|
|
|
|
|
href="/"
|
|
|
|
|
className="inline-flex items-center justify-center rounded-md text-sm font-medium bg-primary text-primary-foreground hover:bg-primary/90 h-9 px-4 py-2 transition-colors"
|
|
|
|
|
>
|
|
|
|
|
{showSignInHint ? "Go to Home Page to Sign In" : "Go Home"}
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{stack && (
|
|
|
|
|
<details className="text-left mt-8 border border-border rounded-md overflow-hidden">
|
|
|
|
|
<summary className="cursor-pointer text-sm text-muted-foreground px-4 py-3 hover:bg-muted/50">
|
|
|
|
|
Stack trace (development only)
|
|
|
|
|
</summary>
|
|
|
|
|
<pre className="p-4 overflow-x-auto text-xs text-muted-foreground border-t border-border">
|
|
|
|
|
<code>{stack}</code>
|
|
|
|
|
</pre>
|
|
|
|
|
</details>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</main>
|
|
|
|
|
</div>
|
2025-10-10 23:04:50 -07:00
|
|
|
);
|
|
|
|
|
}
|
2026-02-21 23:47:42 -08:00
|
|
|
|
|
|
|
|
function statusIcon(status: number) {
|
|
|
|
|
const cls = "h-14 w-14 text-muted-foreground";
|
|
|
|
|
if (status === 401) return <Lock className={cls} />;
|
|
|
|
|
if (status === 403) return <ShieldOff className={cls} />;
|
|
|
|
|
if (status === 404) return <FileQuestion className={cls} />;
|
|
|
|
|
if (status >= 500) return <ServerCrash className={cls} />;
|
|
|
|
|
return <AlertCircle className={cls} />;
|
2026-03-10 23:35:33 -07:00
|
|
|
}
|