scrabble-solver 2.13.6 → 2.13.8
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/.nx/cache/d/server-process.json +1 -0
- package/.nx/cache/file-map.json +1293 -1298
- package/.nx/cache/lockfile.hash +1 -1
- package/.nx/cache/nx_files.nxt +0 -0
- package/.nx/cache/parsed-lock-file.json +306 -361
- package/.nx/cache/project-graph.json +316 -382
- package/.nx/workspace-data/file-map.json +2594 -0
- package/.nx/workspace-data/lockfile.hash +1 -0
- package/.nx/workspace-data/parsed-lock-file.json +31666 -0
- package/.nx/workspace-data/project-graph.json +31937 -0
- package/README.md +10 -19
- package/bump-version.js +15 -9
- package/lerna.json +1 -1
- package/package.json +9 -9
- 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 +2 -2
- package/packages/logger/package.json +1 -1
- package/packages/scrabble-solver/.next/BUILD_ID +1 -1
- package/packages/scrabble-solver/.next/build-manifest.json +11 -11
- 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/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/server-production/0.pack +0 -0
- package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack +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/577.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/807.js +1 -1
- package/packages/scrabble-solver/.next/server/chunks/977.js +1 -1
- package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/404.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/500.html +1 -1
- package/packages/scrabble-solver/.next/server/pages/_app.js +1 -1
- package/packages/scrabble-solver/.next/server/pages/_error.js +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/7zESQYo9UAqNh9LV0b7Sd/_buildManifest.js +1 -0
- package/packages/scrabble-solver/.next/static/chunks/{main-6e708370ad13b1f9.js → main-b5b360c6afb66b05.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/{404-129e0943628b6fab.js → 404-63b972b24be99c62.js} +1 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-a2848b7efa6bb6b0.js +17 -0
- package/packages/scrabble-solver/.next/static/chunks/pages/index-7b73be2915cc7099.js +1 -0
- package/packages/scrabble-solver/.next/static/css/6682db14f926d4c7.css +1 -0
- package/packages/scrabble-solver/.next/static/css/b37850c8d5270d91.css +2 -0
- package/packages/scrabble-solver/.next/trace +44 -44
- package/packages/scrabble-solver/package-lock.json +5 -6
- package/packages/scrabble-solver/package.json +11 -12
- package/packages/scrabble-solver/public/service-worker.js +1 -1
- package/packages/scrabble-solver/src/components/Alert/Alert.module.scss +3 -12
- package/packages/scrabble-solver/src/components/Board/Board.module.scss +1 -4
- package/packages/scrabble-solver/src/components/Board/BoardPure.tsx +1 -1
- package/packages/scrabble-solver/src/components/Board/components/Actions/Actions.module.scss +7 -27
- package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.module.scss +5 -32
- package/packages/scrabble-solver/src/components/Board/components/InputPrompt/InputPrompt.module.scss +4 -18
- package/packages/scrabble-solver/src/components/Board/hooks/useBackgroundImage.tsx +15 -4
- package/packages/scrabble-solver/src/components/Board/hooks/useGrid.ts +13 -5
- package/packages/scrabble-solver/src/components/Board/lib/index.ts +0 -1
- package/packages/scrabble-solver/src/components/Button/Button.module.scss +1 -8
- package/packages/scrabble-solver/src/components/Button/Button.tsx +16 -17
- package/packages/scrabble-solver/src/components/Button/Link.tsx +15 -16
- package/packages/scrabble-solver/src/components/Dictionary/Dictionary.module.scss +1 -8
- package/packages/scrabble-solver/src/components/IconButton/IconButton.tsx +8 -8
- package/packages/scrabble-solver/src/components/IconButton/Link.tsx +8 -8
- package/packages/scrabble-solver/src/components/Loading/Loading.module.scss +1 -4
- package/packages/scrabble-solver/src/components/Modal/Modal.module.scss +2 -16
- package/packages/scrabble-solver/src/components/Rack/Rack.module.scss +4 -18
- package/packages/scrabble-solver/src/components/Rack/components/InputPrompt/InputPrompt.module.scss +1 -4
- package/packages/scrabble-solver/src/components/Results/Cell.tsx +4 -5
- package/packages/scrabble-solver/src/components/Results/HeaderButton.tsx +25 -22
- package/packages/scrabble-solver/src/components/Results/Result.tsx +15 -3
- package/packages/scrabble-solver/src/components/Results/Results.module.scss +31 -48
- package/packages/scrabble-solver/src/components/Results/Results.tsx +1 -1
- package/packages/scrabble-solver/src/components/Results/getCoordinatesColumn.ts +15 -0
- package/packages/scrabble-solver/src/components/Results/getLocaleColumns.ts +7 -0
- package/packages/scrabble-solver/src/components/Results/types.ts +1 -0
- package/packages/scrabble-solver/src/components/Results/useColumns.ts +10 -7
- package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.module.scss +9 -40
- package/packages/scrabble-solver/src/components/Tile/Tile.module.scss +6 -26
- package/packages/scrabble-solver/src/components/Tooltip/Tooltip.tsx +28 -0
- package/packages/scrabble-solver/src/components/Tooltip/TooltipContent.tsx +53 -0
- package/packages/scrabble-solver/src/components/Tooltip/TooltipTrigger.tsx +26 -0
- package/packages/scrabble-solver/src/components/Tooltip/context.ts +17 -0
- package/packages/scrabble-solver/src/components/Tooltip/index.ts +1 -1
- package/packages/scrabble-solver/src/components/Tooltip/useTooltip.ts +54 -0
- package/packages/scrabble-solver/src/components/index.ts +1 -2
- package/packages/scrabble-solver/src/hooks/index.ts +0 -1
- package/packages/scrabble-solver/src/i18n/languages/german.json +1 -1
- package/packages/scrabble-solver/src/icons/index.ts +0 -2
- package/packages/scrabble-solver/src/lib/getCoordinates.ts +18 -0
- package/packages/scrabble-solver/src/lib/groupResults.ts +16 -11
- package/packages/scrabble-solver/src/lib/index.ts +2 -1
- package/packages/scrabble-solver/src/lib/sortResults.ts +1 -0
- package/packages/scrabble-solver/src/modals/KeyMapModal/components/Mapping/Mapping.module.scss +2 -2
- package/packages/scrabble-solver/src/modals/MenuModal/MenuModal.module.scss +2 -15
- package/packages/scrabble-solver/src/modals/RemainingTilesModal/RemainingTilesModal.module.scss +1 -7
- package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.module.scss +2 -15
- package/packages/scrabble-solver/src/pages/_app.tsx +5 -1
- package/packages/scrabble-solver/src/parameters/index.ts +1 -0
- package/packages/scrabble-solver/src/styles/mixins.scss +2 -5
- package/packages/scrabble-solver/src/types/index.ts +1 -0
- 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/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/packages/scrabble-solver/.next/static/4GWIKe7khKxREyq3ZamDK/_buildManifest.js +0 -1
- package/packages/scrabble-solver/.next/static/chunks/pages/_app-cccda36d00fa2328.js +0 -17
- package/packages/scrabble-solver/.next/static/chunks/pages/index-caaf20b2488cb10e.js +0 -1
- package/packages/scrabble-solver/.next/static/css/11366b7489cf90ac.css +0 -1
- package/packages/scrabble-solver/.next/static/css/f549d7823f599b8d.css +0 -2
- package/packages/scrabble-solver/src/components/Checkbox/Checkbox.module.scss +0 -45
- package/packages/scrabble-solver/src/components/Checkbox/Checkbox.tsx +0 -38
- package/packages/scrabble-solver/src/components/Checkbox/index.ts +0 -1
- package/packages/scrabble-solver/src/components/Tooltip/useTooltip.tsx +0 -134
- package/packages/scrabble-solver/src/hooks/usePortal.tsx +0 -47
- package/packages/scrabble-solver/src/icons/CheckboxChecked.svg +0 -4
- package/packages/scrabble-solver/src/icons/CheckboxEmpty.svg +0 -4
- package/packages/scrabble-solver/src/lib/canUseDom.ts +0 -3
- /package/packages/scrabble-solver/.next/static/{4GWIKe7khKxREyq3ZamDK → 7zESQYo9UAqNh9LV0b7Sd}/_ssgManifest.js +0 -0
- /package/packages/scrabble-solver/src/{components/Board/lib → lib}/getCoordinate.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ButtonHTMLAttributes, FunctionComponent, ReactNode, SVGAttributes } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Tooltip } from '../Tooltip';
|
|
5
5
|
|
|
6
6
|
import styles from './Button.module.scss';
|
|
7
7
|
import Link from './Link';
|
|
@@ -23,23 +23,22 @@ const Button: FunctionComponent<Props> = ({
|
|
|
23
23
|
variant = 'default',
|
|
24
24
|
...props
|
|
25
25
|
}) => {
|
|
26
|
-
const triggerProps = useTooltip(tooltip, props);
|
|
27
|
-
|
|
28
26
|
return (
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
<Tooltip tooltip={tooltip}>
|
|
28
|
+
<button
|
|
29
|
+
className={classNames(styles.button, className, {
|
|
30
|
+
[styles.default]: variant === 'default',
|
|
31
|
+
[styles.primary]: variant === 'primary',
|
|
32
|
+
})}
|
|
33
|
+
type="button"
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
<span className={styles.content}>
|
|
37
|
+
{Icon && <Icon className={classNames(styles.icon, iconClassName)} />}
|
|
38
|
+
{children && <span className={styles.label}>{children}</span>}
|
|
39
|
+
</span>
|
|
40
|
+
</button>
|
|
41
|
+
</Tooltip>
|
|
43
42
|
);
|
|
44
43
|
};
|
|
45
44
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { AnchorHTMLAttributes, FunctionComponent, ReactNode, SVGAttributes } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Tooltip } from '../Tooltip';
|
|
5
5
|
|
|
6
6
|
import styles from './Button.module.scss';
|
|
7
7
|
|
|
@@ -23,22 +23,21 @@ const Link: FunctionComponent<Props> = ({
|
|
|
23
23
|
variant = 'default',
|
|
24
24
|
...props
|
|
25
25
|
}) => {
|
|
26
|
-
const triggerProps = useTooltip(tooltip, props);
|
|
27
|
-
|
|
28
26
|
return (
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
<Tooltip tooltip={tooltip}>
|
|
28
|
+
<a
|
|
29
|
+
className={classNames(styles.button, className, {
|
|
30
|
+
[styles.default]: variant === 'default',
|
|
31
|
+
[styles.primary]: variant === 'primary',
|
|
32
|
+
})}
|
|
33
|
+
{...props}
|
|
34
|
+
>
|
|
35
|
+
<span className={styles.content}>
|
|
36
|
+
{Icon && <Icon className={classNames(styles.icon, iconClassName)} />}
|
|
37
|
+
{children && <span className={styles.label}>{children}</span>}
|
|
38
|
+
</span>
|
|
39
|
+
</a>
|
|
40
|
+
</Tooltip>
|
|
42
41
|
);
|
|
43
42
|
};
|
|
44
43
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { ButtonHTMLAttributes, FunctionComponent, MouseEventHandler, SVGAttributes } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Tooltip } from '../Tooltip';
|
|
5
5
|
|
|
6
6
|
import styles from './IconButton.module.scss';
|
|
7
7
|
import Link from './Link';
|
|
@@ -15,14 +15,14 @@ interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const IconButton: FunctionComponent<Props> = ({ className, Icon, tooltip, ...props }) => {
|
|
18
|
-
const triggerProps = useTooltip(tooltip, props);
|
|
19
|
-
|
|
20
18
|
return (
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
<Tooltip tooltip={tooltip}>
|
|
20
|
+
<button className={classNames(styles.iconButton, className)} type="button" {...props}>
|
|
21
|
+
<span className={styles.content}>
|
|
22
|
+
<Icon className={styles.icon} />
|
|
23
|
+
</span>
|
|
24
|
+
</button>
|
|
25
|
+
</Tooltip>
|
|
26
26
|
);
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { AnchorHTMLAttributes, FunctionComponent, SVGAttributes } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { Tooltip } from '../Tooltip';
|
|
5
5
|
|
|
6
6
|
import styles from './IconButton.module.scss';
|
|
7
7
|
|
|
@@ -14,14 +14,14 @@ interface Props extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const Link: FunctionComponent<Props> = ({ className, Icon, tooltip, ...props }) => {
|
|
17
|
-
const triggerProps = useTooltip(tooltip, props);
|
|
18
|
-
|
|
19
17
|
return (
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
<Tooltip tooltip={tooltip}>
|
|
19
|
+
<a className={classNames(styles.iconButton, className)} {...props}>
|
|
20
|
+
<span className={styles.content}>
|
|
21
|
+
<Icon className={styles.icon} />
|
|
22
|
+
</span>
|
|
23
|
+
</a>
|
|
24
|
+
</Tooltip>
|
|
25
25
|
);
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -3,14 +3,7 @@
|
|
|
3
3
|
.modal,
|
|
4
4
|
.closeButton {
|
|
5
5
|
top: 0;
|
|
6
|
-
|
|
7
|
-
[dir='ltr'] & {
|
|
8
|
-
right: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
[dir='rtl'] & {
|
|
12
|
-
left: 0;
|
|
13
|
-
}
|
|
6
|
+
inset-inline-end: 0;
|
|
14
7
|
}
|
|
15
8
|
|
|
16
9
|
.modal {
|
|
@@ -92,14 +85,7 @@
|
|
|
92
85
|
.title {
|
|
93
86
|
font-size: var(--font--size--h1);
|
|
94
87
|
font-weight: 300;
|
|
95
|
-
|
|
96
|
-
[dir='ltr'] & {
|
|
97
|
-
padding-right: calc(var(--square-button--size) + var(--spacing--s));
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
[dir='rtl'] & {
|
|
101
|
-
padding-left: calc(var(--square-button--size) + var(--spacing--s));
|
|
102
|
-
}
|
|
88
|
+
padding-inline-end: calc(var(--square-button--size) + var(--spacing--s));
|
|
103
89
|
}
|
|
104
90
|
|
|
105
91
|
.closeButton {
|
|
@@ -77,25 +77,11 @@
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
.sharpLeft {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
border-bottom-left-radius: 0;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
[dir='rtl'] & {
|
|
86
|
-
border-top-right-radius: 0;
|
|
87
|
-
border-bottom-right-radius: 0;
|
|
88
|
-
}
|
|
80
|
+
border-start-start-radius: 0;
|
|
81
|
+
border-end-start-radius: 0;
|
|
89
82
|
}
|
|
90
83
|
|
|
91
84
|
.sharpRight {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
border-bottom-right-radius: 0;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
[dir='rtl'] & {
|
|
98
|
-
border-top-left-radius: 0;
|
|
99
|
-
border-bottom-left-radius: 0;
|
|
100
|
-
}
|
|
85
|
+
border-start-end-radius: 0;
|
|
86
|
+
border-end-end-radius: 0;
|
|
101
87
|
}
|
|
@@ -4,7 +4,7 @@ import { FunctionComponent, ReactNode } from 'react';
|
|
|
4
4
|
import { selectLocale, useTranslate, useTypedSelector } from 'state';
|
|
5
5
|
import { TranslationKey } from 'types';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Tooltip } from '../Tooltip';
|
|
8
8
|
|
|
9
9
|
import styles from './Results.module.scss';
|
|
10
10
|
|
|
@@ -20,12 +20,11 @@ const Cell: FunctionComponent<Props> = ({ children, className, translationKey, t
|
|
|
20
20
|
const translate = useTranslate();
|
|
21
21
|
const locale = useTypedSelector(selectLocale);
|
|
22
22
|
const formattedValue = value.toLocaleString(locale);
|
|
23
|
-
const triggerProps = useTooltip(`${translate(translationKey)}: ${tooltip || formattedValue}`);
|
|
24
23
|
|
|
25
24
|
return (
|
|
26
|
-
<
|
|
27
|
-
{children || formattedValue}
|
|
28
|
-
</
|
|
25
|
+
<Tooltip tooltip={`${translate(translationKey)}: ${tooltip || formattedValue}`}>
|
|
26
|
+
<div className={classNames(styles.cell, className)}>{children || formattedValue}</div>
|
|
27
|
+
</Tooltip>
|
|
29
28
|
);
|
|
30
29
|
};
|
|
31
30
|
|
|
@@ -6,45 +6,48 @@ import { SortDown, SortUp } from 'icons';
|
|
|
6
6
|
import { resultsSlice, selectResultsSort, useTranslate, useTypedSelector } from 'state';
|
|
7
7
|
import { SortDirection } from 'types';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { Tooltip } from '../Tooltip';
|
|
10
10
|
|
|
11
11
|
import styles from './Results.module.scss';
|
|
12
12
|
import { Column } from './types';
|
|
13
13
|
|
|
14
14
|
interface Props {
|
|
15
15
|
column: Column;
|
|
16
|
+
sortable?: boolean;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
const HeaderButton = ({ column }: Props): ReactElement => {
|
|
19
|
+
const HeaderButton = ({ column, sortable }: Props): ReactElement => {
|
|
19
20
|
const dispatch = useDispatch();
|
|
20
21
|
const translate = useTranslate();
|
|
21
22
|
const sort = useTypedSelector(selectResultsSort);
|
|
22
|
-
const triggerProps = useTooltip(translate(column.translationKey));
|
|
23
23
|
|
|
24
24
|
const handleClick = useCallback(() => {
|
|
25
25
|
dispatch(resultsSlice.actions.sort(column.id));
|
|
26
26
|
}, [column.id, dispatch]);
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
29
|
+
<Tooltip tooltip={translate(column.translationKey)}>
|
|
30
|
+
<button
|
|
31
|
+
aria-label={translate(column.translationKey)}
|
|
32
|
+
className={classNames(styles.headerButton, column.className, {
|
|
33
|
+
[styles.sortable]: sortable,
|
|
34
|
+
})}
|
|
35
|
+
key={column.id}
|
|
36
|
+
type="button"
|
|
37
|
+
onClick={sortable ? handleClick : undefined}
|
|
38
|
+
>
|
|
39
|
+
<span className={styles.cell}>
|
|
40
|
+
<span className={styles.headerButtonLabel}>{translate(column.translationKey)}</span>
|
|
41
|
+
|
|
42
|
+
{sort.column === column.id && (
|
|
43
|
+
<>
|
|
44
|
+
{sort.direction === SortDirection.Ascending && <SortUp className={styles.sortIcon} />}
|
|
45
|
+
{sort.direction === SortDirection.Descending && <SortDown className={styles.sortIcon} />}
|
|
46
|
+
</>
|
|
47
|
+
)}
|
|
48
|
+
</span>
|
|
49
|
+
</button>
|
|
50
|
+
</Tooltip>
|
|
48
51
|
);
|
|
49
52
|
};
|
|
50
53
|
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import { CSSProperties, FocusEventHandler, MouseEventHandler, ReactElement, useRef } from 'react';
|
|
2
|
+
import { CSSProperties, FocusEventHandler, MouseEventHandler, ReactElement, useMemo, useRef } from 'react';
|
|
3
3
|
import Highlighter from 'react-highlight-words';
|
|
4
4
|
|
|
5
5
|
import { LOCALE_FEATURES } from 'i18n';
|
|
6
|
-
import { noop } from 'lib';
|
|
7
|
-
import {
|
|
6
|
+
import { getCoordinates, noop } from 'lib';
|
|
7
|
+
import {
|
|
8
|
+
selectIsResultMatching,
|
|
9
|
+
selectLocale,
|
|
10
|
+
selectResultsQuery,
|
|
11
|
+
selectShowCoordinates,
|
|
12
|
+
useTypedSelector,
|
|
13
|
+
} from 'state';
|
|
8
14
|
import { ResultColumn } from 'types';
|
|
9
15
|
|
|
10
16
|
import Cell from './Cell';
|
|
@@ -31,12 +37,14 @@ const Result = ({ data, index, style }: Props): ReactElement => {
|
|
|
31
37
|
const ref = useRef<HTMLButtonElement>(null);
|
|
32
38
|
const columns = useColumns();
|
|
33
39
|
const locale = useTypedSelector(selectLocale);
|
|
40
|
+
const showCoordinates = useTypedSelector(selectShowCoordinates);
|
|
34
41
|
const query = useTypedSelector(selectResultsQuery);
|
|
35
42
|
const { consonants, direction, separator, vowels } = LOCALE_FEATURES[locale];
|
|
36
43
|
const result = results[index];
|
|
37
44
|
const isMatching = useTypedSelector((state) => selectIsResultMatching(state, index));
|
|
38
45
|
const words = direction === 'rtl' ? [...result.words].reverse() : result.words;
|
|
39
46
|
const enabledColumns = Object.fromEntries(columns.map((column) => [column.id, true]));
|
|
47
|
+
const coordinates = useMemo(() => getCoordinates(result, showCoordinates), [result, showCoordinates]);
|
|
40
48
|
|
|
41
49
|
const handleClick: MouseEventHandler = (event) => onClick(result, event);
|
|
42
50
|
const handleMouseEnter: MouseEventHandler = (event) => onMouseEnter(result, event);
|
|
@@ -61,6 +69,10 @@ const Result = ({ data, index, style }: Props): ReactElement => {
|
|
|
61
69
|
onMouseLeave={handleMouseLeave}
|
|
62
70
|
>
|
|
63
71
|
<span className={styles.resultContent}>
|
|
72
|
+
{enabledColumns[ResultColumn.Coordinates] && (
|
|
73
|
+
<Cell className={styles.coordinates} translationKey="settings.showCoordinates" value={coordinates} />
|
|
74
|
+
)}
|
|
75
|
+
|
|
64
76
|
{enabledColumns[ResultColumn.Word] && (
|
|
65
77
|
<Cell className={styles.word} translationKey="common.word" value={result.word}>
|
|
66
78
|
<Highlighter highlightClassName={styles.highlight} searchWords={[query]} textToHighlight={result.word} />
|
|
@@ -24,10 +24,7 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
24
24
|
|
|
25
25
|
.listContainer {
|
|
26
26
|
position: absolute;
|
|
27
|
-
|
|
28
|
-
left: 0;
|
|
29
|
-
right: 0;
|
|
30
|
-
bottom: 0;
|
|
27
|
+
inset: 0;
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
.list {
|
|
@@ -55,37 +52,29 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
55
52
|
|
|
56
53
|
.headerButton {
|
|
57
54
|
@include button-reset;
|
|
58
|
-
@include focus-effect;
|
|
59
55
|
|
|
60
|
-
cursor: pointer;
|
|
61
56
|
text-transform: uppercase;
|
|
62
57
|
transition: var(--transition);
|
|
63
58
|
background-color: var(--color--background);
|
|
64
59
|
|
|
65
|
-
&:focus,
|
|
66
|
-
&:hover {
|
|
67
|
-
background-color: var(--color--primary);
|
|
68
|
-
color: var(--color--primary--opposite);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
60
|
&:first-child {
|
|
72
|
-
|
|
73
|
-
border-top-left-radius: inherit;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
[dir='rtl'] & {
|
|
77
|
-
border-top-right-radius: inherit;
|
|
78
|
-
}
|
|
61
|
+
border-start-start-radius: inherit;
|
|
79
62
|
}
|
|
80
63
|
|
|
81
64
|
&:last-child {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
65
|
+
border-start-end-radius: inherit;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
85
68
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
69
|
+
.sortable {
|
|
70
|
+
@include focus-effect;
|
|
71
|
+
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
|
|
74
|
+
&:focus,
|
|
75
|
+
&:hover {
|
|
76
|
+
background-color: var(--color--primary);
|
|
77
|
+
color: var(--color--primary--opposite);
|
|
89
78
|
}
|
|
90
79
|
}
|
|
91
80
|
|
|
@@ -93,11 +82,7 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
93
82
|
@include ellipsis;
|
|
94
83
|
|
|
95
84
|
flex: 0 1 auto;
|
|
96
|
-
text-align:
|
|
97
|
-
|
|
98
|
-
[dir='rtl'] & {
|
|
99
|
-
text-align: right;
|
|
100
|
-
}
|
|
85
|
+
text-align: start;
|
|
101
86
|
}
|
|
102
87
|
|
|
103
88
|
.result {
|
|
@@ -139,6 +124,7 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
139
124
|
|
|
140
125
|
.word {
|
|
141
126
|
@include ellipsis;
|
|
127
|
+
display: flex;
|
|
142
128
|
}
|
|
143
129
|
}
|
|
144
130
|
|
|
@@ -151,30 +137,20 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
151
137
|
gap: var(--spacing--s);
|
|
152
138
|
line-height: var(--results--item--height);
|
|
153
139
|
|
|
154
|
-
|
|
155
|
-
.headerButton
|
|
140
|
+
&.word,
|
|
141
|
+
.headerButton.word & {
|
|
156
142
|
justify-content: flex-start;
|
|
143
|
+
}
|
|
157
144
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
[dir='rtl'] & {
|
|
164
|
-
padding-right: $row-padding-horizontal;
|
|
165
|
-
text-align: right;
|
|
166
|
-
}
|
|
145
|
+
.result &:first-child,
|
|
146
|
+
.headerButton:first-child & {
|
|
147
|
+
text-align: start;
|
|
148
|
+
padding-inline-start: $row-padding-horizontal;
|
|
167
149
|
}
|
|
168
150
|
|
|
169
151
|
.result &:last-child,
|
|
170
152
|
.headerButton:last-child & {
|
|
171
|
-
|
|
172
|
-
padding-right: $row-padding-horizontal;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
[dir='rtl'] & {
|
|
176
|
-
padding-left: $row-padding-horizontal;
|
|
177
|
-
}
|
|
153
|
+
padding-inline-end: $row-padding-horizontal;
|
|
178
154
|
}
|
|
179
155
|
|
|
180
156
|
&:last-child {
|
|
@@ -203,6 +179,13 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
|
|
|
203
179
|
font-weight: bold;
|
|
204
180
|
}
|
|
205
181
|
|
|
182
|
+
.coordinates {
|
|
183
|
+
$width: 50px;
|
|
184
|
+
|
|
185
|
+
flex: 0 0 $width;
|
|
186
|
+
max-width: $width;
|
|
187
|
+
}
|
|
188
|
+
|
|
206
189
|
.solveButton {
|
|
207
190
|
display: block;
|
|
208
191
|
margin: var(--spacing--xl) auto 0;
|
|
@@ -69,7 +69,7 @@ const Results: FunctionComponent<Props> = ({ callbacks, className, highlightedIn
|
|
|
69
69
|
<div className={classNames(styles.results, className)}>
|
|
70
70
|
<div className={styles.header}>
|
|
71
71
|
{columns.map((column) => (
|
|
72
|
-
<HeaderButton column={column} key={column.id} />
|
|
72
|
+
<HeaderButton column={column} key={column.id} sortable={column.sortable} />
|
|
73
73
|
))}
|
|
74
74
|
</div>
|
|
75
75
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ResultColumn } from 'types';
|
|
2
|
+
|
|
3
|
+
import styles from './Results.module.scss';
|
|
4
|
+
import { Column } from './types';
|
|
5
|
+
|
|
6
|
+
const getCoordinatesColumn = (): Column => {
|
|
7
|
+
return {
|
|
8
|
+
className: styles.coordinates,
|
|
9
|
+
id: ResultColumn.Coordinates,
|
|
10
|
+
translationKey: 'settings.showCoordinates',
|
|
11
|
+
sortable: false,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default getCoordinatesColumn;
|
|
@@ -10,11 +10,13 @@ const getLocaleColumns = (options: { consonants: boolean; vowels: boolean }): Co
|
|
|
10
10
|
className: styles.word,
|
|
11
11
|
id: ResultColumn.Word,
|
|
12
12
|
translationKey: 'common.word',
|
|
13
|
+
sortable: true,
|
|
13
14
|
},
|
|
14
15
|
{
|
|
15
16
|
className: styles.stat,
|
|
16
17
|
id: ResultColumn.TilesCount,
|
|
17
18
|
translationKey: 'common.tiles',
|
|
19
|
+
sortable: true,
|
|
18
20
|
},
|
|
19
21
|
];
|
|
20
22
|
|
|
@@ -23,6 +25,7 @@ const getLocaleColumns = (options: { consonants: boolean; vowels: boolean }): Co
|
|
|
23
25
|
className: styles.stat,
|
|
24
26
|
id: ResultColumn.ConsonantsCount,
|
|
25
27
|
translationKey: 'common.consonants',
|
|
28
|
+
sortable: true,
|
|
26
29
|
});
|
|
27
30
|
}
|
|
28
31
|
|
|
@@ -31,6 +34,7 @@ const getLocaleColumns = (options: { consonants: boolean; vowels: boolean }): Co
|
|
|
31
34
|
className: styles.stat,
|
|
32
35
|
id: ResultColumn.VowelsCount,
|
|
33
36
|
translationKey: 'common.vowels',
|
|
37
|
+
sortable: true,
|
|
34
38
|
});
|
|
35
39
|
}
|
|
36
40
|
|
|
@@ -39,16 +43,19 @@ const getLocaleColumns = (options: { consonants: boolean; vowels: boolean }): Co
|
|
|
39
43
|
className: styles.stat,
|
|
40
44
|
id: ResultColumn.BlanksCount,
|
|
41
45
|
translationKey: 'common.blanks',
|
|
46
|
+
sortable: true,
|
|
42
47
|
},
|
|
43
48
|
{
|
|
44
49
|
className: styles.stat,
|
|
45
50
|
id: ResultColumn.WordsCount,
|
|
46
51
|
translationKey: 'common.words',
|
|
52
|
+
sortable: true,
|
|
47
53
|
},
|
|
48
54
|
{
|
|
49
55
|
className: styles.points,
|
|
50
56
|
id: ResultColumn.Points,
|
|
51
57
|
translationKey: 'common.points',
|
|
58
|
+
sortable: true,
|
|
52
59
|
},
|
|
53
60
|
);
|
|
54
61
|
|