Download code/frontend/apps/web/src/routes/__root.tsx from Jiali9/Affect-Atlas: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/Jiali9/Affect-Atlas/resolve/main/code/frontend/apps/web/src/routes/__root.tsx
- Command line
-
hf download hf://Jiali9/Affect-Atlas/code/frontend/apps/web/src/routes/__root.tsx
-
curl -L -o __root.tsx https://huggingface.co/Jiali9/Affect-Atlas/resolve/main/code/frontend/apps/web/src/routes/__root.tsx
1.54 kB
| import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router' | |
| import { useTranslation } from 'react-i18next' | |
| import { useEffect } from 'react' | |
| import appCss from '@workspace/ui/globals.css?url' | |
| import i18n from '../i18n' | |
| export const Route = createRootRoute({ | |
| head: () => ({ | |
| meta: [ | |
| { charSet: 'utf-8' }, | |
| { name: 'viewport', content: 'width=device-width, initial-scale=1' }, | |
| { title: i18n.t('common.pageTitle') }, | |
| { name: 'description', content: i18n.t('common.pageDescription') }, | |
| { name: 'robots', content: 'noindex, nofollow' }, | |
| ], | |
| links: [{ rel: 'stylesheet', href: appCss }], | |
| }), | |
| notFoundComponent: NotFoundPage, | |
| shellComponent: RootDocument, | |
| }) | |
| function NotFoundPage() { | |
| const { t } = useTranslation() | |
| return <main className="main-content" style={{ paddingTop: 60 }}><h1>{t('common.error')}</h1><p>{t('common.notFound')}</p><a href="/">{t('common.backHome')}</a></main> | |
| } | |
| function RootDocument({ children }: { children: React.ReactNode }) { | |
| const { t, i18n: instance } = useTranslation() | |
| const lang = instance.resolvedLanguage === 'zh' ? 'zh-CN' : 'en' | |
| const title = t('common.pageTitle') | |
| const description = t('common.pageDescription') | |
| useEffect(() => { | |
| document.title = title | |
| document.querySelector('meta[name="description"]')?.setAttribute('content', description) | |
| }, [title, description]) | |
| return <html lang={lang} dir="ltr"><head><HeadContent/></head><body>{children}<Scripts/></body></html> | |
| } | |