diff --git a/src/routes/games/floriferous/+page.svelte b/src/routes/games/floriferous/+page.svelte index 5263254..4ec28d7 100644 --- a/src/routes/games/floriferous/+page.svelte +++ b/src/routes/games/floriferous/+page.svelte @@ -3,6 +3,7 @@ import { slide } from 'svelte/transition'; import type { PageData } from './$types.js'; import Navbar from '$lib/components/Navbar.svelte'; + import FloriferousScoreCalculator from './FloriferousScoreCalculator.svelte'; import { FloriferousGame } from '../../../lib/floriferous/floriferous-game.js'; import type { FloriferousPlayer } from '../../../lib/floriferous'; @@ -19,6 +20,8 @@ let previousGames: FloriferousGame[] = data.previousGames; let apiPassword = ''; let players: FloriferousPlayer[] = []; + let isScoreCalculatorVisible = true; + let isPlayersVisible = false; let isPreviousScoresVisible = false; let isWinnerVisible = false; let isSaveSubmitting = false; @@ -92,42 +95,64 @@ abundance of nature.

-
-

Players

- - {#if players.length > 0} - - - {#if players.length > 1} - {#if isWinnerVisible} -

And the winner is:{game.winner}

-

Add to Ledger

- - (apiPassword = event.detail)} /> - - {#if apiPassword.length > 0} -

You can save this game in the Ledger

- - {/if} - {:else} - - {/if} +
+
+

Score Calculator

+ {#if isScoreCalculatorVisible} + + {:else} + {/if} - {:else} -

Add at least one player to get started

- {/if} +
- {#if !isWinnerVisible} -

Add a New Player

- + +
+ +
+
+

Players

+ {#if isPlayersVisible} + + {:else} + + {/if} +
+ + {#if isPlayersVisible} + {#if players.length > 0} +
    + {#each players as player} +
  • + {player.name} ({player.score} points, finished on row {player.rowAtEndOfGame}) () +
  • + {/each} +
+ + {#if players.length > 1} + {#if isWinnerVisible} +

And the winner is:{game.winner}

+

Add to Ledger

+ + (apiPassword = event.detail)} /> + + {#if apiPassword.length > 0} +

You can save this game in the Ledger

+ + {/if} + {:else} + + {/if} + {/if} + {:else} +

Add at least one player to get started

+ {/if} + + {#if !isWinnerVisible} +

Add a New Player

+ + {/if} {/if}
@@ -147,6 +172,26 @@ max-width: 600px; } + .players { + padding: var(--spacing-md) 0; + width: 100%; + } + + .players__header { + display: grid; + grid-template-columns: auto min-content; + } + + .score-calculator { + padding: var(--spacing-md) 0; + width: 100%; + } + + .score-calculator__header { + display: grid; + grid-template-columns: auto min-content; + } + .previous-games { padding: var(--spacing-md) 0; width: 100%; diff --git a/src/routes/games/floriferous/FloriferousScoreCalculator.svelte b/src/routes/games/floriferous/FloriferousScoreCalculator.svelte new file mode 100644 index 0000000..5bc58e3 --- /dev/null +++ b/src/routes/games/floriferous/FloriferousScoreCalculator.svelte @@ -0,0 +1,188 @@ + + +{#if isVisible} +
+
+

Your score is {currentScore}

+ +
    + {#each actions as action} +
  • + +{action.score} + {#if action.name.length > 0} ({action.name}) {/if} +
  • + {/each} +
+
+ +
onNewActionSubmit(newActionScore, newActionName)} + > +
+ + +
+ +
+ + +
+ +
+
+ Reason for Points + {#each suggestedDescriptions as suggestion} + + {/each} + + +
+
+ +
+ +
+
+
+{/if} + + diff --git a/src/styles/thomaswilson.css b/src/styles/thomaswilson.css index b3feb22..f9a98a0 100644 --- a/src/styles/thomaswilson.css +++ b/src/styles/thomaswilson.css @@ -131,3 +131,15 @@ ol { text-decoration: none; cursor: pointer; } + +.sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +}