project-nomad/admin/inertia/layouts/DocsLayout.tsx
Martin Seener 134d1642af
Added initial i18n framework and most german translations
- Add i18next, react-i18next, i18next-browser-languagedetector packages
- Configure i18n initialization with language detector in lib/i18n.ts
- Created en/de translation files and moved most hard-coded strings into the files and translated them
- Uses locale-aware date formatting where applicable
- Added language-specific Wikipedia content files (wikipedia.en.json, wikipedia.de.json) and updated download URLs
- Added NOMAD_REPO_URL env variable for fork-friendly URL resolution (easier testing and rollout independent of Crosstalk repo)
2026-03-24 13:21:31 +01:00

33 lines
927 B
TypeScript

import { useQuery } from '@tanstack/react-query'
import { useMemo } from 'react'
import StyledSidebar from '~/components/StyledSidebar'
import api from '~/lib/api'
import { useTranslation } from 'react-i18next'
export default function DocsLayout({ children }: { children: React.ReactNode }) {
const { t } = useTranslation()
const { data, isLoading } = useQuery<Array<{ title: string; slug: string }>>({
queryKey: ['docs'],
queryFn: () => api.listDocs(),
refetchOnWindowFocus: false,
staleTime: Infinity,
})
const items = useMemo(() => {
if (isLoading || !data) return []
return data.map((doc) => ({
name: doc.title,
href: `/docs/${doc.slug}`,
current: false,
}))
}, [data, isLoading])
return (
<div className="min-h-screen flex flex-row bg-desert-white">
<StyledSidebar title={t('common.documentation')} items={items} />
{children}
</div>
)
}