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:
parent
7103c5f7e3
commit
6bcbff572e
9
src/components/HydrateFallback.tsx
Normal file
9
src/components/HydrateFallback.tsx
Normal file
@ -0,0 +1,9 @@
|
||||
import { Spin } from "antd";
|
||||
|
||||
export function HydrateFallback() {
|
||||
return (
|
||||
<Spin spinning>
|
||||
<div style={{ height: '100vh' }} />
|
||||
</Spin>
|
||||
);
|
||||
}
|
||||
12
src/components/Layout/BaseLayout.tsx
Normal file
12
src/components/Layout/BaseLayout.tsx
Normal 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 />
|
||||
</>);
|
||||
}
|
||||
@ -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'),
|
||||
|
||||
@ -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([
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user