-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathUserEventDetailPage.tsx
More file actions
59 lines (52 loc) · 1.87 KB
/
UserEventDetailPage.tsx
File metadata and controls
59 lines (52 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"use client";
import { useParams, useRouter } from "next/navigation";
import { ArrowLeft } from "lucide-react";
import { Button } from "@/components/ui/Button";
import { EventDetailModal } from "../components/EventDetailModal";
import { useGetPaymentDetail } from "../hooks/useEvent";
import Loader from "@/components/common/Loader";
const UserEventDetailPage = () => {
const router = useRouter();
const params = useParams();
const transactionId = params?.transactionId as string;
const { data: paymentData, isLoading } = useGetPaymentDetail(transactionId);
if (isLoading) {
return (
<div className="flex min-h-screen items-center justify-center">
<Loader />
</div>
);
}
if (!paymentData?.data) {
return (
<div className="container mx-auto max-w-3xl px-4 py-8">
<div className="text-center">
<h1 className="mb-4 text-2xl font-bold">Transaction Not Found</h1>
<p className="mb-8 text-gray-600 dark:text-gray-400">
The transaction you are looking for does not exist or has been removed.
</p>
<Button onClick={() => router.push("/my-events")}>
<ArrowLeft className="mr-2 h-4 w-4" />
Back to My Events
</Button>
</div>
</div>
);
}
const eventData = paymentData.data;
return (
<div className="container mx-auto max-w-4xl px-4 py-8">
<div className="mb-6">
<Button variant="outline" onClick={() => router.push("/my-events")}>
<ArrowLeft className="mr-2 h-4 w-4" />
Back to My Events
</Button>
</div>
<div className="rounded-lg border border-gray-200 bg-white p-6 dark:border-gray-800 dark:bg-gray-900">
<h1 className="mb-6 text-2xl font-bold">Event Details</h1>
<EventDetailModal event={eventData} />
</div>
</div>
);
};
export default UserEventDetailPage;