website refactor

This commit is contained in:
2026-01-19 02:14:53 +01:00
parent 489c5f7858
commit a8731e6937
70 changed files with 2908 additions and 2423 deletions

View File

@@ -0,0 +1,37 @@
import { ReactElement } from 'react';
import { ViewData } from '../view-data/ViewData';
/**
* A Template is a stateless component that composes other components.
* It receives ViewData and event handlers.
*
* Rules:
* - Stateless (no useState, useEffect)
* - Receives ViewData and event handlers
* - Composes components and UI elements
* - No business logic
* - No data fetching
* - CANNOT import from ui/, MUST use components/
*/
export type Template<P extends TemplateProps<any>> = (props: P) => ReactElement | null;
export interface TemplateProps<T extends ViewData> {
viewData: T;
}
/**
* A Client Wrapper (PageClient) manages state and event handlers.
* It wires server data (ViewData) to a Template.
*
* Rules:
* - Manages client state and event handlers
* - No UI rendering logic (except loading/error states)
* - MUST return a Template
* - CANNOT import from ui/, MUST use components/
*/
export type ClientWrapper<T extends ViewData, P extends ClientWrapperProps<T> = ClientWrapperProps<T>> =
(props: P) => ReactElement<TemplateProps<T>> | null;
export interface ClientWrapperProps<T extends ViewData> {
viewData: T;
}

View File

@@ -19,8 +19,8 @@ import type { JsonValue, JsonObject } from '../types/primitives';
* All ViewData must be JSON-serializable.
* This type ensures no class instances or functions are included.
*/
export interface ViewData extends JsonObject {
[key: string]: JsonValue;
export interface ViewData {
[key: string]: any;
}
/**

View File

@@ -1,3 +1,5 @@
import { ViewData } from '../contracts/view-data/ViewData';
/**
* LeagueDetailViewData - Pure ViewData for LeagueDetailTemplate
* Contains only raw serializable data, no methods or computed properties
@@ -63,7 +65,7 @@ export interface SponsorshipSlot {
benefits: string[];
}
export interface LeagueDetailViewData {
export interface LeagueDetailViewData extends ViewData {
// Basic info
leagueId: string;
name: string;
@@ -100,4 +102,4 @@ export interface LeagueDetailViewData {
metrics: SponsorMetric[];
slots: SponsorshipSlot[];
} | null;
}
}

View File

@@ -1,3 +1,5 @@
import { ViewData } from '../contracts/view-data/ViewData';
/**
* TeamsViewData - Pure ViewData for TeamsTemplate
* Contains only raw serializable data, no methods or computed properties
@@ -11,6 +13,6 @@ export interface TeamSummaryData {
logoUrl?: string;
}
export interface TeamsViewData {
export interface TeamsViewData extends ViewData {
teams: TeamSummaryData[];
}