diff --git a/client/src/lib/DarkmodeIcon.svelte b/client/src/lib/DarkmodeIcon.svelte new file mode 100644 index 0000000..bd9c890 --- /dev/null +++ b/client/src/lib/DarkmodeIcon.svelte @@ -0,0 +1,9 @@ + + +{#if $themeStore == "dark"} + +{:else} + +{/if} \ No newline at end of file diff --git a/client/src/lib/game.svelte b/client/src/lib/game.svelte index ecb414c..da50220 100644 --- a/client/src/lib/game.svelte +++ b/client/src/lib/game.svelte @@ -168,7 +168,7 @@ } - + @@ -177,7 +177,7 @@ {#if !twoPlayer} -
+
@@ -196,8 +196,23 @@ {#each classes as className, i}
{#each (new Array(9)) as _, j} - {@const move = moves.find(move => move.i == i && move.j == j)} -
addMove(i, j)} class:hover={hoveredPiece?.i == i && hoveredPiece.j == j} class="square" class:move class:preview={!move} class:cross={move && move.p==1} class:circle={move && move.p==2} on:mouseover={() => { if(currentContainer == i) hoveredPiece = { i, j } }} on:mouseleave={() => { if(hoveredPiece?.i == i && hoveredPiece.j == j) hoveredPiece = null; }}> + {@const moveIndex = moves.findIndex(cmove => cmove.i == i && cmove.j == j)} + {@const move = moves[moveIndex]} +
addMove(i, j)} + on:keydown={() => addMove(i, j)} + class:hover={hoveredPiece?.i == i && hoveredPiece.j == j} + class="square" + class:move + class:preview={!move} + class:cross={move && move.p==1} + class:circle={move && move.p==2} + on:mouseover={() => { if(currentContainer == i) hoveredPiece = { i, j } }} + on:focus={() => { if(currentContainer == i) hoveredPiece = { i, j }}} + on:mouseleave={() => { if(hoveredPiece?.i == i && hoveredPiece.j == j) hoveredPiece = null; }} + > + {#if move} {#if move.p == 1} @@ -273,18 +288,18 @@ {/if} {#key currentPlayer} -
- {#if overallState == 1 || currentPlayer == 1} - +
+ {#if overallState == 1 || !overallState && currentPlayer == 1} + - {:else if overallState == 2 || currentPlayer == 2} - + {:else if overallState == 2 || !overallState && currentPlayer == 2} + {:else} - + @@ -301,17 +316,17 @@ {:else} is on turn. {#if twoPlayer && self == currentPlayer} - It is YOUR {selfName ? "(" + selfName + ")" : ""} turn. + It is YOUR {selfName ? "(" + selfName + ")" : ""} turn. {:else if twoPlayer && self != currentPlayer} - Waiting for {opponentName || "opponent"}... + Waiting for {opponentName || "opponent"} {/if} {/if}
{/key}
-
-
+
+
{#if twoPlayer}
@@ -339,7 +354,7 @@
-
+

Rooms

@@ -100,14 +100,35 @@ @apply cursor-pointer border-b border-b-solid border-b-gray-300 p-4; } button { - @apply w-64 h-10 px-2 border border-gray-300 bg-white mt-4 my-0; + @apply w-64 h-10 px-2 border border-gray-300 bg-white mt-4 my-0 cursor-pointer; + } + button:disabled { + @apply bg-gray-300 cursor-not-allowed; + } + :global(.dark) button { + @apply bg-white/15 border-gray-700 text-white; + } + :global(.dark) button:hover { + @apply bg-white/10; + } + :global(.dark) button:disabled { + @apply bg-black; + } + :global(.dark) button:disabled:hover { + @apply bg-gray-900; } dialog .header button { @apply w-12; } + :global(.dark) dialog { + @apply bg-black border-gray-700 text-white; + } input { @apply w-64 h-10 px-2 border border-gray-300 rounded-l-lg mt-4 my-0; } + :global(.dark) input { + @apply border-gray-400 text-white bg-black; + } button:first-child { @apply rounded-l-lg; } diff --git a/client/src/lib/move.svelte b/client/src/lib/move.svelte index 1e85cb0..04d20ae 100644 --- a/client/src/lib/move.svelte +++ b/client/src/lib/move.svelte @@ -4,7 +4,8 @@ export var piece: number | "?"; export var latest: boolean = false; -
+ +
{#if player == 1} @@ -46,6 +47,9 @@ .latest { @apply opacity-35; } + :global(.dark) .latest { + @apply opacity-50; + } .player { @apply inline-block w-1em h-1em; } diff --git a/client/src/lib/nameChoose.svelte b/client/src/lib/nameChoose.svelte index 1d69d0d..6a21d0b 100644 --- a/client/src/lib/nameChoose.svelte +++ b/client/src/lib/nameChoose.svelte @@ -18,7 +18,7 @@ } - + @@ -43,9 +43,6 @@ {/if}

Waiting for an opponent...

-

Currently in room {$room?.name}.

+

Currently in room {$room?.name}.

\ No newline at end of file diff --git a/client/src/routes/+layout.svelte b/client/src/routes/+layout.svelte index 53114ee..8bbf06c 100644 --- a/client/src/routes/+layout.svelte +++ b/client/src/routes/+layout.svelte @@ -1,13 +1,21 @@ -
+
@@ -17,4 +25,7 @@ :global(:root), :global(body) { @apply overflow-hidden w-100vw; } + :global(*) { + @apply transition-colors; + } \ No newline at end of file diff --git a/client/src/routes/+page.svelte b/client/src/routes/+page.svelte index c919935..a6e37a0 100644 --- a/client/src/routes/+page.svelte +++ b/client/src/routes/+page.svelte @@ -1,5 +1,7 @@ @@ -22,19 +32,19 @@

Local multiplayer

- +

A game for two on a single device

Online multiplayer

- +

Play with 2 devices, even across the ocean.

-
+
How do I play the game?

+
+ +
{/if}