Add WelcomeStats component and integrate session management in FlagQuiz

- Created a new WelcomeStats component to display user statistics and session results.
- Integrated session management in FlagQuiz, allowing users to track their performance across multiple sessions.
- Updated game state handling to include session completion and results display.
- Enhanced user experience with improved navigation and session reset functionality.
This commit is contained in:
sha
2025-08-11 21:09:41 +03:00
parent 889514ad45
commit 32846dfc6f
8 changed files with 1448 additions and 366 deletions
+86 -11
View File
@@ -37,17 +37,40 @@
export let collection = "logos";
export let setCollection = () => {};
// Quiz-only data
export let score = null;
export let gameStats = null;
export let achievementCount = { unlocked: 0, total: 0 };
export let onAchievementClick = () => {};
export let sessionStats = null; // New prop for session stats
export let isQuizActive = false; // New prop to determine if quiz is active
let dropdownOpen = false;
let showAllTimeStats = false; // State to toggle between session and all-time stats
let previousQuizState = false; // Track previous quiz state to detect new quiz start
// Check if we're in game mode
$: isGameMode = $location && $location.startsWith('/game');
$: isQuizPage = $location && $location.startsWith('/game/flags');
// Determine default stats view based on quiz state
$: {
// Detect when quiz becomes active (new quiz started)
if (isQuizActive && !previousQuizState) {
// New quiz started - show session stats by default
showAllTimeStats = false;
} else if (!isQuizActive) {
// Quiz not active - show all-time stats
showAllTimeStats = true;
}
// Update previous state
previousQuizState = isQuizActive;
}
function toggleStatsView() {
if (isQuizActive) {
showAllTimeStats = !showAllTimeStats;
}
}
function handleTitleClick() {
dropdownOpen = !dropdownOpen;
}
@@ -123,13 +146,27 @@
<div class="header-row header-controls" class:quiz-mode={isQuizPage}>
{#if isQuizPage}
<div class="quiz-header-stats">
<div class="qh-block">
<span class="qh-label">Current:</span>
<span class="qh-value">{score ? `${score.correct}/${score.total}` : '0/0'} {score && score.skipped > 0 ? `(` : ''}{#if score && score.skipped > 0}<span class="quiz-icon quiz-skip"><InlineSvg path="/icons/skip-square.svg" alt="Skipped" /></span> {score.skipped}){/if}</span>
</div>
<div class="qh-block">
<span class="qh-label">All Time:</span>
<span class="qh-value"><span class="quiz-icon quiz-ok"><InlineSvg path="/icons/ok-square.svg" alt="Correct" /></span> {gameStats?.correct || 0} <span class="quiz-icon quiz-fail"><InlineSvg path="/icons/fail-square.svg" alt="Wrong" /></span> {gameStats?.wrong || 0} {gameStats?.skipped > 0 ? `` : ''}{#if gameStats?.skipped > 0}<span class="quiz-icon quiz-skip"><InlineSvg path="/icons/skip-square.svg" alt="Skipped" /></span> {gameStats.skipped}{/if}</span>
<div class="qh-block stats-block">
{#if isQuizActive && !showAllTimeStats}
<!-- Session Stats -->
<span class="qh-value">
<span class="quiz-icon quiz-ok"><InlineSvg path="/icons/ok-square.svg" alt="Correct" /></span> {sessionStats?.correct || 0}
<span class="quiz-icon quiz-fail"><InlineSvg path="/icons/fail-square.svg" alt="Wrong" /></span> {sessionStats?.wrong || 0}
<span class="quiz-icon quiz-skip"><InlineSvg path="/icons/skip-square.svg" alt="Skipped" /></span> {sessionStats?.skipped || 0}
</span>
{:else}
<!-- All Time Stats -->
<span class="qh-value">
<span class="quiz-icon quiz-ok"><InlineSvg path="/icons/ok-square.svg" alt="Correct" /></span> {gameStats?.correct || 0}
<span class="quiz-icon quiz-fail"><InlineSvg path="/icons/fail-square.svg" alt="Wrong" /></span> {gameStats?.wrong || 0}
<span class="quiz-icon quiz-skip"><InlineSvg path="/icons/skip-square.svg" alt="Skipped" /></span> {gameStats?.skipped || 0}
</span>
{/if}
{#if isQuizActive}
<button class="stats-toggle-btn" class:active={showAllTimeStats} on:click={toggleStatsView} title={showAllTimeStats ? "Show session stats" : "Show all-time stats"}>
<InlineSvg path="/icons/chart-square.svg" alt="Toggle stats" />
</button>
{/if}
</div>
<div class="qh-block achievement-block">
<AchievementButton
@@ -371,14 +408,52 @@
font-size: 0.9rem;
color: var(--color-text);
}
.qh-label {
color: var(--color-text-secondary);
margin-right: 0.35rem;
.qh-block.stats-block {
display: flex;
align-items: center;
gap: 0.5rem;
position: relative;
}
.qh-value {
font-weight: 600;
}
.stats-toggle-btn {
background: none;
border: none;
padding: 0.25rem;
cursor: pointer;
color: var(--color-text-secondary);
transition: all 0.2s ease;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
}
.stats-toggle-btn:hover {
background: var(--color-bg-hover);
color: var(--color-text-primary);
}
.stats-toggle-btn.active {
color: var(--color-primary);
}
.stats-toggle-btn.active:hover {
background: var(--color-bg-hover);
color: var(--color-primary-dark);
}
.stats-toggle-btn :global(.svg-wrapper) {
width: 16px;
height: 16px;
}
.quiz-icon {
display: inline-flex;
width: 20px;
+70 -5
View File
@@ -9,9 +9,9 @@
export let focusWrongAnswers = false;
export let reduceCorrectAnswers = false;
export let soundEnabled = true;
export let sessionLength = 10;
export let showSettings = false;
export let showResetConfirmation = false;
export let quizType = 'flag'; // 'flag', 'logo', 'emblem', etc.
// Customizable labels for different quiz types
export let focusWrongLabel = 'Focus on previously answered incorrectly items';
@@ -28,6 +28,13 @@
}
}
function handleOverlayClick(event) {
// Only close if clicking on the overlay itself, not the modal content
if (event.target === event.currentTarget) {
toggleSettings();
}
}
function resetAllStats() {
showResetConfirmation = true;
dispatch('resetConfirmation', true);
@@ -43,13 +50,14 @@
autoAdvance,
focusWrongAnswers,
reduceCorrectAnswers,
soundEnabled
soundEnabled,
sessionLength
});
</script>
{#if showSettings}
<div class="settings-overlay" on:click={toggleSettings} on:keydown={handleOverlayKeydown} role="button" tabindex="0">
<div class="settings-modal" role="dialog" aria-modal="true" on:click|stopPropagation>
<div class="settings-overlay" on:click={handleOverlayClick} on:keydown={handleOverlayKeydown} role="button" tabindex="0" aria-label="Close settings">
<div class="settings-modal" role="dialog" aria-modal="true">
<div class="settings-header">
<InlineSvg path="/icons/settings.svg" alt="Settings" />
<h3>Game Settings</h3>
@@ -99,6 +107,20 @@
</label>
</div>
<div class="setting-item">
<label for="sessionLength">
Quiz length (number of questions):
<select id="sessionLength" bind:value={sessionLength}>
<option value={5}>5 questions</option>
<option value={10}>10 questions</option>
<option value={15}>15 questions</option>
<option value={20}>20 questions</option>
<option value={25}>25 questions</option>
<option value={50}>50 questions</option>
</select>
</label>
</div>
<div class="setting-actions">
<button class="reset-stats-btn" on:click={resetAllStats}>
Reset All Statistics
@@ -120,7 +142,7 @@
<p>This action will permanently delete:</p>
<ul>
<li>✗ All game statistics (correct, wrong, skipped answers)</li>
<li>✗ Current session score</li>
<li>✗ Current quiz score</li>
<li>✗ All unlocked achievements</li>
<li>✗ Achievement progress</li>
<li>✗ Wrong answer tracking data</li>
@@ -241,12 +263,55 @@
font-size: 0.9rem;
}
.setting-item label[for="sessionLength"] {
flex-direction: column;
align-items: flex-start;
gap: 0.5rem;
cursor: default;
}
.setting-item input[type="checkbox"] {
width: 1rem;
height: 1rem;
cursor: pointer;
}
.setting-item select {
background: var(--color-bg-secondary);
color: var(--color-text-primary);
border: 2px solid var(--color-border);
border-radius: 6px;
padding: 0.75rem 1rem;
font-size: 0.9rem;
cursor: pointer;
width: 100%;
appearance: none;
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
background-repeat: no-repeat;
background-position: right 0.75rem center;
background-size: 1rem;
padding-right: 2.5rem;
transition: all 0.2s ease;
font-family: inherit;
}
.setting-item select:hover {
border-color: var(--color-primary);
background-color: var(--color-bg-hover, var(--color-bg-secondary));
}
.setting-item select:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 0 3px rgba(70, 25, 194, 0.1);
}
.setting-item select option {
background: var(--color-bg-secondary);
color: var(--color-text-primary);
padding: 0.5rem;
}
.setting-actions {
margin-top: 2rem;
padding-top: 1rem;
+414
View File
@@ -0,0 +1,414 @@
<script>
import { createEventDispatcher } from 'svelte';
import InlineSvg from './InlineSvg.svelte';
const dispatch = createEventDispatcher();
export let show = false;
export let sessionStats = {
correct: 0,
wrong: 0,
skipped: 0,
total: 0,
sessionLength: 10
};
function playAgain() {
dispatch('playAgain');
}
function goToGames() {
dispatch('goToGames');
}
function closeResults() {
dispatch('close');
}
$: percentage = sessionStats.total > 0 ? Math.round((sessionStats.correct / sessionStats.total) * 100) : 0;
$: grade = getGrade(percentage);
function getGrade(percentage) {
if (percentage >= 90) return { letter: 'A+', color: '#22c55e', description: 'Excellent!' };
if (percentage >= 80) return { letter: 'A', color: '#22c55e', description: 'Great job!' };
if (percentage >= 70) return { letter: 'B', color: '#3b82f6', description: 'Good work!' };
if (percentage >= 60) return { letter: 'C', color: '#f59e0b', description: 'Not bad!' };
if (percentage >= 50) return { letter: 'D', color: '#ef4444', description: 'Keep practicing!' };
return { letter: 'F', color: '#ef4444', description: 'Try again!' };
}
</script>
{#if show}
<div class="results-overlay" role="dialog" aria-modal="true">
<div class="results-modal">
<div class="results-header">
<div class="header-content">
<div class="trophy-icon">
<InlineSvg path="/icons/cup.svg" alt="Quiz Complete" />
</div>
<h2>Quiz Complete!</h2>
</div>
<button class="close-btn" on:click={closeResults} aria-label="Close results">
<span class="close-icon"></span>
</button>
</div>
<div class="results-content">
<div class="grade-display">
<div class="grade-circle" style="border-color: {grade.color}; color: {grade.color}">
{grade.letter}
</div>
<div class="grade-text">
<div class="percentage">{percentage}%</div>
<div class="description">{grade.description}</div>
</div>
</div>
<div class="stats-grid">
<div class="stat-item correct">
<div class="stat-icon">
<InlineSvg path="/icons/check-square.svg" alt="Correct" />
</div>
<div class="stat-value">{sessionStats.correct}</div>
<div class="stat-label">Correct</div>
</div>
<div class="stat-item wrong">
<div class="stat-icon">
<InlineSvg path="/icons/close-square.svg" alt="Wrong" />
</div>
<div class="stat-value">{sessionStats.wrong}</div>
<div class="stat-label">Wrong</div>
</div>
{#if sessionStats.skipped > 0}
<div class="stat-item skipped">
<div class="stat-icon">
<InlineSvg path="/icons/unread.svg" alt="Skipped" />
</div>
<div class="stat-value">{sessionStats.skipped}</div>
<div class="stat-label">Skipped</div>
</div>
{/if}
</div>
<div class="progress-bar">
<div class="progress-fill" style="width: {percentage}%; background-color: {grade.color}"></div>
</div>
<div class="summary-text">
You answered {sessionStats.correct} out of {sessionStats.total} questions correctly
{#if sessionStats.skipped > 0}
and skipped {sessionStats.skipped} question{sessionStats.skipped > 1 ? 's' : ''}
{/if}.
</div>
</div>
<div class="results-actions">
<button class="btn btn-secondary" on:click={goToGames}>
Back to Games
</button>
<button class="btn btn-primary" on:click={playAgain}>
Play Again
</button>
</div>
</div>
</div>
{/if}
<style>
.results-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
display: flex;
justify-content: center;
align-items: center;
z-index: 1000;
animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.results-modal {
background: var(--color-bg-primary);
border: 1px solid var(--color-border);
border-radius: 12px;
padding: 0;
max-width: 500px;
width: 90%;
max-height: 80vh;
overflow-y: auto;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
from {
transform: translateY(30px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
.results-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1.5rem;
border-bottom: 2px solid var(--color-border);
background: var(--color-bg-secondary);
border-radius: 12px 12px 0 0;
}
.header-content {
display: flex;
align-items: center;
gap: 0.75rem;
}
.trophy-icon {
width: 32px;
height: 32px;
color: #f59e0b;
}
.trophy-icon :global(.svg-wrapper) {
width: 100%;
height: 100%;
}
.results-header h2 {
margin: 0;
color: var(--color-text-primary);
font-size: 1.5rem;
}
.close-btn {
background: none;
border: none;
cursor: pointer;
padding: 4px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.close-icon {
width: 16px;
height: 16px;
border-radius: 50%;
background: #ff5f57;
position: relative;
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
}
.close-icon::before {
content: '×';
color: #8b0000;
font-size: 12px;
font-weight: bold;
opacity: 0;
transition: opacity 0.2s ease;
line-height: 1;
}
.close-btn:hover .close-icon {
background: #ff3b30;
}
.close-btn:hover .close-icon::before {
opacity: 1;
}
.results-content {
padding: 2rem 1.5rem;
}
.grade-display {
display: flex;
align-items: center;
gap: 1.5rem;
margin-bottom: 2rem;
justify-content: center;
}
.grade-circle {
width: 80px;
height: 80px;
border: 4px solid;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 2rem;
font-weight: bold;
background: var(--color-bg-secondary);
}
.grade-text {
text-align: left;
}
.percentage {
font-size: 2rem;
font-weight: bold;
color: var(--color-text-primary);
line-height: 1;
}
.description {
font-size: 1.1rem;
color: var(--color-text-secondary);
margin-top: 0.25rem;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
gap: 1rem;
margin-bottom: 1.5rem;
}
.stat-item {
text-align: center;
padding: 1rem;
background: var(--color-bg-secondary);
border-radius: 8px;
border: 1px solid var(--color-border);
}
.stat-icon {
width: 24px;
height: 24px;
margin: 0 auto 0.5rem;
}
.stat-item.correct .stat-icon {
color: #22c55e;
}
.stat-item.wrong .stat-icon {
color: #ef4444;
}
.stat-item.skipped .stat-icon {
color: #6b7280;
}
.stat-value {
font-size: 1.5rem;
font-weight: bold;
color: var(--color-text-primary);
margin-bottom: 0.25rem;
}
.stat-label {
font-size: 0.9rem;
color: var(--color-text-secondary);
}
.progress-bar {
width: 100%;
height: 8px;
background: var(--color-bg-tertiary);
border-radius: 4px;
overflow: hidden;
margin-bottom: 1.5rem;
border: 1px solid var(--color-border);
}
.progress-fill {
height: 100%;
transition: width 0.8s ease-out;
border-radius: 3px;
}
.summary-text {
text-align: center;
color: var(--color-text-secondary);
font-size: 0.95rem;
line-height: 1.4;
}
.results-actions {
display: flex;
gap: 1rem;
padding: 1.5rem;
border-top: 1px solid var(--color-border);
background: var(--color-bg-secondary);
border-radius: 0 0 12px 12px;
}
.btn {
flex: 1;
padding: 0.75rem 1rem;
border: none;
border-radius: 6px;
cursor: pointer;
font-weight: 600;
font-size: 0.95rem;
transition: all 0.2s ease;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
}
.btn-primary {
background: var(--color-primary);
color: white;
}
.btn-primary:hover {
background: var(--color-primary-dark, #0056b3);
}
.btn-secondary {
background: var(--color-bg-tertiary);
color: var(--color-text-primary);
border: 2px solid var(--color-border);
}
.btn-secondary:hover {
background: var(--color-bg-hover);
border-color: var(--color-primary);
}
@media (max-width: 480px) {
.grade-display {
flex-direction: column;
text-align: center;
gap: 1rem;
}
.grade-text {
text-align: center;
}
.stats-grid {
grid-template-columns: repeat(2, 1fr);
}
.results-actions {
flex-direction: column;
}
}
</style>
+531
View File
@@ -0,0 +1,531 @@
<script>
import { createEventDispatcher } from 'svelte';
import InlineSvg from './InlineSvg.svelte';
const dispatch = createEventDispatcher();
export let gameStats = { correct: 0, wrong: 0, total: 0, skipped: 0 };
export let sessionStats = null;
export let showSessionResults = false;
export let sessionLength = 10;
function startQuiz() {
dispatch('startQuiz');
}
function handlePlayAgain() {
dispatch('startQuiz');
}
function handleGoToGames() {
window.location.hash = '#/game';
}
function openSettings() {
dispatch('openSettings');
}
function handleCloseResults() {
dispatch('closeResults');
}
$: hasPlayedBefore = gameStats.total > 0;
$: totalQuestions = gameStats.correct + gameStats.wrong + gameStats.skipped;
$: accuracy = totalQuestions > 0 ? Math.round((gameStats.correct / totalQuestions) * 100) : 0;
// Session results calculations
$: sessionPercentage = sessionStats && sessionStats.total > 0 ? Math.round((sessionStats.correct / sessionStats.total) * 100) : 0;
$: sessionGrade = sessionStats ? getGrade(sessionPercentage) : null;
// Welcome page grade display for accuracy
$: accuracyGrade = hasPlayedBefore ? getGrade(accuracy) : null;
function getGrade(percentage) {
if (percentage >= 90) return { letter: 'A+', color: '#22c55e', description: 'Excellent!' };
if (percentage >= 80) return { letter: 'A', color: '#22c55e', description: 'Great job!' };
if (percentage >= 70) return { letter: 'B', color: '#3b82f6', description: 'Good work!' };
if (percentage >= 60) return { letter: 'C', color: '#f59e0b', description: 'Not bad!' };
if (percentage >= 50) return { letter: 'D', color: '#ef4444', description: 'Keep practicing!' };
return { letter: 'F', color: '#ef4444', description: 'Try again!' };
}
</script>
<div class="welcome-container">
{#if showSessionResults && sessionStats}
<!-- Session Results View -->
<div class="welcome-header">
<div class="welcome-icon">
<InlineSvg path="/icons/check-circle.svg" alt="Quiz Complete" />
</div>
<h1>Quiz Complete!</h1>
<p class="welcome-subtitle">Great job on completing the quiz</p>
</div>
<div class="stats-section">
<div class="grade-display">
<div class="grade-circle" style="border-color: {sessionGrade.color}; color: {sessionGrade.color}">
{sessionGrade.letter}
</div>
<div class="grade-text">
<div class="percentage">{sessionPercentage}%</div>
<div class="description">{sessionGrade.description}</div>
</div>
</div>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-icon correct">
<InlineSvg path="/icons/check-square.svg" alt="Correct" />
</div>
<div class="stat-value">{sessionStats.correct}</div>
<div class="stat-label">Correct</div>
</div>
<div class="stat-card">
<div class="stat-icon wrong">
<InlineSvg path="/icons/close-square.svg" alt="Wrong" />
</div>
<div class="stat-value">{sessionStats.wrong}</div>
<div class="stat-label">Wrong</div>
</div>
<div class="stat-card">
<div class="stat-icon skipped">
<InlineSvg path="/icons/skip-square.svg" alt="Skipped" />
</div>
<div class="stat-value">{sessionStats.skipped}</div>
<div class="stat-label">Skipped</div>
</div>
</div>
<div class="progress-bar">
<div class="progress-fill" style="width: {sessionPercentage}%; background-color: {sessionGrade.color}"></div>
</div>
<div class="progress-summary">
<h3>You answered {sessionStats.correct} out of {sessionStats.total} questions correctly
{#if sessionStats.skipped > 0}
and skipped {sessionStats.skipped} question{sessionStats.skipped > 1 ? 's' : ''}
{/if}.</h3>
</div>
</div>
<div class="action-buttons">
<button class="action-btn secondary" on:click={handleGoToGames}>
Back to Games
</button>
<button class="action-btn primary" on:click={handlePlayAgain}>
Play Again
</button>
<button class="action-btn secondary" on:click={openSettings}>
Settings
</button>
</div>
{:else}
<!-- Welcome/Stats View -->
<div class="welcome-header">
<div class="welcome-icon">
<InlineSvg path="/icons/flag.svg" alt="Flag Quiz" />
</div>
<h1>Flag Quiz</h1>
<p class="welcome-subtitle">Test your knowledge of world flags</p>
</div>
{#if hasPlayedBefore}
<div class="stats-section">
<h2>Your Statistics</h2>
<div class="grade-display">
<div class="accuracy-icon" style="color: {accuracyGrade.color}">
<InlineSvg path="/icons/medal-star.svg" alt="Accuracy" />
</div>
<div class="grade-text">
<div class="percentage">{accuracy}%</div>
<div class="description">Accuracy</div>
</div>
</div>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-icon correct">
<InlineSvg path="/icons/check-square.svg" alt="Correct" />
</div>
<div class="stat-value">{gameStats.correct}</div>
<div class="stat-label">Correct</div>
</div>
<div class="stat-card">
<div class="stat-icon wrong">
<InlineSvg path="/icons/close-square.svg" alt="Wrong" />
</div>
<div class="stat-value">{gameStats.wrong}</div>
<div class="stat-label">Wrong</div>
</div>
<div class="stat-card">
<div class="stat-icon skipped">
<InlineSvg path="/icons/skip-square.svg" alt="Skipped" />
</div>
<div class="stat-value">{gameStats.skipped}</div>
<div class="stat-label">Skipped</div>
</div>
</div>
<div class="progress-summary">
<h3>Total Questions Answered: {totalQuestions}</h3>
</div>
</div>
{:else}
<div class="welcome-message">
<h2>Welcome to Flag Quiz!</h2>
<p>Challenge yourself to identify flags from around the world. Each quiz contains <strong>{sessionLength} questions</strong> with a mix of flag-to-country and country-to-flag challenges.</p>
<div class="features">
<div class="feature">
<InlineSvg path="/icons/global.svg" alt="Global" />
<span>Flags from every continent</span>
</div>
<div class="feature">
<InlineSvg path="/icons/medal-ribbon.svg" alt="Achievements" />
<span>Unlock achievements</span>
</div>
<div class="feature">
<InlineSvg path="/icons/chart-square.svg" alt="Statistics" />
<span>Track your progress</span>
</div>
</div>
</div>
{/if}
<div class="start-section">
<button class="start-quiz-btn" on:click={startQuiz}>
{hasPlayedBefore ? 'Start New Quiz' : 'Start Quiz'}
</button>
<p class="session-info">{sessionLength} questions per quiz</p>
</div>
{/if}
</div>
<style>
.welcome-container {
max-width: 600px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
.welcome-header {
margin-bottom: 3rem;
}
.welcome-icon {
width: 64px;
height: 64px;
margin: 0 auto 1.5rem;
color: var(--color-primary);
}
.welcome-header h1 {
font-size: 2.5rem;
font-weight: bold;
color: var(--color-text-primary);
margin: 0 0 0.5rem 0;
}
.welcome-subtitle {
font-size: 1.2rem;
color: var(--color-text-secondary);
margin: 0;
}
.stats-section {
background: var(--color-bg-secondary);
border: 1px solid var(--color-border);
border-radius: 12px;
padding: 2rem;
margin-bottom: 2rem;
}
.stats-section h2 {
margin: 0 0 1.5rem 0;
color: var(--color-text-primary);
font-size: 1.5rem;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
gap: 1rem;
margin-bottom: 1.5rem;
}
.stat-card {
background: var(--color-bg-primary);
border: 1px solid var(--color-border);
border-radius: 8px;
padding: 1.5rem 1rem;
text-align: center;
}
.stat-icon {
width: 32px;
height: 32px;
margin: 0 auto 0.75rem;
}
.stat-icon.correct {
color: #22c55e;
}
.stat-icon.wrong {
color: #ef4444;
}
.stat-icon.skipped {
color: #6b7280;
}
.stat-value {
font-size: 1.75rem;
font-weight: bold;
color: var(--color-text-primary);
margin-bottom: 0.25rem;
}
.stat-label {
font-size: 0.9rem;
color: var(--color-text-secondary);
}
.progress-summary {
border-top: 1px solid var(--color-border);
padding-top: 1.5rem;
}
.progress-summary h3 {
margin: 0;
color: var(--color-text-primary);
font-size: 1.1rem;
font-weight: 600;
line-height: 1.4;
}
.grade-display {
display: flex;
align-items: center;
gap: 1.5rem;
margin-bottom: 2rem;
justify-content: center;
}
.grade-circle {
width: 80px;
height: 80px;
border: 4px solid;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 2rem;
font-weight: bold;
background: var(--color-bg-primary);
}
.accuracy-icon {
width: 80px;
height: 80px;
display: flex;
align-items: center;
justify-content: center;
}
.accuracy-icon :global(.svg-wrapper) {
width: 64px;
height: 64px;
}
.grade-text {
text-align: left;
}
.percentage {
font-size: 2rem;
font-weight: bold;
color: var(--color-text-primary);
line-height: 1;
}
.description {
font-size: 1.1rem;
color: var(--color-text-secondary);
margin-top: 0.25rem;
}
.progress-bar {
width: 100%;
height: 8px;
background: var(--color-bg-tertiary);
border-radius: 4px;
overflow: hidden;
margin-bottom: 1.5rem;
border: 1px solid var(--color-border);
}
.progress-fill {
height: 100%;
transition: width 0.8s ease-out;
border-radius: 3px;
}
.action-buttons {
display: flex;
gap: 1rem;
justify-content: center;
flex-wrap: wrap;
}
.action-btn {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 8px;
cursor: pointer;
font-weight: 600;
font-size: 0.95rem;
transition: all 0.2s ease;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 120px;
}
.action-btn.primary {
background: var(--color-primary);
color: white;
}
.action-btn.primary:hover {
background: var(--color-primary-dark, #0056b3);
transform: translateY(-1px);
}
.action-btn.secondary {
background: var(--color-bg-tertiary);
color: var(--color-text-primary);
border: 2px solid var(--color-border);
}
.action-btn.secondary:hover {
background: var(--color-bg-hover);
border-color: var(--color-primary);
transform: translateY(-1px);
}
.welcome-message {
background: var(--color-bg-secondary);
border: 1px solid var(--color-border);
border-radius: 12px;
padding: 2rem;
margin-bottom: 2rem;
}
.welcome-message h2 {
margin: 0 0 1rem 0;
color: var(--color-text-primary);
font-size: 1.5rem;
}
.welcome-message p {
color: var(--color-text-secondary);
line-height: 1.6;
margin-bottom: 1.5rem;
}
.features {
display: flex;
flex-direction: column;
gap: 1rem;
align-items: flex-start;
text-align: left;
}
.feature {
display: flex;
align-items: center;
gap: 0.75rem;
color: var(--color-text-primary);
}
.feature :global(.svg-wrapper) {
width: 24px;
height: 24px;
color: var(--color-primary);
flex-shrink: 0;
}
.start-section {
margin-top: 2rem;
}
.start-quiz-btn {
background: var(--color-primary);
color: white;
border: none;
border-radius: 8px;
padding: 1rem 2rem;
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
margin-bottom: 0.75rem;
}
.start-quiz-btn:hover {
background: var(--color-primary-dark);
transform: translateY(-1px);
}
.session-info {
color: var(--color-text-secondary);
font-size: 0.9rem;
margin: 0;
}
@media (max-width: 480px) {
.welcome-container {
padding: 1rem;
}
.welcome-header h1 {
font-size: 2rem;
}
.stats-grid {
grid-template-columns: repeat(2, 1fr);
}
.features {
align-items: center;
text-align: center;
}
.grade-display {
flex-direction: column;
text-align: center;
gap: 1rem;
}
.grade-text {
text-align: center;
}
.action-buttons {
flex-direction: column;
align-items: stretch;
}
.action-btn {
min-width: auto;
}
}
</style>