|
1 |
| -"use client" |
2 |
| - |
3 |
| -import { useMemo, useState } from "react" |
4 |
| - |
5 | 1 | import { Alert, AlertContent, AlertTitle } from "@/components/ui/alert"
|
6 | 2 | import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
|
7 | 3 |
|
8 | 4 | import { cn } from "@/lib/utils/cn"
|
9 | 5 |
|
10 |
| -import CountDown from "../CountDown" |
11 |
| - |
12 |
| -import Connection from "./Connection" |
13 |
| -import GasFeeInformation from "./GasFeeInformation" |
14 |
| - |
15 | 6 | import Curved10YearsText from "@/public/images/10-year-anniversary/10y-curved-heading.svg"
|
16 | 7 |
|
17 | 8 | interface NFTMintCardProps {
|
18 | 9 | className?: string
|
19 | 10 | }
|
20 | 11 |
|
21 |
| -const endTimestamp = process.env.NEXT_PUBLIC_MINT_TIMESTAMP_END |
22 |
| - |
23 |
| -if (!endTimestamp) { |
24 |
| - throw new Error("NEXT_PUBLIC_MINT_TIMESTAMP_END is not set") |
25 |
| -} |
26 |
| - |
27 | 12 | const NFTMintCard = ({ className }: NFTMintCardProps) => {
|
28 |
| - const endDateTime = useMemo(() => { |
29 |
| - return new Date(Number(endTimestamp) * 1000).toISOString() |
30 |
| - }, []) |
31 |
| - |
32 |
| - const [isExpired, setIsExpired] = useState(false) |
33 |
| - |
34 |
| - const handleExpired = () => { |
35 |
| - setIsExpired(true) |
36 |
| - } |
37 |
| - |
38 | 13 | return (
|
39 |
| - <> |
40 |
| - <Card |
41 |
| - className={cn( |
42 |
| - "w-full overflow-hidden rounded-3xl bg-gradient-to-b from-[#A66BFF20] to-[#EED9FE16] shadow-lg", |
43 |
| - className |
44 |
| - )} |
45 |
| - > |
46 |
| - <CardHeader className="gap-4 pb-0"> |
47 |
| - <div className="relative"> |
48 |
| - {/* Torch/flame video */} |
49 |
| - <div className="flex items-center justify-center pt-12"> |
50 |
| - <div className="relative max-h-[200px] max-w-[200px] overflow-hidden rounded-full border-4 border-white bg-white"> |
51 |
| - <video |
52 |
| - className="pointer-events-none h-full w-full select-none rounded-full object-cover" |
53 |
| - src="/videos/10y-video.mp4" |
54 |
| - aria-label="10th anniversary video" |
55 |
| - autoPlay |
56 |
| - loop |
57 |
| - muted |
58 |
| - poster="/images/10-year-anniversary/10y-cover.png" |
59 |
| - controlsList="nodownload" |
60 |
| - disablePictureInPicture |
61 |
| - playsInline |
62 |
| - /> |
63 |
| - </div> |
| 14 | + <Card |
| 15 | + className={cn( |
| 16 | + "w-full overflow-hidden rounded-3xl bg-gradient-to-b from-[#A66BFF20] to-[#EED9FE16] shadow-lg", |
| 17 | + className |
| 18 | + )} |
| 19 | + > |
| 20 | + <CardHeader className="gap-4 pb-0"> |
| 21 | + <div className="relative"> |
| 22 | + {/* Torch/flame video */} |
| 23 | + <div className="flex items-center justify-center pt-12"> |
| 24 | + <div className="relative max-h-[200px] max-w-[200px] overflow-hidden rounded-full border-4 border-white bg-white"> |
| 25 | + <video |
| 26 | + className="pointer-events-none h-full w-full select-none rounded-full object-cover" |
| 27 | + src="/videos/10y-video.mp4" |
| 28 | + aria-label="10th anniversary video" |
| 29 | + autoPlay |
| 30 | + loop |
| 31 | + muted |
| 32 | + poster="/images/10-year-anniversary/10y-cover.png" |
| 33 | + controlsList="nodownload" |
| 34 | + disablePictureInPicture |
| 35 | + playsInline |
| 36 | + /> |
64 | 37 | </div>
|
65 |
| - |
66 |
| - {/* Curved text */} |
67 |
| - <Curved10YearsText |
68 |
| - viewBox="0 0 313 186" |
69 |
| - className="absolute left-1/2 top-0 h-min w-full max-w-[300px] -translate-x-1/2 fill-primary" |
70 |
| - width="100%" |
71 |
| - height="auto" |
72 |
| - /> |
73 | 38 | </div>
|
74 | 39 |
|
75 |
| - <CardTitle className="text-center">Mint the moment</CardTitle> |
76 |
| - </CardHeader> |
77 |
| - |
78 |
| - <CardContent className="space-y-6 p-6 text-center"> |
79 |
| - <p className="text-body-medium"> |
80 |
| - Celebrate a decade of decentralization with a free, limited-time |
81 |
| - 10th anniversary NFT. Mint yours before time runs out. |
82 |
| - </p> |
83 |
| - |
84 |
| - {isExpired ? ( |
85 |
| - <Alert |
86 |
| - variant="update" |
87 |
| - className="w-full rounded-none border-none text-center" |
88 |
| - > |
89 |
| - <AlertContent> |
90 |
| - <AlertTitle className="!text-primary"> |
91 |
| - The claim period has ended |
92 |
| - </AlertTitle> |
93 |
| - <p className="text-primary"> |
94 |
| - Thank you all for joining the celebration |
95 |
| - </p> |
96 |
| - </AlertContent> |
97 |
| - </Alert> |
98 |
| - ) : ( |
99 |
| - <> |
100 |
| - <div className="space-y-2"> |
101 |
| - <CountDown |
102 |
| - className="text-primary" |
103 |
| - dateTime={endDateTime} |
104 |
| - onExpired={handleExpired} |
105 |
| - hideZeroUnits |
106 |
| - timeLeftLabels={{ |
107 |
| - days: { singular: "day", plural: "days" }, |
108 |
| - hours: { singular: "hour", plural: "hours" }, |
109 |
| - minutes: { singular: "minute", plural: "minutes" }, |
110 |
| - seconds: { singular: "second", plural: "seconds" }, |
111 |
| - }} |
112 |
| - expiredLabel="Minting has ended" |
113 |
| - /> |
114 |
| - <p className="text-sm text-body-medium"> |
115 |
| - Time remaining to mint |
116 |
| - </p> |
117 |
| - </div> |
118 |
| - |
119 |
| - <GasFeeInformation /> |
120 |
| - |
121 |
| - <Connection /> |
122 |
| - </> |
123 |
| - )} |
124 |
| - </CardContent> |
125 |
| - </Card> |
126 |
| - </> |
| 40 | + {/* Curved text */} |
| 41 | + <Curved10YearsText |
| 42 | + viewBox="0 0 313 186" |
| 43 | + className="absolute left-1/2 top-0 h-min w-full max-w-[300px] -translate-x-1/2 fill-primary" |
| 44 | + width="100%" |
| 45 | + height="auto" |
| 46 | + /> |
| 47 | + </div> |
| 48 | + |
| 49 | + <CardTitle className="text-center">Mint the moment</CardTitle> |
| 50 | + </CardHeader> |
| 51 | + |
| 52 | + <CardContent className="space-y-6 p-6 text-center"> |
| 53 | + <p className="text-body-medium"> |
| 54 | + Celebrate a decade of decentralization with a free, limited-time 10th |
| 55 | + anniversary NFT. Mint yours before time runs out. |
| 56 | + </p> |
| 57 | + |
| 58 | + <Alert |
| 59 | + variant="update" |
| 60 | + className="w-full rounded-none border-none text-center" |
| 61 | + > |
| 62 | + <AlertContent> |
| 63 | + <AlertTitle className="!text-primary"> |
| 64 | + The claim period has ended |
| 65 | + </AlertTitle> |
| 66 | + <p className="text-primary"> |
| 67 | + Thank you all for joining the celebration |
| 68 | + </p> |
| 69 | + </AlertContent> |
| 70 | + </Alert> |
| 71 | + </CardContent> |
| 72 | + </Card> |
127 | 73 | )
|
128 | 74 | }
|
129 | 75 |
|
|
0 commit comments