From 9657acea640c27d4a3f1d4c896a6d0bbbb071842 Mon Sep 17 00:00:00 2001 From: kyuuseiryuu Date: Sat, 14 Mar 2026 19:56:48 +0900 Subject: [PATCH] feat(club): upgrade event calendar subscription and add match status display - Refactor ClubEventList to subscribe to all club events instead of just the current page, removing pagination from the ICS URL. - Enhance ICS generation for club subscriptions: - Fetch all non-finished events across pages. - Include geographic location (lat/lon) in the event metadata. - Add 2-hour alarms (display and audio) to all subscribed events. - Improve EventCard status display with logic for 'Finished', 'In Progress', and countdown formats. - Update KaiqiuService to parse match status (isProcessing, isFinished) and location name accurately. - Integrate dayjs timezone (Asia/Tokyo) and UTC plugins across index.tsx, services, and types. - Update IEventInfo interface to include isProcessing and location fields. --- src/components/ClubEventList.tsx | 4 +- src/components/EventCard.tsx | 27 ++++++------ src/index.tsx | 75 +++++++++++++------------------- src/services/KaiqiuService.ts | 38 ++++++++++++---- src/types/index.ts | 2 + 5 files changed, 78 insertions(+), 68 deletions(-) diff --git a/src/components/ClubEventList.tsx b/src/components/ClubEventList.tsx index ea8865e..d5fa2ed 100644 --- a/src/components/ClubEventList.tsx +++ b/src/components/ClubEventList.tsx @@ -51,7 +51,7 @@ export const ClubEvenList = (props: Props) => { return () => clearTimeout(id); }, [props.clubId]); const handleAddToCalendar = useCallback(() => { - const url = `${window.location.origin}/api/club/${props.clubId}/calendar.ics?page=${page}`; + const url = `${window.location.origin}/api/club/${props.clubId}/calendar.ics`; const uri = url.replace(/^http(s)?/, 'webcal'); console.debug(uri); window.open(uri); @@ -72,7 +72,7 @@ export const ClubEvenList = (props: Props) => { icon={} onClick={handleAddToCalendar} > - 本页全部添加到日历 + 订阅该俱乐部比赛 {showAll ? ( { navigate(`/event/${e.matchId}`); }, [e]); - const handleAddCalendar = useCallback(() => { - const url = `${window.location.origin}/calendar/event/${e.matchId}/events.ics`; - const uri = url.replace(/^http(s)?/, 'webcal'); - window.open(uri); + const messageFormat = useMemo(() => { + if (e.isFinished) { + return `已结束 DD 天`; + } + if (e.isProcessing) { + return '比赛进行中'; + } + return `还有 DD 天 HH 时开始`; }, [e]); return ( } - onClick={handleAddCalendar} - > - 加入日历 - ,