feat(client): joined event list
Signed-off-by: Noa Virellia <noa@requiem.garden>
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import type { EventInfo } from '../types';
|
||||
import PlaceholderImage from '@/assets/event-placeholder.png';
|
||||
import { useGetEvents } from '@/hooks/data/useGetEvents';
|
||||
import { useEvents } from '@/hooks/data/useEvents';
|
||||
import { Button } from '../../ui/button';
|
||||
import { DialogTrigger } from '../../ui/dialog';
|
||||
import { EventJoinDialogContainer } from '../event-join.dialog.container';
|
||||
import { KycDialogContainer } from '../kyc/kyc.dialog.container';
|
||||
import { toEventInfo } from '../types';
|
||||
import { EventGridSkeleton } from './event-grid.skeleton';
|
||||
import { EventGridView } from './event-grid.view';
|
||||
|
||||
@@ -15,24 +14,14 @@ function JoinButton() {
|
||||
}
|
||||
|
||||
export function EventGridContainer() {
|
||||
const { data, isLoading } = useGetEvents();
|
||||
const { data, isLoading } = useEvents();
|
||||
|
||||
return (
|
||||
isLoading
|
||||
? <EventGridSkeleton />
|
||||
: (
|
||||
<EventGridView
|
||||
events={data.pages.flatMap(page => page.data ?? []).map(it => ({
|
||||
type: it.type! as EventInfo['type'],
|
||||
eventId: it.event_id!,
|
||||
isJoined: it.is_joined!,
|
||||
requireKyc: it.enable_kyc!,
|
||||
coverImage: it.thumbnail! || PlaceholderImage,
|
||||
eventName: it.name!,
|
||||
description: it.description!,
|
||||
startTime: new Date(it.start_time!),
|
||||
endTime: new Date(it.end_time!),
|
||||
} satisfies EventInfo))}
|
||||
events={data.pages.flatMap(page => page.data ?? []).map(toEventInfo)}
|
||||
footer={eventInfo => (eventInfo.isJoined
|
||||
? <Button className="w-full" disabled>已加入</Button>
|
||||
: (
|
||||
|
||||
Reference in New Issue
Block a user