Skip to content

Commit ea57855

Browse files
Merge pull request #560 from 42core-team/508-make-the-live-event-popup-prettier
feat: Redesign the live event display card with animations, improved …
2 parents d8dba6a + 33bba2c commit ea57855

File tree

1 file changed

+49
-25
lines changed

1 file changed

+49
-25
lines changed

frontend/components/HomePageClient.tsx

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ import { useEffect, useMemo, useState } from "react";
1111
import GlobalStats from "@/components/GlobalStats";
1212
import { GithubIcon, WikiIcon } from "@/components/icons";
1313
import { CoreLogoWhite } from "@/components/social";
14-
import { Badge } from "@/components/ui/badge";
1514
import { Button } from "@/components/ui/button";
1615
import {
1716
Card,
18-
CardContent,
19-
CardDescription,
2017
CardHeader,
2118
CardTitle,
2219
} from "@/components/ui/card";
@@ -99,28 +96,55 @@ export default function HomePageClient(props: {
9996
</Button>
10097
</div>
10198
{props.currentLiveEvent && timeLeftMs > 0 && (
102-
<Card className="mx-auto mt-6 max-w-sm">
103-
<CardHeader className="flex flex-row items-center justify-between gap-3">
104-
<CardTitle className="text-lg font-semibold">
105-
{props.currentLiveEvent.name}
106-
</CardTitle>
107-
<CardDescription className="space-x-2">
108-
<Badge>Live</Badge>
109-
<Badge>
110-
Ends in
111-
{" "}
112-
{formatTimeLeft(timeLeftMs)}
113-
</Badge>
114-
</CardDescription>
115-
</CardHeader>
116-
<CardContent>
117-
<Button asChild>
118-
<Link href={`/events/${props.currentLiveEvent.id}`}>
119-
View event
120-
</Link>
121-
</Button>
122-
</CardContent>
123-
</Card>
99+
<motion.div
100+
initial={{ scale: 0.95, opacity: 0, y: 10 }}
101+
animate={{ scale: 1, opacity: 1, y: 0 }}
102+
transition={{ duration: 0.5, ease: "easeOut" }}
103+
>
104+
<Link href={`/events/${props.currentLiveEvent.id}`} className="group mx-auto mt-6 block w-full max-w-lg rounded-xl focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-none md:mt-8">
105+
<Card className="relative h-full w-full overflow-hidden border-white/10 bg-background/60 shadow-2xl backdrop-blur-xl transition-all duration-300 group-hover:-translate-y-1 group-hover:border-primary/50 group-hover:bg-background/80 group-hover:shadow-[0_20px_40px_-15px_rgba(var(--primary),0.3)] group-active:translate-y-0 group-active:scale-[0.98]">
106+
<div className="absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-primary/50 to-transparent opacity-50 transition-opacity group-hover:opacity-100" />
107+
<CardHeader className="flex flex-row items-center justify-between pb-6">
108+
<div className="flex flex-col gap-2">
109+
<div className="flex items-center gap-2">
110+
<span className="relative flex h-2 w-2">
111+
<span className="absolute top-0 left-0 inline-flex h-full w-full animate-ping rounded-full bg-destructive opacity-75"></span>
112+
<span className="relative inline-flex h-2 w-2 rounded-full bg-destructive"></span>
113+
</span>
114+
<span className="text-xs font-semibold tracking-widest text-destructive uppercase">
115+
Live
116+
</span>
117+
</div>
118+
<CardTitle className="text-xl font-bold tracking-tight text-foreground transition-colors group-hover:text-primary md:text-2xl">
119+
{props.currentLiveEvent.name}
120+
</CardTitle>
121+
</div>
122+
<div className="flex items-center gap-4 border-l border-border/50 pl-4 transition-colors group-hover:border-primary/30">
123+
<div className="flex flex-col items-end gap-1 text-right">
124+
<span className="text-[10px] font-medium tracking-wider text-muted-foreground uppercase transition-colors group-hover:text-primary/70">Closing in</span>
125+
<span className="font-mono text-base font-bold text-foreground tabular-nums transition-colors group-hover:text-primary">
126+
{formatTimeLeft(timeLeftMs)}
127+
</span>
128+
</div>
129+
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary shadow-sm transition-all group-hover:scale-105 group-hover:bg-primary/20 group-hover:text-primary">
130+
<svg
131+
className="h-5 w-5"
132+
xmlns="http://www.w3.org/2000/svg"
133+
viewBox="0 0 24 24"
134+
fill="none"
135+
stroke="currentColor"
136+
strokeWidth="2.5"
137+
strokeLinecap="round"
138+
strokeLinejoin="round"
139+
>
140+
<path d="M5 12h14M12 5l7 7-7 7" />
141+
</svg>
142+
</div>
143+
</div>
144+
</CardHeader>
145+
</Card>
146+
</Link>
147+
</motion.div>
124148
)}
125149
</div>
126150

0 commit comments

Comments
 (0)