website refactor
This commit is contained in:
@@ -1,57 +1,64 @@
|
||||
'use client';
|
||||
|
||||
import { DashboardHero as UiDashboardHero } from '@/components/dashboard/DashboardHero';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
import { Button } from '@/ui/Button';
|
||||
import { Icon } from '@/ui/Icon';
|
||||
import { Link } from '@/ui/Link';
|
||||
import { StatBox } from '@/ui/StatBox';
|
||||
import { StatGrid } from '@/ui/StatGrid';
|
||||
import { Flag, Medal, Target, Trophy, User, Users } from 'lucide-react';
|
||||
import React from 'react';
|
||||
|
||||
interface DashboardHeroProps {
|
||||
currentDriver: {
|
||||
name: string;
|
||||
avatarUrl: string;
|
||||
country: string;
|
||||
rating: string | number;
|
||||
rank: string | number;
|
||||
totalRaces: string | number;
|
||||
wins: string | number;
|
||||
podiums: string | number;
|
||||
rating: number;
|
||||
rank: number;
|
||||
totalRaces: number;
|
||||
wins: number;
|
||||
podiums: number;
|
||||
consistency: string;
|
||||
};
|
||||
activeLeaguesCount: string | number;
|
||||
activeLeaguesCount: number;
|
||||
}
|
||||
|
||||
export function DashboardHero({ currentDriver, activeLeaguesCount }: DashboardHeroProps) {
|
||||
return (
|
||||
<UiDashboardHero
|
||||
driverName={currentDriver.name}
|
||||
avatarUrl={currentDriver.avatarUrl}
|
||||
country={currentDriver.country}
|
||||
rating={currentDriver.rating}
|
||||
rank={currentDriver.rank}
|
||||
totalRaces={currentDriver.totalRaces}
|
||||
actions={
|
||||
<>
|
||||
<Link href={routes.public.leagues} variant="ghost">
|
||||
<Button variant="secondary" icon={<Icon icon={Flag} size={4} />}>
|
||||
Browse Leagues
|
||||
</Button>
|
||||
</Link>
|
||||
<Link href={routes.protected.profile} variant="ghost">
|
||||
<Button variant="primary" icon={<Icon icon={User} size={4} />}>
|
||||
View Profile
|
||||
</Button>
|
||||
</Link>
|
||||
</>
|
||||
}
|
||||
stats={
|
||||
<>
|
||||
<StatBox icon={Trophy} label="Wins" value={currentDriver.wins} color="#10b981" />
|
||||
<StatBox icon={Medal} label="Podiums" value={currentDriver.podiums} color="#FFBE4D" />
|
||||
<StatBox icon={Target} label="Consistency" value={currentDriver.consistency} color="#198CFF" />
|
||||
<StatBox icon={Users} label="Active Leagues" value={activeLeaguesCount} color="#a855f7" />
|
||||
</>
|
||||
}
|
||||
/>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '2rem' }}>
|
||||
<UiDashboardHero
|
||||
driverName={currentDriver.name}
|
||||
avatarUrl={currentDriver.avatarUrl}
|
||||
rating={currentDriver.rating}
|
||||
rank={currentDriver.rank}
|
||||
totalRaces={currentDriver.totalRaces}
|
||||
winRate={Math.round((currentDriver.wins / currentDriver.totalRaces) * 100) || 0}
|
||||
/>
|
||||
|
||||
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>
|
||||
<Link href={routes.public.leagues}>
|
||||
<Button variant="secondary" icon={<Icon icon={Flag} size={4} />}>
|
||||
Browse Leagues
|
||||
</Button>
|
||||
</Link>
|
||||
<Link href={routes.protected.profile}>
|
||||
<Button variant="primary" icon={<Icon icon={User} size={4} />}>
|
||||
View Profile
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<StatGrid
|
||||
variant="box"
|
||||
columns={{ base: 2, md: 4 }}
|
||||
stats={[
|
||||
{ icon: Trophy, label: 'Wins', value: currentDriver.wins, intent: 'success' },
|
||||
{ icon: Medal, label: 'Podiums', value: currentDriver.podiums, intent: 'warning' },
|
||||
{ icon: Target, label: 'Consistency', value: currentDriver.consistency, intent: 'primary' },
|
||||
{ icon: Users, label: 'Active Leagues', value: activeLeaguesCount, intent: 'telemetry' },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user