Merge pull request #11 from orus-dev/ui-stuff

UI stuff
This commit is contained in:
Klesti Selimaj
2026-02-07 21:04:11 +01:00
committed by GitHub
9 changed files with 89 additions and 164 deletions
+1 -59
View File
@@ -163,33 +163,6 @@
} }
@layer components { @layer components {
/* ===== Glow effects ===== */
.glow-purple {
box-shadow:
0 0 20px color-mix(in oklch, var(--primary) 30%, transparent),
0 0 40px color-mix(in oklch, var(--primary) 10%, transparent);
}
.glow-purple-intense {
box-shadow:
0 0 30px color-mix(in oklch, var(--primary) 50%, transparent),
0 0 60px color-mix(in oklch, var(--primary) 20%, transparent);
}
.glow-gold {
box-shadow: 0 0 20px color-mix(in oklch, oklch(82.8% 0.189 84.429) 70%, transparent);
/* box-shadow: 0 0 20px color-mix(in oklch, var(--chart-4) 40%, transparent); */
}
.glow-silver {
box-shadow: 0 0 20px color-mix(in oklch, var(--foreground) 60%, transparent);
}
.glow-bronze {
box-shadow: 0 0 20px color-mix(in oklch, oklch(55.5% 0.163 48.998) 60%, transparent);
}
/* ===== Text glow ===== */ /* ===== Text glow ===== */
.text-glow { .text-glow {
text-shadow: 0 0 20px color-mix(in oklch, var(--primary) 50%, transparent); text-shadow: 0 0 20px color-mix(in oklch, var(--primary) 50%, transparent);
@@ -218,44 +191,13 @@
box-shadow: 0 10px 40px color-mix(in oklch, var(--primary) 15%, transparent); box-shadow: 0 10px 40px color-mix(in oklch, var(--primary) 15%, transparent);
} }
/* ===== Timer / mono UI ===== */ /* ===== Timer ===== */
.timer-display { .timer-display {
font-family: var(--font-geist-mono); font-family: var(--font-geist-mono);
@apply text-6xl font-bold tracking-wider; @apply text-6xl font-bold tracking-wider;
text-shadow: 0 0 30px color-mix(in oklch, var(--primary) 60%, transparent); text-shadow: 0 0 30px color-mix(in oklch, var(--primary) 60%, transparent);
} }
.split-time {
font-family: var(--font-geist-mono);
@apply text-sm tracking-wide;
}
/* ===== Rank badges ===== */
.rank-gold {
@apply bg-linear-to-r from-yellow-500 to-amber-400 text-black;
}
.rank-silver {
@apply bg-linear-to-r from-gray-300 to-gray-400 text-black;
}
.rank-bronze {
@apply bg-linear-to-r from-orange-600 to-amber-700 text-white;
}
/* ===== Difficulty badges ===== */
.diff-easy {
@apply bg-emerald-500/20 text-emerald-400 border border-emerald-500/30;
}
.diff-medium {
@apply bg-amber-500/20 text-amber-400 border border-amber-500/30;
}
.diff-hard {
@apply bg-red-500/20 text-red-400 border border-red-500/30;
}
/* ===== Animations ===== */ /* ===== Animations ===== */
.pulse-live { .pulse-live {
animation: pulse-glow 2s ease-in-out infinite; animation: pulse-glow 2s ease-in-out infinite;
@@ -1,6 +1,6 @@
"use client"; "use client";
import { Trophy, Calendar, Globe, TrendingUp } from "lucide-react"; import { Calendar, Globe } from "lucide-react";
import { useState } from "react"; import { useState } from "react";
import { Card } from "@/components/ui/card"; import { Card } from "@/components/ui/card";
@@ -21,15 +21,14 @@ import {
PaginationPrevious, PaginationPrevious,
} from "@/components/ui/pagination"; } from "@/components/ui/pagination";
import LeaderboardRow from "@/app/leaderboards/components/LeaderboardRow"; import LeaderboardRow from "@/app/leaderboard/components/LeaderboardRow";
import StatCard from "@/components/app/StatCard";
import useAction from "@/hook/use-action"; import useAction from "@/hook/use-action";
import { import {
getGlobalLeaderboard, getGlobalLeaderboard,
getWeeklyLeaderboard, getWeeklyLeaderboard,
} from "@/modules/leaderboard/actions"; } from "@/modules/leaderboard/actions";
export default function Leaderboards() { export default function Leaderboard() {
const [global] = useAction(getGlobalLeaderboard); const [global] = useAction(getGlobalLeaderboard);
const [weekly] = useAction(getWeeklyLeaderboard); const [weekly] = useAction(getWeeklyLeaderboard);
@@ -41,41 +40,13 @@ export default function Leaderboards() {
<div className="container mx-auto px-6 space-y-8"> <div className="container mx-auto px-6 space-y-8">
{/* Header */} {/* Header */}
<div> <div>
<h1 className="text-4xl font-bold">Leaderboards</h1> <h1 className="text-4xl font-bold">Leaderboard</h1>
<p className="text-muted-foreground"> <p className="text-sm text-muted-foreground mb-4">
The fastest runners in the game. Will you claim a spot? 1,284 runners · Ranked by performance
</p> </p>
</div> </div>
{/* Stats */} {/* Filters */}
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
<StatCard
icon={Globe}
label="Total Runners"
value="12,453"
index={0}
/>
<StatCard
icon={Trophy}
label="World Record"
value="2:34.21"
index={1}
/>
<StatCard
icon={TrendingUp}
label="Runs This Week"
value="847K"
index={2}
/>
<StatCard
icon={Calendar}
label="Until Reset"
value="5d 12h"
index={3}
/>
</div>
{/* Tabs + Filters */}
<div className="flex flex-col md:flex-row gap-4 justify-between"> <div className="flex flex-col md:flex-row gap-4 justify-between">
<Tabs <Tabs
value={activeTab} value={activeTab}
+2 -2
View File
@@ -84,10 +84,10 @@ export default function Landing() {
<ArrowRight className="h-5 w-5 transition-transform group-hover:translate-x-1" /> <ArrowRight className="h-5 w-5 transition-transform group-hover:translate-x-1" />
</Button> </Button>
</Link> </Link>
<Link href="/leaderboards"> <Link href="/leaderboard">
<Button variant="hero"> <Button variant="hero">
<Trophy className="h-5 w-5" /> <Trophy className="h-5 w-5" />
View Leaderboards View Leaderboard
</Button> </Button>
</Link> </Link>
</div> </div>
+50 -35
View File
@@ -1,4 +1,13 @@
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import {
Card,
CardHeader,
CardContent,
CardFooter,
CardDescription,
CardTitle,
} from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { Problem } from "@/modules/problems/types"; import { Problem } from "@/modules/problems/types";
import { Clock, Zap, Users, Code } from "lucide-react"; import { Clock, Zap, Users, Code } from "lucide-react";
@@ -15,9 +24,9 @@ const ProblemCard = ({
attempts?: number; attempts?: number;
}) => { }) => {
const difficultyStyles = { const difficultyStyles = {
easy: "diff-easy", easy: "bg-emerald-500/10 text-emerald-400 border border-emerald-500/30",
medium: "diff-medium", medium: "bg-amber-500/10 text-amber-400 border border-amber-500/30",
hard: "diff-hard", hard: "bg-red-500/10 text-red-400 border border-red-500/30",
}; };
const difficultyLabels = { const difficultyLabels = {
@@ -27,66 +36,72 @@ const ProblemCard = ({
}; };
return ( return (
<div <Card
className="group relative bg-card border border-border rounded-xl p-5 card-hover cursor-pointer animate-fade-in opacity-0 h-full flex flex-col justify-between" className={cn(
"group relative cursor-pointer overflow-hidden",
"animate-fade-in opacity-0 h-full",
"card-hover gap-3",
)}
style={{ style={{
animationDelay: `${index * 0.1}s`, animationDelay: `${index * 0.1}s`,
animationFillMode: "forwards", animationFillMode: "forwards",
}} }}
> >
{/* Glow effect on hover */} {/* Glow */}
<div className="absolute inset-0 rounded-xl bg-primary/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none" /> <div className="absolute inset-0 bg-primary/5 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none" />
{/* Content */}
<div className="relative flex flex-col h-full">
{/* Header */} {/* Header */}
<div className="flex items-start justify-between mb-3"> <CardHeader>
<h3 className="font-semibold text-foreground group-hover:text-primary transition-colors"> <CardTitle className="flex justify-between items-center">
{problem.title} {problem.title}
</h3> <Badge
<span variant="secondary"
className={`px-2 py-1 rounded-md text-xs font-medium ${ className={cn(
difficultyStyles[problem.difficulty] "text-xs font-medium text-green-600",
}`} difficultyStyles[problem.difficulty],
)}
> >
{difficultyLabels[problem.difficulty]} {difficultyLabels[problem.difficulty]}
</span> </Badge>
</div> </CardTitle>
{/* Tags / Meta */} <CardDescription className="truncate whitespace-nowrap max-w-full">
<div className="flex flex-wrap gap-2 text-xs text-muted-foreground w-f mb-2 w-full"> {problem.description}
<div className="flex items-center gap-4"> </CardDescription>
</CardHeader>
{/* Content */}
<CardContent className="flex flex-col gap-3">
{/* Meta */}
<div className="flex flex-wrap items-center gap-4 text-xs text-muted-foreground">
{bestTime && ( {bestTime && (
<div className="flex items-center gap-1.5"> <div className="flex items-center gap-1.5">
<Clock className="h-4 w-4 text-primary" /> <Clock className="h-4 w-4 text-primary" />
<span className="font-mono">{bestTime}</span> <span className="font-mono">{bestTime}</span>
</div> </div>
)} )}
<div className="flex items-center gap-1.5"> <div className="flex items-center gap-1.5">
<Users className="h-4 w-4" /> <Users className="h-4 w-4" />
<span>{attempts} runs</span> <span>{attempts} runs</span>
</div> </div>
</div>
{problem.language && ( {problem.language && (
<span className="px-2 py-1 rounded-md bg-secondary"> <Badge variant="secondary" className="flex items-center gap-1">
<Code className="w-3 h-3 inline-block mr-1" /> {problem.language} <Code className="h-3 w-3" />
</span> {problem.language}
</Badge>
)} )}
</div> </div>
</CardContent>
{/* Description */} {/* Footer */}
<p className="text-sm text-muted-foreground truncate overflow-hidden whitespace-nowrap max-w-full"> <CardFooter className="absolute bottom-4 right-4 p-0 opacity-0 group-hover:opacity-100 transition-all">
{problem.description} <Button size="icon">
</p>
<div className="absolute bottom-0 right-0 opacity-0 group-hover:opacity-100 transition-all duration-300">
<Button size="p2">
<Zap className="h-4 w-4" /> <Zap className="h-4 w-4" />
</Button> </Button>
</div> </CardFooter>
</div> </Card>
</div>
); );
}; };
+3 -12
View File
@@ -32,24 +32,13 @@ export default function Problems() {
</div> </div>
{/* Filters */} {/* Filters */}
<div className="flex flex-col lg:flex-row gap-4 items-start lg:items-center"> <div className="flex flex-row flex-wrap gap-4 items-start lg:items-center">
{/* Search */} {/* Search */}
<div className="relative flex-1 max-w-md"> <div className="relative flex-1 max-w-md">
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" /> <Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" />
<Input placeholder="Search problems..." className="pl-9" /> <Input placeholder="Search problems..." className="pl-9" />
</div> </div>
{/* Category Filter */}
<div className="flex flex-wrap gap-2">
<ToggleGroup variant="outline" type="multiple">
{["Arrays", "Trees", "Graphs", "DP", "Strings"].map((f) => (
<ToggleGroupItem value={f.toLowerCase()} aria-label={f} key={f}>
{f}
</ToggleGroupItem>
))}
</ToggleGroup>
</div>
{/* Difficulty Filter */} {/* Difficulty Filter */}
<div className="flex flex-wrap gap-2"> <div className="flex flex-wrap gap-2">
<ToggleGroup variant="outline" type="multiple"> <ToggleGroup variant="outline" type="multiple">
@@ -63,7 +52,9 @@ export default function Problems() {
{/* View Toggle */} {/* View Toggle */}
<ToggleGroup <ToggleGroup
className="hidden md:block"
type="single" type="single"
variant="outline"
value={viewMode} value={viewMode}
onValueChange={(v) => v && setViewMode(v as "grid" | "list")} onValueChange={(v) => v && setViewMode(v as "grid" | "list")}
> >
+1 -1
View File
@@ -34,7 +34,7 @@ const Footer = () => {
<div> <div>
<h4 className="font-semibold text-foreground mb-4">Quick Links</h4> <h4 className="font-semibold text-foreground mb-4">Quick Links</h4>
<ul className="space-y-2"> <ul className="space-y-2">
{["Problems", "Leaderboards", "Categories", "Rules"].map( {["Problems", "Leaderboard", "Categories", "Rules"].map(
(link) => ( (link) => (
<li key={link}> <li key={link}>
<a <a
+2 -2
View File
@@ -13,9 +13,9 @@ const navs = [
name: "Problems", name: "Problems",
}, },
{ {
link: "/leaderboards", link: "/leaderboard",
icon: Trophy, icon: Trophy,
name: "Leaderboards", name: "Leaderboard",
}, },
{ {
link: "/runs", link: "/runs",
+12 -6
View File
@@ -2,16 +2,22 @@ import { Trophy } from "lucide-react";
export default function Rank({ rank }: { rank: number }) { export default function Rank({ rank }: { rank: number }) {
const getRankStyle = (rank: number) => { const getRankStyle = (rank: number) => {
if (rank === 1) return "rank-gold"; if (rank === 1)
if (rank === 2) return "rank-silver"; return "bg-linear-to-r from-yellow-500 to-amber-400 text-black";
if (rank === 3) return "rank-bronze"; if (rank === 2)
return "bg-linear-to-r from-gray-300 to-gray-400 text-black";
if (rank === 3)
return "bg-linear-to-r from-orange-600 to-amber-700 text-white";
return "bg-secondary text-muted-foreground"; return "bg-secondary text-muted-foreground";
}; };
const getRankGlow = (rank: number) => { const getRankGlow = (rank: number) => {
if (rank === 1) return "glow-gold"; if (rank === 1)
if (rank === 2) return "glow-silver"; return "shadow-[0_0_20px_color-mix(in_oklch,oklch(82.8%_0.189_84.429)_70%,transparent)]";
if (rank === 3) return "glow-bronze"; if (rank === 2)
return "shadow-[0_0_20px_color-mix(in_oklch,var(--foreground)_60%,transparent)]";
if (rank === 3)
return "shadow-[0_0_20px_color-mix(in_oklch,oklch(55.5%_0.163_48.998)_60%,transparent)]";
return ""; return "";
}; };