Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions app/components/error-boundary.tsx

This file was deleted.

24 changes: 24 additions & 0 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
type MetaFunction,
} from 'react-router'
import { useChangeLanguage } from 'remix-i18next/react'
import ErrorMessage from './components/error-message'
import { Toaster } from './components/ui/toaster'
import { i18nCookie } from './cookies'
import i18next from './i18next.server'
Expand Down Expand Up @@ -131,3 +132,26 @@ export function App() {
</html>
)
}

/**
* A catch-all error boundary that will render if any error is thrown in the app.
* Add a function like this to subpages, if you want to create a more specific
* error boundary for that page (e.g. with specific messages, styling etc.).
*
* Note that error boundaries are shown in place of the parent pages <Outlet />.
*/
export function ErrorBoundary() {
return (
<html className={clsx('light h-full')}>
<head>
<Meta />
<Links />
</head>
<body className="h-full dark:bg-dark-background dark:text-dark-text">
<div className="flex h-screen w-screen items-center justify-center">
<ErrorMessage />
</div>
</body>
</html>
)
}
1 change: 1 addition & 0 deletions app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Link,
useLoaderData,
} from 'react-router'
import ErrorMessage from '~/components/error-message'
import Footer from '~/components/landing/footer'
import { GlobeComponent } from '~/components/landing/globe.client'
import Header from '~/components/landing/header/header'
Expand Down
23 changes: 9 additions & 14 deletions app/routes/account.password-reset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
useSearchParams,
} from 'react-router'

import ErrorMessage from '~/components/error-message'
import Spinner from '~/components/spinner'
import { Button } from '~/components/ui/button'
import {
Expand Down Expand Up @@ -194,7 +193,7 @@ export default function PasswordResetRoute() {

<Card className="z-50 w-full max-w-md">
{busy && (
<div className="absolute inset-0 z-50 flex items-center justify-center bg-white/30 backdrop-blur-sm dark:bg-zinc-800/30">
<div className="bg-white/30 dark:bg-zinc-800/30 absolute inset-0 z-50 flex items-center justify-center backdrop-blur-sm">
<Spinner />
</div>
)}
Expand All @@ -217,20 +216,22 @@ export default function PasswordResetRoute() {
<CardTitle className="text-2xl font-bold">
{t('set_new_password')}
</CardTitle>
<CardDescription>{t('set_new_password_description')}</CardDescription>
<CardDescription>
{t('set_new_password_description')}
</CardDescription>
</CardHeader>

<CardContent className="space-y-4">
<input type="hidden" name="token" value={token} />

{actionData?.errors?.token && (
<div className="rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/40 dark:text-red-200">
<div className="dark:border-red-900/40 dark:bg-red-950/40 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:text-red-200">
{t(actionData.errors.token)}
</div>
)}

{actionData?.errors?.form && (
<div className="rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-900/40 dark:bg-red-950/40 dark:text-red-200">
<div className="dark:border-red-900/40 dark:bg-red-950/40 rounded-md border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:text-red-200">
{t(actionData.errors.form)}
</div>
)}
Expand All @@ -243,7 +244,9 @@ export default function PasswordResetRoute() {
name="newPassword"
type="password"
autoComplete="new-password"
aria-invalid={actionData?.errors?.newPassword ? true : undefined}
aria-invalid={
actionData?.errors?.newPassword ? true : undefined
}
aria-describedby="new-password-error"
/>
{actionData?.errors?.newPassword && (
Expand Down Expand Up @@ -309,11 +312,3 @@ export default function PasswordResetRoute() {
</div>
)
}

export function ErrorBoundary() {
return (
<div className="flex h-screen w-screen items-center justify-center">
<ErrorMessage />
</div>
)
}
9 changes: 0 additions & 9 deletions app/routes/device.$deviceId.dataupload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
useNavigation,
useParams,
} from 'react-router'
import ErrorMessage from '~/components/error-message'
import { NavBar } from '~/components/nav-bar'
import { Button } from '~/components/ui/button'
import { Input } from '~/components/ui/input'
Expand Down Expand Up @@ -251,11 +250,3 @@ export default function DataUpload({ actionData }: any) {
</div>
)
}

export function ErrorBoundary() {
return (
<div className="flex h-full w-full items-center justify-center">
<ErrorMessage />
</div>
)
}
Loading
Loading