-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add default not found page and dashboard redirect
- Loading branch information
1 parent
402b8a6
commit 3c60261
Showing
6 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
|
||
export const Code: React.FC<React.PropsWithChildren> = React.memo((props) => { | ||
return ( | ||
<span className="rounded-sm border border-zinc-800 bg-zinc-900 px-1 py-0.5"> | ||
{props.children} | ||
</span> | ||
); | ||
}); | ||
Code.displayName = 'Code'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
import { Button } from './ui/button'; | ||
import { Link, useRouterState } from '@tanstack/react-router'; | ||
import { useTranslation } from '@i18next-toolkit/react'; | ||
import { Card, CardContent, CardFooter, CardHeader } from './ui/card'; | ||
import { Code } from './Code'; | ||
|
||
export const DefaultNotFound: React.FC = React.memo(() => { | ||
const { t } = useTranslation(); | ||
const pathname = useRouterState({ | ||
select: (state) => state.location.pathname, | ||
}); | ||
|
||
return ( | ||
<div className="flex h-full w-full items-center justify-center"> | ||
<Card className="min-w-[320px] bg-zinc-900"> | ||
<CardHeader> | ||
<div className="text-center"> | ||
<img className="m-auto h-24 w-24" src="/icon.svg" /> | ||
</div> | ||
</CardHeader> | ||
<CardContent className="text-center"> | ||
<div>{t('Sorry, but this page is not found')}</div> | ||
<div> | ||
<b>{t('Path')}</b>: <Code>{pathname}</Code> | ||
</div> | ||
</CardContent> | ||
<CardFooter> | ||
<Link className="ml-auto" to="/"> | ||
<Button>{t('Back to Homepage')}</Button> | ||
</Link> | ||
</CardFooter> | ||
</Card> | ||
</div> | ||
); | ||
}); | ||
DefaultNotFound.displayName = 'DefaultNotFound'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createFileRoute, redirect } from '@tanstack/react-router'; | ||
|
||
export const Route = createFileRoute('/dashboard')({ | ||
beforeLoad: () => { | ||
redirect({ | ||
to: '/', | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters