import type { LocaleKey } from './modules/i18n/i18n.types'; import { A, Navigate, type RouteDefinition, useParams } from '@solidjs/router'; import { map } from 'lodash-es'; import { localeKeys, locales } from './modules/i18n/i18n.constants'; import { getBrowserLocale, useI18n } from './modules/i18n/i18n.provider'; import { HomePage } from './modules/pages/home.page'; import { ToolPage } from './modules/tools/pages/tool.page'; import { toolSlugs } from './modules/tools/tools.registry'; import { Button } from './modules/ui/components/button'; import { AppLayout } from './modules/ui/layouts/app.layout'; export const routes: RouteDefinition[] = [ { path: '/', component: () => { const { getLocale } = useI18n(); return ; }, }, { path: '/', component: AppLayout, children: [ { path: '/:localeKey', matchFilters: { localeKey: localeKeys, }, component: (props) => { const params = useParams(); const { setLocale } = useI18n(); setLocale(params.localeKey as LocaleKey); return props.children; }, children: [ { path: '/', component: HomePage, }, { path: '/:toolSlug', matchFilters: { toolSlug: toolSlugs, }, component: ToolPage, }, ], }, { path: '*404', component: () => (
404

Page Not Found

The page you are looking for does not exist.

Please check the URL and try again.

), }, ], }, ];