website refactor

This commit is contained in:
2026-01-14 23:31:57 +01:00
parent fbae5e6185
commit c1a86348d7
93 changed files with 7268 additions and 9088 deletions

View File

@@ -1,6 +1,16 @@
import { RulebookViewData } from '@/lib/view-data/leagues/RulebookViewData';
'use client';
import React from 'react';
import { Card } from '@/ui/Card';
import { Section } from '@/ui/Section';
import { Box } from '@/ui/Box';
import { Stack } from '@/ui/Stack';
import { Text } from '@/ui/Text';
import { Heading } from '@/ui/Heading';
import { Badge } from '@/ui/Badge';
import { Grid } from '@/ui/Grid';
import { Table, TableHead, TableBody, TableRow, TableHeader, TableCell } from '@/ui/Table';
import { Surface } from '@/ui/Surface';
import type { RulebookViewData } from '@/lib/view-data/leagues/RulebookViewData';
interface RulebookTemplateProps {
viewData: RulebookViewData;
@@ -8,95 +18,103 @@ interface RulebookTemplateProps {
export function RulebookTemplate({ viewData }: RulebookTemplateProps) {
return (
<Section>
<Stack gap={6}>
{/* Header */}
<div className="flex items-center justify-between">
<div>
<h1 className="text-2xl font-bold text-white">Rulebook</h1>
<p className="text-sm text-gray-400 mt-1">Official rules and regulations</p>
</div>
<div className="flex items-center gap-2 px-3 py-1.5 rounded-full bg-primary-blue/10 border border-primary-blue/20">
<span className="text-sm font-medium text-primary-blue">{viewData.scoringPresetName || 'Custom Rules'}</span>
</div>
</div>
<Stack direction="row" align="center" justify="between">
<Box>
<Heading level={1}>Rulebook</Heading>
<Text size="sm" color="text-gray-400" block mt={1}>Official rules and regulations</Text>
</Box>
<Badge variant="primary">
{viewData.scoringPresetName || 'Custom Rules'}
</Badge>
</Stack>
{/* Quick Stats */}
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
<div className="bg-iron-gray rounded-lg p-4 border border-charcoal-outline">
<p className="text-xs text-gray-500 uppercase tracking-wider mb-1">Platform</p>
<p className="text-lg font-semibold text-white">{viewData.gameName}</p>
</div>
<div className="bg-iron-gray rounded-lg p-4 border border-charcoal-outline">
<p className="text-xs text-gray-500 uppercase tracking-wider mb-1">Championships</p>
<p className="text-lg font-semibold text-white">{viewData.championshipsCount}</p>
</div>
<div className="bg-iron-gray rounded-lg p-4 border border-charcoal-outline">
<p className="text-xs text-gray-500 uppercase tracking-wider mb-1">Sessions Scored</p>
<p className="text-lg font-semibold text-white capitalize">
{viewData.sessionTypes}
</p>
</div>
<div className="bg-iron-gray rounded-lg p-4 border border-charcoal-outline">
<p className="text-xs text-gray-500 uppercase tracking-wider mb-1">Drop Policy</p>
<p className="text-lg font-semibold text-white truncate" title={viewData.dropPolicySummary}>
{viewData.hasActiveDropPolicy ? 'Active' : 'None'}
</p>
</div>
</div>
<Grid cols={4} gap={4}>
<StatItem label="Platform" value={viewData.gameName} />
<StatItem label="Championships" value={viewData.championshipsCount} />
<StatItem label="Sessions Scored" value={viewData.sessionTypes} capitalize />
<StatItem label="Drop Policy" value={viewData.hasActiveDropPolicy ? 'Active' : 'None'} />
</Grid>
{/* Points Table */}
<Card>
<h2 className="text-lg font-semibold text-white mb-4">Points System</h2>
<div className="overflow-x-auto">
<table className="w-full">
<thead>
<tr className="border-b border-charcoal-outline">
<th className="text-left py-2 font-medium text-gray-400">Position</th>
<th className="text-left py-2 font-medium text-gray-400">Points</th>
</tr>
</thead>
<tbody>
{viewData.positionPoints.map((point) => (
<tr key={point.position} className="border-b border-charcoal-outline/50">
<td className="py-3 text-white">{point.position}</td>
<td className="py-3 text-white">{point.points}</td>
</tr>
))}
</tbody>
</table>
</div>
<Box mb={4}>
<Heading level={2}>Points System</Heading>
</Box>
<Table>
<TableHead>
<TableRow>
<TableHeader>Position</TableHeader>
<TableHeader>Points</TableHeader>
</TableRow>
</TableHead>
<TableBody>
{viewData.positionPoints.map((point) => (
<TableRow key={point.position}>
<TableCell>
<Text color="text-white">{point.position}</Text>
</TableCell>
<TableCell>
<Text color="text-white">{point.points}</Text>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</Card>
{/* Bonus Points */}
{viewData.hasBonusPoints && (
<Card>
<h2 className="text-lg font-semibold text-white mb-4">Bonus Points</h2>
<div className="space-y-2">
<Box mb={4}>
<Heading level={2}>Bonus Points</Heading>
</Box>
<Stack gap={2}>
{viewData.bonusPoints.map((bonus, idx) => (
<div
<Surface
key={idx}
className="flex items-center gap-4 p-3 bg-deep-graphite rounded-lg border border-charcoal-outline"
variant="muted"
rounded="lg"
border
padding={3}
>
<div className="w-8 h-8 rounded-full bg-performance-green/10 border border-performance-green/20 flex items-center justify-center shrink-0">
<span className="text-performance-green text-sm font-bold">+</span>
</div>
<p className="text-sm text-gray-300">{bonus}</p>
</div>
<Stack direction="row" align="center" gap={4}>
<Surface variant="muted" rounded="full" padding={1} style={{ width: '2rem', height: '2rem', backgroundColor: 'rgba(16, 185, 129, 0.1)', border: '1px solid rgba(16, 185, 129, 0.2)', display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<Text color="text-performance-green" weight="bold">+</Text>
</Surface>
<Text size="sm" color="text-gray-300">{bonus}</Text>
</Stack>
</Surface>
))}
</div>
</Stack>
</Card>
)}
{/* Drop Policy */}
{viewData.hasActiveDropPolicy && (
<Card>
<h2 className="text-lg font-semibold text-white mb-4">Drop Policy</h2>
<p className="text-sm text-gray-300">{viewData.dropPolicySummary}</p>
<p className="text-xs text-gray-500 mt-3">
Drop rules are applied automatically when calculating championship standings.
</p>
<Box mb={4}>
<Heading level={2}>Drop Policy</Heading>
</Box>
<Text size="sm" color="text-gray-300">{viewData.dropPolicySummary}</Text>
<Box mt={3}>
<Text size="xs" color="text-gray-500" block>
Drop rules are applied automatically when calculating championship standings.
</Text>
</Box>
</Card>
)}
</Section>
</Stack>
);
}
}
function StatItem({ label, value, capitalize }: { label: string, value: string | number, capitalize?: boolean }) {
return (
<Surface variant="muted" rounded="lg" border padding={4} style={{ backgroundColor: '#262626', borderColor: '#262626' }}>
<Text size="xs" color="text-gray-500" style={{ textTransform: 'uppercase', letterSpacing: '0.05em' }} block mb={1}>{label}</Text>
<Text weight="semibold" color="text-white" style={{ fontSize: '1.125rem', textTransform: capitalize ? 'capitalize' : 'none' }}>{value}</Text>
</Surface>
);
}