scrabble-solver 2.15.21 → 2.15.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +11 -0
- package/.github/workflows/build.yml +2 -2
- package/.github/workflows/cypress.yml +3 -3
- package/.github/workflows/deploy.yml +1 -1
- package/.github/workflows/eslint.yml +2 -2
- package/.github/workflows/jest.yml +2 -2
- package/.github/workflows/npx.yml +3 -3
- package/.next/trace +1 -1
- package/.next/trace-build +1 -0
- package/.nx/workspace-data/file-map.json +465 -457
- package/.nx/workspace-data/lockfile-dependencies.hash +1 -1
- package/.nx/workspace-data/lockfile-nodes.hash +1 -1
- package/.nx/workspace-data/nx_files.nxt +0 -0
- package/.nx/workspace-data/parsed-lock-file.dependencies.json +909 -369
- package/.nx/workspace-data/parsed-lock-file.nodes.json +1538 -1140
- package/.nx/workspace-data/project-graph.json +2104 -1271
- package/lerna.json +1 -1
- package/package.json +23 -23
- package/packages/configs/package.json +3 -3
- package/packages/constants/package.json +1 -1
- package/packages/dictionaries/package.json +4 -4
- package/packages/logger/package.json +1 -1
- package/packages/scrabble-solver/.next/BUILD_ID +1 -1
- package/packages/scrabble-solver/.next/build-manifest.json +16 -16
- package/packages/scrabble-solver/.next/cache/.previewinfo +1 -1
- package/packages/scrabble-solver/.next/cache/.rscinfo +1 -1
- package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
- package/packages/scrabble-solver/.next/cache/webpack/client-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack.old +0 -0
- package/packages/scrabble-solver/.next/diagnostics/framework.json +1 -1
- package/packages/scrabble-solver/.next/prerender-manifest.json +4 -4
- package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
- package/packages/scrabble-solver/.next/server/chunks/712.js +1 -1
- package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/404.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/500.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/_error.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/solve.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/api/verify.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.js.nft.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/index.json +1 -1
- package/packages/scrabble-solver/.next/server/pages/not-found.html +1 -1
- package/packages/scrabble-solver/.next/static/chunks/{framework-93e577820ffb186a.js → framework-f7982db529c0590c.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/{main-f63f5bd5e9581250.js → main-ca07941c8a544c9a.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-a3061a79f91b3796.js +7 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/index-6c5b582e7afc063c.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/webpack-1a7a166b34ed8d24.js +1 -0
- package/packages/scrabble-solver/.next/static/{8q_9JlEMMcIoT2TpStZYx → zFnoNsMXUha-MKjuZn6AN}/_buildManifest.js +1 -1
- package/packages/scrabble-solver/.next/trace +21 -21
- package/packages/scrabble-solver/.next/trace-build +1 -1
- package/packages/scrabble-solver/package.json +19 -19
- package/packages/scrabble-solver/public/service-worker.js +1 -1
- package/packages/scrabble-solver/src/app-layout/AppLayoutContext.tsx +25 -0
- package/packages/scrabble-solver/src/app-layout/index.ts +1 -0
- package/packages/scrabble-solver/src/{hooks/useAppLayout.ts → app-layout/useAppLayoutValue.ts} +4 -6
- package/packages/scrabble-solver/src/components/Board/Board.tsx +1 -1
- package/packages/scrabble-solver/src/components/Board/components/InputPrompt/InputPrompt.tsx +9 -2
- package/packages/scrabble-solver/src/components/Board/hooks/useBackgroundImage.tsx +228 -165
- package/packages/scrabble-solver/src/components/Board/hooks/useBoardStyle.ts +1 -1
- package/packages/scrabble-solver/src/components/Board/hooks/useFloatingActions.ts +1 -1
- package/packages/scrabble-solver/src/components/Dictionary/Dictionary.tsx +1 -1
- package/packages/scrabble-solver/src/components/DictionaryInput/DictionaryInput.tsx +2 -2
- package/packages/scrabble-solver/src/components/Logo/Logo.tsx +1 -1
- package/packages/scrabble-solver/src/components/NavButtons/NavButtons.tsx +1 -1
- package/packages/scrabble-solver/src/components/Rack/Rack.tsx +1 -1
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/InputPrompt.tsx +4 -4
- package/packages/scrabble-solver/src/components/Results/Header.tsx +2 -1
- package/packages/scrabble-solver/src/components/Results/Result.tsx +2 -1
- package/packages/scrabble-solver/src/components/ResultsInput/ResultsInput.tsx +2 -2
- package/packages/scrabble-solver/src/components/Solver/Solver.tsx +2 -1
- package/packages/scrabble-solver/src/components/Tile/Tile.tsx +1 -1
- package/packages/scrabble-solver/src/hooks/index.ts +0 -1
- package/packages/scrabble-solver/src/lib/isMac.ts +0 -1
- package/packages/scrabble-solver/src/modals/ResultsModal/ResultsModal.tsx +1 -1
- package/packages/scrabble-solver/src/pages/_app.tsx +7 -4
- package/packages/scrabble-solver/src/pages/index.tsx +42 -21
- package/packages/scrabble-solver/tsconfig.json +3 -2
- package/packages/scrabble-solver/tsconfig.tsbuildinfo +1 -1
- package/packages/solver/package.json +5 -5
- package/packages/types/package.json +2 -2
- package/packages/word-definitions/package.json +4 -4
- package/packages/word-lists/build/lib/transliterateDiacritics.d.ts +2 -2
- package/packages/word-lists/package.json +4 -4
- package/packages/word-lists/src/lib/transliterateDiacritics.ts +2 -2
- package/tsconfig.json +5 -4
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-ac2ab0ef8f59ba92.js +0 -3
- package/packages/scrabble-solver/.next/static/chunks/pages/index-3be9ce84ae513eaa.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/webpack-49a83516933d4cf2.js +0 -1
- /package/packages/scrabble-solver/.next/static/{8q_9JlEMMcIoT2TpStZYx → zFnoNsMXUha-MKjuZn6AN}/_ssgManifest.js +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* eslint-disable max-lines, max-statements */
|
|
2
2
|
|
|
3
3
|
import { BONUS_CHARACTER, BONUS_WORD } from '@scrabble-solver/constants';
|
|
4
|
-
import { useMemo } from 'react';
|
|
4
|
+
import { useCallback, useMemo } from 'react';
|
|
5
5
|
import { renderToString } from 'react-dom/server';
|
|
6
6
|
import { Provider } from 'react-redux';
|
|
7
7
|
|
|
8
|
-
import { useAppLayout
|
|
8
|
+
import { useAppLayout } from 'app-layout';
|
|
9
|
+
import { useMediaQueries } from 'hooks';
|
|
9
10
|
import { LOCALE_FEATURES } from 'i18n';
|
|
10
11
|
import { Star } from 'icons';
|
|
11
12
|
import { getTileSizes } from 'lib';
|
|
@@ -32,7 +33,10 @@ export const useBackgroundImage = () => {
|
|
|
32
33
|
const { isLessThanXs } = useMediaQueries();
|
|
33
34
|
const borderRadius = isLessThanXs ? BORDER_RADIUS_XS : BORDER_RADIUS;
|
|
34
35
|
const config = useTypedSelector(selectConfig);
|
|
35
|
-
const center =
|
|
36
|
+
const center = useMemo(
|
|
37
|
+
() => ({ x: Math.floor(config.boardWidth / 2), y: Math.floor(config.boardHeight / 2) }),
|
|
38
|
+
[config.boardHeight, config.boardWidth],
|
|
39
|
+
);
|
|
36
40
|
const viewBoxHeight = boardHeight;
|
|
37
41
|
const viewBoxWidth = boardWidth;
|
|
38
42
|
const bonusSize = cellSize * 0.8;
|
|
@@ -42,174 +46,233 @@ export const useBackgroundImage = () => {
|
|
|
42
46
|
const { tileFontSize } = getTileSizes(cellSize);
|
|
43
47
|
const fontSize = tileFontSize * 0.6;
|
|
44
48
|
const fontOffset = cellSize / 2;
|
|
45
|
-
const characterBonuses =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
49
|
+
const characterBonuses = useMemo(
|
|
50
|
+
() => config.bonuses.filter((bonus) => bonus.type === BONUS_CHARACTER),
|
|
51
|
+
[config.bonuses],
|
|
52
|
+
);
|
|
53
|
+
const word2Bonuses = useMemo(
|
|
54
|
+
() => config.bonuses.filter((bonus) => bonus.type === BONUS_WORD && bonus.multiplier === 2),
|
|
55
|
+
[config.bonuses],
|
|
56
|
+
);
|
|
57
|
+
const word3Bonuses = useMemo(
|
|
58
|
+
() => config.bonuses.filter((bonus) => bonus.type === BONUS_WORD && bonus.multiplier === 3),
|
|
59
|
+
[config.bonuses],
|
|
60
|
+
);
|
|
61
|
+
const word4Bonuses = useMemo(
|
|
62
|
+
() => config.bonuses.filter((bonus) => bonus.type === BONUS_WORD && bonus.multiplier === 4),
|
|
63
|
+
[config.bonuses],
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const getX = useCallback(
|
|
67
|
+
(point: Point): number => (direction === 'ltr' ? coordinatesSize : 0) + point.x * (cellSize + BORDER_WIDTH),
|
|
68
|
+
[coordinatesSize, cellSize, direction],
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const getY = useCallback(
|
|
72
|
+
(point: Point): number => coordinatesSize + point.y * (cellSize + BORDER_WIDTH),
|
|
73
|
+
[coordinatesSize, cellSize],
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const backgroundSvg = useMemo(
|
|
77
|
+
() =>
|
|
78
|
+
renderToString(
|
|
79
|
+
<Provider store={store}>
|
|
80
|
+
<svg
|
|
81
|
+
height={viewBoxHeight}
|
|
82
|
+
viewBox={`0 0 ${viewBoxWidth} ${viewBoxHeight}`}
|
|
83
|
+
width={viewBoxWidth}
|
|
84
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
85
|
+
>
|
|
86
|
+
<defs>
|
|
87
|
+
<symbol id={HORIZONTAL_LINE}>
|
|
88
|
+
<rect fill={BORDER_COLOR_LIGHT} height={GRID_LINE_SIZE} width={viewBoxWidth} />
|
|
89
|
+
</symbol>
|
|
90
|
+
|
|
91
|
+
<symbol id={VERTICAL_LINE}>
|
|
92
|
+
<rect fill={BORDER_COLOR_LIGHT} height={viewBoxHeight} width={GRID_LINE_SIZE} />
|
|
93
|
+
</symbol>
|
|
94
|
+
|
|
95
|
+
<symbol id={BONUS}>
|
|
96
|
+
<rect height={bonusSize} rx={borderRadius} width={bonusSize} x={bonusOffset} y={bonusOffset} />
|
|
97
|
+
</symbol>
|
|
98
|
+
|
|
99
|
+
<symbol id={BONUS_WORD_2}>
|
|
100
|
+
<rect height={bonusSize} rx={borderRadius} width={bonusSize} x={bonusOffset} y={bonusOffset} />
|
|
101
|
+
|
|
102
|
+
<text
|
|
103
|
+
dominantBaseline="central"
|
|
104
|
+
fill="white"
|
|
105
|
+
fontFamily="system-ui, sans-serif"
|
|
106
|
+
fontSize={fontSize}
|
|
107
|
+
fontWeight="bold"
|
|
108
|
+
textAnchor="middle"
|
|
109
|
+
x={fontOffset}
|
|
110
|
+
y={fontOffset}
|
|
111
|
+
>
|
|
112
|
+
x2
|
|
113
|
+
</text>
|
|
114
|
+
</symbol>
|
|
115
|
+
|
|
116
|
+
<symbol id={BONUS_WORD_3}>
|
|
117
|
+
<rect height={bonusSize} rx={borderRadius} width={bonusSize} x={bonusOffset} y={bonusOffset} />
|
|
118
|
+
|
|
119
|
+
<text
|
|
120
|
+
dominantBaseline="central"
|
|
121
|
+
fill="white"
|
|
122
|
+
fontFamily="system-ui, sans-serif"
|
|
123
|
+
fontSize={fontSize}
|
|
124
|
+
fontWeight="bold"
|
|
125
|
+
textAnchor="middle"
|
|
126
|
+
x={fontOffset}
|
|
127
|
+
y={fontOffset}
|
|
128
|
+
>
|
|
129
|
+
x3
|
|
130
|
+
</text>
|
|
131
|
+
</symbol>
|
|
132
|
+
|
|
133
|
+
<symbol id={BONUS_WORD_4}>
|
|
134
|
+
<rect height={bonusSize} rx={borderRadius} width={bonusSize} x={bonusOffset} y={bonusOffset} />
|
|
135
|
+
|
|
136
|
+
<text
|
|
137
|
+
dominantBaseline="central"
|
|
138
|
+
fill="white"
|
|
139
|
+
fontFamily="system-ui, sans-serif"
|
|
140
|
+
fontSize={fontSize}
|
|
141
|
+
fontWeight="bold"
|
|
142
|
+
textAnchor="middle"
|
|
143
|
+
x={fontOffset}
|
|
144
|
+
y={fontOffset}
|
|
145
|
+
>
|
|
146
|
+
x4
|
|
147
|
+
</text>
|
|
148
|
+
</symbol>
|
|
149
|
+
</defs>
|
|
150
|
+
|
|
151
|
+
{showCoordinates === 'hidden' && (
|
|
152
|
+
<rect fill="white" height={viewBoxHeight} rx={borderRadius} width={viewBoxWidth} x="0" y="0" />
|
|
153
|
+
)}
|
|
154
|
+
|
|
155
|
+
{showCoordinates !== 'hidden' && (
|
|
156
|
+
<>
|
|
157
|
+
<rect
|
|
158
|
+
fill={COLOR_BACKGROUND}
|
|
159
|
+
height={viewBoxHeight}
|
|
160
|
+
rx={borderRadius}
|
|
161
|
+
width={viewBoxWidth}
|
|
162
|
+
x="0"
|
|
163
|
+
y="0"
|
|
164
|
+
/>
|
|
165
|
+
<rect
|
|
166
|
+
fill="white"
|
|
167
|
+
height={viewBoxHeight - coordinatesSize}
|
|
168
|
+
width={viewBoxWidth - coordinatesSize}
|
|
169
|
+
x={direction === 'ltr' ? coordinatesSize : 0}
|
|
170
|
+
y={coordinatesSize}
|
|
171
|
+
/>
|
|
172
|
+
|
|
173
|
+
<rect
|
|
174
|
+
fill={COLOR_BACKGROUND}
|
|
175
|
+
height={coordinatesSize}
|
|
176
|
+
rx={borderRadius}
|
|
177
|
+
width={viewBoxWidth}
|
|
178
|
+
x="0"
|
|
179
|
+
y="0"
|
|
180
|
+
/>
|
|
181
|
+
<rect
|
|
182
|
+
fill={COLOR_BACKGROUND}
|
|
183
|
+
height={viewBoxHeight}
|
|
184
|
+
rx={borderRadius}
|
|
185
|
+
x={direction === 'ltr' ? 0 : viewBoxWidth - coordinatesSize}
|
|
186
|
+
y="0"
|
|
187
|
+
width={coordinatesSize}
|
|
188
|
+
/>
|
|
189
|
+
<use href={`#${HORIZONTAL_LINE}`} y={coordinatesSize - BORDER_WIDTH} />
|
|
190
|
+
<use
|
|
191
|
+
href={`#${VERTICAL_LINE}`}
|
|
192
|
+
x={
|
|
193
|
+
direction === 'ltr' ? coordinatesSize - BORDER_WIDTH : viewBoxWidth - coordinatesSize - BORDER_WIDTH
|
|
194
|
+
}
|
|
195
|
+
/>
|
|
196
|
+
</>
|
|
197
|
+
)}
|
|
198
|
+
|
|
199
|
+
{Array.from({ length: config.boardHeight - 1 }).map((_value, index) => (
|
|
200
|
+
<use
|
|
201
|
+
key={index}
|
|
202
|
+
href={`#${HORIZONTAL_LINE}`}
|
|
203
|
+
y={coordinatesSize + (index + 1) * (cellSize + BORDER_WIDTH) - BORDER_WIDTH}
|
|
204
|
+
/>
|
|
205
|
+
))}
|
|
206
|
+
|
|
207
|
+
{Array.from({ length: config.boardWidth - 1 }).map((_value, index) => (
|
|
208
|
+
<use
|
|
209
|
+
key={index}
|
|
210
|
+
href={`#${VERTICAL_LINE}`}
|
|
211
|
+
x={(direction === 'ltr' ? coordinatesSize : 0) + (index + 1) * (cellSize + BORDER_WIDTH) - BORDER_WIDTH}
|
|
212
|
+
/>
|
|
213
|
+
))}
|
|
214
|
+
|
|
215
|
+
{characterBonuses.map((bonus, index) => (
|
|
216
|
+
<use fill={getBonusColor(bonus)} key={index} href={`#${BONUS}`} x={getX(bonus)} y={getY(bonus)} />
|
|
217
|
+
))}
|
|
218
|
+
|
|
219
|
+
{word2Bonuses.map((bonus, index) => (
|
|
220
|
+
<use fill={getBonusColor(bonus)} key={index} href={`#${BONUS_WORD_2}`} x={getX(bonus)} y={getY(bonus)} />
|
|
221
|
+
))}
|
|
222
|
+
|
|
223
|
+
{word3Bonuses.map((bonus, index) => (
|
|
224
|
+
<use fill={getBonusColor(bonus)} key={index} href={`#${BONUS_WORD_3}`} x={getX(bonus)} y={getY(bonus)} />
|
|
225
|
+
))}
|
|
226
|
+
|
|
227
|
+
{word4Bonuses.map((bonus, index) => (
|
|
228
|
+
<use fill={getBonusColor(bonus)} key={index} href={`#${BONUS_WORD_4}`} x={getX(bonus)} y={getY(bonus)} />
|
|
229
|
+
))}
|
|
142
230
|
|
|
143
|
-
<rect fill={COLOR_BACKGROUND} height={coordinatesSize} rx={borderRadius} width={viewBoxWidth} x="0" y="0" />
|
|
144
231
|
<rect
|
|
145
|
-
fill={
|
|
146
|
-
height={
|
|
232
|
+
fill={COLOR_BONUS_START}
|
|
233
|
+
height={bonusSize}
|
|
147
234
|
rx={borderRadius}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
235
|
+
width={bonusSize}
|
|
236
|
+
x={getX(center) + bonusOffset}
|
|
237
|
+
y={getY(center) + bonusOffset}
|
|
151
238
|
/>
|
|
152
|
-
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
-
|
|
239
|
+
|
|
240
|
+
<Star
|
|
241
|
+
color="white"
|
|
242
|
+
height={iconSize}
|
|
243
|
+
width={iconSize}
|
|
244
|
+
x={getX(center) + iconOffset}
|
|
245
|
+
y={getY(center) + iconOffset}
|
|
156
246
|
/>
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
{word3Bonuses.map((bonus, index) => (
|
|
185
|
-
<use fill={getBonusColor(bonus)} key={index} href={`#${BONUS_WORD_3}`} x={getX(bonus)} y={getY(bonus)} />
|
|
186
|
-
))}
|
|
187
|
-
|
|
188
|
-
{word4Bonuses.map((bonus, index) => (
|
|
189
|
-
<use fill={getBonusColor(bonus)} key={index} href={`#${BONUS_WORD_4}`} x={getX(bonus)} y={getY(bonus)} />
|
|
190
|
-
))}
|
|
191
|
-
|
|
192
|
-
<rect
|
|
193
|
-
fill={COLOR_BONUS_START}
|
|
194
|
-
height={bonusSize}
|
|
195
|
-
rx={borderRadius}
|
|
196
|
-
width={bonusSize}
|
|
197
|
-
x={getX(center) + bonusOffset}
|
|
198
|
-
y={getY(center) + bonusOffset}
|
|
199
|
-
/>
|
|
200
|
-
|
|
201
|
-
<Star
|
|
202
|
-
color="white"
|
|
203
|
-
height={iconSize}
|
|
204
|
-
width={iconSize}
|
|
205
|
-
x={getX(center) + iconOffset}
|
|
206
|
-
y={getY(center) + iconOffset}
|
|
207
|
-
/>
|
|
208
|
-
</svg>
|
|
209
|
-
</Provider>,
|
|
247
|
+
</svg>
|
|
248
|
+
</Provider>,
|
|
249
|
+
),
|
|
250
|
+
[
|
|
251
|
+
bonusOffset,
|
|
252
|
+
bonusSize,
|
|
253
|
+
borderRadius,
|
|
254
|
+
cellSize,
|
|
255
|
+
center,
|
|
256
|
+
characterBonuses,
|
|
257
|
+
config.boardHeight,
|
|
258
|
+
config.boardWidth,
|
|
259
|
+
coordinatesSize,
|
|
260
|
+
direction,
|
|
261
|
+
fontOffset,
|
|
262
|
+
fontSize,
|
|
263
|
+
getX,
|
|
264
|
+
getY,
|
|
265
|
+
iconOffset,
|
|
266
|
+
iconSize,
|
|
267
|
+
showCoordinates,
|
|
268
|
+
viewBoxHeight,
|
|
269
|
+
viewBoxWidth,
|
|
270
|
+
word2Bonuses,
|
|
271
|
+
word3Bonuses,
|
|
272
|
+
word4Bonuses,
|
|
273
|
+
],
|
|
210
274
|
);
|
|
211
275
|
|
|
212
|
-
const
|
|
213
|
-
const dataUrl = `data:image/svg+xml;base64,${encodedSvg}`;
|
|
276
|
+
const dataUrl = useMemo(() => `data:image/svg+xml;base64,${globalThis.btoa(backgroundSvg)}`, [backgroundSvg]);
|
|
214
277
|
return dataUrl;
|
|
215
278
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type CSSProperties, useMemo } from 'react';
|
|
2
2
|
|
|
3
|
-
import { useAppLayout } from '
|
|
3
|
+
import { useAppLayout } from 'app-layout';
|
|
4
4
|
import { getTileSizes } from 'lib';
|
|
5
5
|
import { BORDER_WIDTH } from 'parameters';
|
|
6
6
|
import { selectConfig, selectShowCoordinates, useTypedSelector } from 'state';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { type ChangeEvent, type
|
|
2
|
+
import { type ChangeEvent, type FunctionComponent, type SubmitEvent } from 'react';
|
|
3
3
|
import { useDispatch } from 'react-redux';
|
|
4
4
|
|
|
5
5
|
import { LOCALE_FEATURES } from 'i18n';
|
|
@@ -22,7 +22,7 @@ export const DictionaryInput: FunctionComponent<Props> = ({ className }) => {
|
|
|
22
22
|
dispatch(dictionarySlice.actions.changeInput(event.target.value));
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const handleSubmit = (event:
|
|
25
|
+
const handleSubmit = (event: SubmitEvent<HTMLFormElement>) => {
|
|
26
26
|
event.preventDefault();
|
|
27
27
|
dispatch(dictionarySlice.actions.submit());
|
|
28
28
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { type FunctionComponent, memo } from 'react';
|
|
3
3
|
|
|
4
|
-
import { useAppLayout } from '
|
|
4
|
+
import { useAppLayout } from 'app-layout';
|
|
5
5
|
import { CardChecklist, Cog, Eraser, Github, KeyboardFill, List, Sack } from 'icons';
|
|
6
6
|
import { GITHUB_PROJECT_URL } from 'parameters';
|
|
7
7
|
import { selectConfig, useTranslate, useTypedSelector } from 'state';
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import useOnclickOutside from 'react-cool-onclickoutside';
|
|
17
17
|
import { useDispatch } from 'react-redux';
|
|
18
18
|
|
|
19
|
-
import { useAppLayout } from '
|
|
19
|
+
import { useAppLayout } from 'app-layout';
|
|
20
20
|
import { LOCALE_FEATURES } from 'i18n';
|
|
21
21
|
import { createKeyboardNavigation, extractCharacters, extractInputValue, getTileSizes, isCtrl } from 'lib';
|
|
22
22
|
import { rackSlice, selectConfig, selectInputMode, selectLocale, selectRack, useTypedSelector } from 'state';
|
|
@@ -2,7 +2,7 @@ import classNames from 'classnames';
|
|
|
2
2
|
import {
|
|
3
3
|
type CSSProperties,
|
|
4
4
|
type ChangeEventHandler,
|
|
5
|
-
type
|
|
5
|
+
type SubmitEventHandler,
|
|
6
6
|
forwardRef,
|
|
7
7
|
useCallback,
|
|
8
8
|
useEffect,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from 'react';
|
|
11
11
|
import { useDispatch } from 'react-redux';
|
|
12
12
|
|
|
13
|
-
import { useAppLayout } from '
|
|
13
|
+
import { useAppLayout } from 'app-layout';
|
|
14
14
|
import { rackSlice, selectConfig, useTranslate, useTypedSelector } from 'state';
|
|
15
15
|
|
|
16
16
|
import styles from './InputPrompt.module.scss';
|
|
@@ -22,7 +22,7 @@ interface Props {
|
|
|
22
22
|
value: string;
|
|
23
23
|
onBlur: () => void;
|
|
24
24
|
onChange: ChangeEventHandler<HTMLInputElement>;
|
|
25
|
-
onSubmit:
|
|
25
|
+
onSubmit: SubmitEventHandler<HTMLFormElement>;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const InputPromptBase = forwardRef<HTMLFormElement, Props>(
|
|
@@ -33,7 +33,7 @@ const InputPromptBase = forwardRef<HTMLFormElement, Props>(
|
|
|
33
33
|
const config = useTypedSelector(selectConfig);
|
|
34
34
|
const [inputRef, setInputRef] = useState<HTMLInputElement | null>(null);
|
|
35
35
|
|
|
36
|
-
const handleSubmit:
|
|
36
|
+
const handleSubmit: SubmitEventHandler<HTMLFormElement> = useCallback(
|
|
37
37
|
(event) => {
|
|
38
38
|
event.preventDefault();
|
|
39
39
|
const characters = extractRack(config, value);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type FunctionComponent } from 'react';
|
|
2
2
|
|
|
3
|
-
import { useAppLayout
|
|
3
|
+
import { useAppLayout } from 'app-layout';
|
|
4
|
+
import { useColumns } from 'hooks';
|
|
4
5
|
import { GeoAlt, OneTwoThree, Square, SquareA, SquareB, Squares, Words } from 'icons';
|
|
5
6
|
import { RESULTS_COLUMN_WIDTH } from 'parameters';
|
|
6
7
|
import { ResultColumnId } from 'types';
|
|
@@ -3,7 +3,8 @@ import { type FocusEventHandler, type MouseEventHandler, type ReactElement, useR
|
|
|
3
3
|
import Highlighter from 'react-highlight-words';
|
|
4
4
|
import { type RowComponentProps } from 'react-window';
|
|
5
5
|
|
|
6
|
-
import { useAppLayout
|
|
6
|
+
import { useAppLayout } from 'app-layout';
|
|
7
|
+
import { useColumns } from 'hooks';
|
|
7
8
|
import { LOCALE_FEATURES } from 'i18n';
|
|
8
9
|
import { noop } from 'lib';
|
|
9
10
|
import {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { type ChangeEvent, type
|
|
2
|
+
import { type ChangeEvent, type FunctionComponent, type SubmitEventHandler, useState } from 'react';
|
|
3
3
|
import { useDispatch } from 'react-redux';
|
|
4
4
|
|
|
5
5
|
import { isRegExp } from 'lib';
|
|
@@ -27,7 +27,7 @@ export const ResultsInput: FunctionComponent<Props> = ({ className }) => {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
const handleSubmit:
|
|
30
|
+
const handleSubmit: SubmitEventHandler = (event) => {
|
|
31
31
|
event.preventDefault();
|
|
32
32
|
};
|
|
33
33
|
|
|
@@ -3,7 +3,8 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { type FunctionComponent, memo, type SyntheticEvent, useEffect, useMemo } from 'react';
|
|
4
4
|
import { useDispatch } from 'react-redux';
|
|
5
5
|
|
|
6
|
-
import { useAppLayout
|
|
6
|
+
import { useAppLayout } from 'app-layout';
|
|
7
|
+
import { useIsTouchDevice } from 'hooks';
|
|
7
8
|
import {
|
|
8
9
|
resultsSlice,
|
|
9
10
|
selectAreResultsOutdated,
|
|
@@ -2,8 +2,8 @@ import { type Result } from '@scrabble-solver/types';
|
|
|
2
2
|
import { type FunctionComponent, memo, useEffect, useMemo } from 'react';
|
|
3
3
|
import { useDispatch } from 'react-redux';
|
|
4
4
|
|
|
5
|
+
import { useAppLayout } from 'app-layout';
|
|
5
6
|
import { Button, Dictionary, Modal, Results } from 'components';
|
|
6
|
-
import { useAppLayout } from 'hooks';
|
|
7
7
|
import { Check, EyeFill } from 'icons';
|
|
8
8
|
import { resultsSlice, selectProcessedResults, selectResultCandidate, useTranslate, useTypedSelector } from 'state';
|
|
9
9
|
|
|
@@ -4,6 +4,7 @@ import Head from 'next/head';
|
|
|
4
4
|
import { type FunctionComponent } from 'react';
|
|
5
5
|
import { Provider } from 'react-redux';
|
|
6
6
|
|
|
7
|
+
import { AppLayoutProvider } from 'app-layout';
|
|
7
8
|
import { SeoMessage } from 'components';
|
|
8
9
|
import { store } from 'state';
|
|
9
10
|
|
|
@@ -77,11 +78,13 @@ const App: FunctionComponent<AppProps> = ({ Component, pageProps }) => (
|
|
|
77
78
|
</Head>
|
|
78
79
|
|
|
79
80
|
<Provider store={store}>
|
|
80
|
-
<
|
|
81
|
+
<AppLayoutProvider>
|
|
82
|
+
<SeoMessage />
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
<FloatingDelayGroup delay={0}>
|
|
85
|
+
<Component {...pageProps} />
|
|
86
|
+
</FloatingDelayGroup>
|
|
87
|
+
</AppLayoutProvider>
|
|
85
88
|
</Provider>
|
|
86
89
|
</>
|
|
87
90
|
);
|