import { Button, Card, Statistic, Typography } from "antd"; import type { IEventInfo } from "../types"; import dayjs from "dayjs"; import { CalendarOutlined, EyeOutlined } from "@ant-design/icons"; import { useCallback } from "react"; import { useNavigate } from "react-router"; interface EventCardProps { eventInfo: IEventInfo; } export function EventCard(props: EventCardProps) { const { eventInfo: e } = props; const day = dayjs(e.startDate); const navigate = useNavigate(); const handleView = useCallback(() => { 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); }, [e]); return ( } onClick={handleAddCalendar} > 加入日历 , , ]} > {e.title} {e.info.map(e => (
{e}
))}
) }