import { Game, CombinationStats, TypeChartStats, FullTypeChartCell } from './lib/game'; import { getTypeInfo, TypeName } from './lib/types'; import './style.css'; const app = document.getElementById('app')!; let currentView: 'quiz' | 'stats' | 'info' = 'quiz'; let typeChartView: 'attacking' | 'defending' = 'attacking'; const game = new Game(render); const INFO_SEEN_KEY = 'pokemon-type-quiz-info-seen'; // Check if user has seen info screen before const hasSeenInfo = localStorage.getItem(INFO_SEEN_KEY) === 'true'; if (!hasSeenInfo) { currentView = 'info'; } game.nextQuestion(); function renderTypeBadge(name: TypeName, size: 'small' | 'large' = 'small'): string { const info = getTypeInfo(name); const sizeClass = size === 'large' ? 'type-badge-large' : ''; return `${info.name}`; } function renderInfoScreen(): void { app.innerHTML = `
Test your knowledge of type effectiveness!
1-6 to select answer Enter to continue
Answer at least 3 questions to see stats
'; const worstCombosHtml = worstCombos.length > 0 ? worstCombos.map(renderCombinationItem).join('') : 'Answer at least 3 questions to see stats
'; const typeChartHtml = typeChartStats.map(renderTypeChartCell).join(''); app.innerHTML = `Highest accuracy (min. 3 attempts)
Lowest accuracy (min. 3 attempts)
Accuracy by ${typeChartView} type
Accuracy for each type combination
${renderFullTypeChart(fullTypeChartCells)}