Some small progress on landing page

This commit is contained in:
2026-02-02 00:03:02 +01:00
parent b8f19739da
commit 733ab6d1e3
11 changed files with 691 additions and 60 deletions
+84
View File
@@ -0,0 +1,84 @@
import { Timer, Github, Twitter, MessageCircle } from "lucide-react";
const Footer = () => {
return (
<footer className="border-t border-border bg-card/50 mt-auto">
<div className="container mx-auto px-6 py-12">
<div className="grid grid-cols-1 md:grid-cols-4 gap-8">
{/* Brand */}
<div className="md:col-span-1">
<div className="flex items-center gap-2 mb-4">
<Timer className="h-6 w-6 text-primary" />
<span className="text-lg font-bold">
Dev<span className="text-primary">Run</span>
</span>
</div>
<p className="text-sm text-muted-foreground leading-relaxed">
The competitive programming platform for speedrunners. Race the clock, not the grind.
</p>
</div>
{/* Quick Links */}
<div>
<h4 className="font-semibold text-foreground mb-4">Quick Links</h4>
<ul className="space-y-2">
{["Problems", "Leaderboards", "Categories", "Rules"].map((link) => (
<li key={link}>
<a href="#" className="text-sm text-muted-foreground hover:text-primary transition-colors hover-underline">
{link}
</a>
</li>
))}
</ul>
</div>
{/* Community */}
<div>
<h4 className="font-semibold text-foreground mb-4">Community</h4>
<ul className="space-y-2">
{["Discord", "Reddit", "Twitter", "GitHub"].map((link) => (
<li key={link}>
<a href="#" className="text-sm text-muted-foreground hover:text-primary transition-colors hover-underline">
{link}
</a>
</li>
))}
</ul>
</div>
{/* Social */}
<div>
<h4 className="font-semibold text-foreground mb-4">Connect</h4>
<div className="flex gap-3">
<a href="#" className="p-2 rounded-lg bg-secondary text-muted-foreground hover:text-primary hover:bg-secondary/80 transition-all">
<Github className="h-5 w-5" />
</a>
<a href="#" className="p-2 rounded-lg bg-secondary text-muted-foreground hover:text-primary hover:bg-secondary/80 transition-all">
<Twitter className="h-5 w-5" />
</a>
<a href="#" className="p-2 rounded-lg bg-secondary text-muted-foreground hover:text-primary hover:bg-secondary/80 transition-all">
<MessageCircle className="h-5 w-5" />
</a>
</div>
</div>
</div>
<div className="mt-12 pt-8 border-t border-border flex flex-col sm:flex-row justify-between items-center gap-4">
<p className="text-sm text-muted-foreground">
© 2026 DevRun. Made with ⚡ by runners, for runners.
</p>
<div className="flex gap-6">
<a href="#" className="text-sm text-muted-foreground hover:text-foreground transition-colors">
Privacy
</a>
<a href="#" className="text-sm text-muted-foreground hover:text-foreground transition-colors">
Terms
</a>
</div>
</div>
</div>
</footer>
);
};
export default Footer;
+73
View File
@@ -0,0 +1,73 @@
import { Trophy } from "lucide-react";
interface LeaderboardRowProps {
rank: number;
username: string;
pb: string;
runsCount: number;
category: string;
index?: number;
}
const LeaderboardRow = ({ rank, username, pb, runsCount, category, index = 0 }: LeaderboardRowProps) => {
const getRankStyle = (rank: number) => {
if (rank === 1) return "rank-gold";
if (rank === 2) return "rank-silver";
if (rank === 3) return "rank-bronze";
return "bg-secondary text-muted-foreground";
};
const getRankGlow = (rank: number) => {
if (rank === 1) return "glow-gold";
if (rank === 2) return "glow-silver";
if (rank === 3) return "glow-bronze";
return "";
};
const isTopThree = rank <= 3;
return (
<tr
className={`group border-b border-border hover:bg-secondary/50 transition-colors animate-fade-in opacity-0 ${isTopThree ? 'bg-secondary/30' : ''}`}
style={{ animationDelay: `${index * 0.05}s`, animationFillMode: 'forwards' }}
>
{/* Rank */}
<td className="py-4 px-4">
<div className={`inline-flex items-center justify-center w-8 h-8 rounded-lg text-sm font-bold ${getRankStyle(rank)} ${getRankGlow(rank)}`}>
{rank <= 3 ? <Trophy className="h-4 w-4" /> : rank}
</div>
</td>
{/* Username */}
<td className="py-4 px-4">
<div className="flex items-center gap-3">
<div className="w-8 h-8 rounded-full bg-gradient-to-br from-primary/50 to-primary/20 flex items-center justify-center text-xs font-bold text-primary">
{username.charAt(0).toUpperCase()}
</div>
<span className={`font-medium ${isTopThree ? 'text-foreground' : 'text-secondary-foreground'} group-hover:text-primary transition-colors`}>
{username}
</span>
</div>
</td>
{/* PB */}
<td className="py-4 px-4">
<span className="font-mono text-primary font-semibold">{pb}</span>
</td>
{/* Runs */}
<td className="py-4 px-4 text-muted-foreground">
{runsCount}
</td>
{/* Category */}
<td className="py-4 px-4">
<span className="px-2 py-1 rounded-md bg-secondary text-muted-foreground text-xs">
{category}
</span>
</td>
</tr>
);
};
export default LeaderboardRow;
+29
View File
@@ -0,0 +1,29 @@
import Link, { LinkProps } from "next/link";
import { forwardRef } from "react";
import { cn } from "@/lib/utils";
import { usePathname } from "next/navigation";
interface NavLinkCompatProps extends Omit<LinkProps, "className"> {
className?: string;
activeClassName?: string;
pendingClassName?: string;
}
const NavLink = forwardRef<HTMLAnchorElement, NavLinkCompatProps>(
({ className, activeClassName, pendingClassName, href, ...props }, ref) => {
const pathname = usePathname();
const isActive = pathname === href;
const isPending = false;
return (
<Link
ref={ref}
href={href}
className={cn(className, isActive && activeClassName, isPending && pendingClassName)}
{...props}
/>
);
}
);
NavLink.displayName = "NavLink";
+71
View File
@@ -0,0 +1,71 @@
import Link from "next/link";
import { Timer, Trophy, User, Zap } from "lucide-react";
import { usePathname } from "next/navigation";
const Navbar = () => {
const pathname = usePathname();
const navLinks = [
{ to: "/problems", label: "Problems", icon: Zap },
{ to: "/run", label: "Run", icon: Timer },
{ to: "/leaderboards", label: "Leaderboards", icon: Trophy },
{ to: "/profile", label: "Profile", icon: User },
];
const isActive = (path: string) => pathname === path;
return (
<nav className="fixed top-0 left-0 right-0 z-50 border-b border-border bg-background/80 backdrop-blur-xl">
<div className="container mx-auto px-6">
<div className="flex h-16 items-center justify-between">
{/* Logo */}
<Link
href="/"
className="flex items-center gap-2 group"
>
<div className="relative">
<Timer className="h-8 w-8 text-primary transition-transform duration-300 group-hover:scale-110" />
<div className="absolute inset-0 bg-primary/30 blur-xl opacity-0 group-hover:opacity-100 transition-opacity duration-300" />
</div>
<span className="text-xl font-bold text-foreground">
Dev<span className="text-primary">Run</span>
</span>
</Link>
{/* Navigation Links */}
<div className="hidden md:flex items-center gap-1">
{navLinks.map(({ to, label, icon: Icon }) => (
<Link
key={to}
href={to}
className={`flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium transition-all duration-300 ${isActive(to)
? "bg-primary/10 text-primary"
: "text-muted-foreground hover:text-foreground hover:bg-secondary"
}`}
>
<Icon className="h-4 w-4" />
{label}
</Link>
))}
</div>
{/* CTA Button */}
<div className="flex items-center gap-4">
<button className="hidden sm:flex items-center gap-2 px-4 py-2 rounded-lg bg-primary text-primary-foreground text-sm font-semibold transition-all duration-300 hover:scale-105 glow-purple hover:glow-purple-intense">
Start Run
</button>
{/* Mobile menu button */}
<button className="md:hidden p-2 text-muted-foreground hover:text-foreground">
<svg className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 12h16M4 18h16" />
</svg>
</button>
</div>
</div>
</div>
</nav>
);
};
export default Navbar;
+81
View File
@@ -0,0 +1,81 @@
import { Clock, Zap, Users } from "lucide-react";
interface ProblemCardProps {
name: string;
difficulty: "easy" | "medium" | "hard";
tags: string[];
bestTime?: string;
attempts: number;
index?: number;
}
const ProblemCard = ({ name, difficulty, tags, bestTime, attempts, index = 0 }: ProblemCardProps) => {
const difficultyStyles = {
easy: "diff-easy",
medium: "diff-medium",
hard: "diff-hard",
};
const difficultyLabels = {
easy: "Easy",
medium: "Medium",
hard: "Hard",
};
return (
<div
className={`group relative bg-card border border-border rounded-xl p-5 card-hover cursor-pointer animate-fade-in opacity-0`}
style={{ animationDelay: `${index * 0.1}s`, animationFillMode: 'forwards' }}
>
{/* Glow effect on hover */}
<div className="absolute inset-0 rounded-xl bg-primary/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300" />
<div className="relative">
{/* Header */}
<div className="flex items-start justify-between mb-3">
<h3 className="font-semibold text-foreground group-hover:text-primary transition-colors">
{name}
</h3>
<span className={`px-2 py-1 rounded-md text-xs font-medium ${difficultyStyles[difficulty]}`}>
{difficultyLabels[difficulty]}
</span>
</div>
{/* Tags */}
<div className="flex flex-wrap gap-2 mb-4">
{tags.map((tag) => (
<span
key={tag}
className="px-2 py-1 rounded-md bg-secondary text-muted-foreground text-xs"
>
{tag}
</span>
))}
</div>
{/* Stats */}
<div className="flex items-center gap-4 text-sm text-muted-foreground">
{bestTime && (
<div className="flex items-center gap-1.5">
<Clock className="h-4 w-4 text-primary" />
<span className="font-mono">{bestTime}</span>
</div>
)}
<div className="flex items-center gap-1.5">
<Users className="h-4 w-4" />
<span>{attempts} runs</span>
</div>
</div>
{/* Quick run button - appears on hover */}
<div className="absolute top-1/2 right-4 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-all duration-300 transform translate-x-2 group-hover:translate-x-0">
<button className="p-2 rounded-lg bg-primary text-primary-foreground">
<Zap className="h-4 w-4" />
</button>
</div>
</div>
</div>
);
};
export default ProblemCard;
+66
View File
@@ -0,0 +1,66 @@
import { Check, Minus } from "lucide-react";
interface SplitRowProps {
problemName: string;
splitTime: string;
delta?: string;
isCompleted: boolean;
isCurrent?: boolean;
pbTime?: string;
}
const SplitRow = ({ problemName, splitTime, delta, isCompleted, isCurrent, pbTime }: SplitRowProps) => {
const getDeltaColor = (delta?: string) => {
if (!delta) return "text-muted-foreground";
if (delta.startsWith("-")) return "text-emerald-400";
if (delta.startsWith("+")) return "text-red-400";
return "text-muted-foreground";
};
return (
<div
className={`flex items-center justify-between py-3 px-4 rounded-lg transition-all duration-300 ${
isCurrent
? 'bg-primary/10 border border-primary/30'
: isCompleted
? 'bg-secondary/50'
: 'bg-card'
}`}
>
<div className="flex items-center gap-3">
{/* Status indicator */}
<div className={`w-6 h-6 rounded-full flex items-center justify-center ${
isCompleted
? 'bg-emerald-500/20 text-emerald-400'
: isCurrent
? 'bg-primary/20 text-primary pulse-live'
: 'bg-secondary text-muted-foreground'
}`}>
{isCompleted ? <Check className="h-3.5 w-3.5" /> : <Minus className="h-3.5 w-3.5" />}
</div>
<span className={`font-medium ${isCurrent ? 'text-primary' : isCompleted ? 'text-foreground' : 'text-muted-foreground'}`}>
{problemName}
</span>
</div>
<div className="flex items-center gap-4">
{/* Delta */}
{isCompleted && delta && (
<span className={`split-time ${getDeltaColor(delta)}`}>
{delta}
</span>
)}
{/* Split time */}
<span className={`split-time min-w-[70px] text-right ${
isCompleted ? 'text-foreground' : 'text-muted-foreground'
}`}>
{isCompleted ? splitTime : pbTime || '--:--'}
</span>
</div>
</div>
);
};
export default SplitRow;
+35
View File
@@ -0,0 +1,35 @@
import { LucideIcon } from "lucide-react";
interface StatCardProps {
label: string;
value: string;
icon: LucideIcon;
trend?: string;
index?: number;
}
const StatCard = ({ label, value, icon: Icon, trend, index = 0 }: StatCardProps) => {
return (
<div
className="bg-card border border-border rounded-xl p-5 card-hover animate-fade-in opacity-0"
style={{ animationDelay: `${index * 0.1}s`, animationFillMode: 'forwards' }}
>
<div className="flex items-start justify-between mb-3">
<div className="p-2 rounded-lg bg-primary/10">
<Icon className="h-5 w-5 text-primary" />
</div>
{trend && (
<span className={`text-xs font-medium ${
trend.startsWith('+') ? 'text-emerald-400' : 'text-muted-foreground'
}`}>
{trend}
</span>
)}
</div>
<p className="text-2xl font-bold text-foreground font-mono">{value}</p>
<p className="text-sm text-muted-foreground mt-1">{label}</p>
</div>
);
};
export default StatCard;
+64
View File
@@ -0,0 +1,64 @@
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline:
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost:
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
icon: "size-9",
"icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
"icon-sm": "size-8",
"icon-lg": "size-10",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
}
)
function Button({
className,
variant = "default",
size = "default",
asChild = false,
...props
}: React.ComponentProps<"button"> &
VariantProps<typeof buttonVariants> & {
asChild?: boolean
}) {
const Comp = asChild ? Slot : "button"
return (
<Comp
data-slot="button"
data-variant={variant}
data-size={size}
className={cn(buttonVariants({ variant, size, className }))}
{...props}
/>
)
}
export { Button, buttonVariants }