From 6bcbff572eceb700964f5df5dc5c6e8e7e0ca66b Mon Sep 17 00:00:00 2001 From: kyuuseiryuu Date: Sun, 15 Mar 2026 09:13:57 +0900 Subject: [PATCH] fix(i18n): normalize event date parsing for ICS export - Update `src/index.tsx` to use a unified `ics.convertTimestampToArray` helper instead of manually parsing formatted strings. This ensures consistent timestamp handling across different environments. - Remove the custom `HydrateFallback` and `Layout` components from `src/routes.tsx`. - Import the existing `HydrateFallback` and `Layout` implementations from their respective component files (`./components/HydrateFallback` and `./components/Layout/BaseLayout`) to reduce code duplication and improve maintainability. --- src/components/HydrateFallback.tsx | 9 +++++++++ src/components/Layout/BaseLayout.tsx | 12 ++++++++++++ src/index.tsx | 2 +- src/routes.tsx | 23 +++-------------------- 4 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 src/components/HydrateFallback.tsx create mode 100644 src/components/Layout/BaseLayout.tsx diff --git a/src/components/HydrateFallback.tsx b/src/components/HydrateFallback.tsx new file mode 100644 index 0000000..35124cd --- /dev/null +++ b/src/components/HydrateFallback.tsx @@ -0,0 +1,9 @@ +import { Spin } from "antd"; + +export function HydrateFallback() { + return ( + +
+ + ); +} diff --git a/src/components/Layout/BaseLayout.tsx b/src/components/Layout/BaseLayout.tsx new file mode 100644 index 0000000..1f797ea --- /dev/null +++ b/src/components/Layout/BaseLayout.tsx @@ -0,0 +1,12 @@ +import { Outlet, useNavigation } from "react-router"; +import { HydrateFallback } from "../HydrateFallback"; +import { MenuButtons } from "../MenuButtons"; + +export function Layout() { + const navigation = useNavigation(); + const loading = navigation.state === 'loading'; + return loading ? : (<> + + + ); +} diff --git a/src/index.tsx b/src/index.tsx index a0027e1..de4e010 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -61,7 +61,7 @@ const server = serve({ lat: clubInfo.geo.lat, lon: clubInfo.geo.lng, } } : {}), - start: dayjs.tz(e.startDate, 'Asia/Tokyo').format('YYYY-MM-DD-HH-mm').split('-').map(v => Number(v)) as any, + start: ics.convertTimestampToArray(dayjs.tz(e.startDate, 'Asia/Tokyo').toDate().getTime(), 'local') , duration: { hours: 6, minutes: 30 }, title: e.title, // end: dayjs(event.startDate).add(6, 'h').add(30, 'minute').format('YYYY-MM-DD HH:mm'), diff --git a/src/routes.tsx b/src/routes.tsx index 9bcf1ec..f789c4d 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -1,6 +1,4 @@ -import { Spin } from "antd"; -import { createBrowserRouter, Outlet, useNavigation } from "react-router"; -import { MenuButtons } from "./components/MenuButtons"; +import { createBrowserRouter } from "react-router"; import ProfilePage from "./page/ProfilePage"; import EventPage from "./page/EventPage"; import type { MatchInfo, XCXMember } from "./types"; @@ -10,23 +8,8 @@ import { UserCenter } from "./page/UserCenter"; import { CallbackPage } from "./page/Logto/Callback"; import App from "./App"; import { ClubEventsPage } from "./page/ClubEvents"; - -function HydrateFallback() { - return ( - -
- - ); -} - -function Layout() { - const navigation = useNavigation(); - const loading = navigation.state === 'loading'; - return loading ? : (<> - - - ); -} +import { HydrateFallback } from "./components/HydrateFallback"; +import { Layout } from "./components/Layout/BaseLayout"; export const route = createBrowserRouter([ {