@scrabble-solver/scrabble-solver 2.10.5 → 2.10.6
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 +9 -9
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_8dgz12 +1 -1
- package/.next/cache/next-server.js.nft.json +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/edge-server-production/0.pack +0 -0
- package/.next/cache/webpack/edge-server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/next-server.js.nft.json +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/176.js +343 -209
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +2 -2
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.html +2 -2
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/index.html +2 -2
- package/.next/server/pages/index.js +4 -4
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/index.json +1 -1
- package/.next/server/pages-manifest.json +2 -2
- package/.next/static/chunks/791-93aa8b8c22e488ac.js +1 -0
- package/.next/static/chunks/pages/{404-7619583a9e7188b1.js → 404-ff35a4cf7f1ec85a.js} +1 -1
- package/.next/static/chunks/pages/index-ded620fd5df96be0.js +1 -0
- package/.next/static/css/4482c4a0064d3807.css +1 -0
- package/.next/static/css/a943dd97164732d4.css +1 -0
- package/.next/static/iL0av55MV28b0MXfhKKt2/_buildManifest.js +1 -0
- package/.next/trace +55 -55
- package/package.json +14 -14
- package/src/components/Button/Button.module.scss +2 -5
- package/src/components/Solver/Solver.module.scss +9 -21
- package/src/components/Solver/Solver.tsx +12 -48
- package/src/components/Solver/components/MobileControls/MobileControls.tsx +62 -0
- package/src/components/Solver/components/MobileControls/index.ts +1 -0
- package/src/components/{ResultCandidatePicker → Solver/components/ResultCandidatePicker}/ResultCandidatePicker.module.scss +47 -3
- package/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.tsx +75 -0
- package/src/components/Solver/components/index.ts +2 -0
- package/src/components/SquareButton/SquareButton.module.scss +1 -2
- package/src/components/index.ts +0 -1
- package/src/icons/ChevronLeft.svg +4 -0
- package/src/icons/ChevronRight.svg +4 -0
- package/src/icons/index.ts +2 -0
- package/src/modals/MenuModal/MenuModal.module.scss +2 -3
- package/src/styles/mixins.scss +6 -0
- package/.next/static/WILX-RgqlLTd4ZoPs8C_E/_buildManifest.js +0 -1
- package/.next/static/chunks/144-6768fe9a92865ec8.js +0 -1
- package/.next/static/chunks/pages/index-1a6bbb880f28606a.js +0 -1
- package/.next/static/css/d80ffccf2315791a.css +0 -1
- package/.next/static/css/e737d5d7fbed2434.css +0 -1
- package/src/components/ResultCandidatePicker/ResultCandidatePicker.tsx +0 -38
- /package/.next/static/{WILX-RgqlLTd4ZoPs8C_E → iL0av55MV28b0MXfhKKt2}/_ssgManifest.js +0 -0
- /package/src/components/{ResultCandidatePicker → Solver/components/ResultCandidatePicker}/index.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/scrabble-solver",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.6",
|
|
4
4
|
"description": "Scrabble Solver 2 - App",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16"
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@kamilmielnik/trie": "^2.0.1",
|
|
32
32
|
"@popperjs/core": "^2.11.6",
|
|
33
|
-
"@reduxjs/toolkit": "^1.9.
|
|
34
|
-
"@scrabble-solver/configs": "^2.10.
|
|
35
|
-
"@scrabble-solver/constants": "^2.10.
|
|
36
|
-
"@scrabble-solver/dictionaries": "^2.10.
|
|
37
|
-
"@scrabble-solver/logger": "^2.10.
|
|
38
|
-
"@scrabble-solver/solver": "^2.10.
|
|
39
|
-
"@scrabble-solver/types": "^2.10.
|
|
40
|
-
"@scrabble-solver/word-definitions": "^2.10.
|
|
33
|
+
"@reduxjs/toolkit": "^1.9.3",
|
|
34
|
+
"@scrabble-solver/configs": "^2.10.6",
|
|
35
|
+
"@scrabble-solver/constants": "^2.10.6",
|
|
36
|
+
"@scrabble-solver/dictionaries": "^2.10.6",
|
|
37
|
+
"@scrabble-solver/logger": "^2.10.6",
|
|
38
|
+
"@scrabble-solver/solver": "^2.10.6",
|
|
39
|
+
"@scrabble-solver/types": "^2.10.6",
|
|
40
|
+
"@scrabble-solver/word-definitions": "^2.10.6",
|
|
41
41
|
"classnames": "^2.3.2",
|
|
42
42
|
"include-media": "^2.0.0",
|
|
43
43
|
"include-media-query-builder": "^1.1.0",
|
|
@@ -63,18 +63,18 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@svgr/webpack": "^6.5.1",
|
|
65
65
|
"@types/classnames": "^2.3.0",
|
|
66
|
-
"@types/react": "^18.0.
|
|
67
|
-
"@types/react-dom": "^18.0.
|
|
66
|
+
"@types/react": "^18.0.28",
|
|
67
|
+
"@types/react-dom": "^18.0.11",
|
|
68
68
|
"@types/react-modal": "^3.13.1",
|
|
69
69
|
"@types/react-portal": "^4.0.4",
|
|
70
70
|
"@types/react-redux": "^7.1.25",
|
|
71
71
|
"@types/react-window": "^1.8.5",
|
|
72
72
|
"@types/redux": "^3.6.31",
|
|
73
73
|
"@types/redux-saga": "^0.10.5",
|
|
74
|
-
"@types/uuid": "^9.0.
|
|
74
|
+
"@types/uuid": "^9.0.1",
|
|
75
75
|
"env-cmd": "^10.1.0",
|
|
76
|
-
"sass": "^1.
|
|
76
|
+
"sass": "^1.58.3",
|
|
77
77
|
"workbox-webpack-plugin": "^6.5.4"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "188bb77933a4e88af88b05063a4977c50c788071"
|
|
80
80
|
}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
padding: var(--spacing--m) var(--spacing--l);
|
|
9
9
|
border: var(--border);
|
|
10
10
|
border-radius: var(--border--radius);
|
|
11
|
-
color: var(--color--inactive);
|
|
12
11
|
text-transform: uppercase;
|
|
13
12
|
transition: var(--transition);
|
|
14
13
|
cursor: pointer;
|
|
@@ -37,7 +36,7 @@
|
|
|
37
36
|
|
|
38
37
|
&:focus,
|
|
39
38
|
&:hover {
|
|
40
|
-
&.default {
|
|
39
|
+
&.default:not(:disabled) {
|
|
41
40
|
.icon {
|
|
42
41
|
color: var(--color--foreground--secondary);
|
|
43
42
|
}
|
|
@@ -54,9 +53,7 @@
|
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
&[disabled] {
|
|
57
|
-
|
|
58
|
-
box-shadow: none;
|
|
59
|
-
cursor: not-allowed;
|
|
56
|
+
@include disabled;
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
59
|
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
margin: 0 auto;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
.submitInput {
|
|
51
|
+
display: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
50
54
|
.column {
|
|
51
55
|
display: flex;
|
|
52
56
|
flex-direction: column;
|
|
@@ -58,6 +62,11 @@
|
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
|
|
65
|
+
.resultsContainer {
|
|
66
|
+
flex: 1;
|
|
67
|
+
position: relative;
|
|
68
|
+
}
|
|
69
|
+
|
|
61
70
|
.dictionary {
|
|
62
71
|
display: flex;
|
|
63
72
|
flex-direction: column;
|
|
@@ -72,11 +81,6 @@
|
|
|
72
81
|
flex: 0 0 auto;
|
|
73
82
|
}
|
|
74
83
|
|
|
75
|
-
.resultsContainer {
|
|
76
|
-
flex: 1;
|
|
77
|
-
position: relative;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
84
|
.bottomContainer {
|
|
81
85
|
flex: 0 0 auto;
|
|
82
86
|
display: flex;
|
|
@@ -101,24 +105,8 @@
|
|
|
101
105
|
border: var(--border);
|
|
102
106
|
}
|
|
103
107
|
|
|
104
|
-
.submitInput {
|
|
105
|
-
display: none;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
108
|
.controls {
|
|
109
109
|
width: 100%;
|
|
110
|
-
display: flex;
|
|
111
|
-
align-items: flex-start;
|
|
112
|
-
justify-content: center;
|
|
113
|
-
gap: var(--spacing--l);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.resultCandidatePicker {
|
|
117
|
-
flex: 1;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.apply {
|
|
121
|
-
flex: 0 0 auto;
|
|
122
110
|
}
|
|
123
111
|
|
|
124
112
|
.solve {
|
|
@@ -17,14 +17,10 @@ import {
|
|
|
17
17
|
} from 'parameters';
|
|
18
18
|
import {
|
|
19
19
|
resultsSlice,
|
|
20
|
-
selectAreResultsOutdated,
|
|
21
20
|
selectConfig,
|
|
22
21
|
selectResultCandidate,
|
|
23
|
-
selectSolveError,
|
|
24
22
|
selectSortedFilteredResults,
|
|
25
|
-
selectSortedResults,
|
|
26
23
|
solveSlice,
|
|
27
|
-
useTranslate,
|
|
28
24
|
useTypedSelector,
|
|
29
25
|
} from 'state';
|
|
30
26
|
|
|
@@ -32,11 +28,10 @@ import Board from '../Board';
|
|
|
32
28
|
import Dictionary from '../Dictionary';
|
|
33
29
|
import DictionaryInput from '../DictionaryInput';
|
|
34
30
|
import Rack from '../Rack';
|
|
35
|
-
import ResultCandidatePicker from '../ResultCandidatePicker';
|
|
36
31
|
import Results from '../Results';
|
|
37
32
|
import Well from '../Well';
|
|
38
33
|
|
|
39
|
-
import {
|
|
34
|
+
import { MobileControls, SolveButton } from './components';
|
|
40
35
|
import styles from './Solver.module.scss';
|
|
41
36
|
|
|
42
37
|
interface Props {
|
|
@@ -49,20 +44,21 @@ interface Props {
|
|
|
49
44
|
// eslint-disable-next-line max-statements
|
|
50
45
|
const Solver: FunctionComponent<Props> = ({ className, height, width, onShowResults }) => {
|
|
51
46
|
const dispatch = useDispatch();
|
|
52
|
-
const translate = useTranslate();
|
|
53
47
|
const isTouchDevice = useIsTouchDevice();
|
|
54
48
|
const [bottomContainerRef, { height: bottomContainerHeight }] = useMeasure<HTMLDivElement>();
|
|
55
49
|
const [resultsContainerRef, { width: resultsContainerWidth }] = useMeasure<HTMLDivElement>();
|
|
56
50
|
const isLessThanXl = useMediaQuery('<xl');
|
|
57
51
|
const isLessThanL = useMediaQuery('<l');
|
|
52
|
+
const isLessThanM = useMediaQuery('<m');
|
|
58
53
|
const componentsSpacing = isLessThanXl ? COMPONENTS_SPACING_SMALL : COMPONENTS_SPACING;
|
|
59
54
|
const maxBoardWidth = width - resultsContainerWidth - (isLessThanL ? 0 : componentsSpacing) - 2 * componentsSpacing;
|
|
60
|
-
const maxBoardHeight = Math.max(
|
|
55
|
+
const maxBoardHeight = Math.max(
|
|
56
|
+
height - bottomContainerHeight,
|
|
57
|
+
isLessThanL ? 0 : COLUMN_MIN_HEIGHT,
|
|
58
|
+
isLessThanM ? Number.POSITIVE_INFINITY : 0,
|
|
59
|
+
);
|
|
61
60
|
const config = useTypedSelector(selectConfig);
|
|
62
61
|
const resultCandidate = useTypedSelector(selectResultCandidate);
|
|
63
|
-
const isOutdated = useTypedSelector(selectAreResultsOutdated);
|
|
64
|
-
const allResults = useTypedSelector(selectSortedResults);
|
|
65
|
-
const error = useTypedSelector(selectSolveError);
|
|
66
62
|
const results = useTypedSelector(selectSortedFilteredResults);
|
|
67
63
|
const [bestResult] = results || [];
|
|
68
64
|
const cellWidth = (maxBoardWidth - (config.boardWidth + 1) * BORDER_WIDTH) / config.boardWidth;
|
|
@@ -159,43 +155,11 @@ const Solver: FunctionComponent<Props> = ({ className, height, width, onShowResu
|
|
|
159
155
|
</form>
|
|
160
156
|
|
|
161
157
|
{isLessThanL && (
|
|
162
|
-
<
|
|
163
|
-
{
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
)}
|
|
168
|
-
|
|
169
|
-
{typeof error === 'undefined' && typeof results === 'undefined' && (
|
|
170
|
-
<EmptyState variant="info" onClick={onShowResults}>
|
|
171
|
-
{translate('results.empty-state.uninitialized')}
|
|
172
|
-
</EmptyState>
|
|
173
|
-
)}
|
|
174
|
-
|
|
175
|
-
{typeof error === 'undefined' && typeof results !== 'undefined' && typeof allResults !== 'undefined' && (
|
|
176
|
-
<>
|
|
177
|
-
{(isOutdated || !resultCandidate) && (
|
|
178
|
-
<EmptyState variant="info" onClick={onShowResults}>
|
|
179
|
-
{translate('results.empty-state.outdated')}
|
|
180
|
-
</EmptyState>
|
|
181
|
-
)}
|
|
182
|
-
|
|
183
|
-
{!isOutdated && allResults.length === 0 && (
|
|
184
|
-
<EmptyState variant="warning" onClick={onShowResults}>
|
|
185
|
-
{translate('results.empty-state.no-results')}
|
|
186
|
-
</EmptyState>
|
|
187
|
-
)}
|
|
188
|
-
|
|
189
|
-
{!isOutdated && allResults.length > 0 && resultCandidate && (
|
|
190
|
-
<ResultCandidatePicker className={styles.resultCandidatePicker} onClick={onShowResults} />
|
|
191
|
-
)}
|
|
192
|
-
</>
|
|
193
|
-
)}
|
|
194
|
-
|
|
195
|
-
{allResults && allResults.length > 0 && !isOutdated && resultCandidate && (
|
|
196
|
-
<ApplyButton className={classNames(styles.submit, styles.apply)} />
|
|
197
|
-
)}
|
|
198
|
-
</div>
|
|
158
|
+
<MobileControls
|
|
159
|
+
className={styles.controls}
|
|
160
|
+
style={{ maxWidth: maxControlsWidth }}
|
|
161
|
+
onShowResults={onShowResults}
|
|
162
|
+
/>
|
|
199
163
|
)}
|
|
200
164
|
</div>
|
|
201
165
|
</div>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { FunctionComponent, HTMLProps } from 'react';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
selectAreResultsOutdated,
|
|
5
|
+
selectResultCandidate,
|
|
6
|
+
selectSolveError,
|
|
7
|
+
selectSortedResults,
|
|
8
|
+
useTranslate,
|
|
9
|
+
useTypedSelector,
|
|
10
|
+
} from 'state';
|
|
11
|
+
|
|
12
|
+
import EmptyState from '../EmptyState';
|
|
13
|
+
import ResultCandidatePicker from '../ResultCandidatePicker';
|
|
14
|
+
|
|
15
|
+
interface Props extends HTMLProps<HTMLDivElement> {
|
|
16
|
+
onShowResults: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line max-statements
|
|
20
|
+
const MobileControls: FunctionComponent<Props> = ({ onShowResults, ...props }) => {
|
|
21
|
+
const translate = useTranslate();
|
|
22
|
+
const resultCandidate = useTypedSelector(selectResultCandidate);
|
|
23
|
+
const isOutdated = useTypedSelector(selectAreResultsOutdated);
|
|
24
|
+
const allResults = useTypedSelector(selectSortedResults);
|
|
25
|
+
const error = useTypedSelector(selectSolveError);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div {...props}>
|
|
29
|
+
{typeof error !== 'undefined' && (
|
|
30
|
+
<EmptyState variant="error" onClick={onShowResults}>
|
|
31
|
+
{error.message}
|
|
32
|
+
</EmptyState>
|
|
33
|
+
)}
|
|
34
|
+
|
|
35
|
+
{typeof error === 'undefined' && typeof allResults === 'undefined' && (
|
|
36
|
+
<EmptyState variant="info" onClick={onShowResults}>
|
|
37
|
+
{translate('results.empty-state.uninitialized')}
|
|
38
|
+
</EmptyState>
|
|
39
|
+
)}
|
|
40
|
+
|
|
41
|
+
{typeof error === 'undefined' && typeof allResults !== 'undefined' && (
|
|
42
|
+
<>
|
|
43
|
+
{(isOutdated || !resultCandidate) && (
|
|
44
|
+
<EmptyState variant="info" onClick={onShowResults}>
|
|
45
|
+
{translate('results.empty-state.outdated')}
|
|
46
|
+
</EmptyState>
|
|
47
|
+
)}
|
|
48
|
+
|
|
49
|
+
{!isOutdated && allResults.length === 0 && (
|
|
50
|
+
<EmptyState variant="warning" onClick={onShowResults}>
|
|
51
|
+
{translate('results.empty-state.no-results')}
|
|
52
|
+
</EmptyState>
|
|
53
|
+
)}
|
|
54
|
+
|
|
55
|
+
{!isOutdated && allResults.length > 0 && resultCandidate && <ResultCandidatePicker onClick={onShowResults} />}
|
|
56
|
+
</>
|
|
57
|
+
)}
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default MobileControls;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './MobileControls';
|
|
@@ -1,9 +1,51 @@
|
|
|
1
1
|
@import 'styles/mixins';
|
|
2
2
|
|
|
3
3
|
.resultCandidatePicker {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: var(--spacing--l);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.buttons {
|
|
10
|
+
flex: 0 0 auto;
|
|
11
|
+
display: flex;
|
|
12
|
+
border-radius: var(--border--radius);
|
|
13
|
+
box-shadow: var(--box-shadow);
|
|
14
|
+
|
|
15
|
+
@include media('<xs') {
|
|
16
|
+
display: none;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.button {
|
|
21
|
+
padding: var(--spacing--m);
|
|
22
|
+
box-shadow: none;
|
|
23
|
+
|
|
24
|
+
&:focus-within {
|
|
25
|
+
z-index: 1;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:first-child {
|
|
29
|
+
border-right: none;
|
|
30
|
+
border-top-right-radius: 0;
|
|
31
|
+
border-bottom-right-radius: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:last-child {
|
|
35
|
+
border-top-left-radius: 0;
|
|
36
|
+
border-bottom-left-radius: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[dir='rtl'] & {
|
|
40
|
+
transform: rotate(180deg);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.resultCandidate {
|
|
4
45
|
@include button-reset;
|
|
5
46
|
@include focus-effect;
|
|
6
47
|
|
|
48
|
+
flex: 1;
|
|
7
49
|
display: flex;
|
|
8
50
|
align-items: center;
|
|
9
51
|
min-width: 0;
|
|
@@ -15,9 +57,7 @@
|
|
|
15
57
|
cursor: pointer;
|
|
16
58
|
|
|
17
59
|
&[disabled] {
|
|
18
|
-
|
|
19
|
-
box-shadow: none;
|
|
20
|
-
cursor: not-allowed;
|
|
60
|
+
@include disabled;
|
|
21
61
|
}
|
|
22
62
|
}
|
|
23
63
|
|
|
@@ -74,3 +114,7 @@
|
|
|
74
114
|
height: $size;
|
|
75
115
|
color: var(--color--inactive);
|
|
76
116
|
}
|
|
117
|
+
|
|
118
|
+
.apply {
|
|
119
|
+
flex: 0 0 auto;
|
|
120
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { FunctionComponent, HTMLProps } from 'react';
|
|
3
|
+
import { useDispatch } from 'react-redux';
|
|
4
|
+
|
|
5
|
+
import { ChevronDown, ChevronLeft, ChevronRight } from 'icons';
|
|
6
|
+
import {
|
|
7
|
+
resultsSlice,
|
|
8
|
+
selectAreResultsOutdated,
|
|
9
|
+
selectLocale,
|
|
10
|
+
selectResultCandidate,
|
|
11
|
+
selectSortedResults,
|
|
12
|
+
useTypedSelector,
|
|
13
|
+
} from 'state';
|
|
14
|
+
|
|
15
|
+
import Button from '../../../Button';
|
|
16
|
+
import ApplyButton from '../ApplyButton';
|
|
17
|
+
|
|
18
|
+
import styles from './ResultCandidatePicker.module.scss';
|
|
19
|
+
|
|
20
|
+
const ResultCandidatePicker: FunctionComponent<HTMLProps<HTMLDivElement>> = ({ className, ...props }) => {
|
|
21
|
+
const dispatch = useDispatch();
|
|
22
|
+
const locale = useTypedSelector(selectLocale);
|
|
23
|
+
const isOutdated = useTypedSelector(selectAreResultsOutdated);
|
|
24
|
+
const sortedResults = useTypedSelector(selectSortedResults);
|
|
25
|
+
const results = sortedResults || [];
|
|
26
|
+
const resultCandidate = useTypedSelector(selectResultCandidate);
|
|
27
|
+
|
|
28
|
+
if (!resultCandidate) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const index = results.findIndex((result) => result.id === resultCandidate.id);
|
|
33
|
+
const isPreviousDisabled = index <= 0;
|
|
34
|
+
const isNextDisabled = index >= results.length - 1;
|
|
35
|
+
|
|
36
|
+
const handleNextClick = () => {
|
|
37
|
+
if (!isNextDisabled) {
|
|
38
|
+
const nextResult = results[index + 1];
|
|
39
|
+
dispatch(resultsSlice.actions.changeResultCandidate(nextResult));
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const handlePreviousClick = () => {
|
|
44
|
+
if (!isPreviousDisabled) {
|
|
45
|
+
const previousResult = results[index - 1];
|
|
46
|
+
dispatch(resultsSlice.actions.changeResultCandidate(previousResult));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div className={classNames(styles.resultCandidatePicker, className)} {...props}>
|
|
52
|
+
<div className={styles.buttons}>
|
|
53
|
+
<Button
|
|
54
|
+
className={styles.button}
|
|
55
|
+
disabled={isPreviousDisabled}
|
|
56
|
+
Icon={ChevronLeft}
|
|
57
|
+
onClick={handlePreviousClick}
|
|
58
|
+
/>
|
|
59
|
+
<Button className={styles.button} disabled={isNextDisabled} Icon={ChevronRight} onClick={handleNextClick} />
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<button className={styles.resultCandidate} disabled={isOutdated} type="button">
|
|
63
|
+
<div className={styles.points}>{resultCandidate.points.toLocaleString(locale)}</div>
|
|
64
|
+
<div className={styles.word}>{resultCandidate.word}</div>
|
|
65
|
+
<div className={styles.iconContainer}>
|
|
66
|
+
<ChevronDown className={styles.icon} />
|
|
67
|
+
</div>
|
|
68
|
+
</button>
|
|
69
|
+
|
|
70
|
+
<ApplyButton className={styles.apply} />
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default ResultCandidatePicker;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default as ApplyButton } from './ApplyButton';
|
|
2
2
|
export { default as EmptyState } from './EmptyState';
|
|
3
|
+
export { default as MobileControls } from './MobileControls';
|
|
4
|
+
export { default as ResultCandidatePicker } from './ResultCandidatePicker';
|
|
3
5
|
export { default as SolveButton } from './SolveButton';
|
package/src/components/index.ts
CHANGED
|
@@ -16,7 +16,6 @@ export { default as PlainTiles } from './PlainTiles';
|
|
|
16
16
|
export { default as Progress } from './Progress';
|
|
17
17
|
export { default as Rack } from './Rack';
|
|
18
18
|
export { default as Radio } from './Radio';
|
|
19
|
-
export { default as ResultCandidatePicker } from './ResultCandidatePicker';
|
|
20
19
|
export { default as Results } from './Results';
|
|
21
20
|
export { default as ResultsInput } from './ResultsInput';
|
|
22
21
|
export { default as Sizer } from './Sizer';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<!-- https://icons.getbootstrap.com/icons/chevron-left/ -->
|
|
2
|
+
<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z" fill="currentColor" fill-rule="evenodd" />
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<!-- https://icons.getbootstrap.com/icons/chevron-right/ -->
|
|
2
|
+
<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z" fill="currentColor" fill-rule="evenodd" />
|
|
4
|
+
</svg>
|
package/src/icons/index.ts
CHANGED
|
@@ -8,6 +8,8 @@ export { default as Check } from './Check.svg';
|
|
|
8
8
|
export { default as CheckboxChecked } from './CheckboxChecked.svg';
|
|
9
9
|
export { default as CheckboxEmpty } from './CheckboxEmpty.svg';
|
|
10
10
|
export { default as ChevronDown } from './ChevronDown.svg';
|
|
11
|
+
export { default as ChevronLeft } from './ChevronLeft.svg';
|
|
12
|
+
export { default as ChevronRight } from './ChevronRight.svg';
|
|
11
13
|
export { default as Cog } from './Cog.svg';
|
|
12
14
|
export { default as Cross } from './Cross.svg';
|
|
13
15
|
export { default as CrossCircleFill } from './CrossCircleFill.svg';
|
package/src/styles/mixins.scss
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,e,c){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[s,e,c,"static/css/d80ffccf2315791a.css","static/chunks/pages/index-1a6bbb880f28606a.js"],"/404":[s,e,c,"static/chunks/pages/404-7619583a9e7188b1.js"],"/_error":["static/chunks/pages/_error-8353112a01355ec2.js"],sortedPages:["/","/404","/_app","/_error"]}}("static/chunks/490-d29992f1c264d70e.js","static/css/e737d5d7fbed2434.css","static/chunks/144-6768fe9a92865ec8.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|