@scrabble-solver/scrabble-solver 2.13.12 → 2.13.13
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +14 -14
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_8dgz12 +1 -1
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/.next/cache/webpack/edge-server-production/0.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack.old +0 -0
- package/.next/prerender-manifest.js +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/807.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages/api/solve.js +1 -1
- package/.next/server/pages/index.html +1 -1
- package/.next/server/pages/index.js +1 -1
- package/.next/server/pages/index.json +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/static/chunks/{main-b5b360c6afb66b05.js → main-8b0b4e610892a916.js} +1 -1
- package/.next/static/chunks/pages/{404-0c9f3e0f8b15f487.js → 404-b0c2ccded2455be0.js} +1 -1
- package/.next/static/chunks/pages/_app-42ce6b4032e931ff.js +17 -0
- package/.next/static/chunks/pages/index-3718075f2ba2220c.js +1 -0
- package/.next/static/chunks/webpack-c4acd79e87956a0e.js +1 -0
- package/.next/static/css/2adc9736d823979b.css +2 -0
- package/.next/static/{N8hSsS6Ppzlj3ebHMSZvI → qwJjm2FeDHHGY92CY5oQQ}/_buildManifest.js +1 -1
- package/.next/trace +45 -45
- package/package.json +13 -13
- package/src/components/Board/Board.module.scss +3 -9
- package/src/components/Board/Board.tsx +2 -2
- package/src/components/Board/BoardPure.tsx +3 -2
- package/src/components/Board/components/ToggleDirectionButton/ToggleDirectionButton.tsx +2 -0
- package/src/components/Board/hooks/useBackgroundImage.tsx +2 -6
- package/src/components/Board/hooks/useBoardStyle.ts +10 -4
- package/src/components/Dictionary/Dictionary.module.scss +10 -7
- package/src/components/Dictionary/Dictionary.tsx +38 -36
- package/src/components/Loading/Loading.module.scss +1 -0
- package/src/components/Loading/Loading.tsx +1 -1
- package/src/components/Modal/components/Section/Section.tsx +3 -2
- package/src/components/NavButtons/NavButtons.tsx +1 -0
- package/src/components/Rack/Rack.tsx +1 -0
- package/src/components/Results/Cell.tsx +7 -3
- package/src/components/Results/Header.tsx +99 -0
- package/src/components/Results/HeaderButton.tsx +18 -13
- package/src/components/Results/Result.tsx +23 -16
- package/src/components/Results/Results.module.scss +24 -12
- package/src/components/Results/Results.tsx +3 -9
- package/src/components/Results/types.ts +0 -8
- package/src/components/Solver/Solver.tsx +1 -1
- package/src/components/Tile/TilePure.tsx +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAppLayout.ts +12 -1
- package/src/hooks/useColumns.ts +47 -0
- package/src/icons/GeoAlt.svg +5 -0
- package/src/icons/OneTwoThree.svg +4 -0
- package/src/icons/SquareA.svg +6 -0
- package/src/icons/SquareB.svg +6 -0
- package/src/icons/Squares.svg +34 -0
- package/src/icons/Words.svg +22 -0
- package/src/icons/index.ts +6 -0
- package/src/lib/groupResults.ts +1 -1
- package/src/lib/index.ts +0 -1
- package/src/lib/sortResults.ts +10 -10
- package/src/modals/KeyMapModal/KeyMapModal.tsx +8 -9
- package/src/modals/RemainingTilesModal/RemainingTilesModal.tsx +1 -0
- package/src/modals/SettingsModal/SettingsModal.tsx +5 -5
- package/src/modals/WordsModal/WordsModal.tsx +2 -0
- package/src/parameters/index.ts +12 -0
- package/src/state/selectors.ts +26 -1
- package/src/state/slices/resultsInitialState.ts +2 -2
- package/src/state/slices/resultsSlice.ts +2 -2
- package/src/state/useTranslate.ts +5 -1
- package/src/styles/variables.scss +1 -0
- package/src/types/index.ts +11 -2
- package/.next/static/chunks/pages/_app-8246f5b39b6a5e59.js +0 -17
- package/.next/static/chunks/pages/index-65bfe83d121535ab.js +0 -1
- package/.next/static/chunks/webpack-6ef43a8d4a395f49.js +0 -1
- package/.next/static/css/2f727b21d1331ea5.css +0 -2
- package/src/components/Results/getCoordinatesColumn.ts +0 -14
- package/src/components/Results/getLocaleColumns.ts +0 -58
- package/src/components/Results/useColumns.ts +0 -44
- package/src/lib/dataUrlToBlob.ts +0 -20
- /package/.next/static/{N8hSsS6Ppzlj3ebHMSZvI → qwJjm2FeDHHGY92CY5oQQ}/_ssgManifest.js +0 -0
|
@@ -21,6 +21,7 @@ const WordsModal: FunctionComponent<Props> = ({ className, isOpen, onClose }) =>
|
|
|
21
21
|
return (
|
|
22
22
|
<Modal className={className} isOpen={isOpen} title={translate('words')} onClose={onClose}>
|
|
23
23
|
<Modal.Section
|
|
24
|
+
label={translate('words.invalid')}
|
|
24
25
|
title={
|
|
25
26
|
<span className={styles.title}>
|
|
26
27
|
<span>{translate('words.invalid')}</span>
|
|
@@ -36,6 +37,7 @@ const WordsModal: FunctionComponent<Props> = ({ className, isOpen, onClose }) =>
|
|
|
36
37
|
</Modal.Section>
|
|
37
38
|
|
|
38
39
|
<Modal.Section
|
|
40
|
+
label={translate('words.valid')}
|
|
39
41
|
title={
|
|
40
42
|
<span className={styles.title}>
|
|
41
43
|
<span>{translate('words.valid')}</span>
|
package/src/parameters/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ResultColumnId } from 'types';
|
|
2
|
+
|
|
1
3
|
export const BREAKPOINTS = {
|
|
2
4
|
xs: 480,
|
|
3
5
|
s: 768,
|
|
@@ -120,6 +122,16 @@ export const RACK_TILE_SIZE_MAX = 80;
|
|
|
120
122
|
|
|
121
123
|
export const REMAINING_TILES_TILE_SIZE = 50;
|
|
122
124
|
|
|
125
|
+
export const RESULTS_COLUMN_WIDTH: Record<ResultColumnId, number | undefined> = {
|
|
126
|
+
[ResultColumnId.BlanksCount]: 55,
|
|
127
|
+
[ResultColumnId.ConsonantsCount]: 55,
|
|
128
|
+
[ResultColumnId.Coordinates]: 55,
|
|
129
|
+
[ResultColumnId.Points]: 80,
|
|
130
|
+
[ResultColumnId.TilesCount]: 55,
|
|
131
|
+
[ResultColumnId.VowelsCount]: 55,
|
|
132
|
+
[ResultColumnId.Word]: undefined,
|
|
133
|
+
[ResultColumnId.WordsCount]: 55,
|
|
134
|
+
};
|
|
123
135
|
export const RESULTS_ITEM_HEIGHT = 40;
|
|
124
136
|
|
|
125
137
|
export const RESULTS_HEADER_HEIGHT = RESULTS_ITEM_HEIGHT;
|
package/src/state/selectors.ts
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
sortGroupedResults,
|
|
17
17
|
unorderedArraysEqual,
|
|
18
18
|
} from 'lib';
|
|
19
|
-
import { Point, Translations } from 'types';
|
|
19
|
+
import { Point, ResultColumnId, Translations } from 'types';
|
|
20
20
|
|
|
21
21
|
import { RootState } from './types';
|
|
22
22
|
|
|
@@ -231,3 +231,28 @@ export const selectVerify = selectVerifyRoot;
|
|
|
231
231
|
export const selectHasInvalidWords = createSelector([selectVerify], ({ invalidWords }) => {
|
|
232
232
|
return invalidWords.length > 0;
|
|
233
233
|
});
|
|
234
|
+
|
|
235
|
+
export const selectColumns = createSelector([selectLocale, selectShowCoordinates], (locale, showCoordinates) => {
|
|
236
|
+
const { consonants, vowels } = LOCALE_FEATURES[locale];
|
|
237
|
+
const columns: ResultColumnId[] = [
|
|
238
|
+
ResultColumnId.Word,
|
|
239
|
+
ResultColumnId.TilesCount,
|
|
240
|
+
ResultColumnId.BlanksCount,
|
|
241
|
+
ResultColumnId.WordsCount,
|
|
242
|
+
ResultColumnId.Points,
|
|
243
|
+
];
|
|
244
|
+
|
|
245
|
+
if (showCoordinates !== 'hidden') {
|
|
246
|
+
columns.push(ResultColumnId.Coordinates);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (vowels) {
|
|
250
|
+
columns.push(ResultColumnId.VowelsCount);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (consonants) {
|
|
254
|
+
columns.push(ResultColumnId.ConsonantsCount);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return columns;
|
|
258
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from '@scrabble-solver/types';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { ResultColumnId, Sort, SortDirection } from 'types';
|
|
4
4
|
|
|
5
5
|
export interface ResultsState {
|
|
6
6
|
candidate: Result | null;
|
|
@@ -14,7 +14,7 @@ const resultsInitialState: ResultsState = {
|
|
|
14
14
|
query: '',
|
|
15
15
|
results: undefined,
|
|
16
16
|
sort: {
|
|
17
|
-
column:
|
|
17
|
+
column: ResultColumnId.Points,
|
|
18
18
|
direction: SortDirection.Descending,
|
|
19
19
|
},
|
|
20
20
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
2
2
|
import { Result } from '@scrabble-solver/types';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { ResultColumnId, SortDirection } from 'types';
|
|
5
5
|
|
|
6
6
|
import resultsInitialState from './resultsInitialState';
|
|
7
7
|
|
|
@@ -37,7 +37,7 @@ const resultsSlice = createSlice({
|
|
|
37
37
|
};
|
|
38
38
|
},
|
|
39
39
|
|
|
40
|
-
sort: (state, action: PayloadAction<
|
|
40
|
+
sort: (state, action: PayloadAction<ResultColumnId>) => {
|
|
41
41
|
const columndId = action.payload;
|
|
42
42
|
const { column, direction } = state.sort;
|
|
43
43
|
|
|
@@ -9,13 +9,17 @@ const useTranslate = (): Translate => {
|
|
|
9
9
|
const translations = useTypedSelector(selectTranslations);
|
|
10
10
|
const locale = useTypedSelector(selectLocale);
|
|
11
11
|
const translate: Translate = useCallback(
|
|
12
|
-
(id, replacements
|
|
12
|
+
(id, replacements) => {
|
|
13
13
|
const translation = translations[id];
|
|
14
14
|
|
|
15
15
|
if (typeof translation === 'undefined') {
|
|
16
16
|
throw new Error(`Untranslated key "${id}" in locale "${locale}"`);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
if (!replacements) {
|
|
20
|
+
return translation;
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
return Object.entries(replacements).reduce(
|
|
20
24
|
(result, [key, value]) => result.replaceAll(`{{${key}}}`, value),
|
|
21
25
|
translation,
|
|
@@ -106,6 +106,7 @@ $easeOutSine: cubic-bezier(0.61, 1, 0.88, 1);
|
|
|
106
106
|
--modal--width: 370px;
|
|
107
107
|
--nav--height: calc(var(--logo--height) + var(--nav--padding));
|
|
108
108
|
--nav--padding: var(--spacing--l);
|
|
109
|
+
--results--icon--size: 18px;
|
|
109
110
|
--results--item--height: 40px;
|
|
110
111
|
--solver-column--width: 580px;
|
|
111
112
|
--square-button--size: 32px;
|
package/src/types/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Result } from '@scrabble-solver/types';
|
|
2
|
+
import { FunctionComponent, SVGAttributes } from 'react';
|
|
2
3
|
|
|
3
4
|
export type Comparator<T> = (a: T, B: T) => number;
|
|
4
5
|
|
|
@@ -24,7 +25,7 @@ export interface Point {
|
|
|
24
25
|
export type Rack = (string | null)[];
|
|
25
26
|
|
|
26
27
|
export interface Sort {
|
|
27
|
-
column:
|
|
28
|
+
column: ResultColumnId;
|
|
28
29
|
direction: SortDirection;
|
|
29
30
|
}
|
|
30
31
|
|
|
@@ -47,7 +48,7 @@ export interface RemainingTilesGroup {
|
|
|
47
48
|
totalCount: number;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
export enum
|
|
51
|
+
export enum ResultColumnId {
|
|
51
52
|
BlanksCount = 'blanks-count',
|
|
52
53
|
ConsonantsCount = 'consonants-count',
|
|
53
54
|
Coordinates = 'coordinates',
|
|
@@ -58,6 +59,14 @@ export enum ResultColumn {
|
|
|
58
59
|
WordsCount = 'words-count',
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
export interface ResultColumn {
|
|
63
|
+
className: string;
|
|
64
|
+
Icon?: FunctionComponent<SVGAttributes<SVGElement>>;
|
|
65
|
+
id: ResultColumnId;
|
|
66
|
+
translationKey: TranslationKey;
|
|
67
|
+
width?: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
61
70
|
export interface GroupedResults {
|
|
62
71
|
matching: Result[];
|
|
63
72
|
other: Result[];
|