Spaces:
Runtime error
Runtime error
remove spaces possibiliy
Browse files
frontend/src/lib/Keyboard.svelte
CHANGED
@@ -8,8 +8,7 @@
|
|
8 |
const rows = [
|
9 |
'qwertyuiop'.split(''),
|
10 |
[...'asdfghjkl'.split(''), 'Backspace'],
|
11 |
-
[...'zxcvbnm'.split(''), 'Enter']
|
12 |
-
[' ']
|
13 |
];
|
14 |
</script>
|
15 |
|
@@ -29,8 +28,6 @@
|
|
29 |
d="M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.9.89 1.59.89h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H7.07L2.4 12l4.66-7H22v14zm-11.59-2L14 13.41 17.59 17 19 15.59 15.41 12 19 8.41 17.59 7 14 10.59 10.41 7 9 8.41 12.59 12 9 15.59z"
|
30 |
/>
|
31 |
</svg>
|
32 |
-
{:else if key === ' '}
|
33 |
-
<span>Space</span>
|
34 |
{:else}
|
35 |
<span>{key}</span>
|
36 |
{/if}
|
|
|
8 |
const rows = [
|
9 |
'qwertyuiop'.split(''),
|
10 |
[...'asdfghjkl'.split(''), 'Backspace'],
|
11 |
+
[...'zxcvbnm'.split(''), 'Enter']
|
|
|
12 |
];
|
13 |
</script>
|
14 |
|
|
|
28 |
d="M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.9.89 1.59.89h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H7.07L2.4 12l4.66-7H22v14zm-11.59-2L14 13.41 17.59 17 19 15.59 15.41 12 19 8.41 17.59 7 14 10.59 10.41 7 9 8.41 12.59 12 9 15.59z"
|
29 |
/>
|
30 |
</svg>
|
|
|
|
|
31 |
{:else}
|
32 |
<span>{key}</span>
|
33 |
{/if}
|
frontend/src/lib/utils.ts
CHANGED
@@ -18,6 +18,9 @@ export function fillTile(board: Board, currentRowIndex: number, letter: string)
|
|
18 |
const newBoard = [...board];
|
19 |
const currentRow = newBoard[currentRowIndex];
|
20 |
for (const tile of currentRow) {
|
|
|
|
|
|
|
21 |
if (!tile.letter) {
|
22 |
tile.letter = letter;
|
23 |
break;
|
|
|
18 |
const newBoard = [...board];
|
19 |
const currentRow = newBoard[currentRowIndex];
|
20 |
for (const tile of currentRow) {
|
21 |
+
if (tile.correct === ' ') {
|
22 |
+
tile.letter = ' ';
|
23 |
+
}
|
24 |
if (!tile.letter) {
|
25 |
tile.letter = letter;
|
26 |
break;
|
frontend/src/routes/index.svelte
CHANGED
@@ -78,7 +78,7 @@
|
|
78 |
|
79 |
function onKey(key: string) {
|
80 |
if (!allowInput) return;
|
81 |
-
if (/^[a-zA-Z
|
82 |
board = fillTile(board, currentRowIndex, key.toLowerCase());
|
83 |
} else if (key === 'Backspace') {
|
84 |
board = clearTile(board, currentRowIndex);
|
|
|
78 |
|
79 |
function onKey(key: string) {
|
80 |
if (!allowInput) return;
|
81 |
+
if (/^[a-zA-Z]$/.test(key)) {
|
82 |
board = fillTile(board, currentRowIndex, key.toLowerCase());
|
83 |
} else if (key === 'Backspace') {
|
84 |
board = clearTile(board, currentRowIndex);
|