@scrabble-solver/scrabble-solver 2.9.2 → 2.10.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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +11 -11
- 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/{429.js → 131.js} +2 -3652
- package/.next/server/chunks/413.js +367 -185
- package/.next/server/chunks/44.js +71 -45
- package/.next/server/chunks/515.js +1135 -504
- package/.next/server/chunks/911.js +96 -2
- 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/_error.js.nft.json +1 -1
- package/.next/server/pages/api/dictionary/[locale]/[word].js +48 -10
- package/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
- package/.next/server/pages/api/dictionary/[locale].js +1 -8
- package/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
- package/.next/server/pages/api/solve.js +62 -49
- package/.next/server/pages/api/solve.js.nft.json +1 -1
- package/.next/server/pages/api/verify.js +2 -9
- package/.next/server/pages/api/verify.js.nft.json +1 -1
- package/.next/server/pages/index.html +4 -8
- package/.next/server/pages/index.js +43 -36
- 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/368-d423e70be6c0c473.js +1 -0
- package/.next/static/chunks/pages/{404-7082923654d5996f.js → 404-932294135c3206dd.js} +1 -1
- package/.next/static/chunks/pages/_app-3f5508a5f544d9eb.js +1 -0
- package/.next/static/chunks/pages/index-8af7a9d7a2cd98a7.js +1 -0
- package/.next/static/css/6b1833fd19d3a74a.css +1 -0
- package/.next/static/css/a6154e4ca046ca13.css +1 -0
- package/.next/static/css/bad53af6f8616677.css +1 -0
- package/.next/static/vscqn7BEtAxJteWSwNnas/_buildManifest.js +1 -0
- package/.next/static/{Ntg-ilwD7GqTIFwRpSaTQ → vscqn7BEtAxJteWSwNnas}/_ssgManifest.js +0 -0
- package/.next/trace +52 -52
- package/package.json +9 -9
- package/src/components/Board/components/Cell/Cell.module.scss +45 -9
- package/src/components/Board/hooks/useGrid.ts +4 -2
- package/src/components/Dictionary/Dictionary.module.scss +8 -1
- package/src/components/EmptyState/EmptyState.tsx +6 -2
- package/src/components/Loading/Loading.tsx +13 -2
- package/src/components/Logo/Logo.svg +62 -0
- package/src/components/Logo/index.ts +1 -1
- package/src/components/NavButtons/NavButtons.module.scss +8 -7
- package/src/components/NavButtons/NavButtons.tsx +35 -28
- package/src/components/PlainTiles/PlainTiles.tsx +7 -1
- package/src/components/PlainTiles/Tile.tsx +4 -3
- package/src/components/Rack/Rack.tsx +4 -2
- package/src/components/Radio/Radio.module.scss +1 -1
- package/src/components/RemainingTiles/Character.tsx +7 -2
- package/src/components/RemainingTiles/RemainingTiles.tsx +28 -20
- package/src/components/Results/Cell.tsx +5 -3
- package/src/components/Results/Result.tsx +8 -3
- package/src/components/Results/Results.module.scss +31 -9
- package/src/components/Results/Results.tsx +6 -2
- package/src/components/Results/getColumns.ts +58 -0
- package/src/components/Settings/components/ConfigSetting/ConfigSetting.module.scss +1 -0
- package/src/components/Settings/components/LocaleSetting/LocaleSetting.module.scss +12 -1
- package/src/components/Settings/components/LocaleSetting/LocaleSetting.tsx +1 -1
- package/src/components/Settings/components/LocaleSetting/options.ts +7 -1
- package/src/components/Sidebar/Sidebar.module.scss +42 -8
- package/src/components/SvgFontCss/SvgFontCss.tsx +8 -7
- package/src/components/SvgFontCss/createCss.ts +11 -0
- package/src/components/SvgFontCss/createStyle.ts +9 -0
- package/src/components/SvgFontCss/createSvg.ts +10 -0
- package/src/components/SvgFontFix/SvgFontFix.module.scss +5 -0
- package/src/components/SvgFontFix/SvgFontFix.tsx +21 -0
- package/src/components/SvgFontFix/index.ts +1 -0
- package/src/components/Tile/Tile.module.scss +10 -2
- package/src/components/Tile/Tile.tsx +4 -0
- package/src/components/Tile/TilePure.tsx +3 -1
- package/src/components/Words/Words.tsx +4 -3
- package/src/components/index.ts +1 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useDirection.ts +22 -0
- package/src/hooks/useLanguage.ts +22 -0
- package/src/i18n/constants.ts +53 -0
- package/src/i18n/fa.json +56 -0
- package/src/i18n/i18n.ts +22 -0
- package/src/i18n/index.ts +2 -20
- package/src/icons/FlagFa.svg +95 -0
- package/src/icons/index.ts +1 -0
- package/src/lib/createComparator.ts +22 -0
- package/src/lib/createKeyComparator.ts +4 -2
- package/src/lib/createStringComparator.ts +5 -0
- package/src/lib/detectLocale.ts +4 -0
- package/src/lib/getRemainingTiles.ts +4 -2
- package/src/lib/getRemainingTilesGroups.ts +48 -23
- package/src/lib/index.ts +2 -2
- package/src/lib/sortResults.ts +11 -9
- package/src/lib/unorderedArraysEqual.ts +3 -2
- package/src/pages/api/verify.ts +1 -1
- package/src/pages/index.module.scss +7 -18
- package/src/pages/index.tsx +10 -2
- package/src/service-worker/routeVerifyRequests.ts +1 -1
- package/src/state/selectors.ts +5 -5
- package/src/styles/global.scss +6 -1
- package/.next/static/Ntg-ilwD7GqTIFwRpSaTQ/_buildManifest.js +0 -1
- package/.next/static/chunks/317-5e5334962dd7c681.js +0 -1
- package/.next/static/chunks/pages/_app-183f598b1d4d480b.js +0 -1
- package/.next/static/chunks/pages/index-b1ffeaddd9fb64b5.js +0 -1
- package/.next/static/css/751e8a14776d05d8.css +0 -1
- package/.next/static/css/ad2a08918868cad8.css +0 -1
- package/.next/static/css/e8de67ad5ea35427.css +0 -1
- package/src/components/Results/constants.ts +0 -42
- package/src/lib/comparator.ts +0 -16
- package/src/lib/stringComparator.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrabble-solver/scrabble-solver",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "Scrabble Solver 2 - App",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16"
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"@kamilmielnik/trie": "^2.0.1",
|
|
32
32
|
"@popperjs/core": "^2.11.6",
|
|
33
33
|
"@reduxjs/toolkit": "^1.8.6",
|
|
34
|
-
"@scrabble-solver/configs": "^2.
|
|
35
|
-
"@scrabble-solver/constants": "^2.
|
|
36
|
-
"@scrabble-solver/dictionaries": "^2.
|
|
37
|
-
"@scrabble-solver/logger": "^2.
|
|
38
|
-
"@scrabble-solver/solver": "^2.
|
|
39
|
-
"@scrabble-solver/types": "^2.
|
|
40
|
-
"@scrabble-solver/word-definitions": "^2.
|
|
34
|
+
"@scrabble-solver/configs": "^2.10.0",
|
|
35
|
+
"@scrabble-solver/constants": "^2.10.0",
|
|
36
|
+
"@scrabble-solver/dictionaries": "^2.10.0",
|
|
37
|
+
"@scrabble-solver/logger": "^2.10.0",
|
|
38
|
+
"@scrabble-solver/solver": "^2.10.0",
|
|
39
|
+
"@scrabble-solver/types": "^2.10.0",
|
|
40
|
+
"@scrabble-solver/word-definitions": "^2.10.0",
|
|
41
41
|
"classnames": "^2.3.2",
|
|
42
42
|
"next": "^12.3.1",
|
|
43
43
|
"normalize.css": "^8.0.1",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"sass": "^1.55.0",
|
|
75
75
|
"workbox-webpack-plugin": "^6.5.4"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "7fd0f6bf536fca88c18ce02e320da71b0c6d6f61"
|
|
78
78
|
}
|
|
@@ -66,6 +66,10 @@ $icon-size: 16px;
|
|
|
66
66
|
&:before {
|
|
67
67
|
font-size: 75%;
|
|
68
68
|
color: white;
|
|
69
|
+
|
|
70
|
+
[lang='fa-IR'] & {
|
|
71
|
+
font-family: 'Open Sans', sans-serif;
|
|
72
|
+
}
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
75
|
|
|
@@ -122,13 +126,20 @@ $icon-size: 16px;
|
|
|
122
126
|
.actions {
|
|
123
127
|
display: none;
|
|
124
128
|
position: absolute;
|
|
125
|
-
left: calc(100% + var(--spacing--s) - #{$icon-size});
|
|
126
129
|
top: -$icon-size;
|
|
127
130
|
z-index: 2;
|
|
128
131
|
transition: var(--transition);
|
|
129
132
|
pointer-events: none;
|
|
130
133
|
box-shadow: var(--box-shadow);
|
|
131
134
|
border-radius: var(--border--radius);
|
|
135
|
+
|
|
136
|
+
[dir='ltr'] & {
|
|
137
|
+
left: calc(100% + var(--spacing--s) - #{$icon-size});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
[dir='rtl'] & {
|
|
141
|
+
right: calc(100% + var(--spacing--s) - #{$icon-size});
|
|
142
|
+
}
|
|
132
143
|
}
|
|
133
144
|
|
|
134
145
|
.action {
|
|
@@ -142,8 +153,6 @@ $icon-size: 16px;
|
|
|
142
153
|
box-sizing: content-box;
|
|
143
154
|
background-color: white;
|
|
144
155
|
border: var(--border);
|
|
145
|
-
border-top-left-radius: var(--border--radius);
|
|
146
|
-
border-bottom-left-radius: var(--border--radius);
|
|
147
156
|
font-size: var(--font--size--m);
|
|
148
157
|
line-height: $icon-size;
|
|
149
158
|
color: var(--color--foreground--secondary);
|
|
@@ -151,14 +160,37 @@ $icon-size: 16px;
|
|
|
151
160
|
cursor: pointer;
|
|
152
161
|
|
|
153
162
|
& + & {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
163
|
+
[dir='ltr'] & {
|
|
164
|
+
border-left: none;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
[dir='rtl'] & {
|
|
168
|
+
border-right: none;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
[dir='ltr'] & {
|
|
173
|
+
&:first-child {
|
|
174
|
+
border-top-left-radius: var(--border--radius);
|
|
175
|
+
border-bottom-left-radius: var(--border--radius);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&:last-child {
|
|
179
|
+
border-top-right-radius: var(--border--radius);
|
|
180
|
+
border-bottom-right-radius: var(--border--radius);
|
|
181
|
+
}
|
|
157
182
|
}
|
|
158
183
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
184
|
+
[dir='rtl'] & {
|
|
185
|
+
&:first-child {
|
|
186
|
+
border-top-right-radius: var(--border--radius);
|
|
187
|
+
border-bottom-right-radius: var(--border--radius);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&:last-child {
|
|
191
|
+
border-top-left-radius: var(--border--radius);
|
|
192
|
+
border-bottom-left-radius: var(--border--radius);
|
|
193
|
+
}
|
|
162
194
|
}
|
|
163
195
|
|
|
164
196
|
&,
|
|
@@ -177,6 +209,10 @@ $icon-size: 16px;
|
|
|
177
209
|
.toggleDirection {
|
|
178
210
|
&.right {
|
|
179
211
|
transform: rotate(-90deg);
|
|
212
|
+
|
|
213
|
+
[dir='rtl'] & {
|
|
214
|
+
transform: rotate(90deg);
|
|
215
|
+
}
|
|
180
216
|
}
|
|
181
217
|
}
|
|
182
218
|
|
|
@@ -235,7 +235,8 @@ const useGrid = (rows: Cell[][]): [State, Actions] => {
|
|
|
235
235
|
if (isCtrl(event)) {
|
|
236
236
|
onDirectionToggle();
|
|
237
237
|
} else {
|
|
238
|
-
|
|
238
|
+
const isRtl = document.body.parentElement?.dir === 'rtl';
|
|
239
|
+
changeActiveIndex(isRtl ? 1 : -1, 0);
|
|
239
240
|
}
|
|
240
241
|
},
|
|
241
242
|
onArrowRight: (event) => {
|
|
@@ -244,7 +245,8 @@ const useGrid = (rows: Cell[][]): [State, Actions] => {
|
|
|
244
245
|
if (isCtrl(event)) {
|
|
245
246
|
onDirectionToggle();
|
|
246
247
|
} else {
|
|
247
|
-
|
|
248
|
+
const isRtl = document.body.parentElement?.dir === 'rtl';
|
|
249
|
+
changeActiveIndex(isRtl ? -1 : 1, 0);
|
|
248
250
|
}
|
|
249
251
|
},
|
|
250
252
|
onArrowUp: (event) => {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { FunctionComponent, ReactNode, useMemo } from 'react';
|
|
3
3
|
|
|
4
|
+
import { LOCALE_FEATURES } from 'i18n';
|
|
4
5
|
import { COLOR_BLUE, COLOR_GREEN, COLOR_RED, COLOR_YELLOW } from 'parameters';
|
|
5
|
-
import { useTranslate } from 'state';
|
|
6
|
+
import { selectLocale, useTranslate, useTypedSelector } from 'state';
|
|
6
7
|
import { Translations } from 'types';
|
|
7
8
|
|
|
8
9
|
import PlainTiles from '../PlainTiles';
|
|
@@ -31,8 +32,11 @@ const COLORS_PER_TYPE: Record<Props['type'], string> = {
|
|
|
31
32
|
|
|
32
33
|
const EmptyState: FunctionComponent<Props> = ({ className, children, type }) => {
|
|
33
34
|
const translate = useTranslate();
|
|
35
|
+
const locale = useTypedSelector(selectLocale);
|
|
36
|
+
const { direction } = LOCALE_FEATURES[locale];
|
|
34
37
|
const title = useMemo(() => translate(TITLE_KEY_PER_TYPE[type]), [translate]);
|
|
35
|
-
const
|
|
38
|
+
const message = direction === 'ltr' ? title : title.split('').reverse().join('');
|
|
39
|
+
const content = useMemo(() => [[message.toUpperCase()]], [title]);
|
|
36
40
|
|
|
37
41
|
return (
|
|
38
42
|
<div className={classNames(styles.emptyState, className)}>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { FunctionComponent, useMemo } from 'react';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { LOCALE_FEATURES } from 'i18n';
|
|
5
|
+
import { selectLocale, useTranslate, useTypedSelector } from 'state';
|
|
5
6
|
|
|
6
7
|
import PlainTiles from '../PlainTiles';
|
|
7
8
|
|
|
@@ -13,9 +14,19 @@ interface Props {
|
|
|
13
14
|
wave?: boolean;
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
const prepareContent = (message: string): string[][] => {
|
|
18
|
+
const uppercased = message.toLocaleUpperCase();
|
|
19
|
+
const parts = uppercased.split(' ');
|
|
20
|
+
return [parts];
|
|
21
|
+
};
|
|
22
|
+
|
|
16
23
|
const Loading: FunctionComponent<Props> = ({ className, wave = true }) => {
|
|
17
24
|
const translate = useTranslate();
|
|
18
|
-
const
|
|
25
|
+
const locale = useTypedSelector(selectLocale);
|
|
26
|
+
const { direction } = LOCALE_FEATURES[locale];
|
|
27
|
+
const translation = translate('common.loading');
|
|
28
|
+
const message = direction === 'ltr' ? translation : translation.split('').reverse().join('');
|
|
29
|
+
const content = useMemo(() => prepareContent(message), [message]);
|
|
19
30
|
|
|
20
31
|
return (
|
|
21
32
|
<div className={classNames(styles.loading, className)}>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<svg viewBox="0 0 682 166" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
|
|
2
|
+
<g transform="rotate(0, 40, 40)">
|
|
3
|
+
<path fill="#efe3ae" d="M 0,0 H 80 V 80 H 0 Z" />
|
|
4
|
+
<path aria-label="S" d="m 51.167969,47.628907 q 0,3.046875 -1.476563,5.296875 -1.476562,2.25 -4.3125,3.46875 -2.8125,1.21875 -6.84375,1.21875 -1.78125,0 -3.492187,-0.234375 -1.6875,-0.234375 -3.257813,-0.679687 -1.546875,-0.46875 -2.953125,-1.148438 v -6.75 q 2.4375,1.078125 5.0625,1.945313 2.625,0.867187 5.203125,0.867187 1.78125,0 2.859375,-0.46875 1.101563,-0.46875 1.59375,-1.289062 0.492188,-0.820313 0.492188,-1.875 0,-1.289063 -0.867188,-2.203125 -0.867187,-0.914063 -2.390625,-1.710938 -1.5,-0.796875 -3.398437,-1.710937 -1.195313,-0.5625 -2.601563,-1.359375 -1.40625,-0.820313 -2.671875,-1.992188 -1.265625,-1.171875 -2.085937,-2.835937 -0.796875,-1.6875 -0.796875,-4.03125 0,-3.070313 1.40625,-5.25 1.40625,-2.179688 4.007812,-3.328125 2.625,-1.171875 6.1875,-1.171875 2.671875,0 5.085938,0.632812 2.4375,0.609375 5.085937,1.78125 l -2.34375,5.648438 q -2.367187,-0.960938 -4.242187,-1.476563 -1.875,-0.539062 -3.820313,-0.539062 -1.359375,0 -2.320312,0.445312 -0.960938,0.421875 -1.453125,1.21875 -0.492188,0.773438 -0.492188,1.804688 0,1.21875 0.703125,2.0625 0.726563,0.820312 2.15625,1.59375 1.453125,0.773437 3.609375,1.804687 2.625,1.242188 4.476563,2.601563 1.875,1.335937 2.882812,3.164062 1.007813,1.804688 1.007813,4.5 z" />
|
|
5
|
+
</g>
|
|
6
|
+
<g transform="rotate(0, 126, 40)">
|
|
7
|
+
<path fill="#c7d8f9" d="m 86,0 h 80 V 80 H 86 Z" />
|
|
8
|
+
<path aria-label="C" d="m 129.57422,28.433595 q -2.08594,0 -3.70313,0.820312 -1.59375,0.796875 -2.69531,2.320313 -1.07812,1.523437 -1.64062,3.679687 -0.5625,2.15625 -0.5625,4.851563 0,3.632812 0.89062,6.210937 0.91406,2.554688 2.8125,3.914063 1.89844,1.335937 4.89844,1.335937 2.08594,0 4.17187,-0.46875 2.10938,-0.46875 4.57032,-1.335937 v 6.09375 q -2.27344,0.9375 -4.47657,1.335937 -2.20312,0.421875 -4.94531,0.421875 -5.29687,0 -8.71875,-2.179687 -3.39844,-2.203125 -5.03906,-6.140625 -1.64063,-3.960938 -1.64063,-9.234375 0,-3.890625 1.05469,-7.125 1.05469,-3.234375 3.09375,-5.601563 2.03906,-2.367187 5.03906,-3.65625 3,-1.289062 6.89063,-1.289062 2.55469,0 5.10937,0.65625 2.57813,0.632812 4.92188,1.757812 l -2.34375,5.90625 q -1.92188,-0.914062 -3.86719,-1.59375 -1.94531,-0.679687 -3.82031,-0.679687 z" />
|
|
9
|
+
</g>
|
|
10
|
+
<g transform="rotate(0, 212, 40)">
|
|
11
|
+
<path fill="#efe3ae" d="m 172,0 h 80 v 80 h -80 z" />
|
|
12
|
+
<path aria-label="R" d="m 210.45312,22.867188 q 4.66407,0 7.6875,1.125 3.04688,1.125 4.52344,3.398438 1.47656,2.273437 1.47656,5.742187 0,2.34375 -0.89062,4.101563 -0.89063,1.757812 -2.34375,2.976562 -1.45313,1.21875 -3.14063,1.992188 l 10.07813,14.929687 h -8.0625 l -8.17969,-13.148437 h -3.86719 v 13.148437 h -7.26562 V 22.867188 Z m -0.51562,5.953125 h -2.20313 v 9.257813 h 2.34375 q 3.60938,0 5.15625,-1.195313 1.57032,-1.21875 1.57032,-3.5625 0,-2.4375 -1.6875,-3.46875 -1.66407,-1.03125 -5.17969,-1.03125 z" />
|
|
13
|
+
</g>
|
|
14
|
+
<g transform="rotate(0, 298, 40)">
|
|
15
|
+
<path fill="#efe3ae" d="m 258,0 h 80 v 80 h -80 z" />
|
|
16
|
+
<path aria-label="A" d="m 306.73047,57.203126 -2.48438,-8.15625 h -12.49218 l -2.48438,8.15625 h -7.82812 l 12.09375,-34.40625 h 8.88281 l 12.14062,34.40625 z m -4.21875,-14.25 -2.48438,-7.96875 q -0.23437,-0.796875 -0.63281,-2.039063 -0.375,-1.265625 -0.77344,-2.554687 -0.375,-1.3125 -0.60937,-2.273438 -0.23438,0.960938 -0.65625,2.390625 -0.39844,1.40625 -0.77344,2.671875 -0.375,1.265625 -0.53906,1.804688 l -2.46094,7.96875 z" />
|
|
17
|
+
</g>
|
|
18
|
+
<g transform="rotate(0, 384, 40)">
|
|
19
|
+
<path fill="#c7d8f9" d="m 344,0 h 80 v 80 h -80 z" />
|
|
20
|
+
<path aria-label="B" d="m 372.1875,22.867188 h 10.66406 q 6.84375,0 10.35938,1.921875 3.51562,1.921875 3.51562,6.75 0,1.945313 -0.63281,3.515625 -0.60938,1.570313 -1.78125,2.578125 -1.17188,1.007813 -2.85938,1.3125 v 0.234375 q 1.71094,0.351563 3.09375,1.21875 1.38282,0.84375 2.20313,2.484375 0.84375,1.617188 0.84375,4.3125 0,3.117188 -1.52344,5.34375 -1.52344,2.226563 -4.35937,3.421875 -2.8125,1.171875 -6.70313,1.171875 H 372.1875 Z m 7.26562,13.570313 h 4.21875 q 3.16407,0 4.38282,-0.984375 1.21875,-1.007813 1.21875,-2.953125 0,-1.96875 -1.45313,-2.8125 -1.42969,-0.867188 -4.54687,-0.867188 h -3.82032 z m 0,5.765625 v 8.929687 h 4.73438 q 3.28125,0 4.57031,-1.265625 1.28906,-1.265625 1.28906,-3.398437 0,-1.265625 -0.5625,-2.226563 -0.5625,-0.960937 -1.89843,-1.5 -1.3125,-0.539062 -3.63282,-0.539062 z" />
|
|
21
|
+
</g>
|
|
22
|
+
<g transform="rotate(0, 470, 40)">
|
|
23
|
+
<path fill="#c7d8f9" d="m 430,0 h 80 v 80 h -80 z" />
|
|
24
|
+
<path aria-label="B" d="m 458.1875,22.867188 h 10.66406 q 6.84375,0 10.35938,1.921875 3.51562,1.921875 3.51562,6.75 0,1.945313 -0.63281,3.515625 -0.60938,1.570313 -1.78125,2.578125 -1.17188,1.007813 -2.85938,1.3125 v 0.234375 q 1.71094,0.351563 3.09375,1.21875 1.38282,0.84375 2.20313,2.484375 0.84375,1.617188 0.84375,4.3125 0,3.117188 -1.52344,5.34375 -1.52344,2.226563 -4.35937,3.421875 -2.8125,1.171875 -6.70313,1.171875 H 458.1875 Z m 7.26562,13.570313 h 4.21875 q 3.16407,0 4.38282,-0.984375 1.21875,-1.007813 1.21875,-2.953125 0,-1.96875 -1.45313,-2.8125 -1.42969,-0.867188 -4.54687,-0.867188 h -3.82032 z m 0,5.765625 v 8.929687 h 4.73438 q 3.28125,0 4.57031,-1.265625 1.28906,-1.265625 1.28906,-3.398437 0,-1.265625 -0.5625,-2.226563 -0.5625,-0.960937 -1.89843,-1.5 -1.3125,-0.539062 -3.63282,-0.539062 z" />
|
|
25
|
+
</g>
|
|
26
|
+
<g transform="rotate(0, 556, 40)">
|
|
27
|
+
<path fill="#efe3ae" d="m 516,0 h 80 v 80 h -80 z" />
|
|
28
|
+
<path aria-label="L" d="M 546.75391,57.132813 V 22.867188 h 7.26562 v 28.265625 h 13.89844 v 6 z" />
|
|
29
|
+
</g>
|
|
30
|
+
<g transform="rotate(0, 642, 40)">
|
|
31
|
+
<path fill="#efe3ae" d="m 602,0 h 80 v 80 h -80 z" />
|
|
32
|
+
<path aria-label="E" d="M 652.60547,57.132813 H 632.87109 V 22.867188 h 19.73438 v 5.953125 h -12.46875 v 7.523438 h 11.60156 v 5.953125 h -11.60156 v 8.835937 h 12.46875 z" />
|
|
33
|
+
</g>
|
|
34
|
+
<g transform="rotate(0, 40, 40)">
|
|
35
|
+
<path fill="#efe3ae" d="m 0,86 h 80 v 80 H 0 Z" />
|
|
36
|
+
<path aria-label="S" d="m 51.320312,133.6289 q 0,3.04688 -1.476562,5.29688 -1.476563,2.25 -4.3125,3.46875 -2.8125,1.21875 -6.84375,1.21875 -1.78125,0 -3.492188,-0.23438 -1.6875,-0.23437 -3.257812,-0.67968 -1.546875,-0.46875 -2.953125,-1.14844 v -6.75 q 2.4375,1.07812 5.0625,1.94531 2.625,0.86719 5.203125,0.86719 1.78125,0 2.859375,-0.46875 1.101562,-0.46875 1.59375,-1.28906 0.492187,-0.82032 0.492187,-1.875 0,-1.28907 -0.867187,-2.20313 -0.867188,-0.91406 -2.390625,-1.71094 -1.5,-0.79687 -3.398438,-1.71093 -1.195312,-0.5625 -2.601562,-1.35938 -1.40625,-0.82031 -2.671875,-1.99219 Q 31,123.83203 30.179687,122.16797 q -0.796875,-1.6875 -0.796875,-4.03125 0,-3.07032 1.40625,-5.25 1.40625,-2.17969 4.007813,-3.32813 2.625,-1.17187 6.1875,-1.17187 2.671875,0 5.085937,0.63281 2.4375,0.60937 5.085938,1.78125 l -2.34375,5.64844 q -2.367188,-0.96094 -4.242188,-1.47657 -1.875,-0.53906 -3.820312,-0.53906 -1.359375,0 -2.320313,0.44531 -0.960937,0.42188 -1.453125,1.21875 -0.492187,0.77344 -0.492187,1.80469 0,1.21875 0.703125,2.0625 0.726562,0.82031 2.15625,1.59375 1.453125,0.77344 3.609375,1.80469 2.625,1.24219 4.476562,2.60156 1.875,1.33594 2.882813,3.16406 1.007812,1.80469 1.007812,4.5 z" />
|
|
37
|
+
</g>
|
|
38
|
+
<g transform="rotate(0, 126, 40)">
|
|
39
|
+
<path fill="#efe3ae" d="m 86,86 h 80 v 80 H 86 Z" />
|
|
40
|
+
<path aria-label="O" d="m 142.3125,125.98828 q 0,3.96094 -0.98438,7.21875 -0.98437,3.23437 -3,5.57812 -1.99218,2.34375 -5.0625,3.60938 -3.07031,1.24219 -7.26562,1.24219 -4.19531,0 -7.26562,-1.24219 -3.07032,-1.26563 -5.08594,-3.60938 -1.99219,-2.34375 -2.97656,-5.60156 -0.98438,-3.25781 -0.98438,-7.24219 0,-5.32031 1.73438,-9.25781 1.75781,-3.96094 5.39062,-6.14062 3.63281,-2.17969 9.23438,-2.17969 5.57812,0 9.16406,2.17969 3.60937,2.17968 5.34375,6.14062 1.75781,3.96094 1.75781,9.30469 z m -25.00781,0 q 0,3.58594 0.89062,6.1875 0.91407,2.57812 2.83594,3.98437 1.92188,1.38282 4.96875,1.38282 3.09375,0 5.01562,-1.38282 1.92188,-1.40625 2.78907,-3.98437 0.89062,-2.60156 0.89062,-6.1875 0,-5.39063 -2.01562,-8.48438 -2.01563,-3.09375 -6.63281,-3.09375 -3.07032,0 -5.01563,1.40625 -1.92187,1.38282 -2.83594,3.98438 -0.89062,2.57812 -0.89062,6.1875 z" />
|
|
41
|
+
</g>
|
|
42
|
+
<g transform="rotate(0, 212, 40)">
|
|
43
|
+
<path fill="#efe3ae" d="m 172,86 h 80 v 80 h -80 z" />
|
|
44
|
+
<path aria-label="L" d="m 202.75391,143.13281 v -34.26563 h 7.26562 v 28.26563 h 13.89844 v 6 z" />
|
|
45
|
+
</g>
|
|
46
|
+
<g transform="rotate(0, 298, 40)">
|
|
47
|
+
<path fill="#f7c2aa" d="m 258,86 h 80 v 80 h -80 z" />
|
|
48
|
+
<path aria-label="V" d="m 313.59766,108.86718 -11.64844,34.26563 h -7.92188 l -11.625,-34.26563 h 7.33594 l 6.44531,20.39063 q 0.16407,0.51562 0.53907,1.94531 0.375,1.40625 0.75,3 0.39843,1.57031 0.53906,2.60156 0.14062,-1.03125 0.49219,-2.60156 0.375,-1.57031 0.72656,-2.97656 0.375,-1.42969 0.53906,-1.96875 l 6.49219,-20.39063 z" />
|
|
49
|
+
</g>
|
|
50
|
+
<g transform="rotate(0, 384, 40)">
|
|
51
|
+
<path fill="#efe3ae" d="m 344,86 h 80 v 80 h -80 z" />
|
|
52
|
+
<path aria-label="E" d="m 394.60547,143.13281 h -19.73438 v -34.26563 h 19.73438 v 5.95313 h -12.46875 v 7.52344 h 11.60156 v 5.95312 h -11.60156 v 8.83594 h 12.46875 z" />
|
|
53
|
+
</g>
|
|
54
|
+
<g transform="rotate(0, 470, 40)">
|
|
55
|
+
<path fill="#efe3ae" d="m 430,86 h 80 v 80 h -80 z" />
|
|
56
|
+
<path aria-label="R" d="m 468.45312,108.86718 q 4.66407,0 7.6875,1.125 3.04688,1.125 4.52344,3.39844 1.47656,2.27344 1.47656,5.74219 0,2.34375 -0.89062,4.10156 -0.89063,1.75781 -2.34375,2.97656 -1.45313,1.21875 -3.14063,1.99219 l 10.07813,14.92969 h -8.0625 l -8.17969,-13.14844 h -3.86719 v 13.14844 h -7.26562 v -34.26563 z m -0.51562,5.95313 h -2.20313 v 9.25781 h 2.34375 q 3.60938,0 5.15625,-1.19531 1.57032,-1.21875 1.57032,-3.5625 0,-2.4375 -1.6875,-3.46875 -1.66407,-1.03125 -5.17969,-1.03125 z" />
|
|
57
|
+
</g>
|
|
58
|
+
<g transform="rotate(0, 642, 40)">
|
|
59
|
+
<path fill="#bae3ba" d="m 602,86 h 80 v 80 h -80 z" />
|
|
60
|
+
<path aria-label="2" d="m 654.15234,143.3789 h -23.95312 v -5.03906 l 8.60156,-8.69531 q 2.60156,-2.67188 4.17188,-4.45313 1.59375,-1.80468 2.29687,-3.28125 0.72656,-1.47656 0.72656,-3.16406 0,-2.03906 -1.14843,-3.04687 -1.125,-1.03125 -3.02344,-1.03125 -1.99219,0 -3.86719,0.91406 -1.875,0.91406 -3.91406,2.60156 l -3.9375,-4.66406 q 1.47656,-1.26563 3.11719,-2.39063 1.66406,-1.125 3.84375,-1.80468 2.20312,-0.70313 5.27343,-0.70313 3.375,0 5.78907,1.21875 2.4375,1.21875 3.75,3.32813 1.3125,2.08593 1.3125,4.73437 0,2.83594 -1.125,5.17969 -1.125,2.34375 -3.28125,4.64062 -2.13282,2.29688 -5.15625,5.08594 l -4.40625,4.14844 v 0.32812 h 14.92968 z" />
|
|
61
|
+
</g>
|
|
62
|
+
</svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './Logo';
|
|
1
|
+
export { default } from './Logo.svg';
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
$size: 32px;
|
|
2
|
-
|
|
3
1
|
.navButtons {
|
|
4
2
|
display: flex;
|
|
5
3
|
align-items: center;
|
|
4
|
+
gap: var(--spacing--l);
|
|
5
|
+
gap: calc(var(--spacing--l) - var(--spacing--xs));
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
.button,
|
|
9
9
|
.separator {
|
|
10
|
-
margin-right: calc(var(--spacing--l) - 2 * var(--spacing--xs));
|
|
11
|
-
|
|
12
10
|
&:last-child {
|
|
13
11
|
margin-right: 0;
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
14
|
|
|
15
|
+
.group {
|
|
16
|
+
display: flex;
|
|
17
|
+
gap: var(--spacing--l);
|
|
18
|
+
}
|
|
19
|
+
|
|
17
20
|
.separator {
|
|
18
|
-
margin-right: calc(var(--spacing--l) - var(--spacing--xs));
|
|
19
|
-
margin-left: var(--spacing--xs);
|
|
20
21
|
border-right: var(--border);
|
|
21
22
|
border-color: var(--color--inactive);
|
|
22
|
-
height:
|
|
23
|
+
height: 32px;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
.error {
|
|
@@ -30,44 +30,51 @@ const NavButtons: FunctionComponent<Props> = ({
|
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
32
|
<div className={styles.navButtons}>
|
|
33
|
-
<
|
|
33
|
+
<div className={styles.group}>
|
|
34
|
+
<SquareButton className={styles.button} Icon={Eraser} tooltip={translate('common.clear')} onClick={onClear} />
|
|
35
|
+
</div>
|
|
34
36
|
|
|
35
37
|
<div className={styles.separator} />
|
|
36
38
|
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
<div className={styles.group}>
|
|
40
|
+
<SquareButton
|
|
41
|
+
className={classNames(styles.button, {
|
|
42
|
+
[styles.error]: hasOverusedTiles,
|
|
43
|
+
})}
|
|
44
|
+
Icon={Sack}
|
|
45
|
+
tooltip={translate('remaining-tiles')}
|
|
46
|
+
onClick={onShowRemainingTiles}
|
|
47
|
+
/>
|
|
45
48
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
<SquareButton
|
|
50
|
+
className={classNames(styles.button, {
|
|
51
|
+
[styles.error]: hasInvalidWords,
|
|
52
|
+
})}
|
|
53
|
+
Icon={BookHalf}
|
|
54
|
+
tooltip={translate('words')}
|
|
55
|
+
onClick={onShowWords}
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
54
58
|
|
|
55
59
|
<div className={styles.separator} />
|
|
56
60
|
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
<div className={styles.group}>
|
|
62
|
+
<SquareButton.Link
|
|
63
|
+
className={styles.button}
|
|
64
|
+
href={GITHUB_PROJECT_URL}
|
|
65
|
+
Icon={Github}
|
|
66
|
+
rel="noopener noreferrer"
|
|
67
|
+
target="_blank"
|
|
68
|
+
tooltip={translate('github')}
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
65
71
|
|
|
66
72
|
<div className={styles.separator} />
|
|
67
73
|
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
<div className={styles.group}>
|
|
75
|
+
<SquareButton className={styles.button} Icon={Keyboard} tooltip={translate('keyMap')} onClick={onShowKeyMap} />
|
|
76
|
+
<SquareButton className={styles.button} Icon={Cog} tooltip={translate('settings')} onClick={onShowSettings} />
|
|
77
|
+
</div>
|
|
71
78
|
</div>
|
|
72
79
|
);
|
|
73
80
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { CSSProperties, FunctionComponent, useMemo } from 'react';
|
|
3
3
|
|
|
4
|
+
import { LOCALE_FEATURES } from 'i18n';
|
|
5
|
+
import { selectLocale, useTypedSelector } from 'state';
|
|
6
|
+
|
|
4
7
|
import SvgFontCss from '../SvgFontCss';
|
|
5
8
|
|
|
6
9
|
import { createPlainTiles, getViewbox } from './lib';
|
|
@@ -18,6 +21,8 @@ interface Props {
|
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
const PlainTiles: FunctionComponent<Props> = ({ className, color, content, dropShadow, showPoints, style, wave }) => {
|
|
24
|
+
const locale = useTypedSelector(selectLocale);
|
|
25
|
+
const { fontFamily } = LOCALE_FEATURES[locale];
|
|
21
26
|
const tiles = useMemo(() => createPlainTiles({ color, content, showPoints }), [color, content, showPoints]);
|
|
22
27
|
|
|
23
28
|
return (
|
|
@@ -30,13 +35,14 @@ const PlainTiles: FunctionComponent<Props> = ({ className, color, content, dropS
|
|
|
30
35
|
viewBox={getViewbox(content)}
|
|
31
36
|
xmlns="http://www.w3.org/2000/svg"
|
|
32
37
|
>
|
|
33
|
-
<SvgFontCss />
|
|
38
|
+
<SvgFontCss fontFamily={fontFamily} />
|
|
34
39
|
|
|
35
40
|
{tiles.map((tile, index) => (
|
|
36
41
|
<Tile
|
|
37
42
|
character={tile.character}
|
|
38
43
|
className={styles.tile}
|
|
39
44
|
color={tile.color}
|
|
45
|
+
fontFamily={fontFamily}
|
|
40
46
|
key={index}
|
|
41
47
|
points={tile.points}
|
|
42
48
|
size={tile.size}
|
|
@@ -4,6 +4,7 @@ interface Props {
|
|
|
4
4
|
character: string;
|
|
5
5
|
className?: string;
|
|
6
6
|
color: string;
|
|
7
|
+
fontFamily: string;
|
|
7
8
|
points?: number;
|
|
8
9
|
size: number;
|
|
9
10
|
transform?: string;
|
|
@@ -11,13 +12,13 @@ interface Props {
|
|
|
11
12
|
y: number;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const Tile: FunctionComponent<Props> = ({ character, className, color, points, size, transform, x, y }) => (
|
|
15
|
+
const Tile: FunctionComponent<Props> = ({ character, className, color, fontFamily, points, size, transform, x, y }) => (
|
|
15
16
|
<g className={className} transform={transform}>
|
|
16
17
|
<rect fill={color} height={size} width={size} x={x} y={y} />
|
|
17
18
|
|
|
18
19
|
<text
|
|
19
20
|
dominantBaseline="central"
|
|
20
|
-
fontFamily=
|
|
21
|
+
fontFamily={fontFamily}
|
|
21
22
|
fontSize={0.6 * size}
|
|
22
23
|
fontWeight="bold"
|
|
23
24
|
textAnchor="middle"
|
|
@@ -30,7 +31,7 @@ const Tile: FunctionComponent<Props> = ({ character, className, color, points, s
|
|
|
30
31
|
{typeof points === 'number' && (
|
|
31
32
|
<text
|
|
32
33
|
dominantBaseline="text-after-edge"
|
|
33
|
-
fontFamily=
|
|
34
|
+
fontFamily={fontFamily}
|
|
34
35
|
fontSize={0.25 * size}
|
|
35
36
|
fontWeight="bold"
|
|
36
37
|
textAnchor="end"
|
|
@@ -73,11 +73,13 @@ const Rack: FunctionComponent<Props> = ({ className }) => {
|
|
|
73
73
|
return createKeyboardNavigation({
|
|
74
74
|
onArrowLeft: (event) => {
|
|
75
75
|
event.preventDefault();
|
|
76
|
-
|
|
76
|
+
const direction = document.body.parentElement?.dir || 'ltr';
|
|
77
|
+
changeActiveIndex(direction === 'ltr' ? -1 : 1);
|
|
77
78
|
},
|
|
78
79
|
onArrowRight: (event) => {
|
|
79
80
|
event.preventDefault();
|
|
80
|
-
|
|
81
|
+
const direction = document.body.parentElement?.dir || 'ltr';
|
|
82
|
+
changeActiveIndex(direction === 'ltr' ? 1 : -1);
|
|
81
83
|
},
|
|
82
84
|
onBackspace: (event) => {
|
|
83
85
|
event.preventDefault();
|
|
@@ -10,6 +10,7 @@ $radio-box-size: $radio-size + 2 * $radio-inner-border;
|
|
|
10
10
|
|
|
11
11
|
display: flex;
|
|
12
12
|
align-items: center;
|
|
13
|
+
gap: var(--spacing--l);
|
|
13
14
|
padding: var(--spacing--m);
|
|
14
15
|
transition: var(--transition);
|
|
15
16
|
cursor: pointer;
|
|
@@ -65,5 +66,4 @@ $radio-box-size: $radio-size + 2 * $radio-inner-border;
|
|
|
65
66
|
|
|
66
67
|
.content {
|
|
67
68
|
flex: 1;
|
|
68
|
-
margin-left: var(--spacing--l);
|
|
69
69
|
}
|
|
@@ -2,8 +2,9 @@ import { BLANK } from '@scrabble-solver/constants';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { FunctionComponent } from 'react';
|
|
4
4
|
|
|
5
|
+
import { LOCALE_FEATURES } from 'i18n';
|
|
5
6
|
import { REMAINING_TILES_TILE_SIZE } from 'parameters';
|
|
6
|
-
import { selectCharacterPoints, useTypedSelector } from 'state';
|
|
7
|
+
import { selectCharacterPoints, selectLocale, useTypedSelector } from 'state';
|
|
7
8
|
import { RemainingTile } from 'types';
|
|
8
9
|
|
|
9
10
|
import Tile from '../Tile';
|
|
@@ -15,9 +16,13 @@ interface Props {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
const Character: FunctionComponent<Props> = ({ tile }) => {
|
|
19
|
+
const locale = useTypedSelector(selectLocale);
|
|
20
|
+
const { direction } = LOCALE_FEATURES[locale];
|
|
18
21
|
const { character, count, usedCount } = tile;
|
|
19
22
|
const remainingCount = count - usedCount;
|
|
20
23
|
const points = useTypedSelector((state) => selectCharacterPoints(state, character));
|
|
24
|
+
const current = direction === 'ltr' ? remainingCount : count;
|
|
25
|
+
const total = direction === 'ltr' ? count : remainingCount;
|
|
21
26
|
|
|
22
27
|
return (
|
|
23
28
|
<div
|
|
@@ -37,7 +42,7 @@ const Character: FunctionComponent<Props> = ({ tile }) => {
|
|
|
37
42
|
size={REMAINING_TILES_TILE_SIZE}
|
|
38
43
|
/>
|
|
39
44
|
<div className={styles.count}>
|
|
40
|
-
{
|
|
45
|
+
{current.toLocaleString(locale)} / {total.toLocaleString(locale)}
|
|
41
46
|
</div>
|
|
42
47
|
</div>
|
|
43
48
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FunctionComponent } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { LOCALE_FEATURES } from 'i18n';
|
|
4
|
+
import { selectLocale, selectRemainingTilesGroups, useTranslate, useTypedSelector } from 'state';
|
|
4
5
|
|
|
5
6
|
import Badge from '../Badge';
|
|
6
7
|
import Sidebar from '../Sidebar';
|
|
@@ -16,29 +17,36 @@ interface Props {
|
|
|
16
17
|
|
|
17
18
|
const RemainingTiles: FunctionComponent<Props> = ({ className, isOpen, onClose }) => {
|
|
18
19
|
const translate = useTranslate();
|
|
20
|
+
const locale = useTypedSelector(selectLocale);
|
|
19
21
|
const groups = useTypedSelector(selectRemainingTilesGroups);
|
|
22
|
+
const { direction } = LOCALE_FEATURES[locale];
|
|
20
23
|
|
|
21
24
|
return (
|
|
22
25
|
<Sidebar className={className} isOpen={isOpen} title={translate('remaining-tiles')} onClose={onClose}>
|
|
23
|
-
{groups.map(({ remainingCount, tiles, translationKey, totalCount }) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
{groups.map(({ remainingCount, tiles, translationKey, totalCount }) => {
|
|
27
|
+
const current = direction === 'ltr' ? remainingCount : totalCount;
|
|
28
|
+
const total = direction === 'ltr' ? totalCount : remainingCount;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Sidebar.Section
|
|
32
|
+
key={translationKey}
|
|
33
|
+
title={
|
|
34
|
+
<span className={styles.title}>
|
|
35
|
+
<span>{translate(translationKey)}</span>
|
|
36
|
+
<Badge className={styles.badge}>
|
|
37
|
+
{current.toLocaleString(locale)} / {total.toLocaleString(locale)}
|
|
38
|
+
</Badge>
|
|
39
|
+
</span>
|
|
40
|
+
}
|
|
41
|
+
>
|
|
42
|
+
<div className={styles.content}>
|
|
43
|
+
{tiles.map((tile) => {
|
|
44
|
+
return <Character key={tile.character} tile={tile} />;
|
|
45
|
+
})}
|
|
46
|
+
</div>
|
|
47
|
+
</Sidebar.Section>
|
|
48
|
+
);
|
|
49
|
+
})}
|
|
42
50
|
</Sidebar>
|
|
43
51
|
);
|
|
44
52
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import { FunctionComponent } from 'react';
|
|
3
3
|
|
|
4
|
-
import { useTranslate } from 'state';
|
|
4
|
+
import { selectLocale, useTranslate, useTypedSelector } from 'state';
|
|
5
5
|
import { TranslationKey } from 'types';
|
|
6
6
|
|
|
7
7
|
import { useTooltip } from '../Tooltip';
|
|
@@ -17,11 +17,13 @@ interface Props {
|
|
|
17
17
|
|
|
18
18
|
const Cell: FunctionComponent<Props> = ({ className, translationKey, tooltip, value }) => {
|
|
19
19
|
const translate = useTranslate();
|
|
20
|
-
const
|
|
20
|
+
const locale = useTypedSelector(selectLocale);
|
|
21
|
+
const formattedValue = value.toLocaleString(locale);
|
|
22
|
+
const triggerProps = useTooltip(`${translate(translationKey)}: ${tooltip || formattedValue}`);
|
|
21
23
|
|
|
22
24
|
return (
|
|
23
25
|
<span className={classNames(styles.cell, className)} {...triggerProps}>
|
|
24
|
-
{
|
|
26
|
+
{formattedValue}
|
|
25
27
|
</span>
|
|
26
28
|
);
|
|
27
29
|
};
|