このコミットが含まれているのは:
2026-10-18 23:26:55 +09:00
コミット 8bcc61c0f8
11個のファイルの変更、75行の追加、63行の削除
+14 -8
ファイルの表示
@@ -1,13 +1,19 @@
import { matchPath } from 'react-router-dom'
import { unlocalisedPath } from '@/lib/locales'
import type { QueryClient } from '@tanstack/react-query'
import type { IndexRouteObject, NonIndexRouteObject, Params } from 'react-router-dom'
import type { LocaleCode } from '@/lib/locales'
const PAGE_LOCALES: { path: string; locale: LocaleCode }[] = [
{ path: '/gekanator', locale: 'ja' }]
export type PagePreparation = {
client: QueryClient
params: Readonly<Params>
locale: LocaleCode
searchParams: URLSearchParams }
export type PageRouteHandle = {
ssr?: (request: PagePreparation) => Promise<number>
locale?: LocaleCode
notFound?: boolean }
export const requiredPageLocale = (pathname: string): LocaleCode | null =>
PAGE_LOCALES.find (page =>
matchPath ({ path: page.path, end: true }, unlocalisedPath (pathname)))?.locale ?? null
export type PageRoute = { handle?: PageRouteHandle } & (
Omit<IndexRouteObject, 'handle'>
| (Omit<NonIndexRouteObject, 'handle' | 'children'> & { children?: PageRoute[] }))