diff --git a/public/icons/github.svg b/public/icons/github.svg new file mode 100644 index 0000000..9640694 --- /dev/null +++ b/public/icons/github.svg @@ -0,0 +1,4 @@ + + + diff --git a/src/components/ActionButtons.svelte b/src/components/ActionButtons.svelte new file mode 100644 index 0000000..55aa6e5 --- /dev/null +++ b/src/components/ActionButtons.svelte @@ -0,0 +1,117 @@ + + +
+ {#if sessionInfo} +
+ {sessionInfo} +
+ {/if} + +
+ {#if mode === 'welcome'} + + + {:else if mode === 'quiz'} + + + {:else if mode === 'results'} + + + + {/if} +
+
+ + diff --git a/src/components/Footer.svelte b/src/components/Footer.svelte index f1240d5..1b52e8a 100644 --- a/src/components/Footer.svelte +++ b/src/components/Footer.svelte @@ -1,29 +1,19 @@ diff --git a/src/components/WelcomeStats.svelte b/src/components/WelcomeStats.svelte index 3dda0fb..e2c7eb5 100644 --- a/src/components/WelcomeStats.svelte +++ b/src/components/WelcomeStats.svelte @@ -1,531 +1,488 @@
- {#if showSessionResults && sessionStats} - -
-
- -
-

Quiz Complete!

-

Great job on completing the quiz

-
- -
-
-
- {sessionGrade.letter} -
-
-
{sessionPercentage}%
-
{sessionGrade.description}
-
-
- -
-
-
- -
-
{sessionStats.correct}
-
Correct
-
- -
-
- -
-
{sessionStats.wrong}
-
Wrong
-
- -
-
- -
-
{sessionStats.skipped}
-
Skipped
-
-
- -
-
-
- -
-

You answered {sessionStats.correct} out of {sessionStats.total} questions correctly - {#if sessionStats.skipped > 0} - and skipped {sessionStats.skipped} question{sessionStats.skipped > 1 ? 's' : ''} - {/if}.

-
-
- -
- - - -
- {:else} - -
-
- -
-

Flag Quiz

-

Test your knowledge of world flags

-
- - {#if hasPlayedBefore} -
-

Your Statistics

- -
-
- -
-
-
{accuracy}%
-
Accuracy
-
-
- -
-
-
- + {#if showSessionResults && sessionStats} + +
+
+
-
{gameStats.correct}
-
Correct
-
- -
-
- -
-
{gameStats.wrong}
-
Wrong
-
- -
-
- -
-
{gameStats.skipped}
-
Skipped
-
+

Quiz Complete!

+

Great job on completing the quiz

-
-

Total Questions Answered: {totalQuestions}

+
+
+
+ {sessionGrade.letter} +
+
+
{sessionPercentage}%
+
{sessionGrade.description}
+
+
+ +
+
+
+ +
+
{sessionStats.correct}
+
Correct
+
+ +
+
+ +
+
{sessionStats.wrong}
+
Wrong
+
+ +
+
+ +
+
{sessionStats.skipped}
+
Skipped
+
+
+ +
+
+
+ +
+

+ You answered {sessionStats.correct} out of {sessionStats.total} + questions correctly + {#if sessionStats.skipped > 0} + and skipped {sessionStats.skipped} question{sessionStats.skipped > + 1 + ? "s" + : ""} + {/if}. +

+
-
{:else} -
-

Welcome to Flag Quiz!

-

Challenge yourself to identify flags from around the world. Each quiz contains {sessionLength} questions with a mix of flag-to-country and country-to-flag challenges.

- -
-
- - Flags from every continent -
-
- - Unlock achievements -
-
- - Track your progress -
+ +
+
+ +
+

Flag Quiz

+

Test your knowledge of world flags

-
- {/if} -
- -

{sessionLength} questions per quiz

-
- {/if} + {#if hasPlayedBefore} +
+

Your Statistics

+ +
+
+ +
+
+
{accuracy}%
+
Accuracy
+
+
+ +
+
+
+ +
+
{gameStats.correct}
+
Correct
+
+ +
+
+ +
+
{gameStats.wrong}
+
Wrong
+
+ +
+
+ +
+
{gameStats.skipped}
+
Skipped
+
+
+ +
+

Total Questions Answered: {totalQuestions}

+
+
+ {:else} +
+

Welcome to Flag Quiz!

+

+ Challenge yourself to identify flags from around the world. + Each quiz contains {sessionLength} questions with a mix of flag-to-country and country-to-flag challenges. +

+ +
+
+ + Flags from every continent +
+
+ + Unlock achievements +
+
+ + Track your progress +
+
+
+ {/if} + {/if}
diff --git a/src/pages/FlagQuiz.svelte b/src/pages/FlagQuiz.svelte index 7af6490..e5d8d51 100644 --- a/src/pages/FlagQuiz.svelte +++ b/src/pages/FlagQuiz.svelte @@ -1,29 +1,30 @@ @@ -753,9 +865,9 @@ {setTheme} {gameStats} {achievementCount} - sessionStats={sessionStats} - isQuizActive={sessionInProgress && quizSubpage === 'quiz'} - onAchievementClick={() => showAchievements = true} + {sessionStats} + isQuizActive={sessionInProgress && quizSubpage === "quiz"} + onAchievementClick={() => (showAchievements = true)} />
@@ -783,31 +895,44 @@ {gameStats} {currentStreak} show={showAchievements} - on:close={() => showAchievements = false} + on:close={() => (showAchievements = false)} on:achievementsUnlocked={handleAchievementsUnlocked} /> - {#if quizSubpage === 'welcome'} + {#if quizSubpage === "welcome"} showSettings = true} - on:closeResults={() => showSessionResults = false} + on:openSettings={() => (showSettings = true)} + on:closeResults={() => (showSessionResults = false)} /> - {:else if quizSubpage === 'quiz'} + + 0} + on:action={handleActionButtonClick} + /> + {:else if quizSubpage === "quiz"} - {#if gameState === 'loading'} + {#if gameState === "loading"}
Loading flags...
{:else if currentQuestion}
-
Question {currentSessionQuestions + 1} from {sessionLength}
+
+ Question {currentSessionQuestions + 1} from {sessionLength} +
- {currentQuestion.type === 'flag-to-country' ? 'Which country does this flag belong to?' : 'Which flag belongs to this country?'} + {currentQuestion.type === "flag-to-country" + ? "Which country does this flag belong to?" + : "Which flag belongs to this country?"}
@@ -816,30 +941,58 @@ {#if showResult}
{#if selectedAnswer === correctAnswer} -
Correct!
+
+ Correct! +
{:else}
- Wrong! - {#if currentQuestion.type === 'flag-to-country'} + + Wrong! + {#if currentQuestion.type === "flag-to-country"} - The correct answer is: {getCountryName(currentQuestion.correct)}. + The correct answer is: {getCountryName( + currentQuestion.correct, + )}. {#if showResultCountryInfo} - {/if} @@ -847,9 +1000,13 @@ {/if}
- {#if currentQuestion.type === 'flag-to-country'} + {#if currentQuestion.type === "flag-to-country"}
- Flag + Flag
@@ -858,9 +1015,11 @@ class="option" class:selected={selectedAnswer === index} class:correct={showResult && index === correctAnswer} - class:wrong={showResult && selectedAnswer === index && index !== correctAnswer} + class:wrong={showResult && + selectedAnswer === index && + index !== correctAnswer} on:click={() => selectAnswer(index)} - disabled={gameState === 'answered'} + disabled={gameState === "answered"} > {getCountryName(option)} @@ -876,9 +1035,14 @@ aria-label="Show country info" aria-expanded={showCountryInfo} on:click={() => (showCountryInfo = !showCountryInfo)} - on:keydown={(e) => { if (e.key === 'Escape') showCountryInfo = false; }} + on:keydown={(e) => { + if (e.key === "Escape") showCountryInfo = false; + }} > - + {#if showCountryInfo} {/if} - {#if gameState === 'question'} - - {:else if (!autoAdvance && gameState === 'answered') || (autoAdvance && gameState === 'answered' && sessionRestoredFromReload)} - + {#if gameState === "question"} + + {:else if (!autoAdvance && gameState === "answered") || (autoAdvance && gameState === "answered" && sessionRestoredFromReload)} + {/if} - {#if autoAdvance && gameState === 'answered' && timerProgress > 0 && !sessionRestoredFromReload} + {#if autoAdvance && gameState === "answered" && timerProgress > 0 && !sessionRestoredFromReload}
-
+
- Next question in {Math.ceil((timerDuration - (timerProgress / 100 * timerDuration)) / 1000)}s + Next question in {Math.ceil( + (timerDuration - (timerProgress / 100) * timerDuration) / + 1000, + )}s
{/if}
{/if} -
- - -
+ {/if}
@@ -1007,7 +1192,7 @@ .country-display { text-align: center; margin-bottom: 2rem; - position: relative; + position: relative; } .country-name { @@ -1057,7 +1242,7 @@ width: min(90vw, 520px); max-height: 40vh; overflow: auto; - box-shadow: 0 8px 20px rgba(0,0,0,0.2); + box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); z-index: 5; text-align: left; font-size: 0.95rem; @@ -1268,13 +1453,6 @@ max-width: 300px; } - .controls { - display: flex; - justify-content: center; - gap: 1rem; - flex-wrap: wrap; - } - .btn { padding: 0.75rem 1.5rem; border: none; @@ -1302,16 +1480,6 @@ text-align: center; } - .btn-secondary { - background: var(--color-bg-secondary); - color: var(--color-text-primary); - border: 1px solid var(--color-border); - } - - .btn-secondary:hover { - background: var(--color-bg-hover); - } - .btn-skip { background: var(--color-text-secondary); color: var(--color-bg-primary); @@ -1377,13 +1545,5 @@ left: 50%; transform: translateX(-50%); } - - .controls { - flex-direction: row; - flex-wrap: nowrap; - overflow-x: auto; - -webkit-overflow-scrolling: touch; - justify-content: center; - } }