feat: Implement Phase 1 critical features and fix API integration
This commit completes the first phase of feature parity implementation and resolves all API integration issues to match the backend API format. ## API Integration Fixes - Remove all hardcoded default values from transformers (tick_rate, kast, player_count, steam_updated) - Update TypeScript types to make fields optional where backend doesn't guarantee them - Update Zod schemas to validate optional fields correctly - Fix mock data to match real API response format (plain arrays, not wrapped objects) - Update UI components to handle undefined values with proper fallbacks - Add comprehensive API documentation for Match and Player endpoints ## Phase 1 Features Implemented (3/6) ### 1. Player Tracking System ✅ - Created TrackPlayerModal.svelte with auth code input - Integrated track/untrack player API endpoints - Added UI for providing optional share code - Displays tracked status on player profiles - Full validation and error handling ### 2. Share Code Parsing ✅ - Created ShareCodeInput.svelte component - Added to matches page for easy match submission - Real-time validation of share code format - Parse status feedback with loading states - Auto-redirect to match page on success ### 3. VAC/Game Ban Status ✅ - Added VAC and game ban count/date fields to Player type - Display status badges on player profile pages - Show ban count and date when available - Visual indicators using DaisyUI badge components ## Component Improvements - Modal.svelte: Added Svelte 5 Snippet types, actions slot support - ThemeToggle.svelte: Removed deprecated svelte:component usage - Tooltip.svelte: Fixed type safety with Snippet type - All new components follow Svelte 5 runes pattern ($state, $derived, $bindable) ## Type Safety & Linting - Fixed all ESLint errors (any types → proper types) - Fixed form label accessibility issues - Replaced error: any with error: unknown + proper type guards - Added Snippet type imports where needed - Updated all catch blocks to use instanceof Error checks ## Static Assets - Migrated all files from public/ to static/ directory per SvelteKit best practices - Moved 200+ map icons, screenshots, and other assets - Updated all import paths to use /images/ (served from static/) ## Documentation - Created IMPLEMENTATION_STATUS.md tracking all 15 missing features - Updated API.md with optional field annotations - Created MATCHES_API.md with comprehensive endpoint documentation - Added inline comments marking optional vs required fields ## Testing - Updated mock fixtures to remove default values - Fixed mock handlers to return plain arrays like real API - Ensured all components handle undefined gracefully ## Remaining Phase 1 Tasks - [ ] Add VAC status column to match scoreboard - [ ] Create weapons statistics tab for matches - [ ] Implement recently visited players on home page 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -39,8 +39,8 @@ export interface Match {
|
||||
/** Whether any player has a game ban */
|
||||
gameban_present: boolean;
|
||||
|
||||
/** Server tick rate (64 or 128) */
|
||||
tick_rate: number;
|
||||
/** Server tick rate (64 or 128) - optional, not always provided by API */
|
||||
tick_rate?: number;
|
||||
|
||||
/** Array of player statistics (optional, included in detailed match view) */
|
||||
players?: MatchPlayer[];
|
||||
@@ -57,7 +57,7 @@ export interface MatchListItem {
|
||||
score_team_b: number;
|
||||
duration: number;
|
||||
demo_parsed: boolean;
|
||||
player_count: number;
|
||||
player_count?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,8 +91,14 @@ export interface MatchPlayer {
|
||||
/** In-game score */
|
||||
score: number;
|
||||
|
||||
/** KAST percentage (0-100): Kill/Assist/Survive/Trade */
|
||||
kast: number;
|
||||
/** KAST percentage (0-100): Kill/Assist/Survive/Trade - optional, not always provided by API */
|
||||
kast?: number;
|
||||
|
||||
/** Average Damage per Round */
|
||||
adr?: number;
|
||||
|
||||
/** Headshot percentage */
|
||||
hs_percent?: number;
|
||||
|
||||
// Rank tracking (CS2 Premier rating: 0-30000)
|
||||
rank_old?: number;
|
||||
|
||||
@@ -20,8 +20,8 @@ export interface Player {
|
||||
/** Actual vanity URL (may differ from vanity_url) */
|
||||
vanity_url_real?: string;
|
||||
|
||||
/** Last time Steam profile was updated (ISO 8601) */
|
||||
steam_updated: string;
|
||||
/** Last time Steam profile was updated (ISO 8601) - optional, not always provided by API */
|
||||
steam_updated?: string;
|
||||
|
||||
/** Steam account creation date (ISO 8601) */
|
||||
profile_created?: string;
|
||||
@@ -53,6 +53,9 @@ export interface Player {
|
||||
/** Oldest match share code seen for this player */
|
||||
oldest_sharecode_seen?: string;
|
||||
|
||||
/** Whether this player is being tracked for automatic match updates */
|
||||
tracked?: boolean;
|
||||
|
||||
/** Recent matches with player statistics */
|
||||
matches?: PlayerMatch[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user