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.
This commit is contained in:
kyuuseiryuu 2026-03-15 09:13:57 +09:00
parent 7103c5f7e3
commit 6bcbff572e
4 changed files with 25 additions and 21 deletions

View File

@ -0,0 +1,9 @@
import { Spin } from "antd";
export function HydrateFallback() {
return (
<Spin spinning>
<div style={{ height: '100vh' }} />
</Spin>
);
}

View File

@ -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 ? <HydrateFallback /> : (<>
<Outlet />
<MenuButtons />
</>);
}

View File

@ -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'),

View File

@ -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 (
<Spin spinning>
<div style={{ height: '100vh' }} />
</Spin>
);
}
function Layout() {
const navigation = useNavigation();
const loading = navigation.state === 'loading';
return loading ? <HydrateFallback /> : (<>
<Outlet />
<MenuButtons />
</>);
}
import { HydrateFallback } from "./components/HydrateFallback";
import { Layout } from "./components/Layout/BaseLayout";
export const route = createBrowserRouter([
{