scrabble-solver 2.13.12 → 2.14.0
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/.eslintrc.js +13 -4
- package/.github/workflows/build.yml +6 -14
- package/.github/workflows/cypress.yml +28 -0
- package/.github/workflows/eslint.yml +9 -16
- package/.github/workflows/jest.yml +21 -0
- package/.nx/cache/nx_files.nxt +0 -0
- package/.nx/workspace-data/file-map.json +639 -543
- package/.nx/workspace-data/lockfile.hash +1 -1
- package/.nx/workspace-data/parsed-lock-file.json +6131 -5552
- package/.nx/workspace-data/project-graph.json +4276 -2896
- package/README.md +5 -3
- package/bin/scrabble-solver.js +0 -0
- package/cypress/e2e/app.spec.cy.ts +118 -0
- package/cypress/e2e/bugs/112-character-bonus.ts +40 -0
- package/cypress/e2e/bugs/129-esc-sidebar.ts +23 -0
- package/cypress/e2e/bugs/2-q-tile-in-english.ts +33 -0
- package/cypress/e2e/bugs/3-x-tile-in-polish.ts +33 -0
- package/cypress/e2e/bugs/30-click-inside-radio-icon.ts +26 -0
- package/cypress/e2e/bugs/333-disabled-radio-cursor.ts +24 -0
- package/cypress/e2e/bugs/342-results-sorting.ts +48 -0
- package/cypress/e2e/bugs/348-results-word-padding.ts +74 -0
- package/cypress/e2e/bugs.spec.cy.ts +8 -0
- package/cypress/support/commands.ts +4 -0
- package/cypress/support/e2e.ts +1 -0
- package/cypress/support/index.ts +1 -0
- package/cypress/support/lib/actions.ts +57 -0
- package/cypress/support/lib/index.ts +2 -0
- package/cypress/support/lib/selectors.ts +70 -0
- package/cypress/tsconfig.json +9 -0
- package/cypress.config.ts +9 -0
- package/jest.config.js +2 -3
- package/lerna.json +1 -1
- package/package.json +29 -22
- package/packages/configs/package.json +3 -3
- package/packages/constants/package.json +1 -1
- package/packages/dictionaries/package-lock.json +2 -2
- package/packages/dictionaries/package.json +4 -4
- package/packages/logger/package-lock.json +3 -3
- package/packages/logger/package.json +2 -2
- package/packages/scrabble-solver/.next/BUILD_ID +1 -1
- package/packages/scrabble-solver/.next/build-manifest.json +14 -14
- package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
- package/packages/scrabble-solver/.next/cache/eslint/.cache_8dgz12 +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/0.pack +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/prerender-manifest.js +1 -1
- package/packages/scrabble-solver/.next/prerender-manifest.json +1 -1
- package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
- package/packages/scrabble-solver/.next/server/chunks/807.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/api/solve.js +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.json +1 -1
- package/packages/scrabble-solver/.next/server/pages-manifest.json +1 -1
- package/packages/scrabble-solver/.next/static/{N8hSsS6Ppzlj3ebHMSZvI → TxfjxrH5h31sPQxPhrJzG}/_buildManifest.js +1 -1
- package/packages/scrabble-solver/.next/static/chunks/{main-b5b360c6afb66b05.js → main-8b0b4e610892a916.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/{404-0c9f3e0f8b15f487.js → 404-b0c2ccded2455be0.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-2912876c7b6e698e.js +17 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/index-86d9ad372c48c8b7.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/webpack-c4acd79e87956a0e.js +1 -0
- package/packages/scrabble-solver/.next/static/css/14625ff7b4d265d0.css +2 -0
- package/packages/scrabble-solver/.next/trace +45 -45
- package/packages/scrabble-solver/package-lock.json +6 -6
- package/packages/scrabble-solver/package.json +13 -13
- package/packages/scrabble-solver/public/service-worker.js +1 -1
- package/packages/scrabble-solver/src/components/Alert/Alert.tsx +1 -1
- package/packages/scrabble-solver/src/components/Board/Board.module.scss +3 -9
- package/packages/scrabble-solver/src/components/Board/Board.tsx +2 -2
- package/packages/scrabble-solver/src/components/Board/BoardPure.tsx +4 -3
- package/packages/scrabble-solver/src/components/Board/components/ToggleDirectionButton/ToggleDirectionButton.tsx +2 -0
- package/packages/scrabble-solver/src/components/Board/hooks/useBackgroundImage.tsx +2 -6
- package/packages/scrabble-solver/src/components/Board/hooks/useBoardStyle.ts +10 -4
- package/packages/scrabble-solver/src/components/Button/Button.tsx +1 -1
- package/packages/scrabble-solver/src/components/Dictionary/Dictionary.module.scss +10 -7
- package/packages/scrabble-solver/src/components/Dictionary/Dictionary.tsx +38 -36
- package/packages/scrabble-solver/src/components/IconButton/IconButton.tsx +1 -1
- package/packages/scrabble-solver/src/components/IconButton/Link.tsx +1 -1
- package/packages/scrabble-solver/src/components/Keys/Arrows/Arrows.tsx +4 -4
- package/packages/scrabble-solver/src/components/Loading/Loading.module.scss +1 -0
- package/packages/scrabble-solver/src/components/Loading/Loading.tsx +1 -1
- package/packages/scrabble-solver/src/components/Modal/components/Section/Section.tsx +3 -2
- package/packages/scrabble-solver/src/components/NavButtons/NavButtons.tsx +1 -0
- package/packages/scrabble-solver/src/components/NotFound/NotFound.tsx +1 -1
- package/packages/scrabble-solver/src/components/Rack/Rack.tsx +1 -0
- package/packages/scrabble-solver/src/components/Radio/Radio.tsx +1 -1
- package/packages/scrabble-solver/src/components/Results/Cell.tsx +7 -3
- package/packages/scrabble-solver/src/components/Results/Header.tsx +99 -0
- package/packages/scrabble-solver/src/components/Results/HeaderButton.tsx +18 -13
- package/packages/scrabble-solver/src/components/Results/Result.tsx +23 -16
- package/packages/scrabble-solver/src/components/Results/Results.module.scss +27 -18
- package/packages/scrabble-solver/src/components/Results/Results.tsx +3 -9
- package/packages/scrabble-solver/src/components/Results/types.ts +0 -8
- package/packages/scrabble-solver/src/components/Solver/Solver.tsx +1 -1
- package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.tsx +1 -1
- package/packages/scrabble-solver/src/components/Tile/TilePure.tsx +2 -1
- package/packages/scrabble-solver/src/hooks/index.ts +1 -0
- package/packages/scrabble-solver/src/hooks/useAppLayout.ts +12 -1
- package/packages/scrabble-solver/src/hooks/useColumns.ts +47 -0
- package/packages/scrabble-solver/src/icons/GeoAlt.svg +5 -0
- package/packages/scrabble-solver/src/icons/OneTwoThree.svg +4 -0
- package/packages/scrabble-solver/src/icons/SquareA.svg +6 -0
- package/packages/scrabble-solver/src/icons/SquareB.svg +6 -0
- package/packages/scrabble-solver/src/icons/Squares.svg +34 -0
- package/packages/scrabble-solver/src/icons/Words.svg +22 -0
- package/packages/scrabble-solver/src/icons/index.ts +6 -0
- package/packages/scrabble-solver/src/lib/groupResults.ts +1 -1
- package/packages/scrabble-solver/src/lib/index.ts +0 -1
- package/packages/scrabble-solver/src/lib/sortResults.ts +10 -10
- package/packages/scrabble-solver/src/modals/KeyMapModal/KeyMapModal.tsx +8 -9
- package/packages/scrabble-solver/src/modals/MenuModal/MenuModal.tsx +1 -1
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/RemainingTilesModal.tsx +1 -0
- package/packages/scrabble-solver/src/modals/SettingsModal/SettingsModal.tsx +5 -5
- package/packages/scrabble-solver/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.tsx +1 -1
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.tsx +4 -2
- package/packages/scrabble-solver/src/parameters/index.ts +12 -0
- package/packages/scrabble-solver/src/state/selectors.ts +26 -1
- package/packages/scrabble-solver/src/state/slices/resultsInitialState.ts +2 -2
- package/packages/scrabble-solver/src/state/slices/resultsSlice.ts +2 -2
- package/packages/scrabble-solver/src/state/useTranslate.ts +5 -1
- package/packages/scrabble-solver/src/styles/variables.scss +1 -0
- package/packages/scrabble-solver/src/types/index.ts +11 -2
- package/packages/solver/package-lock.json +2 -2
- package/packages/solver/package.json +5 -5
- package/packages/types/package.json +2 -2
- package/packages/word-definitions/build/lib/request.d.ts +0 -1
- package/packages/word-definitions/package-lock.json +2 -2
- package/packages/word-definitions/package.json +2 -2
- package/packages/word-lists/package-lock.json +3 -3
- package/packages/word-lists/package.json +3 -3
- package/tsconfig.jest.json +2 -1
- package/.github/workflows/test.yml +0 -28
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-8246f5b39b6a5e59.js +0 -17
- package/packages/scrabble-solver/.next/static/chunks/pages/index-65bfe83d121535ab.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/webpack-6ef43a8d4a395f49.js +0 -1
- package/packages/scrabble-solver/.next/static/css/2f727b21d1331ea5.css +0 -2
- package/packages/scrabble-solver/src/components/Results/getCoordinatesColumn.ts +0 -14
- package/packages/scrabble-solver/src/components/Results/getLocaleColumns.ts +0 -58
- package/packages/scrabble-solver/src/components/Results/useColumns.ts +0 -44
- package/packages/scrabble-solver/src/lib/dataUrlToBlob.ts +0 -20
- /package/packages/scrabble-solver/.next/static/{N8hSsS6Ppzlj3ebHMSZvI → TxfjxrH5h31sPQxPhrJzG}/_ssgManifest.js +0 -0
|
@@ -20,12 +20,11 @@ import EmptyState from '../EmptyState';
|
|
|
20
20
|
import Loading from '../Loading';
|
|
21
21
|
import ResultsInput from '../ResultsInput';
|
|
22
22
|
|
|
23
|
-
import
|
|
23
|
+
import Header from './Header';
|
|
24
24
|
import Result from './Result';
|
|
25
25
|
import styles from './Results.module.scss';
|
|
26
26
|
import SolveButton from './SolveButton';
|
|
27
27
|
import { ResultCallbacks, ResultData } from './types';
|
|
28
|
-
import useColumns from './useColumns';
|
|
29
28
|
|
|
30
29
|
interface Props {
|
|
31
30
|
callbacks: ResultCallbacks;
|
|
@@ -47,7 +46,6 @@ const Results: FunctionComponent<Props> = ({ callbacks, className, highlightedIn
|
|
|
47
46
|
const error = useTypedSelector(selectSolveError);
|
|
48
47
|
const itemData = useMemo(() => ({ ...callbacks, highlightedIndex, results }), [callbacks, highlightedIndex, results]);
|
|
49
48
|
const [listRef, setListRef] = useState<FixedSizeList<ResultData> | null>(null);
|
|
50
|
-
const columns = useColumns();
|
|
51
49
|
const scrollToIndex = typeof highlightedIndex === 'number' ? highlightedIndex : 0;
|
|
52
50
|
const scrollToIndexRef = useLatest(scrollToIndex);
|
|
53
51
|
const hasResults = typeof error === 'undefined' && typeof results !== 'undefined';
|
|
@@ -70,12 +68,8 @@ const Results: FunctionComponent<Props> = ({ callbacks, className, highlightedIn
|
|
|
70
68
|
}, [results, listRef, scrollToIndexRef]);
|
|
71
69
|
|
|
72
70
|
return (
|
|
73
|
-
<div className={classNames(styles.results, className)}>
|
|
74
|
-
<
|
|
75
|
-
{columns.map((column) => (
|
|
76
|
-
<HeaderButton column={column} key={column.id} />
|
|
77
|
-
))}
|
|
78
|
-
</div>
|
|
71
|
+
<div className={classNames(styles.results, className)} data-testid="results">
|
|
72
|
+
<Header />
|
|
79
73
|
|
|
80
74
|
<div className={styles.content}>
|
|
81
75
|
{typeof error !== 'undefined' && (
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { Result } from '@scrabble-solver/types';
|
|
2
2
|
import { FocusEvent, MouseEvent } from 'react';
|
|
3
3
|
|
|
4
|
-
import { ResultColumn, TranslationKey } from 'types';
|
|
5
|
-
|
|
6
|
-
export interface Column {
|
|
7
|
-
className: string;
|
|
8
|
-
id: ResultColumn;
|
|
9
|
-
translationKey: TranslationKey;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
4
|
export interface ResultCallbacks {
|
|
13
5
|
onBlur?: (result: Result, event: FocusEvent) => void;
|
|
14
6
|
onClick?: (result: Result, event: MouseEvent) => void;
|
|
@@ -100,7 +100,7 @@ const Solver: FunctionComponent<Props> = ({ className, onShowResults }) => {
|
|
|
100
100
|
<div className={styles.column}>
|
|
101
101
|
<Results callbacks={callbacks} className={styles.results} />
|
|
102
102
|
|
|
103
|
-
<div className={styles.dictionaryContainer}>
|
|
103
|
+
<div data-testid="dictionary" className={styles.dictionaryContainer}>
|
|
104
104
|
<Dictionary className={styles.dictionary} />
|
|
105
105
|
<DictionaryInput className={styles.dictionaryInput} />
|
|
106
106
|
</div>
|
|
@@ -90,7 +90,7 @@ const ResultCandidatePicker: FunctionComponent<Props> = ({ className, onResultCl
|
|
|
90
90
|
|
|
91
91
|
<div className={styles.iconContainer}>
|
|
92
92
|
{isLoading && <Spinner className={styles.loading} />}
|
|
93
|
-
{!isLoading && <ChevronDown className={styles.icon} />}
|
|
93
|
+
{!isLoading && <ChevronDown aria-hidden="true" className={styles.icon} role="img" />}
|
|
94
94
|
</div>
|
|
95
95
|
</button>
|
|
96
96
|
|
|
@@ -77,6 +77,7 @@ const TilePure: FunctionComponent<Props> = ({
|
|
|
77
77
|
[styles.points5]: typeof points === 'number' && points >= 5,
|
|
78
78
|
[styles.raised]: raised,
|
|
79
79
|
})}
|
|
80
|
+
role={highlighted ? 'mark' : undefined}
|
|
80
81
|
style={style}
|
|
81
82
|
>
|
|
82
83
|
{character || placeholder}
|
|
@@ -106,7 +107,7 @@ const TilePure: FunctionComponent<Props> = ({
|
|
|
106
107
|
</span>
|
|
107
108
|
)}
|
|
108
109
|
|
|
109
|
-
{!isValid && <ExclamationSquareFill className={styles.alert} />}
|
|
110
|
+
{!isValid && <ExclamationSquareFill aria-hidden="true" className={styles.alert} role="img" />}
|
|
110
111
|
</div>
|
|
111
112
|
);
|
|
112
113
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as useAppLayout } from './useAppLayout';
|
|
2
|
+
export { default as useColumns } from './useColumns';
|
|
2
3
|
export { default as useDirection } from './useDirection';
|
|
3
4
|
export { default as useEffectOnce } from './useEffectOnce';
|
|
4
5
|
export { default as useIsTouchDevice } from './useIsTouchDevice';
|
|
@@ -15,10 +15,13 @@ import {
|
|
|
15
15
|
MODAL_WIDTH,
|
|
16
16
|
NAV_PADDING,
|
|
17
17
|
RACK_TILE_SIZE_MAX,
|
|
18
|
+
RESULTS_COLUMN_WIDTH,
|
|
18
19
|
SOLVER_COLUMN_WIDTH,
|
|
19
20
|
} from 'parameters';
|
|
20
21
|
import { selectConfig, selectShowCoordinates, useTypedSelector } from 'state';
|
|
22
|
+
import { ResultColumnId } from 'types';
|
|
21
23
|
|
|
24
|
+
import useColumns from './useColumns';
|
|
22
25
|
import useIsTouchDevice from './useIsTouchDevice';
|
|
23
26
|
import useMediaQueries from './useMediaQueries';
|
|
24
27
|
import useViewportSize from './useViewportSize';
|
|
@@ -29,6 +32,7 @@ const useAppLayout = () => {
|
|
|
29
32
|
const showCoordinates = useTypedSelector(selectShowCoordinates);
|
|
30
33
|
const isTouchDevice = useIsTouchDevice();
|
|
31
34
|
const { isLessThanXs, isLessThanS, isLessThanM, isLessThanL, isLessThanXl } = useMediaQueries();
|
|
35
|
+
const columns = useColumns();
|
|
32
36
|
const isBoardFullWidth = isLessThanM;
|
|
33
37
|
const showResultCandidatePicker = isLessThanL;
|
|
34
38
|
const componentsSpacing = isLessThanXl ? COMPONENTS_SPACING_SMALL : COMPONENTS_SPACING;
|
|
@@ -68,6 +72,12 @@ const useAppLayout = () => {
|
|
|
68
72
|
? viewportHeight - dictionaryHeight - BUTTON_HEIGHT - MODAL_HEADER_HEIGHT - 5 * componentsSpacing
|
|
69
73
|
: boardSize - componentsSpacing - dictionaryHeight;
|
|
70
74
|
const rackWidth = tileSize * config.rackSize;
|
|
75
|
+
const resultsWidth = isLessThanL ? modalWidth - 2 * componentsSpacing : SOLVER_COLUMN_WIDTH;
|
|
76
|
+
const columnsWidth = Object.keys(columns).reduce(
|
|
77
|
+
(sum, column) => sum + (RESULTS_COLUMN_WIDTH[column as ResultColumnId] ?? 0),
|
|
78
|
+
0,
|
|
79
|
+
);
|
|
80
|
+
const resultWordWidth = resultsWidth - 2 * BORDER_WIDTH - columnsWidth;
|
|
71
81
|
|
|
72
82
|
return {
|
|
73
83
|
actionsWidth: 2 * BUTTON_HEIGHT - BORDER_WIDTH,
|
|
@@ -83,7 +93,8 @@ const useAppLayout = () => {
|
|
|
83
93
|
rackHeight: tileSize,
|
|
84
94
|
rackWidth,
|
|
85
95
|
resultsHeight,
|
|
86
|
-
resultsWidth
|
|
96
|
+
resultsWidth,
|
|
97
|
+
resultWordWidth,
|
|
87
98
|
showCompactControls: !showColumn,
|
|
88
99
|
showKeyMap: !isTouchDevice,
|
|
89
100
|
showResultsInModal,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { selectColumns, useTypedSelector } from 'state';
|
|
4
|
+
import { ResultColumnId } from 'types';
|
|
5
|
+
|
|
6
|
+
import useMediaQueries from './useMediaQueries';
|
|
7
|
+
|
|
8
|
+
const COLUMNS_XS = [ResultColumnId.Coordinates, ResultColumnId.Word, ResultColumnId.Points];
|
|
9
|
+
|
|
10
|
+
const COLUMNS_S = [...COLUMNS_XS, ResultColumnId.BlanksCount, ResultColumnId.WordsCount];
|
|
11
|
+
|
|
12
|
+
const COLUMNS_M = [...COLUMNS_XS];
|
|
13
|
+
|
|
14
|
+
const COLUMNS_L = [...COLUMNS_XS];
|
|
15
|
+
|
|
16
|
+
const useColumns = (): Partial<Record<ResultColumnId, boolean>> => {
|
|
17
|
+
const columns = useTypedSelector(selectColumns);
|
|
18
|
+
const { isLessThanXs, isLessThanS, isLessThanM, isLessThanL } = useMediaQueries();
|
|
19
|
+
|
|
20
|
+
const filteredColumns = useMemo(() => {
|
|
21
|
+
if (isLessThanXs) {
|
|
22
|
+
return columns.filter((columnId) => COLUMNS_XS.includes(columnId));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (isLessThanS) {
|
|
26
|
+
return columns.filter((columnId) => COLUMNS_S.includes(columnId));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (isLessThanM) {
|
|
30
|
+
return columns.filter((columnId) => COLUMNS_M.includes(columnId));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (isLessThanL) {
|
|
34
|
+
return columns.filter((columnId) => COLUMNS_L.includes(columnId));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return columns;
|
|
38
|
+
}, [columns, isLessThanXs, isLessThanS, isLessThanM, isLessThanL]);
|
|
39
|
+
|
|
40
|
+
const columnsMap = useMemo(() => {
|
|
41
|
+
return Object.fromEntries(filteredColumns.map((column) => [column, true]));
|
|
42
|
+
}, [filteredColumns]);
|
|
43
|
+
|
|
44
|
+
return columnsMap;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default useColumns;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<!-- https://icons.getbootstrap.com/icons/geo-alt/ -->
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16">
|
|
3
|
+
<path d="M12.166 8.94c-.524 1.062-1.234 2.12-1.96 3.07A32 32 0 0 1 8 14.58a32 32 0 0 1-2.206-2.57c-.726-.95-1.436-2.008-1.96-3.07C3.304 7.867 3 6.862 3 6a5 5 0 0 1 10 0c0 .862-.305 1.867-.834 2.94M8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10" />
|
|
4
|
+
<path d="M8 8a2 2 0 1 1 0-4 2 2 0 0 1 0 4m0 1a3 3 0 1 0 0-6 3 3 0 0 0 0 6" />
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<!-- https://icons.getbootstrap.com/icons/123/ -->
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16">
|
|
3
|
+
<path d="M2.873 11.297V4.142H1.699L0 5.379v1.137l1.64-1.18h.06v5.961zm3.213-5.09v-.063c0-.618.44-1.169 1.196-1.169.676 0 1.174.44 1.174 1.106 0 .624-.42 1.101-.807 1.526L4.99 10.553v.744h4.78v-.99H6.643v-.069L8.41 8.252c.65-.724 1.237-1.332 1.237-2.27C9.646 4.849 8.723 4 7.308 4c-1.573 0-2.36 1.064-2.36 2.15v.057zm6.559 1.883h.786c.823 0 1.374.481 1.379 1.179.01.707-.55 1.216-1.421 1.21-.77-.005-1.326-.419-1.379-.953h-1.095c.042 1.053.938 1.918 2.464 1.918 1.478 0 2.642-.839 2.62-2.144-.02-1.143-.922-1.651-1.551-1.714v-.063c.535-.09 1.347-.66 1.326-1.678-.026-1.053-.933-1.855-2.359-1.845-1.5.005-2.317.88-2.348 1.898h1.116c.032-.498.498-.944 1.206-.944.703 0 1.206.435 1.206 1.07.005.64-.504 1.106-1.2 1.106h-.75z" />
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<!-- https://icons.getbootstrap.com/icons/square/ -->
|
|
2
|
+
<!-- https://icons.getbootstrap.com/icons/alphabet-uppercase/ -->
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16">
|
|
4
|
+
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z" />
|
|
5
|
+
<path d="M 7.2949219,4.8691409 5.2382813,11.130859 H 6.4648438 L 6.9453125,9.5195319 h 2.046875 L 9.4707032,11.130859 H 10.761719 L 8.7148438,4.8691409 Z m 0.6484375,1.199219 h 0.054687 l 0.75,2.53125 h -1.554687 z" />
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<!-- https://icons.getbootstrap.com/icons/square/ -->
|
|
2
|
+
<!-- https://icons.getbootstrap.com/icons/alphabet-uppercase/ -->
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16">
|
|
4
|
+
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z" />
|
|
5
|
+
<path d="m 5.658203,4.8691408 v 6.2617182 h 2.5507813 c 1.2429974,0 2.1328127,-0.646627 2.1328127,-1.7656244 0,-0.9409982 -0.629236,-1.4533438 -1.3652346,-1.5273438 V 7.7812502 C 9.5825612,7.6292506 10.027344,7.172155 10.027344,6.4101564 c 0,-0.957998 -0.7185963,-1.5410156 -1.8085941,-1.5410156 z m 1.203125,0.9316406 h 1.0742187 c 0.569999,1e-7 0.8964844,0.3103136 0.8964844,0.8203126 0,0.5449988 -0.3579236,0.8535156 -1.1699218,0.8535156 H 6.861328 Z m 0,2.5371094 h 1.1503906 c 0.7129986,0 1.0957031,0.3621262 1.0957031,0.953125 10e-8,0.5969988 -0.3927518,0.9082032 -1.34375,0.9082032 H 6.861328 Z" />
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<!-- https://icons.getbootstrap.com/icons/square/ -->
|
|
2
|
+
<!-- https://icons.getbootstrap.com/icons/alphabet-uppercase/ -->
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16">
|
|
4
|
+
<path
|
|
5
|
+
d="m 2.75,4 v 0.75 h 7.75 a 0.75,0.75 0 0 1 0.75,0.75 v 7.75 H 12 V 5.5 A 1.5,1.5 0 0 0 10.5,4 Z"
|
|
6
|
+
stroke-width="0.75" />
|
|
7
|
+
<path
|
|
8
|
+
d="m 12,14 h -0.75 v 0.5 a 0.75,0.75 0 0 1 -0.75,0.75 h -9 A 0.75,0.75 0 0 1 0.75,14.5 v -9 A 0.75,0.75 0 0 1 1.5,4.75 H 2 V 4 H 1.5 A 1.5,1.5 0 0 0 0,5.5 v 9 A 1.5,1.5 0 0 0 1.5,16 h 9 A 1.5,1.5 0 0 0 12,14.5 Z"
|
|
9
|
+
stroke-width="0.75" />
|
|
10
|
+
<path
|
|
11
|
+
d="M 2,4.75 H 2.75 V 4 H 2 Z"
|
|
12
|
+
stroke-width="0.75" />
|
|
13
|
+
<path
|
|
14
|
+
d="M 12,14 V 13.25 H 11.25 V 14 Z"
|
|
15
|
+
stroke-width="0.75" />
|
|
16
|
+
<path
|
|
17
|
+
d="m 4.75,2 v 0.75 h 7.75 a 0.75,0.75 0 0 1 0.75,0.75 v 7.75 H 14 V 3.5 A 1.5,1.5 0 0 0 12.5,2 Z"
|
|
18
|
+
stroke-width="0.75" />
|
|
19
|
+
<path
|
|
20
|
+
d="M 4,2.75 V 2 H 3.5 A 1.5,1.5 0 0 0 2,3.5 V 4 H 2.75 V 3.5 A 0.75,0.75 0 0 1 3.5,2.75 Z"
|
|
21
|
+
stroke-width="0.75" />
|
|
22
|
+
<path
|
|
23
|
+
d="m 14,12 h -0.75 v 0.5 A 0.75,0.75 0 0 1 12.5,13.25 H 12 V 14 h 0.5 A 1.5,1.5 0 0 0 14,12.5 Z"
|
|
24
|
+
stroke-width="0.75" />
|
|
25
|
+
<path
|
|
26
|
+
d="M 4,2.75 H 4.75 V 2 H 4 Z"
|
|
27
|
+
stroke-width="0.75" />
|
|
28
|
+
<path
|
|
29
|
+
d="M 14,12 V 11.25 H 13.25 V 12 Z"
|
|
30
|
+
stroke-width="0.75" />
|
|
31
|
+
<path
|
|
32
|
+
d="M 5.5,0 A 1.5,1.5 0 0 0 4,1.5 V 2 H 4.75 V 1.5 A 0.75,0.75 0 0 1 5.5,0.75 h 9 a 0.75,0.75 0 0 1 0.75,0.75 v 9 A 0.75,0.75 0 0 1 14.5,11.25 H 14 V 12 h 0.5 A 1.5,1.5 0 0 0 16,10.5 v -9 A 1.5,1.5 0 0 0 14.5,0 Z"
|
|
33
|
+
stroke-width="0.75" />
|
|
34
|
+
</svg>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<!-- https://icons.getbootstrap.com/icons/square/ -->
|
|
2
|
+
<!-- https://icons.getbootstrap.com/icons/alphabet-uppercase/ -->
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 16">
|
|
4
|
+
<path
|
|
5
|
+
d="M 7.21875,0.51562499 A 0.51562499,0.51562499 0 0 1 7.734375,1.03125 v 6.1875 A 0.51562499,0.51562499 0 0 1 7.21875,7.734375 H 1.03125 A 0.51562499,0.51562499 0 0 1 0.51562499,7.21875 V 1.03125 A 0.51562499,0.51562499 0 0 1 1.03125,0.51562499 Z M 1.03125,0 A 1.03125,1.03125 0 0 0 0,1.03125 v 6.1875 A 1.03125,1.03125 0 0 0 1.03125,8.25 h 6.1875 A 1.03125,1.03125 0 0 0 8.25,7.21875 V 1.03125 A 1.03125,1.03125 0 0 0 7.21875,0 Z"
|
|
6
|
+
stroke-width="0.5" />
|
|
7
|
+
<path
|
|
8
|
+
d="m 14.96875,8.265625 a 0.51562499,0.51562499 0 0 1 0.515625,0.515625 v 6.1875 A 0.51562499,0.51562499 0 0 1 14.96875,15.484375 H 8.7812501 A 0.51562499,0.51562499 0 0 1 8.265625,14.96875 V 8.78125 A 0.51562499,0.51562499 0 0 1 8.7812501,8.265625 Z M 8.7812501,7.75 A 1.03125,1.03125 0 0 0 7.75,8.78125 v 6.1875 A 1.03125,1.03125 0 0 0 8.7812501,16 H 14.96875 A 1.03125,1.03125 0 0 0 16,14.96875 V 8.78125 A 1.03125,1.03125 0 0 0 14.96875,7.75 Z"
|
|
9
|
+
stroke-width="0.5" />
|
|
10
|
+
<path
|
|
11
|
+
d="M 3.7614277,2.5 2.7009247,5.75 H 3.3333995 L 3.5811523,4.9136776 H 4.6366198 L 4.8833654,5.75 H 5.5490753 L 4.493608,2.5 Z m 0.3343657,0.6224265 h 0.0282 L 4.5107288,4.4362133 H 3.7090572 Z"
|
|
12
|
+
stroke-width="0.5" />
|
|
13
|
+
<path
|
|
14
|
+
d="m 2.954049,10.250001 v 3.25 h 1.275448 c 0.621526,0 1.066454,-0.335617 1.066454,-0.916407 0,-0.488403 -0.314632,-0.754324 -0.682648,-0.792732 v -0.0294 c 0.303013,-0.07889 0.525414,-0.316137 0.525414,-0.711635 0,-0.497226 -0.359314,-0.799828 -0.904337,-0.799828 z m 0.60159,0.483546 h 0.537133 c 0.285012,0 0.448262,0.161062 0.448262,0.425765 0,0.282869 -0.17897,0.442997 -0.584987,0.442997 H 3.555639 Z m 0,1.316828 h 0.57522 c 0.356516,0 0.547877,0.187953 0.547877,0.494698 0,0.309859 -0.196385,0.471382 -0.671906,0.471382 H 3.555639 Z"
|
|
15
|
+
stroke-width="0.5" />
|
|
16
|
+
<path
|
|
17
|
+
d="M 7.21875,8.265625 A 0.51562499,0.51562499 0 0 1 7.734375,8.78125 v 6.1875 A 0.51562499,0.51562499 0 0 1 7.21875,15.484375 H 1.03125 A 0.51562499,0.51562499 0 0 1 0.515625,14.96875 V 8.78125 A 0.51562499,0.51562499 0 0 1 1.03125,8.265625 Z M 1.03125,7.75 A 1.03125,1.03125 0 0 0 0,8.78125 v 6.1875 A 1.03125,1.03125 0 0 0 1.03125,16 h 6.1875 A 1.03125,1.03125 0 0 0 8.25,14.96875 V 8.78125 A 1.03125,1.03125 0 0 0 7.21875,7.75 Z"
|
|
18
|
+
stroke-width="0.5" />
|
|
19
|
+
<path
|
|
20
|
+
d="m 11.92041,10.250001 c -0.819499,0 -1.287109,0.548047 -1.287109,1.435547 v 0.389648 c 0,0.887999 0.46311,1.424805 1.287109,1.424805 0.6715,0 1.167289,-0.413243 1.196289,-1.010742 v -0.06055 h -0.585937 c -0.0245,0.320999 -0.253946,0.547851 -0.606446,0.547851 -0.428499,0 -0.672851,-0.323367 -0.672851,-0.901367 v -0.386719 c 0,-0.579999 0.248352,-0.915039 0.672851,-0.915039 0.348,0 0.581446,0.244649 0.606446,0.577149 h 0.585937 v -0.05664 c -0.0265,-0.618999 -0.522789,-1.043945 -1.196289,-1.043945 z"
|
|
21
|
+
stroke-width="0.5" />
|
|
22
|
+
</svg>
|
|
@@ -28,15 +28,21 @@ export { default as FlagGb } from './FlagGb.svg';
|
|
|
28
28
|
export { default as FlagPl } from './FlagPl.svg';
|
|
29
29
|
export { default as FlagRo } from './FlagRo.svg';
|
|
30
30
|
export { default as FlagUs } from './FlagUs.svg';
|
|
31
|
+
export { default as GeoAlt } from './GeoAlt.svg';
|
|
31
32
|
export { default as Github } from './Github.svg';
|
|
32
33
|
export { default as InfoCircleFill } from './InfoCircleFill.svg';
|
|
33
34
|
export { default as Keyboard } from './Keyboard.svg';
|
|
34
35
|
export { default as KeyboardFill } from './KeyboardFill.svg';
|
|
35
36
|
export { default as List } from './List.svg';
|
|
37
|
+
export { default as OneTwoThree } from './OneTwoThree.svg';
|
|
36
38
|
export { default as Sack } from './Sack.svg';
|
|
37
39
|
export { default as Search } from './Search.svg';
|
|
38
40
|
export { default as SortDown } from './SortDown.svg';
|
|
39
41
|
export { default as SortUp } from './SortUp.svg';
|
|
40
42
|
export { default as Square } from './Square.svg';
|
|
43
|
+
export { default as SquareA } from './SquareA.svg';
|
|
44
|
+
export { default as SquareB } from './SquareB.svg';
|
|
41
45
|
export { default as SquareFill } from './SquareFill.svg';
|
|
46
|
+
export { default as Squares } from './Squares.svg';
|
|
42
47
|
export { default as Star } from './Star.svg';
|
|
48
|
+
export { default as Words } from './Words.svg';
|
|
@@ -18,7 +18,7 @@ const groupResults = (
|
|
|
18
18
|
|
|
19
19
|
const { matching, other } = results.reduce<GroupedResults>(
|
|
20
20
|
(groupedResults, result) => {
|
|
21
|
-
const matchesQuery = () =>
|
|
21
|
+
const matchesQuery = () => Boolean(result.word.match(regExp));
|
|
22
22
|
|
|
23
23
|
if (resultMatchesCellFilter(result, cellFilter) && matchesQuery()) {
|
|
24
24
|
groupedResults.matching.push(result);
|
|
@@ -7,7 +7,6 @@ export { default as createKeyboardNavigation } from './createKeyboardNavigation'
|
|
|
7
7
|
export { default as createNullMovingComparator } from './createNullMovingComparator';
|
|
8
8
|
export { default as createRegExp } from './createRegExp';
|
|
9
9
|
export { default as createStringComparator } from './createStringComparator';
|
|
10
|
-
export { default as dataUrlToBlob } from './dataUrlToBlob';
|
|
11
10
|
export { default as detectLocale } from './detectLocale';
|
|
12
11
|
export { default as extractCharacters } from './extractCharacters';
|
|
13
12
|
export { default as extractCharactersByCase } from './extractCharactersByCase';
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { Result, ShowCoordinates } from '@scrabble-solver/types';
|
|
2
2
|
|
|
3
|
-
import { Comparator,
|
|
3
|
+
import { Comparator, ResultColumnId, Sort, SortDirection } from 'types';
|
|
4
4
|
|
|
5
5
|
import createKeyComparator from './createKeyComparator';
|
|
6
6
|
import createStringComparator from './createStringComparator';
|
|
7
7
|
import getCoordinates from './getCoordinates';
|
|
8
8
|
import reverseComparator from './reverseComparator';
|
|
9
9
|
|
|
10
|
-
const comparators: Record<
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
10
|
+
const comparators: Record<ResultColumnId, (locale: string, showCoordinates: ShowCoordinates) => Comparator<Result>> = {
|
|
11
|
+
[ResultColumnId.BlanksCount]: (locale: string) => createKeyComparator('blanksCount', locale),
|
|
12
|
+
[ResultColumnId.ConsonantsCount]: (locale: string) => createKeyComparator('consonantsCount', locale),
|
|
13
|
+
[ResultColumnId.Coordinates]: (locale: string, showCoordinates: ShowCoordinates) => (a, b) => {
|
|
14
14
|
const stringComparator = createStringComparator(locale);
|
|
15
15
|
const aValue = getCoordinates(a, showCoordinates);
|
|
16
16
|
const bValue = getCoordinates(b, showCoordinates);
|
|
17
17
|
return stringComparator(aValue, bValue);
|
|
18
18
|
},
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
19
|
+
[ResultColumnId.Points]: (locale: string) => createKeyComparator('points', locale),
|
|
20
|
+
[ResultColumnId.TilesCount]: (locale: string) => createKeyComparator('tilesCount', locale),
|
|
21
|
+
[ResultColumnId.VowelsCount]: (locale: string) => createKeyComparator('vowelsCount', locale),
|
|
22
|
+
[ResultColumnId.Word]: (locale: string) => createKeyComparator('word', locale),
|
|
23
|
+
[ResultColumnId.WordsCount]: (locale: string) => createKeyComparator('wordsCount', locale),
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const sortResults = (
|
|
@@ -17,7 +17,7 @@ const KeyMapModal: FunctionComponent<Props> = ({ className, isOpen, onClose }) =
|
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
19
|
<Modal className={className} isOpen={isOpen} title={translate('keyMap')} onClose={onClose}>
|
|
20
|
-
<Modal.Section title={translate('keyMap.board-and-rack')}>
|
|
20
|
+
<Modal.Section label={translate('keyMap.board-and-rack')} title={translate('keyMap.board-and-rack')}>
|
|
21
21
|
<Mapping description={translate('keyMap.board-and-rack.navigate')} mapping={[<Arrows key="arrows" />]} />
|
|
22
22
|
|
|
23
23
|
<Mapping
|
|
@@ -27,11 +27,6 @@ const KeyMapModal: FunctionComponent<Props> = ({ className, isOpen, onClose }) =
|
|
|
27
27
|
|
|
28
28
|
<Mapping description={translate('keyMap.board-and-rack.submit')} mapping={[<Enter key="del" />]} />
|
|
29
29
|
|
|
30
|
-
<Mapping
|
|
31
|
-
description={translate('keyMap.board.toggle-cell-filter')}
|
|
32
|
-
mapping={[[<Ctrl key="ctrl" />, <Key key="g">G</Key>]]}
|
|
33
|
-
/>
|
|
34
|
-
|
|
35
30
|
{config.twoCharacterTiles.length > 0 && (
|
|
36
31
|
<Mapping
|
|
37
32
|
description={translate('keyMap.board-and-rack.insert-two-letter-tile')}
|
|
@@ -49,12 +44,16 @@ const KeyMapModal: FunctionComponent<Props> = ({ className, isOpen, onClose }) =
|
|
|
49
44
|
)}
|
|
50
45
|
</Modal.Section>
|
|
51
46
|
|
|
52
|
-
<Modal.Section title={translate('keyMap.board')}>
|
|
53
|
-
<Mapping description={translate('keyMap.board.toggle-blank')} mapping={[<Space key="space" />]} />
|
|
47
|
+
<Modal.Section label={translate('keyMap.board')} title={translate('keyMap.board')}>
|
|
54
48
|
<Mapping description={translate('keyMap.board.toggle-direction')} mapping={[<Arrows key="arrows" />]} />
|
|
49
|
+
<Mapping description={translate('keyMap.board.toggle-blank')} mapping={[<Space key="space" />]} />
|
|
50
|
+
<Mapping
|
|
51
|
+
description={translate('keyMap.board.toggle-cell-filter')}
|
|
52
|
+
mapping={[[<Ctrl key="ctrl" />, <Key key="g">G</Key>]]}
|
|
53
|
+
/>
|
|
55
54
|
</Modal.Section>
|
|
56
55
|
|
|
57
|
-
<Modal.Section title={translate('keyMap.rack')}>
|
|
56
|
+
<Modal.Section label={translate('keyMap.rack')} title={translate('keyMap.rack')}>
|
|
58
57
|
<Mapping description={translate('keyMap.rack.insert-blank')} mapping={[<Space key="space" />]} />
|
|
59
58
|
</Modal.Section>
|
|
60
59
|
</Modal>
|
|
@@ -64,7 +64,7 @@ const MenuModal: FunctionComponent<Props> = ({
|
|
|
64
64
|
<Button aria-label={translate('settings')} className={styles.button} Icon={Cog} onClick={onShowSettings}>
|
|
65
65
|
<div className={styles.settings}>
|
|
66
66
|
<div className={styles.settingsLabel}>{translate('settings')}</div>
|
|
67
|
-
<Icon className={styles.flag} />
|
|
67
|
+
<Icon aria-hidden="true" className={styles.flag} role="img" />
|
|
68
68
|
</div>
|
|
69
69
|
</Button>
|
|
70
70
|
</Modal>
|
|
@@ -24,25 +24,25 @@ const SettingsModal: FunctionComponent<Props> = ({ className, isOpen, onClose })
|
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
26
|
<Modal className={className} isOpen={isOpen} title={translate('settings')} onClose={onClose}>
|
|
27
|
-
<Modal.Section title={translate('settings.game')}>
|
|
27
|
+
<Modal.Section label={translate('settings.game')} title={translate('settings.game')}>
|
|
28
28
|
<ConfigSetting disabled={!isOpen} />
|
|
29
29
|
</Modal.Section>
|
|
30
30
|
|
|
31
|
-
<Modal.Section title={translate('settings.language')}>
|
|
31
|
+
<Modal.Section label={translate('settings.language')} title={translate('settings.language')}>
|
|
32
32
|
<LocaleSetting disabled={!isOpen} />
|
|
33
33
|
</Modal.Section>
|
|
34
34
|
|
|
35
|
-
<Modal.Section title={translate('settings.showCoordinates')}>
|
|
35
|
+
<Modal.Section label={translate('settings.showCoordinates')} title={translate('settings.showCoordinates')}>
|
|
36
36
|
<ShowCoordinatesSetting disabled={!isOpen} />
|
|
37
37
|
</Modal.Section>
|
|
38
38
|
|
|
39
39
|
{!isTouchDevice && (
|
|
40
|
-
<Modal.Section title={translate('settings.inputMode')}>
|
|
40
|
+
<Modal.Section label={translate('settings.inputMode')} title={translate('settings.inputMode')}>
|
|
41
41
|
<InputModeSetting disabled={!isOpen} />
|
|
42
42
|
</Modal.Section>
|
|
43
43
|
)}
|
|
44
44
|
|
|
45
|
-
<Modal.Section title={translate('settings.autoGroupTiles')}>
|
|
45
|
+
<Modal.Section label={translate('settings.autoGroupTiles')} title={translate('settings.autoGroupTiles')}>
|
|
46
46
|
<AutoGroupTilesSetting disabled={!isOpen} />
|
|
47
47
|
</Modal.Section>
|
|
48
48
|
</Modal>
|
package/packages/scrabble-solver/src/modals/SettingsModal/components/LocaleSetting/LocaleSetting.tsx
CHANGED
|
@@ -40,7 +40,7 @@ const LocaleSetting: FunctionComponent<Props> = ({ className, disabled }) => {
|
|
|
40
40
|
onChange={handleChange}
|
|
41
41
|
>
|
|
42
42
|
<span className={styles.label}>
|
|
43
|
-
<Icon className={styles.flag} />
|
|
43
|
+
<Icon aria-hidden="true" className={styles.flag} role="img" />
|
|
44
44
|
|
|
45
45
|
<span>{option.label}</span>
|
|
46
46
|
</span>
|
|
@@ -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>
|
|
@@ -30,12 +31,13 @@ const WordsModal: FunctionComponent<Props> = ({ className, isOpen, onClose }) =>
|
|
|
30
31
|
>
|
|
31
32
|
{invalidWords.map((word, index) => (
|
|
32
33
|
<div className={styles.word} key={index}>
|
|
33
|
-
<Cross className={classNames(styles.icon, styles.invalid)} /> {word}
|
|
34
|
+
<Cross aria-hidden="true" className={classNames(styles.icon, styles.invalid)} role="img" /> {word}
|
|
34
35
|
</div>
|
|
35
36
|
))}
|
|
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>
|
|
@@ -45,7 +47,7 @@ const WordsModal: FunctionComponent<Props> = ({ className, isOpen, onClose }) =>
|
|
|
45
47
|
>
|
|
46
48
|
{validWords.map((word, index) => (
|
|
47
49
|
<div className={styles.word} key={index}>
|
|
48
|
-
<Check className={classNames(styles.icon, styles.valid)} /> {word}
|
|
50
|
+
<Check aria-hidden="true" className={classNames(styles.icon, styles.valid)} role="img" /> {word}
|
|
49
51
|
</div>
|
|
50
52
|
))}
|
|
51
53
|
</Modal.Section>
|
|
@@ -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;
|
|
@@ -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;
|