|
| 1 | +import { |
| 2 | + AvatarBase as Avatar, |
| 3 | + AvatarFallback, |
| 4 | + AvatarImage, |
| 5 | +} from "@/components/ui/avatar" |
| 6 | +import { ButtonLink } from "@/components/ui/buttons/Button" |
| 7 | +import { |
| 8 | + Card, |
| 9 | + CardContent, |
| 10 | + CardFooter, |
| 11 | + CardHeader, |
| 12 | + CardTitle, |
| 13 | +} from "@/components/ui/card" |
| 14 | +import { BaseLink } from "@/components/ui/Link" |
| 15 | + |
| 16 | +import { cn } from "@/lib/utils/cn" |
| 17 | + |
| 18 | +import Curved10YearsText from "./10y.svg" |
| 19 | + |
| 20 | +import { |
| 21 | + formatAddress, |
| 22 | + getAddressEtherscanUrl, |
| 23 | + getAvatarImage, |
| 24 | + type TorchHolderMetadata, |
| 25 | +} from "@/lib/torch" |
| 26 | + |
| 27 | +interface CurrentTorchHolderCardProps { |
| 28 | + currentHolder: TorchHolderMetadata | null |
| 29 | + isBurned?: boolean |
| 30 | + className?: string |
| 31 | +} |
| 32 | + |
| 33 | +const CurrentTorchHolderCard = ({ |
| 34 | + currentHolder, |
| 35 | + isBurned = false, |
| 36 | + className, |
| 37 | +}: CurrentTorchHolderCardProps) => { |
| 38 | + return ( |
| 39 | + <Card |
| 40 | + className={cn( |
| 41 | + "w-full overflow-hidden rounded-3xl bg-background-highlight shadow-xl", |
| 42 | + className |
| 43 | + )} |
| 44 | + > |
| 45 | + <CardHeader className="bg-[#161A36]"> |
| 46 | + <div className="relative"> |
| 47 | + {/* Torch/flame video */} |
| 48 | + <div className="flex items-center justify-center pt-12"> |
| 49 | + <div className="relative max-h-[170px] max-w-[170px]"> |
| 50 | + <video |
| 51 | + className="pointer-events-none select-none" |
| 52 | + src="/videos/torch.mp4" |
| 53 | + aria-label="Torch video" |
| 54 | + autoPlay |
| 55 | + loop |
| 56 | + muted |
| 57 | + poster="/images/10-year-anniversary/torch-cover.png" |
| 58 | + controlsList="nodownload" |
| 59 | + disablePictureInPicture |
| 60 | + playsInline |
| 61 | + /> |
| 62 | + <div className="pointer-events-none absolute top-0 h-full w-full select-none bg-[url('/images/10-year-anniversary/torch-overlay.png')] bg-contain bg-center bg-no-repeat" /> |
| 63 | + </div> |
| 64 | + </div> |
| 65 | + |
| 66 | + <CardTitle className="p-0"> |
| 67 | + {/* Curved text */} |
| 68 | + <Curved10YearsText |
| 69 | + viewBox="0 0 356 186" |
| 70 | + className="absolute left-1/2 top-0 h-min w-full max-w-[600px] -translate-x-1/2" |
| 71 | + width="100%" |
| 72 | + height="auto" |
| 73 | + /> |
| 74 | + </CardTitle> |
| 75 | + </div> |
| 76 | + </CardHeader> |
| 77 | + {/* Bottom section: torchbearer info */} |
| 78 | + <CardContent className="p-6"> |
| 79 | + {currentHolder ? ( |
| 80 | + <div className="flex items-start gap-4"> |
| 81 | + <Avatar className="h-19 w-19 !shadow-none"> |
| 82 | + <AvatarImage |
| 83 | + src={getAvatarImage(currentHolder)} |
| 84 | + alt={`Avatar for ${currentHolder.name || currentHolder.address}`} |
| 85 | + /> |
| 86 | + <AvatarFallback> |
| 87 | + {currentHolder.name || formatAddress(currentHolder.address)} |
| 88 | + </AvatarFallback> |
| 89 | + </Avatar> |
| 90 | + |
| 91 | + <div className="flex flex-col"> |
| 92 | + {/* Name */} |
| 93 | + <div className="text-lg font-bold leading-none"> |
| 94 | + {currentHolder.name || formatAddress(currentHolder.address)} |
| 95 | + </div> |
| 96 | + {/* Description */} |
| 97 | + <div>{currentHolder.role || "Current torchbearer"}</div> |
| 98 | + {/* Verify onchain link */} |
| 99 | + <BaseLink |
| 100 | + className="mt-2 text-xs" |
| 101 | + href={getAddressEtherscanUrl(currentHolder.address)} |
| 102 | + > |
| 103 | + View on Etherscan |
| 104 | + </BaseLink> |
| 105 | + </div> |
| 106 | + </div> |
| 107 | + ) : isBurned ? ( |
| 108 | + <div className="flex flex-col items-center gap-4 text-center"> |
| 109 | + <div className="text-xl font-bold text-red-500"> |
| 110 | + 🔥 Torch Burned 🔥 |
| 111 | + </div> |
| 112 | + <div> |
| 113 | + The Ethereum Torch has been burned to celebrate the 10-year |
| 114 | + anniversary! |
| 115 | + </div> |
| 116 | + </div> |
| 117 | + ) : ( |
| 118 | + <div className="flex flex-col items-center gap-4 text-center"> |
| 119 | + <div className="text-xl font-bold">🤐 Unknown Bearer</div> |
| 120 | + <div> |
| 121 | + The current torch bearer's identity is not publicly |
| 122 | + available. |
| 123 | + </div> |
| 124 | + </div> |
| 125 | + )} |
| 126 | + </CardContent> |
| 127 | + <CardFooter className="justify-center pt-4"> |
| 128 | + <ButtonLink href="#torch-history" variant="outline"> |
| 129 | + See all torchbearers |
| 130 | + </ButtonLink> |
| 131 | + </CardFooter> |
| 132 | + </Card> |
| 133 | + ) |
| 134 | +} |
| 135 | + |
| 136 | +export default CurrentTorchHolderCard |
0 commit comments