@scrabble-solver/scrabble-solver 2.10.3 → 2.10.5
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 +13 -13
- 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 +1439 -1658
- package/.next/server/chunks/579.js +50 -26
- 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/api/solve.js +22 -6
- package/.next/server/pages/index.html +2 -2
- package/.next/server/pages/index.js +1509 -52
- 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/WILX-RgqlLTd4ZoPs8C_E/_buildManifest.js +1 -0
- package/.next/static/{FJkPF91uL-OCAJKTTpVSP → WILX-RgqlLTd4ZoPs8C_E}/_ssgManifest.js +0 -0
- package/.next/static/chunks/144-6768fe9a92865ec8.js +1 -0
- package/.next/static/chunks/490-d29992f1c264d70e.js +5 -0
- package/.next/static/chunks/pages/{404-24f9617eeb8d6dc1.js → 404-7619583a9e7188b1.js} +1 -1
- package/.next/static/chunks/pages/_app-fa0661b072fc6af9.js +24 -0
- package/.next/static/chunks/pages/index-1a6bbb880f28606a.js +1 -0
- package/.next/static/css/78e42ad01f580f64.css +1 -0
- package/.next/static/css/d80ffccf2315791a.css +1 -0
- package/.next/static/css/e737d5d7fbed2434.css +1 -0
- package/.next/trace +55 -52
- package/package.json +11 -9
- package/src/components/Badge/Badge.module.scss +4 -5
- package/src/components/Board/BoardPure.tsx +5 -5
- package/src/components/Board/components/Cell/Cell.module.scss +11 -11
- package/src/components/Button/Button.module.scss +34 -40
- package/src/components/Button/Button.tsx +28 -8
- package/src/components/Button/Link.tsx +44 -0
- package/src/components/Dictionary/Dictionary.module.scss +1 -2
- package/src/components/Dictionary/Dictionary.tsx +2 -6
- package/src/components/DictionaryInput/DictionaryInput.module.scss +1 -3
- package/src/components/EmptyState/EmptyState.module.scss +6 -7
- package/src/components/EmptyState/EmptyState.tsx +6 -6
- package/src/components/Key/Key.module.scss +0 -1
- package/src/components/{Splash/Splash.module.scss → LogoSplashScreen/LogoSplashScreen.module.scss} +1 -1
- package/src/components/{Splash/Splash.tsx → LogoSplashScreen/LogoSplashScreen.tsx} +7 -7
- package/src/components/LogoSplashScreen/index.ts +1 -0
- package/src/components/{Sidebar/Sidebar.module.scss → Modal/Modal.module.scss} +25 -20
- package/src/components/{Sidebar/Sidebar.tsx → Modal/Modal.tsx} +9 -9
- package/src/components/{Sidebar → Modal}/components/Section/Section.module.scss +0 -0
- package/src/components/{Sidebar → Modal}/components/Section/Section.tsx +0 -0
- package/src/components/{Sidebar → Modal}/components/Section/index.ts +0 -0
- package/src/components/{Sidebar → Modal}/components/index.ts +0 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/NavButtons/NavButtons.tsx +22 -3
- package/src/components/Progress/Progress.module.scss +9 -0
- package/src/components/Progress/Progress.tsx +38 -0
- package/src/components/Progress/index.ts +1 -0
- package/src/components/Rack/Rack.module.scss +2 -0
- package/src/components/Rack/Rack.tsx +3 -1
- package/src/components/Rack/RackTile.tsx +3 -2
- package/src/components/Radio/Radio.module.scss +2 -2
- package/src/components/ResultCandidatePicker/ResultCandidatePicker.module.scss +76 -0
- package/src/components/ResultCandidatePicker/ResultCandidatePicker.tsx +38 -0
- package/src/components/ResultCandidatePicker/index.ts +1 -0
- package/src/components/Results/Result.tsx +64 -43
- package/src/components/Results/Results.module.scss +9 -16
- package/src/components/Results/Results.tsx +45 -28
- package/src/components/Results/SolveButton.tsx +10 -7
- package/src/components/Results/{getColumns.ts → getLocaleColumns.ts} +2 -2
- package/src/components/Results/types.ts +16 -0
- package/src/components/Results/useColumns.ts +44 -0
- package/src/components/ResultsInput/ResultsInput.module.scss +1 -3
- package/src/components/Sizer/Sizer.module.scss +10 -0
- package/src/components/Sizer/Sizer.tsx +10 -0
- package/src/components/Sizer/index.ts +1 -0
- package/src/components/Solver/Solver.module.scss +83 -27
- package/src/components/Solver/Solver.tsx +158 -25
- package/src/components/Solver/components/ApplyButton/ApplyButton.module.scss +5 -0
- package/src/components/Solver/components/ApplyButton/ApplyButton.tsx +38 -0
- package/src/components/Solver/components/ApplyButton/index.ts +1 -0
- package/src/components/Solver/components/EmptyState/EmptyState.module.scss +59 -0
- package/src/components/Solver/components/EmptyState/EmptyState.tsx +41 -0
- package/src/components/Solver/components/EmptyState/index.ts +1 -0
- package/src/components/Solver/components/SolveButton/SolveButton.module.scss +4 -0
- package/src/components/Solver/components/SolveButton/SolveButton.tsx +43 -0
- package/src/components/Solver/components/SolveButton/index.ts +1 -0
- package/src/components/Solver/components/index.ts +3 -0
- package/src/components/{Screen/Screen.module.scss → SplashScreen/SplashScreen.module.scss} +2 -12
- package/src/components/{Screen/Screen.tsx → SplashScreen/SplashScreen.tsx} +4 -4
- package/src/components/SplashScreen/index.ts +1 -0
- package/src/components/SquareButton/SquareButton.module.scss +3 -3
- package/src/components/SquareButton/SquareButton.tsx +2 -2
- package/src/components/Tile/Tile.module.scss +39 -30
- package/src/components/Tile/Tile.tsx +2 -2
- package/src/components/Tile/TilePure.tsx +9 -5
- package/src/components/Tooltip/Tooltip.module.scss +5 -6
- package/src/components/index.ts +6 -7
- package/src/hooks/index.ts +1 -1
- package/src/hooks/useMediaQuery.ts +11 -0
- package/src/hooks/usePortal.tsx +1 -1
- package/src/i18n/de.json +2 -0
- package/src/i18n/en.json +2 -0
- package/src/i18n/es.json +2 -0
- package/src/i18n/fa.json +2 -0
- package/src/i18n/fr.json +2 -0
- package/src/i18n/pl.json +2 -0
- package/src/icons/CardChecklist.svg +5 -0
- package/src/icons/Check.svg +2 -2
- package/src/icons/ChevronDown.svg +4 -0
- package/src/icons/CrossCircleFill.svg +4 -0
- package/src/icons/{CrossFill.svg → CrossSquareFill.svg} +0 -0
- package/src/icons/ExclamationTriangleFill.svg +4 -0
- package/src/icons/InfoCircleFill.svg +4 -0
- package/src/icons/List.svg +4 -0
- package/src/icons/Search.svg +4 -0
- package/src/icons/index.ts +8 -2
- package/src/{components/KeyMap/KeyMap.tsx → modals/KeyMapModal/KeyMapModal.tsx} +11 -13
- package/src/{components/KeyMap → modals/KeyMapModal}/components/Mapping/Mapping.module.scss +0 -0
- package/src/{components/KeyMap → modals/KeyMapModal}/components/Mapping/Mapping.tsx +0 -0
- package/src/{components/KeyMap → modals/KeyMapModal}/components/Mapping/index.ts +0 -0
- package/src/{components/KeyMap → modals/KeyMapModal}/components/index.ts +0 -0
- package/src/modals/KeyMapModal/index.ts +1 -0
- package/src/{components/KeyMap → modals/KeyMapModal}/keys.tsx +1 -2
- package/src/modals/MenuModal/MenuModal.module.scss +11 -0
- package/src/modals/MenuModal/MenuModal.tsx +56 -0
- package/src/modals/MenuModal/index.ts +1 -0
- package/src/modals/RemainingTilesModal/RemainingTilesModal.module.scss +28 -0
- package/src/{components/RemainingTiles/RemainingTiles.tsx → modals/RemainingTilesModal/RemainingTilesModal.tsx} +14 -12
- package/src/{components/RemainingTiles → modals/RemainingTilesModal/components/Character}/Character.module.scss +7 -3
- package/src/{components/RemainingTiles → modals/RemainingTilesModal/components/Character}/Character.tsx +11 -3
- package/src/modals/RemainingTilesModal/components/Character/index.ts +1 -0
- package/src/modals/RemainingTilesModal/components/index.ts +1 -0
- package/src/modals/RemainingTilesModal/index.ts +1 -0
- package/src/modals/ResultsModal/ResultsModal.module.scss +7 -0
- package/src/modals/ResultsModal/ResultsModal.tsx +58 -0
- package/src/modals/ResultsModal/index.ts +1 -0
- package/src/modals/SettingsModal/SettingsModal.tsx +34 -0
- package/src/{components/Settings → modals/SettingsModal}/components/AutoGroupTilesSetting/AutoGroupTilesSetting.module.scss +0 -0
- package/src/{components/Settings → modals/SettingsModal}/components/AutoGroupTilesSetting/AutoGroupTilesSetting.tsx +1 -2
- package/src/{components/Settings → modals/SettingsModal}/components/AutoGroupTilesSetting/constants.ts +0 -0
- package/src/{components/Settings → modals/SettingsModal}/components/AutoGroupTilesSetting/index.ts +0 -0
- package/src/{components/Settings → modals/SettingsModal}/components/AutoGroupTilesSetting/lib.ts +0 -0
- package/src/{components/Settings → modals/SettingsModal}/components/ConfigSetting/ConfigSetting.module.scss +0 -0
- package/src/{components/Settings → modals/SettingsModal}/components/ConfigSetting/ConfigSetting.tsx +1 -2
- package/src/{components/Settings → modals/SettingsModal}/components/ConfigSetting/index.ts +0 -0
- package/src/{components/Settings → modals/SettingsModal}/components/ConfigSetting/options.ts +0 -0
- package/src/{components/Settings → modals/SettingsModal}/components/ConfigSetting/types.ts +0 -0
- package/src/{components/Settings → modals/SettingsModal}/components/LocaleSetting/LocaleSetting.module.scss +0 -0
- package/src/{components/Settings → modals/SettingsModal}/components/LocaleSetting/LocaleSetting.tsx +1 -2
- package/src/{components/Settings → modals/SettingsModal}/components/LocaleSetting/index.ts +0 -0
- package/src/{components/Settings → modals/SettingsModal}/components/LocaleSetting/options.ts +0 -0
- package/src/{components/Settings → modals/SettingsModal}/components/LocaleSetting/types.ts +0 -0
- package/src/{components/Settings → modals/SettingsModal}/components/index.ts +0 -0
- package/src/modals/SettingsModal/index.ts +1 -0
- package/src/{components/Words/Words.module.scss → modals/WordsModal/WordsModal.module.scss} +7 -1
- package/src/{components/Words/Words.tsx → modals/WordsModal/WordsModal.tsx} +10 -12
- package/src/modals/WordsModal/index.ts +1 -0
- package/src/modals/index.ts +6 -0
- package/src/pages/index.module.scss +6 -4
- package/src/pages/index.tsx +63 -26
- package/src/parameters/index.ts +28 -6
- package/src/state/createAppStore.ts +7 -4
- package/src/styles/mixins.scss +17 -15
- package/src/styles/variables.scss +15 -17
- package/src/types/index.ts +2 -0
- package/tsconfig.json +1 -0
- package/.next/cache/webpack/client-development/7.pack_ +0 -0
- package/.next/static/FJkPF91uL-OCAJKTTpVSP/_buildManifest.js +0 -1
- package/.next/static/chunks/361-d16f336a9752a55a.js +0 -1
- package/.next/static/chunks/724-eb48df4d1ba3df8b.js +0 -5
- package/.next/static/chunks/pages/_app-959e495f0f221247.js +0 -24
- package/.next/static/chunks/pages/index-1e30dafa41bddb80.js +0 -1
- package/.next/static/css/aafd07997120f1e4.css +0 -1
- package/.next/static/css/cb5b206454513f3c.css +0 -1
- package/.next/static/css/eb9d57f7103525ab.css +0 -1
- package/src/components/KeyMap/index.ts +0 -1
- package/src/components/RemainingTiles/RemainingTiles.module.scss +0 -16
- package/src/components/RemainingTiles/index.ts +0 -1
- package/src/components/Screen/index.ts +0 -1
- package/src/components/Settings/Settings.tsx +0 -35
- package/src/components/Settings/index.ts +0 -1
- package/src/components/Sidebar/index.ts +0 -1
- package/src/components/Splash/index.ts +0 -1
- package/src/components/Words/index.ts +0 -1
- package/src/hooks/useIsTablet.ts +0 -10
- package/src/icons/Play.svg +0 -4
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { FunctionComponent, ReactNode, useEffect, useState } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import ReactModal from 'react-modal';
|
|
4
4
|
import { useKey } from 'react-use';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { CrossSquareFill } from 'icons';
|
|
7
7
|
import { TRANSITION_DURATION_LONG } from 'parameters';
|
|
8
8
|
import { useTranslate } from 'state';
|
|
9
9
|
|
|
10
10
|
import SquareButton from '../SquareButton';
|
|
11
11
|
|
|
12
12
|
import { Section } from './components';
|
|
13
|
-
import styles from './
|
|
13
|
+
import styles from './Modal.module.scss';
|
|
14
14
|
|
|
15
15
|
export interface Props {
|
|
16
16
|
children: ReactNode;
|
|
@@ -20,7 +20,7 @@ export interface Props {
|
|
|
20
20
|
onClose: () => void;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const Modal: FunctionComponent<Props> = ({ children, className, isOpen, title, onClose }) => {
|
|
24
24
|
const translate = useTranslate();
|
|
25
25
|
const [shouldReturnFocusAfterClose, setShouldReturnFocusAfterClose] = useState(true);
|
|
26
26
|
|
|
@@ -41,7 +41,7 @@ const Sidebar: FunctionComponent<Props> = ({ children, className, isOpen, title,
|
|
|
41
41
|
}, [isOpen]);
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
|
-
<
|
|
44
|
+
<ReactModal
|
|
45
45
|
className={{
|
|
46
46
|
afterOpen: styles.afterOpen,
|
|
47
47
|
base: styles.modal,
|
|
@@ -54,13 +54,13 @@ const Sidebar: FunctionComponent<Props> = ({ children, className, isOpen, title,
|
|
|
54
54
|
shouldReturnFocusAfterClose={shouldReturnFocusAfterClose}
|
|
55
55
|
onRequestClose={onClose}
|
|
56
56
|
>
|
|
57
|
-
<div className={classNames(styles.
|
|
57
|
+
<div className={classNames(styles.container, className)}>
|
|
58
58
|
<div className={styles.header}>
|
|
59
59
|
<h1 className={styles.title}>{title}</h1>
|
|
60
60
|
|
|
61
61
|
<SquareButton
|
|
62
62
|
className={styles.closeButton}
|
|
63
|
-
Icon={
|
|
63
|
+
Icon={CrossSquareFill}
|
|
64
64
|
tooltip={translate('common.close')}
|
|
65
65
|
onClick={onClose}
|
|
66
66
|
/>
|
|
@@ -68,10 +68,10 @@ const Sidebar: FunctionComponent<Props> = ({ children, className, isOpen, title,
|
|
|
68
68
|
|
|
69
69
|
<div className={styles.content}>{children}</div>
|
|
70
70
|
</div>
|
|
71
|
-
</
|
|
71
|
+
</ReactModal>
|
|
72
72
|
);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
export default Object.assign(
|
|
75
|
+
export default Object.assign(Modal, {
|
|
76
76
|
Section,
|
|
77
77
|
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Modal';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { FunctionComponent } from 'react';
|
|
3
3
|
|
|
4
|
-
import { useIsTouchDevice } from 'hooks';
|
|
5
|
-
import {
|
|
4
|
+
import { useIsTouchDevice, useMediaQuery } from 'hooks';
|
|
5
|
+
import { CardChecklist, Cog, Eraser, Github, Keyboard, List, Sack } from 'icons';
|
|
6
6
|
import { GITHUB_PROJECT_URL } from 'parameters';
|
|
7
7
|
import { selectHasInvalidWords, selectHasOverusedTiles, useTranslate, useTypedSelector } from 'state';
|
|
8
8
|
|
|
@@ -13,6 +13,7 @@ import styles from './NavButtons.module.scss';
|
|
|
13
13
|
interface Props {
|
|
14
14
|
onClear: () => void;
|
|
15
15
|
onShowKeyMap: () => void;
|
|
16
|
+
onShowMenu: () => void;
|
|
16
17
|
onShowRemainingTiles: () => void;
|
|
17
18
|
onShowSettings: () => void;
|
|
18
19
|
onShowWords: () => void;
|
|
@@ -21,6 +22,7 @@ interface Props {
|
|
|
21
22
|
const NavButtons: FunctionComponent<Props> = ({
|
|
22
23
|
onClear,
|
|
23
24
|
onShowKeyMap,
|
|
25
|
+
onShowMenu,
|
|
24
26
|
onShowRemainingTiles,
|
|
25
27
|
onShowSettings,
|
|
26
28
|
onShowWords,
|
|
@@ -29,6 +31,23 @@ const NavButtons: FunctionComponent<Props> = ({
|
|
|
29
31
|
const hasOverusedTiles = useTypedSelector(selectHasOverusedTiles);
|
|
30
32
|
const hasInvalidWords = useTypedSelector(selectHasInvalidWords);
|
|
31
33
|
const isTouchDevice = useIsTouchDevice();
|
|
34
|
+
const isLessThanS = useMediaQuery('<s');
|
|
35
|
+
|
|
36
|
+
if (isLessThanS) {
|
|
37
|
+
return (
|
|
38
|
+
<div className={styles.navButtons}>
|
|
39
|
+
<div className={styles.group}>
|
|
40
|
+
<SquareButton className={styles.button} Icon={Eraser} tooltip={translate('common.clear')} onClick={onClear} />
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div className={styles.separator} />
|
|
44
|
+
|
|
45
|
+
<div className={styles.group}>
|
|
46
|
+
<SquareButton className={styles.button} Icon={List} tooltip={translate('menu')} onClick={onShowMenu} />
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
32
51
|
|
|
33
52
|
return (
|
|
34
53
|
<div className={styles.navButtons}>
|
|
@@ -52,7 +71,7 @@ const NavButtons: FunctionComponent<Props> = ({
|
|
|
52
71
|
className={classNames(styles.button, {
|
|
53
72
|
[styles.error]: hasInvalidWords,
|
|
54
73
|
})}
|
|
55
|
-
Icon={
|
|
74
|
+
Icon={CardChecklist}
|
|
56
75
|
tooltip={translate('words')}
|
|
57
76
|
onClick={onShowWords}
|
|
58
77
|
/>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { FunctionComponent, HTMLProps } from 'react';
|
|
3
|
+
|
|
4
|
+
import { PROGRESS_COLOR_BACKGROUND, PROGRESS_COLOR_VALUE } from 'parameters';
|
|
5
|
+
import { selectLocale, useTypedSelector } from 'state';
|
|
6
|
+
|
|
7
|
+
import styles from './Progress.module.scss';
|
|
8
|
+
|
|
9
|
+
interface Props extends HTMLProps<HTMLDivElement> {
|
|
10
|
+
max: number;
|
|
11
|
+
min?: number;
|
|
12
|
+
value: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const getGradient = (progress: number, color: string, background: string) => {
|
|
16
|
+
const percent = 100 * progress;
|
|
17
|
+
return `linear-gradient(90deg, ${color} 0%, ${color} ${percent}%, ${background} ${percent}%, ${background} 100%)`;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const Progress: FunctionComponent<Props> = ({ className, max, min = 0, style, value, ...props }) => {
|
|
21
|
+
const locale = useTypedSelector(selectLocale);
|
|
22
|
+
const progress = value / (max - min);
|
|
23
|
+
const percent = Math.round(100 * progress);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
{...props}
|
|
28
|
+
className={classNames(styles.progress, className)}
|
|
29
|
+
style={{
|
|
30
|
+
...style,
|
|
31
|
+
backgroundImage: getGradient(progress, PROGRESS_COLOR_VALUE, PROGRESS_COLOR_BACKGROUND),
|
|
32
|
+
}}
|
|
33
|
+
title={`${percent.toLocaleString(locale)}%`}
|
|
34
|
+
/>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default Progress;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Progress';
|
|
@@ -18,9 +18,10 @@ import RackTile from './RackTile';
|
|
|
18
18
|
|
|
19
19
|
interface Props {
|
|
20
20
|
className?: string;
|
|
21
|
+
tileSize: number;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
const Rack: FunctionComponent<Props> = ({ className }) => {
|
|
24
|
+
const Rack: FunctionComponent<Props> = ({ className, tileSize }) => {
|
|
24
25
|
const dispatch = useDispatch();
|
|
25
26
|
const config = useTypedSelector(selectConfig);
|
|
26
27
|
const locale = useTypedSelector(selectLocale);
|
|
@@ -120,6 +121,7 @@ const Rack: FunctionComponent<Props> = ({ className }) => {
|
|
|
120
121
|
index={index}
|
|
121
122
|
inputRef={tilesRefs[index]}
|
|
122
123
|
key={index}
|
|
124
|
+
size={tileSize}
|
|
123
125
|
tile={tile}
|
|
124
126
|
onChange={handleChange}
|
|
125
127
|
onKeyDown={handleKeyDown}
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
import { useDispatch } from 'react-redux';
|
|
14
14
|
|
|
15
15
|
import { createKeyboardNavigation, extractCharacters, extractInputValue, isCtrl } from 'lib';
|
|
16
|
-
import { TILE_SIZE } from 'parameters';
|
|
17
16
|
import {
|
|
18
17
|
rackSlice,
|
|
19
18
|
selectCharacterIsValid,
|
|
@@ -32,6 +31,7 @@ interface Props {
|
|
|
32
31
|
character: string | null;
|
|
33
32
|
index: number;
|
|
34
33
|
inputRef: RefObject<HTMLInputElement>;
|
|
34
|
+
size: number;
|
|
35
35
|
tile: TileModel | null;
|
|
36
36
|
onChange: ChangeEventHandler<HTMLInputElement>;
|
|
37
37
|
onKeyDown: KeyboardEventHandler<HTMLInputElement>;
|
|
@@ -42,6 +42,7 @@ const RackTile: FunctionComponent<Props> = ({
|
|
|
42
42
|
character,
|
|
43
43
|
index,
|
|
44
44
|
inputRef,
|
|
45
|
+
size,
|
|
45
46
|
tile,
|
|
46
47
|
onChange,
|
|
47
48
|
onKeyDown,
|
|
@@ -101,7 +102,7 @@ const RackTile: FunctionComponent<Props> = ({
|
|
|
101
102
|
placeholder={translate('rack.placeholder')[index]}
|
|
102
103
|
points={points}
|
|
103
104
|
raised
|
|
104
|
-
size={
|
|
105
|
+
size={size}
|
|
105
106
|
tabIndex={index === 0 ? undefined : -1}
|
|
106
107
|
onChange={handleChange}
|
|
107
108
|
onFocus={handleFocus}
|
|
@@ -24,7 +24,7 @@ $radio-box-size: $radio-size + 2 * $radio-inner-border;
|
|
|
24
24
|
|
|
25
25
|
&.checked {
|
|
26
26
|
.icon {
|
|
27
|
-
|
|
27
|
+
&::after {
|
|
28
28
|
background-color: var(--color--primary);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -51,7 +51,7 @@ $radio-box-size: $radio-size + 2 * $radio-inner-border;
|
|
|
51
51
|
box-shadow: var(--box-shadow--null);
|
|
52
52
|
pointer-events: none;
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
&::after {
|
|
55
55
|
content: ' ';
|
|
56
56
|
position: absolute;
|
|
57
57
|
top: $radio-inner-border;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
@import 'styles/mixins';
|
|
2
|
+
|
|
3
|
+
.resultCandidatePicker {
|
|
4
|
+
@include button-reset;
|
|
5
|
+
@include focus-effect;
|
|
6
|
+
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
width: 100%;
|
|
11
|
+
border: var(--border);
|
|
12
|
+
border-radius: var(--border--radius);
|
|
13
|
+
background-color: white;
|
|
14
|
+
box-shadow: var(--box-shadow);
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
|
|
17
|
+
&[disabled] {
|
|
18
|
+
opacity: var(--opacity--disabled);
|
|
19
|
+
box-shadow: none;
|
|
20
|
+
cursor: not-allowed;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.content {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
width: 100%;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.points,
|
|
32
|
+
.word {
|
|
33
|
+
padding: var(--spacing--m) var(--spacing--l);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.points {
|
|
37
|
+
flex: 0 0 auto;
|
|
38
|
+
font-weight: bold;
|
|
39
|
+
|
|
40
|
+
[dir='ltr'] & {
|
|
41
|
+
border-right: var(--border);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[dir='rtl'] & {
|
|
45
|
+
border-left: var(--border);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.word {
|
|
50
|
+
@include ellipsis;
|
|
51
|
+
|
|
52
|
+
flex: 1;
|
|
53
|
+
text-transform: uppercase;
|
|
54
|
+
text-align: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.iconContainer {
|
|
58
|
+
flex: 0 0 auto;
|
|
59
|
+
display: flex;
|
|
60
|
+
|
|
61
|
+
[dir='ltr'] & {
|
|
62
|
+
padding-right: var(--spacing--l);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[dir='rtl'] & {
|
|
66
|
+
padding-left: var(--spacing--l);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.icon {
|
|
71
|
+
$size: 20px;
|
|
72
|
+
|
|
73
|
+
width: $size;
|
|
74
|
+
height: $size;
|
|
75
|
+
color: var(--color--inactive);
|
|
76
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { FunctionComponent, HTMLProps } from 'react';
|
|
3
|
+
|
|
4
|
+
import { ChevronDown } from 'icons';
|
|
5
|
+
import { selectAreResultsOutdated, selectLocale, selectResultCandidate, useTypedSelector } from 'state';
|
|
6
|
+
|
|
7
|
+
import styles from './ResultCandidatePicker.module.scss';
|
|
8
|
+
|
|
9
|
+
interface Props extends HTMLProps<HTMLButtonElement> {
|
|
10
|
+
type?: 'button' | 'submit' | 'reset' | undefined;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const ResultCandidatePicker: FunctionComponent<Props> = ({ className, ...props }) => {
|
|
14
|
+
const locale = useTypedSelector(selectLocale);
|
|
15
|
+
const isOutdated = useTypedSelector(selectAreResultsOutdated);
|
|
16
|
+
const resultCandidate = useTypedSelector(selectResultCandidate);
|
|
17
|
+
|
|
18
|
+
if (!resultCandidate) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<button
|
|
24
|
+
className={classNames(styles.resultCandidatePicker, className)}
|
|
25
|
+
disabled={isOutdated}
|
|
26
|
+
type="button"
|
|
27
|
+
{...props}
|
|
28
|
+
>
|
|
29
|
+
<div className={styles.points}>{resultCandidate.points.toLocaleString(locale)}</div>
|
|
30
|
+
<div className={styles.word}>{resultCandidate.word}</div>
|
|
31
|
+
<div className={styles.iconContainer}>
|
|
32
|
+
<ChevronDown className={styles.icon} />
|
|
33
|
+
</div>
|
|
34
|
+
</button>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default ResultCandidatePicker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ResultCandidatePicker';
|
|
@@ -1,49 +1,52 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import { CSSProperties, FocusEventHandler, MouseEventHandler, ReactElement, useRef } from 'react';
|
|
3
3
|
|
|
4
4
|
import { LOCALE_FEATURES } from 'i18n';
|
|
5
|
-
import {
|
|
5
|
+
import { noop } from 'lib';
|
|
6
|
+
import { selectLocale, useTypedSelector } from 'state';
|
|
7
|
+
import { ResultColumn } from 'types';
|
|
6
8
|
|
|
7
9
|
import Cell from './Cell';
|
|
8
10
|
import styles from './Results.module.scss';
|
|
11
|
+
import { ResultData } from './types';
|
|
12
|
+
import useColumns from './useColumns';
|
|
9
13
|
|
|
10
14
|
interface Props {
|
|
15
|
+
data: ResultData;
|
|
11
16
|
index: number;
|
|
12
17
|
style?: CSSProperties;
|
|
13
18
|
}
|
|
14
19
|
|
|
15
|
-
const Result = ({ index, style }: Props): ReactElement => {
|
|
16
|
-
const
|
|
20
|
+
const Result = ({ data, index, style }: Props): ReactElement => {
|
|
21
|
+
const {
|
|
22
|
+
highlightedIndex,
|
|
23
|
+
results,
|
|
24
|
+
onBlur = noop,
|
|
25
|
+
onClick = noop,
|
|
26
|
+
onFocus = noop,
|
|
27
|
+
onMouseEnter = noop,
|
|
28
|
+
onMouseLeave = noop,
|
|
29
|
+
} = data;
|
|
30
|
+
const ref = useRef<HTMLButtonElement>(null);
|
|
17
31
|
const locale = useTypedSelector(selectLocale);
|
|
18
32
|
const { consonants, vowels } = LOCALE_FEATURES[locale];
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
20
|
-
const results = useTypedSelector(selectSortedFilteredResults)!;
|
|
21
33
|
const result = results[index];
|
|
22
34
|
const otherWords = result.words.slice(1).join(' / ').toLocaleUpperCase();
|
|
35
|
+
const columns = useColumns();
|
|
36
|
+
const enabledColumns = Object.fromEntries(columns.map((column) => [column.id, true]));
|
|
23
37
|
|
|
24
|
-
const handleClick = () =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
dispatch(resultsSlice.actions.changeResultCandidate(result));
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const handleMouseLeave = () => {
|
|
33
|
-
dispatch(resultsSlice.actions.changeResultCandidate(null));
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const handleFocus = () => {
|
|
37
|
-
dispatch(resultsSlice.actions.changeResultCandidate(result));
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const handleBlur = () => {
|
|
41
|
-
dispatch(resultsSlice.actions.changeResultCandidate(null));
|
|
42
|
-
};
|
|
38
|
+
const handleClick: MouseEventHandler = (event) => onClick(result, event);
|
|
39
|
+
const handleMouseEnter: MouseEventHandler = (event) => onMouseEnter(result, event);
|
|
40
|
+
const handleMouseLeave: MouseEventHandler = (event) => onMouseLeave(result, event);
|
|
41
|
+
const handleBlur: FocusEventHandler = (event) => onBlur(result, event);
|
|
42
|
+
const handleFocus: FocusEventHandler = (event) => onFocus(result, event);
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
45
|
<button
|
|
46
|
-
className={styles.result
|
|
46
|
+
className={classNames(styles.result, {
|
|
47
|
+
[styles.highlighted]: index === highlightedIndex,
|
|
48
|
+
})}
|
|
49
|
+
ref={ref}
|
|
47
50
|
style={style}
|
|
48
51
|
type="button"
|
|
49
52
|
onBlur={handleBlur}
|
|
@@ -53,24 +56,42 @@ const Result = ({ index, style }: Props): ReactElement => {
|
|
|
53
56
|
onMouseLeave={handleMouseLeave}
|
|
54
57
|
>
|
|
55
58
|
<span className={styles.resultContent}>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
{enabledColumns[ResultColumn.Word] && (
|
|
60
|
+
<Cell
|
|
61
|
+
className={styles.word}
|
|
62
|
+
translationKey="common.word"
|
|
63
|
+
value={`${result.word.toLocaleUpperCase()}${otherWords.length > 0 ? ` (${otherWords})` : ''}`}
|
|
64
|
+
/>
|
|
65
|
+
)}
|
|
66
|
+
|
|
67
|
+
{enabledColumns[ResultColumn.TilesCount] && (
|
|
68
|
+
<Cell className={styles.stat} translationKey="common.tiles" value={result.tilesCount} />
|
|
69
|
+
)}
|
|
70
|
+
|
|
71
|
+
{enabledColumns[ResultColumn.ConsonantsCount] && consonants && (
|
|
63
72
|
<Cell className={styles.stat} translationKey="common.consonants" value={result.consonantsCount} />
|
|
64
73
|
)}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
value={result.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
|
|
75
|
+
{enabledColumns[ResultColumn.VowelsCount] && vowels && (
|
|
76
|
+
<Cell className={styles.stat} translationKey="common.vowels" value={result.vowelsCount} />
|
|
77
|
+
)}
|
|
78
|
+
|
|
79
|
+
{enabledColumns[ResultColumn.BlanksCount] && (
|
|
80
|
+
<Cell className={styles.stat} translationKey="common.blanks" value={result.blanksCount} />
|
|
81
|
+
)}
|
|
82
|
+
|
|
83
|
+
{enabledColumns[ResultColumn.WordsCount] && (
|
|
84
|
+
<Cell
|
|
85
|
+
className={styles.stat}
|
|
86
|
+
translationKey="common.words"
|
|
87
|
+
tooltip={`${result.wordsCount} (${result.words.join(' / ').toLocaleUpperCase()})`}
|
|
88
|
+
value={result.wordsCount}
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
91
|
+
|
|
92
|
+
{enabledColumns[ResultColumn.Points] && (
|
|
93
|
+
<Cell className={styles.points} translationKey="common.points" value={result.points} />
|
|
94
|
+
)}
|
|
74
95
|
</span>
|
|
75
96
|
</button>
|
|
76
97
|
);
|
|
@@ -8,7 +8,6 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
8
8
|
flex-direction: column;
|
|
9
9
|
height: 100%;
|
|
10
10
|
font-family: var(--font--family--title);
|
|
11
|
-
font-size: var(--font--size--s);
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
.emptyState {
|
|
@@ -16,6 +15,7 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
.list {
|
|
18
|
+
flex: 1 1 auto;
|
|
19
19
|
transition: var(--transition);
|
|
20
20
|
|
|
21
21
|
&.outdated {
|
|
@@ -30,8 +30,8 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
30
30
|
align-items: center;
|
|
31
31
|
justify-content: space-between;
|
|
32
32
|
border-bottom: var(--border);
|
|
33
|
-
font-size: var(--font--size--s);
|
|
34
33
|
font-weight: 700;
|
|
34
|
+
overflow: auto;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.headerButton {
|
|
@@ -41,6 +41,7 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
41
41
|
cursor: pointer;
|
|
42
42
|
text-transform: uppercase;
|
|
43
43
|
transition: var(--transition);
|
|
44
|
+
padding: var(--spacing--s) 0;
|
|
44
45
|
|
|
45
46
|
&:focus,
|
|
46
47
|
&:hover {
|
|
@@ -69,7 +70,8 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
69
70
|
font-weight: 400;
|
|
70
71
|
|
|
71
72
|
&:focus,
|
|
72
|
-
&:hover
|
|
73
|
+
&:hover,
|
|
74
|
+
&.highlighted {
|
|
73
75
|
&:not(:disabled) {
|
|
74
76
|
background-color: var(--color--primary);
|
|
75
77
|
color: white;
|
|
@@ -82,10 +84,6 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
82
84
|
align-items: center;
|
|
83
85
|
justify-content: space-between;
|
|
84
86
|
|
|
85
|
-
[dir='rtl'] & {
|
|
86
|
-
flex-direction: row-reverse;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
87
|
.word {
|
|
90
88
|
@include ellipsis;
|
|
91
89
|
}
|
|
@@ -95,7 +93,7 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
95
93
|
display: flex;
|
|
96
94
|
align-items: center;
|
|
97
95
|
justify-content: center;
|
|
98
|
-
padding: var(--spacing--s);
|
|
96
|
+
padding: 0 var(--spacing--s);
|
|
99
97
|
gap: var(--spacing--s);
|
|
100
98
|
|
|
101
99
|
.result &:first-child,
|
|
@@ -150,18 +148,13 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
150
148
|
font-weight: bold;
|
|
151
149
|
}
|
|
152
150
|
|
|
153
|
-
.
|
|
151
|
+
.solveButton {
|
|
154
152
|
display: block;
|
|
155
|
-
margin:
|
|
156
|
-
margin-top: var(--spacing--xxl);
|
|
157
|
-
|
|
158
|
-
@include tablet {
|
|
159
|
-
margin-top: var(--spacing--l);
|
|
160
|
-
}
|
|
153
|
+
margin: var(--spacing--xl) auto 0;
|
|
161
154
|
}
|
|
162
155
|
|
|
163
156
|
.sortIcon {
|
|
164
|
-
$size:
|
|
157
|
+
$size: 19px;
|
|
165
158
|
|
|
166
159
|
flex: 0 0 auto;
|
|
167
160
|
width: $size;
|