scrabble-solver 2.18.1 → 2.18.3

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.
Files changed (354) hide show
  1. package/.nx/workspace-data/d/server-process.json +2 -2
  2. package/.nx/workspace-data/file-map.json +1721 -1473
  3. package/.nx/workspace-data/lockfile-dependencies.hash +1 -1
  4. package/.nx/workspace-data/lockfile-nodes.hash +1 -1
  5. package/.nx/workspace-data/nx_files.nxt +0 -0
  6. package/.nx/workspace-data/parsed-lock-file.dependencies.json +184 -209
  7. package/.nx/workspace-data/parsed-lock-file.nodes.json +374 -419
  8. package/.nx/workspace-data/project-graph.json +610 -653
  9. package/.nx/workspace-data/source-maps.json +68 -0
  10. package/CLAUDE.md +13 -11
  11. package/README.md +3 -3
  12. package/bun.lock +115 -130
  13. package/e2e/bugs/398-digraphs-in-created-words.spec.ts +2 -2
  14. package/e2e/bugs/445-tile-text-selection.spec.ts +38 -0
  15. package/e2e/bugs/451-results-list-gap-hover.spec.ts +35 -0
  16. package/e2e/bugs/452-stale-translations-cache.spec.ts +32 -0
  17. package/e2e/features/427-highlight-created-words.spec.ts +86 -0
  18. package/e2e/features/430-highlight-unreachable-cells-results.spec.ts +75 -0
  19. package/e2e/features/91-hover-remaining-tile-highlights.spec.ts +22 -0
  20. package/e2e/features/result-candidate-picker.spec.ts +21 -0
  21. package/e2e/features/results-interactions.spec.ts +170 -0
  22. package/e2e/features/words-dictionary-search.spec.ts +36 -0
  23. package/e2e/features/words-empty-state.spec.ts +42 -0
  24. package/e2e/features/words-interactions.spec.ts +179 -0
  25. package/e2e/features/words-preview.spec.ts +140 -0
  26. package/e2e/features/words-table-filtering.spec.ts +22 -0
  27. package/e2e/features/words-table-sorting.spec.ts +33 -0
  28. package/e2e/lib/actions.ts +76 -6
  29. package/e2e/lib/selectors.ts +40 -3
  30. package/lerna.json +1 -1
  31. package/package.json +10 -10
  32. package/packages/configs/build/games/index.d.ts +1 -0
  33. package/packages/configs/build/games/index.js +1 -0
  34. package/packages/configs/build/games/wyrazy.d.ts +19 -0
  35. package/packages/configs/build/games/wyrazy.js +73 -0
  36. package/packages/configs/build/languages/polish.d.ts +1 -0
  37. package/packages/configs/build/languages/polish.js +39 -1
  38. package/packages/configs/package.json +5 -4
  39. package/packages/configs/src/games/index.ts +1 -0
  40. package/packages/configs/src/games/wyrazy.ts +71 -0
  41. package/packages/configs/src/languages/polish.ts +40 -1
  42. package/packages/constants/package.json +1 -1
  43. package/packages/dictionaries/package.json +4 -4
  44. package/packages/logger/package.json +1 -1
  45. package/packages/logger/scripts/stats.js +52 -31
  46. package/packages/scrabble-solver/.next/BUILD_ID +1 -1
  47. package/packages/scrabble-solver/.next/build-manifest.json +14 -14
  48. package/packages/scrabble-solver/.next/cache/.previewinfo +1 -1
  49. package/packages/scrabble-solver/.next/cache/.rscinfo +1 -1
  50. package/packages/scrabble-solver/.next/cache/.tsbuildinfo +1 -1
  51. package/packages/scrabble-solver/.next/cache/webpack/client-production/0.pack +0 -0
  52. package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack +0 -0
  53. package/packages/scrabble-solver/.next/cache/webpack/client-production/index.pack.old +0 -0
  54. package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack +0 -0
  55. package/packages/scrabble-solver/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
  56. package/packages/scrabble-solver/.next/cache/webpack/server-production/0.pack +0 -0
  57. package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack +0 -0
  58. package/packages/scrabble-solver/.next/cache/webpack/server-production/index.pack.old +0 -0
  59. package/packages/scrabble-solver/.next/diagnostics/framework.json +1 -1
  60. package/packages/scrabble-solver/.next/dynamic-css-manifest.json +2 -2
  61. package/packages/scrabble-solver/.next/prerender-manifest.json +4 -4
  62. package/packages/scrabble-solver/.next/react-loadable-manifest.json +37 -37
  63. package/packages/scrabble-solver/.next/routes-manifest.json +1 -1
  64. package/packages/scrabble-solver/.next/server/chunks/309.js +1 -1
  65. package/packages/scrabble-solver/.next/server/chunks/344.js +1 -1
  66. package/packages/scrabble-solver/.next/server/chunks/371.js +1 -1
  67. package/packages/scrabble-solver/.next/server/chunks/392.js +1 -1
  68. package/packages/scrabble-solver/.next/server/chunks/465.js +1 -1
  69. package/packages/scrabble-solver/.next/server/chunks/546.js +1 -1
  70. package/packages/scrabble-solver/.next/server/chunks/641.js +1 -1
  71. package/packages/scrabble-solver/.next/server/chunks/67.js +1 -0
  72. package/packages/scrabble-solver/.next/server/chunks/712.js +1 -1
  73. package/packages/scrabble-solver/.next/server/chunks/812.js +1 -1
  74. package/packages/scrabble-solver/.next/server/chunks/846.js +1 -1
  75. package/packages/scrabble-solver/.next/server/chunks/886.js +1 -1
  76. package/packages/scrabble-solver/.next/server/chunks/942.js +1 -0
  77. package/packages/scrabble-solver/.next/server/chunks/953.js +1 -1
  78. package/packages/scrabble-solver/.next/server/chunks/961.js +1 -1
  79. package/packages/scrabble-solver/.next/server/dynamic-css-manifest.js +1 -1
  80. package/packages/scrabble-solver/.next/server/middleware-build-manifest.js +1 -1
  81. package/packages/scrabble-solver/.next/server/middleware-react-loadable-manifest.js +1 -1
  82. package/packages/scrabble-solver/.next/server/pages/404.html +3 -3
  83. package/packages/scrabble-solver/.next/server/pages/500.html +3 -3
  84. package/packages/scrabble-solver/.next/server/pages/_app.js +1 -1
  85. package/packages/scrabble-solver/.next/server/pages/_app.js.nft.json +1 -1
  86. package/packages/scrabble-solver/.next/server/pages/_document.js +2 -2
  87. package/packages/scrabble-solver/.next/server/pages/_document.js.nft.json +1 -1
  88. package/packages/scrabble-solver/.next/server/pages/_error.js +1 -1
  89. package/packages/scrabble-solver/.next/server/pages/_error.js.nft.json +1 -1
  90. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js +1 -1
  91. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale]/[word].js.nft.json +1 -1
  92. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js +1 -1
  93. package/packages/scrabble-solver/.next/server/pages/api/dictionary/[locale].js.nft.json +1 -1
  94. package/packages/scrabble-solver/.next/server/pages/api/solve.js +1 -1
  95. package/packages/scrabble-solver/.next/server/pages/api/solve.js.nft.json +1 -1
  96. package/packages/scrabble-solver/.next/server/pages/api/verify.js +1 -1
  97. package/packages/scrabble-solver/.next/server/pages/api/verify.js.nft.json +1 -1
  98. package/packages/scrabble-solver/.next/server/pages/index.html +3 -3
  99. package/packages/scrabble-solver/.next/server/pages/index.js +4 -4
  100. package/packages/scrabble-solver/.next/server/pages/index.js.nft.json +1 -1
  101. package/packages/scrabble-solver/.next/server/pages/index.json +1 -1
  102. package/packages/scrabble-solver/.next/server/pages/not-found.html +3 -3
  103. package/packages/scrabble-solver/.next/server/pages/not-found.js.nft.json +1 -1
  104. package/packages/scrabble-solver/.next/server/pages-manifest.json +1 -1
  105. package/packages/scrabble-solver/.next/static/{5KOWzYqfY1Z2rjrzptr8D → 8WnIUTe-yJvPD6stltvYI}/_buildManifest.js +1 -1
  106. package/packages/scrabble-solver/.next/static/chunks/100.305bdf9c75b1758f.js +1 -0
  107. package/packages/scrabble-solver/.next/static/chunks/256.6a20b23a766cfebd.js +1 -0
  108. package/packages/scrabble-solver/.next/static/chunks/{307.67f52f13e3d60d4e.js → 307.89e6100f58443679.js} +1 -1
  109. package/packages/scrabble-solver/.next/static/chunks/{363.01eed3233f92b6a4.js → 363.cec65b1f9668a75e.js} +1 -1
  110. package/packages/scrabble-solver/.next/static/chunks/{422.1559ae6756912ca5.js → 422.3e55b4c94e328701.js} +1 -1
  111. package/packages/scrabble-solver/.next/static/chunks/{663.d2c9ca36b26695b8.js → 663.bd2c45413fbca518.js} +1 -1
  112. package/packages/scrabble-solver/.next/static/chunks/693.677c88e0eb1340b5.js +1 -0
  113. package/packages/scrabble-solver/.next/static/chunks/{820.97b82f751ca49579.js → 820.823e9e885ebb66af.js} +1 -1
  114. package/packages/scrabble-solver/.next/static/chunks/827.c81b92b383a748c9.js +1 -0
  115. package/packages/scrabble-solver/.next/static/chunks/{865.a9b563a45848a83c.js → 865.59baba8296c9b116.js} +1 -1
  116. package/packages/scrabble-solver/.next/static/chunks/912.077603e4f0bc6cca.js +1 -0
  117. package/packages/scrabble-solver/.next/static/chunks/{939.19b33a3d3c351d73.js → 939.2ad86b50405c7897.js} +1 -1
  118. package/packages/scrabble-solver/.next/static/chunks/980.7ce17464fc56648a.js +1 -0
  119. package/packages/scrabble-solver/.next/static/chunks/{main-b92e08f3fc96dd8d.js → main-7e52da35a4beea0b.js} +1 -1
  120. package/packages/scrabble-solver/.next/static/chunks/pages/_app-e3fe880e24c024ab.js +1 -0
  121. package/packages/scrabble-solver/.next/static/chunks/pages/index-b073a1686818dd26.js +1 -0
  122. package/packages/scrabble-solver/.next/static/chunks/webpack-d7138f1ef6b8c9d6.js +1 -0
  123. package/packages/scrabble-solver/.next/static/css/65bcc9440e067113.css +1 -0
  124. package/packages/scrabble-solver/.next/static/css/{4dbcacc1122ac6b9.css → 92f85ce358a0a468.css} +1 -1
  125. package/packages/scrabble-solver/.next/static/css/a691348b788f8bc0.css +1 -0
  126. package/packages/scrabble-solver/.next/static/css/cd4d7f2458487399.css +1 -0
  127. package/packages/scrabble-solver/.next/trace +22 -21
  128. package/packages/scrabble-solver/.next/trace-build +1 -1
  129. package/packages/scrabble-solver/AGENTS.md +9 -0
  130. package/packages/scrabble-solver/CLAUDE.md +1 -0
  131. package/packages/scrabble-solver/package.json +13 -11
  132. package/packages/scrabble-solver/public/llms.txt +1 -1
  133. package/packages/scrabble-solver/public/service-worker.js +1 -1
  134. package/packages/scrabble-solver/src/components/Board/Board.tsx +3 -1
  135. package/packages/scrabble-solver/src/components/Board/BoardPure.tsx +26 -20
  136. package/packages/scrabble-solver/src/components/Board/components/Cell/Cell.tsx +4 -4
  137. package/packages/scrabble-solver/src/components/Board/lib.test.ts +106 -0
  138. package/packages/scrabble-solver/src/components/Board/lib.ts +34 -3
  139. package/packages/scrabble-solver/src/components/Board/selectors.ts +17 -5
  140. package/packages/scrabble-solver/src/components/Button/Button.module.scss +1 -1
  141. package/packages/scrabble-solver/src/components/Modal/Modal.module.scss +0 -4
  142. package/packages/scrabble-solver/src/components/Results/Header.tsx +30 -5
  143. package/packages/scrabble-solver/src/components/Results/Result.tsx +45 -55
  144. package/packages/scrabble-solver/src/components/Results/Results.module.scss +0 -126
  145. package/packages/scrabble-solver/src/components/Results/Results.module.scss.d.ts +0 -10
  146. package/packages/scrabble-solver/src/components/Results/Results.tsx +25 -5
  147. package/packages/scrabble-solver/src/components/Solver/Solver.module.scss +4 -4
  148. package/packages/scrabble-solver/src/components/Solver/Solver.tsx +5 -3
  149. package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.module.scss +5 -1
  150. package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.module.scss.d.ts +1 -0
  151. package/packages/scrabble-solver/src/components/Solver/components/ResultCandidatePicker/ResultCandidatePicker.tsx +5 -2
  152. package/packages/scrabble-solver/src/components/Table/Cell.tsx +42 -0
  153. package/packages/scrabble-solver/src/components/Table/Header.tsx +11 -0
  154. package/packages/scrabble-solver/src/components/{Results → Table}/HeaderButton.tsx +22 -14
  155. package/packages/scrabble-solver/src/components/Table/Row.tsx +59 -0
  156. package/packages/scrabble-solver/src/components/{ResultsInput/ResultsInput.tsx → Table/Search.tsx} +9 -11
  157. package/packages/scrabble-solver/src/components/Table/Table.module.scss +147 -0
  158. package/packages/scrabble-solver/src/components/Table/Table.module.scss.d.ts +19 -0
  159. package/packages/scrabble-solver/src/components/Table/index.ts +5 -0
  160. package/packages/scrabble-solver/src/components/Tile/Tile.module.scss +2 -1
  161. package/packages/scrabble-solver/src/hooks/useColumns.ts +7 -5
  162. package/packages/scrabble-solver/src/hooks/useIsCompactLayout.ts +14 -0
  163. package/packages/scrabble-solver/src/i18n/languages/english.json +6 -1
  164. package/packages/scrabble-solver/src/i18n/languages/french.json +6 -1
  165. package/packages/scrabble-solver/src/i18n/languages/german.json +6 -1
  166. package/packages/scrabble-solver/src/i18n/languages/persian.json +6 -1
  167. package/packages/scrabble-solver/src/i18n/languages/polish.json +6 -1
  168. package/packages/scrabble-solver/src/i18n/languages/romanian.json +6 -1
  169. package/packages/scrabble-solver/src/i18n/languages/spanish.json +6 -1
  170. package/packages/scrabble-solver/src/i18n/languages/turkish.json +6 -1
  171. package/packages/scrabble-solver/src/icons/QuestionSquare.svg +5 -0
  172. package/packages/scrabble-solver/src/lib/createCoordinatesComparator.ts +23 -0
  173. package/packages/scrabble-solver/src/lib/createKeyComparator.ts +1 -4
  174. package/packages/scrabble-solver/src/lib/createSortComparator.ts +22 -0
  175. package/packages/scrabble-solver/src/lib/getCoordinates.test.ts +21 -0
  176. package/packages/scrabble-solver/src/lib/getCoordinates.ts +16 -0
  177. package/packages/scrabble-solver/src/lib/getNextSort.ts +12 -0
  178. package/packages/scrabble-solver/src/modals/RemainingTilesModal/RemainingTilesModal.tsx +3 -1
  179. package/packages/scrabble-solver/src/modals/RemainingTilesModal/components/Character/Character.tsx +8 -9
  180. package/packages/scrabble-solver/src/modals/ResultsModal/ResultsModal.tsx +14 -10
  181. package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.module.scss +16 -27
  182. package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.module.scss.d.ts +3 -6
  183. package/packages/scrabble-solver/src/modals/WordsModal/WordsModal.tsx +56 -42
  184. package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordRow.tsx +92 -0
  185. package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.module.scss +69 -0
  186. package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.module.scss.d.ts +16 -0
  187. package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/WordsTable.tsx +137 -0
  188. package/packages/scrabble-solver/src/modals/WordsModal/components/WordsTable/index.ts +1 -0
  189. package/packages/scrabble-solver/src/modals/WordsModal/components/index.ts +1 -0
  190. package/packages/scrabble-solver/src/pages/api/verify.ts +7 -6
  191. package/packages/scrabble-solver/src/pages/index.tsx +29 -4
  192. package/packages/scrabble-solver/src/parameters/index.ts +2 -0
  193. package/packages/scrabble-solver/src/sdk/verify.ts +3 -2
  194. package/packages/scrabble-solver/src/solver-worker/client.test.ts +10 -3
  195. package/packages/scrabble-solver/src/solver-worker/index.worker.ts +7 -7
  196. package/packages/scrabble-solver/src/solver-worker/messages.ts +3 -3
  197. package/packages/scrabble-solver/src/state/hoveredWord/index.ts +4 -0
  198. package/packages/scrabble-solver/src/state/hoveredWord/initialState.ts +5 -0
  199. package/packages/scrabble-solver/src/state/hoveredWord/selectors.ts +5 -0
  200. package/packages/scrabble-solver/src/state/hoveredWord/slice.ts +18 -0
  201. package/packages/scrabble-solver/src/state/hoveredWord/types.ts +5 -0
  202. package/packages/scrabble-solver/src/state/index.ts +1 -0
  203. package/packages/scrabble-solver/src/state/localStorage.ts +13 -2
  204. package/packages/scrabble-solver/src/state/results/lib.ts +9 -26
  205. package/packages/scrabble-solver/src/state/results/selectors.ts +9 -1
  206. package/packages/scrabble-solver/src/state/results/slice.ts +4 -16
  207. package/packages/scrabble-solver/src/state/sagas.ts +26 -1
  208. package/packages/scrabble-solver/src/state/selectors.ts +18 -1
  209. package/packages/scrabble-solver/src/state/store.ts +2 -0
  210. package/packages/scrabble-solver/src/state/types.ts +2 -0
  211. package/packages/scrabble-solver/src/state/verify/initialState.ts +7 -0
  212. package/packages/scrabble-solver/src/state/verify/lib.test.ts +55 -0
  213. package/packages/scrabble-solver/src/state/verify/lib.ts +49 -0
  214. package/packages/scrabble-solver/src/state/verify/selectors.ts +37 -0
  215. package/packages/scrabble-solver/src/state/verify/slice.ts +13 -2
  216. package/packages/scrabble-solver/src/state/verify/types.ts +6 -2
  217. package/packages/scrabble-solver/src/styles/_tokens.scss +2 -0
  218. package/packages/scrabble-solver/src/styles/mixins.scss +5 -0
  219. package/packages/scrabble-solver/src/styles/variables.module.scss +1 -0
  220. package/packages/scrabble-solver/src/styles/variables.module.scss.d.ts +1 -0
  221. package/packages/scrabble-solver/src/styles/variables.scss +1 -1
  222. package/packages/scrabble-solver/src/types/index.ts +24 -11
  223. package/packages/scrabble-solver/tsconfig.tsbuildinfo +1 -1
  224. package/packages/solver/package.json +5 -5
  225. package/packages/types/build/Bingo.d.ts +0 -3
  226. package/packages/types/build/Bingo.js +0 -14
  227. package/packages/types/build/Board.d.ts +3 -1
  228. package/packages/types/build/Board.js +5 -40
  229. package/packages/types/build/BoardJson.d.ts +0 -1
  230. package/packages/types/build/BoardJson.js +0 -19
  231. package/packages/types/build/BoardWord.d.ts +7 -0
  232. package/packages/types/build/BoardWord.js +2 -0
  233. package/packages/types/build/CellJson.d.ts +0 -1
  234. package/packages/types/build/CellJson.js +0 -11
  235. package/packages/types/build/Game.d.ts +2 -2
  236. package/packages/types/build/Game.js +2 -4
  237. package/packages/types/build/Locale.d.ts +0 -1
  238. package/packages/types/build/Locale.js +1 -4
  239. package/packages/types/build/Result.js +3 -3
  240. package/packages/types/build/TileJson.d.ts +0 -1
  241. package/packages/types/build/TileJson.js +0 -6
  242. package/packages/types/build/index.d.ts +9 -8
  243. package/packages/types/build/index.js +14 -17
  244. package/packages/types/build/lib/getBoardWords.d.ts +3 -0
  245. package/packages/types/build/lib/getBoardWords.js +10 -0
  246. package/packages/types/build/lib/getCells.d.ts +4 -0
  247. package/packages/types/build/lib/getCells.js +27 -0
  248. package/packages/types/build/lib/getCollidingWords.d.ts +3 -0
  249. package/packages/types/build/lib/getCollidingWords.js +19 -0
  250. package/packages/types/build/lib/getCollision.d.ts +3 -0
  251. package/packages/types/build/lib/getCollision.js +31 -0
  252. package/packages/types/build/lib/getCollisions.d.ts +3 -0
  253. package/packages/types/build/lib/getCollisions.js +17 -0
  254. package/packages/types/build/lib/getPlacedCell.d.ts +3 -0
  255. package/packages/types/build/lib/getPlacedCell.js +10 -0
  256. package/packages/types/build/lib/getWordThrough.d.ts +4 -0
  257. package/packages/types/build/lib/getWordThrough.js +23 -0
  258. package/packages/types/build/lib/getWordsInRows.d.ts +8 -0
  259. package/packages/types/build/lib/getWordsInRows.js +29 -0
  260. package/packages/types/build/lib/index.d.ts +5 -0
  261. package/packages/types/build/lib/index.js +21 -0
  262. package/packages/types/build/lib/isSameBoardWord.d.ts +2 -0
  263. package/packages/types/build/lib/isSameBoardWord.js +6 -0
  264. package/packages/types/build/lib/toBoardWord.d.ts +4 -0
  265. package/packages/types/build/lib/toBoardWord.js +11 -0
  266. package/packages/types/build/lib/transpose.d.ts +1 -0
  267. package/packages/types/build/lib/transpose.js +16 -0
  268. package/packages/types/build/type-guards/index.d.ts +10 -0
  269. package/packages/types/build/type-guards/index.js +23 -0
  270. package/packages/types/build/type-guards/isBingo.d.ts +2 -0
  271. package/packages/types/build/type-guards/isBingo.js +9 -0
  272. package/packages/types/build/type-guards/isBoardJson.d.ts +2 -0
  273. package/packages/types/build/type-guards/isBoardJson.js +21 -0
  274. package/packages/types/build/type-guards/isCellJson.d.ts +2 -0
  275. package/packages/types/build/type-guards/isCellJson.js +13 -0
  276. package/packages/types/build/type-guards/isGame.d.ts +2 -0
  277. package/packages/types/build/type-guards/isGame.js +7 -0
  278. package/packages/types/build/type-guards/isLocale.d.ts +2 -0
  279. package/packages/types/build/type-guards/isLocale.js +7 -0
  280. package/packages/types/build/type-guards/isMultiplierBingo.d.ts +2 -0
  281. package/packages/types/build/type-guards/isMultiplierBingo.js +8 -0
  282. package/packages/types/build/type-guards/isScoreBingo.d.ts +2 -0
  283. package/packages/types/build/type-guards/isScoreBingo.js +8 -0
  284. package/packages/types/build/type-guards/isTileJson.d.ts +2 -0
  285. package/packages/types/build/type-guards/isTileJson.js +8 -0
  286. package/packages/types/package.json +2 -2
  287. package/packages/types/src/Bingo.ts +0 -14
  288. package/packages/types/src/Board.test.ts +85 -0
  289. package/packages/types/src/Board.ts +8 -49
  290. package/packages/types/src/BoardJson.ts +1 -21
  291. package/packages/types/src/BoardWord.ts +8 -0
  292. package/packages/types/src/CellJson.ts +1 -12
  293. package/packages/types/src/Game.ts +1 -4
  294. package/packages/types/src/Locale.ts +0 -4
  295. package/packages/types/src/Result.ts +3 -3
  296. package/packages/types/src/TileJson.ts +0 -6
  297. package/packages/types/src/index.ts +20 -8
  298. package/packages/types/src/lib/getBoardWords.ts +11 -0
  299. package/packages/types/src/lib/getCells.test.ts +127 -0
  300. package/packages/types/src/lib/getCells.ts +31 -0
  301. package/packages/types/src/lib/getCollidingWords.ts +25 -0
  302. package/packages/types/src/lib/getCollision.ts +38 -0
  303. package/packages/types/src/lib/getCollisions.test.ts +82 -0
  304. package/packages/types/src/lib/getCollisions.ts +22 -0
  305. package/packages/types/src/lib/getPlacedCell.ts +9 -0
  306. package/packages/types/src/lib/getWordThrough.ts +30 -0
  307. package/packages/types/src/lib/getWordsInRows.ts +34 -0
  308. package/packages/types/src/lib/index.ts +5 -0
  309. package/packages/types/src/lib/isSameBoardWord.ts +5 -0
  310. package/packages/types/src/lib/toBoardWord.ts +12 -0
  311. package/packages/types/src/lib/transpose.ts +15 -0
  312. package/packages/types/src/type-guards/index.ts +10 -0
  313. package/packages/types/src/type-guards/isBingo.ts +8 -0
  314. package/packages/types/src/type-guards/isBoardJson.test.ts +33 -0
  315. package/packages/types/src/type-guards/isBoardJson.ts +23 -0
  316. package/packages/types/src/type-guards/isCellJson.ts +14 -0
  317. package/packages/types/src/type-guards/isGame.ts +5 -0
  318. package/packages/types/src/type-guards/isLocale.ts +5 -0
  319. package/packages/types/src/type-guards/isMultiplierBingo.ts +7 -0
  320. package/packages/types/src/type-guards/isScoreBingo.ts +7 -0
  321. package/packages/types/src/type-guards/isTileJson.ts +7 -0
  322. package/packages/word-definitions/package.json +2 -2
  323. package/packages/word-lists/package.json +2 -2
  324. package/playwright-report/index.html +1 -1
  325. package/screencast.gif +0 -0
  326. package/packages/scrabble-solver/.next/server/chunks/316.js +0 -1
  327. package/packages/scrabble-solver/.next/server/chunks/916.js +0 -1
  328. package/packages/scrabble-solver/.next/static/chunks/106.e414e88694add27f.js +0 -1
  329. package/packages/scrabble-solver/.next/static/chunks/127.125d896a19061d71.js +0 -1
  330. package/packages/scrabble-solver/.next/static/chunks/18.8b91e137d239e15c.js +0 -1
  331. package/packages/scrabble-solver/.next/static/chunks/583.7a46807be14c377e.js +0 -1
  332. package/packages/scrabble-solver/.next/static/chunks/711.ba7b8f900dfd40d0.js +0 -1
  333. package/packages/scrabble-solver/.next/static/chunks/912.ff8037ba9d4db5c8.js +0 -1
  334. package/packages/scrabble-solver/.next/static/chunks/pages/_app-2e607dcd4135f340.js +0 -1
  335. package/packages/scrabble-solver/.next/static/chunks/pages/index-e0087247c995328d.js +0 -1
  336. package/packages/scrabble-solver/.next/static/chunks/webpack-cfb34d175e081981.js +0 -1
  337. package/packages/scrabble-solver/.next/static/css/b74cd7de82dabcdd.css +0 -1
  338. package/packages/scrabble-solver/.next/static/css/c403ce739a9c0d83.css +0 -1
  339. package/packages/scrabble-solver/.next/static/css/fbfdce70731d0d2b.css +0 -1
  340. package/packages/scrabble-solver/src/components/Results/Cell.tsx +0 -32
  341. package/packages/scrabble-solver/src/components/ResultsInput/ResultsInput.module.scss +0 -12
  342. package/packages/scrabble-solver/src/components/ResultsInput/ResultsInput.module.scss.d.ts +0 -7
  343. package/packages/scrabble-solver/src/components/ResultsInput/index.ts +0 -1
  344. package/packages/types/build/readResultCells.d.ts +0 -5
  345. package/packages/types/build/readResultCells.js +0 -75
  346. package/packages/types/src/readResultCells.test.ts +0 -140
  347. package/packages/types/src/readResultCells.ts +0 -90
  348. /package/packages/scrabble-solver/.next/static/{5KOWzYqfY1Z2rjrzptr8D → 8WnIUTe-yJvPD6stltvYI}/_ssgManifest.js +0 -0
  349. /package/packages/types/build/{isError.d.ts → type-guards/isError.d.ts} +0 -0
  350. /package/packages/types/build/{isError.js → type-guards/isError.js} +0 -0
  351. /package/packages/types/build/{isObject.d.ts → type-guards/isObject.d.ts} +0 -0
  352. /package/packages/types/build/{isObject.js → type-guards/isObject.js} +0 -0
  353. /package/packages/types/src/{isError.ts → type-guards/isError.ts} +0 -0
  354. /package/packages/types/src/{isObject.ts → type-guards/isObject.ts} +0 -0
@@ -1,11 +1,10 @@
1
- import classNames from 'classnames';
2
- import { type FocusEventHandler, type MouseEventHandler, type ReactElement, useRef } from 'react';
1
+ import { type FocusEventHandler, type MouseEventHandler, type ReactElement } from 'react';
3
2
  import Highlighter from 'react-highlight-words';
4
3
  import { type RowComponentProps } from 'react-window';
5
4
 
5
+ import { Cell, Row } from '@/components/Table';
6
6
  import { useColumns } from '@/hooks/useColumns';
7
7
  import { LOCALE_FEATURES } from '@/i18n/constants';
8
- import { noop } from '@/lib/noop';
9
8
  import {
10
9
  selectIsResultMatching,
11
10
  selectLocale,
@@ -15,7 +14,6 @@ import {
15
14
  } from '@/state';
16
15
  import { ResultColumnId } from '@/types';
17
16
 
18
- import { Cell } from './Cell';
19
17
  import styles from './Results.module.scss';
20
18
  import { type ResultData } from './types';
21
19
 
@@ -23,13 +21,12 @@ export const Result = ({
23
21
  index,
24
22
  highlightedIndex,
25
23
  results = [],
26
- onBlur = noop,
27
- onClick = noop,
28
- onFocus = noop,
29
- onMouseEnter = noop,
24
+ onBlur,
25
+ onClick,
26
+ onFocus,
27
+ onMouseEnter,
30
28
  style,
31
29
  }: RowComponentProps<ResultData>): ReactElement => {
32
- const ref = useRef<HTMLButtonElement>(null);
33
30
  const columns = useColumns();
34
31
  const locale = useTypedSelector(selectLocale);
35
32
  const query = useTypedSelector(selectResultsQuery);
@@ -39,68 +36,61 @@ export const Result = ({
39
36
  const words = direction === 'rtl' ? [...result.words].reverse() : result.words;
40
37
  const coordinates = useTypedSelector((state) => selectResultCoordinates(state, index));
41
38
 
42
- const handleClick: MouseEventHandler = (event) => onClick(result, event);
43
- const handleMouseEnter: MouseEventHandler = (event) => onMouseEnter(result, event);
44
- const handleBlur: FocusEventHandler = (event) => onBlur(result, event);
45
- const handleFocus: FocusEventHandler = (event) => onFocus(result, event);
39
+ const handleClick: MouseEventHandler | undefined = onClick && ((event) => onClick(result, event));
40
+ const handleMouseEnter: MouseEventHandler | undefined = onMouseEnter && ((event) => onMouseEnter(result, event));
41
+ const handleBlur: FocusEventHandler | undefined = onBlur && ((event) => onBlur(result, event));
42
+ const handleFocus: FocusEventHandler | undefined = onFocus && ((event) => onFocus(result, event));
46
43
 
47
44
  return (
48
- <button
49
- aria-current={index === highlightedIndex ? 'true' : undefined}
50
- aria-hidden={isMatching ? undefined : 'true'}
45
+ <Row
51
46
  aria-label={result.word}
52
- className={classNames(styles.result, {
53
- [styles.highlighted]: index === highlightedIndex,
54
- })}
55
47
  data-testid="result"
56
- ref={ref}
48
+ highlighted={index === highlightedIndex}
49
+ inactive={!isMatching}
57
50
  style={style}
58
- type="button"
59
51
  onBlur={handleBlur}
60
52
  onClick={handleClick}
61
53
  onFocus={handleFocus}
62
54
  onMouseEnter={handleMouseEnter}
63
55
  >
64
- <span className={styles.resultContent}>
65
- {columns[ResultColumnId.Coordinates] && (
66
- <Cell className={styles.coordinates} translationKey="settings.showCoordinates" value={coordinates} />
67
- )}
56
+ {columns[ResultColumnId.Coordinates] && (
57
+ <Cell className={styles.coordinates} translationKey="settings.showCoordinates" value={coordinates} />
58
+ )}
68
59
 
69
- {columns[ResultColumnId.Word] && (
70
- <Cell className={styles.word} translationKey="common.word" value={result.word}>
71
- <Highlighter highlightClassName={styles.highlight} searchWords={[query]} textToHighlight={result.word} />
72
- </Cell>
73
- )}
60
+ {columns[ResultColumnId.Word] && (
61
+ <Cell primary translationKey="common.word" value={result.word}>
62
+ <Highlighter highlightClassName={styles.highlight} searchWords={[query]} textToHighlight={result.word} />
63
+ </Cell>
64
+ )}
74
65
 
75
- {columns[ResultColumnId.TilesCount] && (
76
- <Cell className={styles.stat} translationKey="common.tiles" value={result.tilesCount} />
77
- )}
66
+ {columns[ResultColumnId.TilesCount] && (
67
+ <Cell className={styles.stat} translationKey="common.tiles" value={result.tilesCount} />
68
+ )}
78
69
 
79
- {columns[ResultColumnId.VowelsCount] && (
80
- <Cell className={styles.stat} translationKey="common.vowels" value={result.vowelsCount} />
81
- )}
70
+ {columns[ResultColumnId.VowelsCount] && (
71
+ <Cell className={styles.stat} translationKey="common.vowels" value={result.vowelsCount} />
72
+ )}
82
73
 
83
- {columns[ResultColumnId.ConsonantsCount] && (
84
- <Cell className={styles.stat} translationKey="common.consonants" value={result.consonantsCount} />
85
- )}
74
+ {columns[ResultColumnId.ConsonantsCount] && (
75
+ <Cell className={styles.stat} translationKey="common.consonants" value={result.consonantsCount} />
76
+ )}
86
77
 
87
- {columns[ResultColumnId.BlanksCount] && (
88
- <Cell className={styles.stat} translationKey="common.blanks" value={result.blanksCount} />
89
- )}
78
+ {columns[ResultColumnId.BlanksCount] && (
79
+ <Cell className={styles.stat} translationKey="common.blanks" value={result.blanksCount} />
80
+ )}
90
81
 
91
- {columns[ResultColumnId.WordsCount] && (
92
- <Cell
93
- className={styles.stat}
94
- translationKey="common.words"
95
- tooltip={`${result.wordsCount.toLocaleString(locale)} (${words.join(separator)})`}
96
- value={result.wordsCount}
97
- />
98
- )}
82
+ {columns[ResultColumnId.WordsCount] && (
83
+ <Cell
84
+ className={styles.stat}
85
+ translationKey="common.words"
86
+ tooltip={`${result.wordsCount.toLocaleString(locale)} (${words.join(separator)})`}
87
+ value={result.wordsCount}
88
+ />
89
+ )}
99
90
 
100
- {columns[ResultColumnId.Points] && (
101
- <Cell className={styles.points} dataTestId="points" translationKey="common.points" value={result.points} />
102
- )}
103
- </span>
104
- </button>
91
+ {columns[ResultColumnId.Points] && (
92
+ <Cell className={styles.points} data-testid="points" translationKey="common.points" value={result.points} />
93
+ )}
94
+ </Row>
105
95
  );
106
96
  };
@@ -1,7 +1,5 @@
1
1
  @use 'styles/mixins' as *;
2
2
 
3
- $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
4
-
5
3
  .results {
6
4
  position: relative;
7
5
  display: flex;
@@ -37,122 +35,6 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
37
35
  }
38
36
  }
39
37
 
40
- .header {
41
- position: relative;
42
- z-index: 1;
43
- display: flex;
44
- align-items: center;
45
- justify-content: space-between;
46
- border-bottom: var(--border);
47
- border-top-left-radius: inherit;
48
- border-top-right-radius: inherit;
49
- }
50
-
51
- .headerButton {
52
- @include button-reset;
53
- @include focus-effect;
54
-
55
- cursor: pointer;
56
-
57
- text-transform: uppercase;
58
- transition:
59
- background-color var(--transition--duration) var(--transition--easing),
60
- color var(--transition--duration) var(--transition--easing);
61
- background-color: var(--color--background);
62
- height: 100%;
63
-
64
- &:first-child {
65
- border-start-start-radius: inherit;
66
- }
67
-
68
- &:last-child {
69
- border-start-end-radius: inherit;
70
- }
71
-
72
- &:focus,
73
- &:hover {
74
- background-color: var(--color--primary);
75
- color: var(--color--primary--opposite);
76
- }
77
- }
78
-
79
- .headerButtonLabel {
80
- @include ellipsis;
81
-
82
- flex: 0 1 auto;
83
- text-align: start;
84
- }
85
-
86
- .headerButtonIcon {
87
- flex: 0 0 auto;
88
- width: var(--results--icon--size);
89
- height: var(--results--icon--size);
90
- }
91
-
92
- .result {
93
- @include button-reset;
94
-
95
- user-select: none;
96
- cursor: pointer;
97
- font-weight: 400;
98
-
99
- &:focus,
100
- &:hover,
101
- &.highlighted {
102
- &:not(:disabled) {
103
- background-color: var(--color--primary);
104
- color: var(--color--primary--opposite);
105
- }
106
- }
107
-
108
- &[aria-hidden='true'] {
109
- color: var(--color--inactive);
110
-
111
- &:focus,
112
- &:hover,
113
- &.highlighted {
114
- &:not(:disabled) {
115
- background-color: var(--color--primary--light);
116
- color: var(--color--primary--opposite);
117
- }
118
- }
119
- }
120
- }
121
-
122
- .resultContent {
123
- display: flex;
124
- align-items: center;
125
- justify-content: space-between;
126
- height: 100%;
127
-
128
- .word {
129
- @include ellipsis;
130
-
131
- display: flex;
132
- }
133
- }
134
-
135
- .cell {
136
- display: flex;
137
- align-items: center;
138
- justify-content: center;
139
- height: 100%;
140
- gap: var(--spacing--s);
141
- line-height: var(--results--item--height);
142
-
143
- .result &.word,
144
- .headerButton.word & {
145
- justify-content: flex-start;
146
- padding-inline-start: $row-padding-horizontal;
147
- }
148
- }
149
-
150
- .word {
151
- flex: 1 1 0;
152
- min-width: 0;
153
- text-transform: uppercase;
154
- }
155
-
156
38
  .stat {
157
39
  $width: 55px;
158
40
 
@@ -181,14 +63,6 @@ $row-padding-horizontal: calc(var(--spacing--m) + var(--spacing--s));
181
63
  margin: var(--spacing--xl) auto 0;
182
64
  }
183
65
 
184
- .sortIcon {
185
- $size: 19px;
186
-
187
- flex: 0 0 auto;
188
- width: $size;
189
- height: $size;
190
- }
191
-
192
66
  .input {
193
67
  border-top: var(--border);
194
68
  border-bottom-left-radius: var(--border--radius);
@@ -1,27 +1,17 @@
1
1
  // Generated by scripts/generate-scss-types.ts - do not edit.
2
2
  declare const styles: {
3
- readonly cell: string;
4
3
  readonly content: string;
5
4
  readonly coordinates: string;
6
5
  readonly emptyState: string;
7
- readonly header: string;
8
- readonly headerButton: string;
9
- readonly headerButtonIcon: string;
10
- readonly headerButtonLabel: string;
11
6
  readonly highlight: string;
12
- readonly highlighted: string;
13
7
  readonly input: string;
14
8
  readonly list: string;
15
9
  readonly listContainer: string;
16
10
  readonly outdated: string;
17
11
  readonly points: string;
18
- readonly result: string;
19
- readonly resultContent: string;
20
12
  readonly results: string;
21
13
  readonly solveButton: string;
22
- readonly sortIcon: string;
23
14
  readonly stat: string;
24
- readonly word: string;
25
15
  };
26
16
 
27
17
  export default styles;
@@ -1,5 +1,6 @@
1
1
  import classNames from 'classnames';
2
- import { useEffect, useMemo, type FunctionComponent } from 'react';
2
+ import { useCallback, useEffect, useMemo, type FunctionComponent } from 'react';
3
+ import { useDispatch } from 'react-redux';
3
4
  import { List, useListRef } from 'react-window';
4
5
  import { useDebounce } from 'use-debounce';
5
6
 
@@ -7,9 +8,11 @@ import { useLatest } from '@/hooks/useLatest';
7
8
  import { LOCALE_FEATURES } from '@/i18n/constants';
8
9
  import { RESULTS_ITEM_HEIGHT, RESULTS_OVERSCAN_COUNT } from '@/parameters';
9
10
  import {
11
+ resultsSlice,
10
12
  selectAreResultsOutdated,
11
13
  selectLocale,
12
14
  selectProcessedResults,
15
+ selectResultsQuery,
13
16
  selectSolveError,
14
17
  selectSolveIsLoading,
15
18
  useTranslate,
@@ -18,7 +21,7 @@ import {
18
21
 
19
22
  import { EmptyState } from '../EmptyState';
20
23
  import { Loading } from '../Loading';
21
- import { ResultsInput } from '../ResultsInput';
24
+ import { Search } from '../Table';
22
25
 
23
26
  import { Header } from './Header';
24
27
  import { Result } from './Result';
@@ -35,10 +38,12 @@ interface Props {
35
38
  const IS_LOADING_DEBOUNCE = 100;
36
39
 
37
40
  export const Results: FunctionComponent<Props> = ({ callbacks, className, highlightedIndex }) => {
41
+ const dispatch = useDispatch();
38
42
  const translate = useTranslate();
39
43
  const locale = useTypedSelector(selectLocale);
40
44
  const { direction } = LOCALE_FEATURES[locale];
41
45
  const results = useTypedSelector(selectProcessedResults);
46
+ const query = useTypedSelector(selectResultsQuery);
42
47
  const isLoading = useTypedSelector(selectSolveIsLoading);
43
48
  const [isLoadingDebounced] = useDebounce(isLoading, IS_LOADING_DEBOUNCE);
44
49
  const isOutdated = useTypedSelector(selectAreResultsOutdated);
@@ -58,7 +63,14 @@ export const Results: FunctionComponent<Props> = ({ callbacks, className, highli
58
63
  const scrollToIndex = typeof highlightedIndex === 'number' ? highlightedIndex : 0;
59
64
  const scrollToIndexRef = useLatest(scrollToIndex);
60
65
  const hasResults = typeof error === 'undefined' && typeof results !== 'undefined';
61
- const showInput = hasResults && results.length > 0 && !isOutdated;
66
+ const showSearch = hasResults && results.length > 0 && !isOutdated;
67
+
68
+ const handleQueryChange = useCallback(
69
+ (newQuery: string) => {
70
+ dispatch(resultsSlice.actions.changeQuery(newQuery));
71
+ },
72
+ [dispatch],
73
+ );
62
74
 
63
75
  useEffect(() => {
64
76
  // without setTimeout, the initial scrolling offset is calculated
@@ -119,7 +131,7 @@ export const Results: FunctionComponent<Props> = ({ callbacks, className, highli
119
131
  )}
120
132
 
121
133
  {!isOutdated && results.length > 0 && (
122
- <div className={styles.listContainer} onMouseLeave={callbacks.onMouseLeave}>
134
+ <div className={styles.listContainer}>
123
135
  <List
124
136
  className={classNames(styles.list, {
125
137
  [styles.outdated]: isOutdated,
@@ -131,6 +143,7 @@ export const Results: FunctionComponent<Props> = ({ callbacks, className, highli
131
143
  rowCount={results.length}
132
144
  rowHeight={RESULTS_ITEM_HEIGHT}
133
145
  rowProps={itemData}
146
+ onMouseLeave={callbacks.onMouseLeave}
134
147
  />
135
148
  </div>
136
149
  )}
@@ -138,7 +151,14 @@ export const Results: FunctionComponent<Props> = ({ callbacks, className, highli
138
151
  )}
139
152
  </div>
140
153
 
141
- {showInput && <ResultsInput className={styles.input} />}
154
+ {showSearch && (
155
+ <Search
156
+ className={styles.input}
157
+ placeholder={translate('results.input.placeholder')}
158
+ value={query}
159
+ onChange={handleQueryChange}
160
+ />
161
+ )}
142
162
 
143
163
  {isLoadingDebounced && <Loading />}
144
164
  </div>
@@ -8,7 +8,7 @@
8
8
  display: flex;
9
9
  flex-direction: column;
10
10
 
11
- @include media('<l', 'touch') {
11
+ @include media('compact', 'touch') {
12
12
  margin-bottom: calc(3 * var(--spacing--l) + var(--button--icon--size));
13
13
  }
14
14
 
@@ -31,7 +31,7 @@
31
31
  height: 100%;
32
32
  margin: 0 auto;
33
33
 
34
- @include media('<l') {
34
+ @include media('compact') {
35
35
  grid-template-columns: 1fr;
36
36
  }
37
37
  }
@@ -54,7 +54,7 @@
54
54
  flex: 0 0 var(--solver-column--width);
55
55
  gap: var(--spacing);
56
56
 
57
- @include media('<l') {
57
+ @include media('compact') {
58
58
  display: none;
59
59
  }
60
60
  }
@@ -106,7 +106,7 @@
106
106
  width: 100%;
107
107
  max-width: var(--controls-max-width);
108
108
 
109
- @include media('>=l') {
109
+ @include media('desktop') {
110
110
  display: none;
111
111
  }
112
112
  }
@@ -3,13 +3,14 @@ import classNames from 'classnames';
3
3
  import { type FunctionComponent, memo, type SyntheticEvent, useEffect, useMemo } from 'react';
4
4
  import { useDispatch } from 'react-redux';
5
5
 
6
+ import { useIsCompactLayout } from '@/hooks/useIsCompactLayout';
6
7
  import { useIsTouchDevice } from '@/hooks/useIsTouchDevice';
7
- import { useMediaQuery } from '@/hooks/useMediaQuery';
8
8
  import {
9
9
  resultsSlice,
10
10
  selectAreResultsOutdated,
11
11
  selectProcessedResults,
12
12
  selectResultCandidate,
13
+ selectResultCandidateIndex,
13
14
  selectSolveError,
14
15
  solveSlice,
15
16
  useTranslate,
@@ -36,10 +37,11 @@ const SolverBase: FunctionComponent<Props> = ({ className, onShowResults }) => {
36
37
  const dispatch = useDispatch();
37
38
  const translate = useTranslate();
38
39
  const isTouchDevice = useIsTouchDevice();
39
- const showCompactControls = useMediaQuery('<l');
40
+ const showCompactControls = useIsCompactLayout();
40
41
  const error = useTypedSelector(selectSolveError);
41
42
  const isOutdated = useTypedSelector(selectAreResultsOutdated);
42
43
  const results = useTypedSelector(selectProcessedResults);
44
+ const highlightedIndex = useTypedSelector(selectResultCandidateIndex);
43
45
  const store = useTypedStore();
44
46
  const [bestResult] = results || [];
45
47
  const touchCallbacks = useMemo(
@@ -100,7 +102,7 @@ const SolverBase: FunctionComponent<Props> = ({ className, onShowResults }) => {
100
102
  </form>
101
103
 
102
104
  <div className={styles.column}>
103
- <Results callbacks={callbacks} className={styles.results} />
105
+ <Results callbacks={callbacks} className={styles.results} highlightedIndex={highlightedIndex} />
104
106
 
105
107
  <div data-testid="dictionary" className={styles.dictionaryContainer}>
106
108
  <Dictionary className={styles.dictionary} />
@@ -96,7 +96,6 @@
96
96
  flex: 1;
97
97
  text-transform: uppercase;
98
98
  text-align: center;
99
- white-space: pre-wrap;
100
99
 
101
100
  @include media('<xs') {
102
101
  padding: var(--spacing--m);
@@ -104,6 +103,11 @@
104
103
  }
105
104
  }
106
105
 
106
+ .placeholder {
107
+ color: var(--color--foreground--secondary);
108
+ text-transform: none;
109
+ }
110
+
107
111
  .iconContainer {
108
112
  flex: 0 0 auto;
109
113
  display: flex;
@@ -8,6 +8,7 @@ declare const styles: {
8
8
  readonly iconContainer: string;
9
9
  readonly insert: string;
10
10
  readonly loading: string;
11
+ readonly placeholder: string;
11
12
  readonly points: string;
12
13
  readonly resultCandidate: string;
13
14
  readonly resultCandidatePicker: string;
@@ -35,7 +35,7 @@ export const ResultCandidatePicker: FunctionComponent<Props> = ({ className, onR
35
35
  const results = useTypedSelector(selectProcessedResults);
36
36
  const resultCandidate = useTypedSelector(selectResultCandidate);
37
37
  const index = resultCandidate && results ? results.findIndex((result) => result.id === resultCandidate.id) : -1;
38
- const disabled = isOutdated || !resultCandidate;
38
+ const disabled = isOutdated || !results || results.length === 0;
39
39
  const isPreviousDisabled = !results || index <= 0 || disabled;
40
40
  const isNextDisabled = !results || index >= results.length - 1 || disabled;
41
41
  const bothEnabled = !isPreviousDisabled && !isNextDisabled;
@@ -77,6 +77,7 @@ export const ResultCandidatePicker: FunctionComponent<Props> = ({ className, onR
77
77
  <button
78
78
  aria-label={translate('results')}
79
79
  className={styles.resultCandidate}
80
+ data-testid="result-candidate-picker"
80
81
  disabled={disabled}
81
82
  type="button"
82
83
  onClick={onResultClick}
@@ -88,7 +89,9 @@ export const ResultCandidatePicker: FunctionComponent<Props> = ({ className, onR
88
89
  </>
89
90
  )}
90
91
 
91
- {!resultCandidate && <div className={styles.word}> </div>}
92
+ {!resultCandidate && (
93
+ <div className={classNames(styles.word, styles.placeholder)}>{translate('results.select')}</div>
94
+ )}
92
95
 
93
96
  <div className={styles.iconContainer}>
94
97
  {isLoading && <Spinner className={styles.loading} />}
@@ -0,0 +1,42 @@
1
+ import classNames from 'classnames';
2
+ import { type FunctionComponent, type ReactNode } from 'react';
3
+
4
+ import { selectLocale, useTranslate, useTypedSelector } from '@/state';
5
+ import { type TranslationKey } from '@/types';
6
+
7
+ import { Tooltip } from '../Tooltip';
8
+
9
+ import styles from './Table.module.scss';
10
+
11
+ interface Props {
12
+ children?: ReactNode;
13
+ className?: string;
14
+ 'data-testid'?: string;
15
+ primary?: boolean;
16
+ translationKey?: TranslationKey;
17
+ tooltip?: string | number;
18
+ value: string | number;
19
+ }
20
+
21
+ export const Cell: FunctionComponent<Props> = ({
22
+ children,
23
+ className,
24
+ 'data-testid': dataTestId,
25
+ primary,
26
+ translationKey,
27
+ tooltip,
28
+ value,
29
+ }) => {
30
+ const translate = useTranslate();
31
+ const locale = useTypedSelector(selectLocale);
32
+ const formattedValue = value.toLocaleString(locale);
33
+ const label = translationKey ? `${translate(translationKey)}: ` : '';
34
+
35
+ return (
36
+ <Tooltip tooltip={`${label}${tooltip || formattedValue}`}>
37
+ <div className={classNames(styles.cell, className, { [styles.primary]: primary })} data-testid={dataTestId}>
38
+ <span className={styles.cellValue}>{children || formattedValue}</span>
39
+ </div>
40
+ </Tooltip>
41
+ );
42
+ };
@@ -0,0 +1,11 @@
1
+ import { type FunctionComponent, type ReactNode } from 'react';
2
+
3
+ import styles from './Table.module.scss';
4
+
5
+ interface Props {
6
+ children: ReactNode;
7
+ }
8
+
9
+ export const Header: FunctionComponent<Props> = ({ children }) => {
10
+ return <div className={styles.header}>{children}</div>;
11
+ };
@@ -1,41 +1,49 @@
1
1
  import classNames from 'classnames';
2
2
  import { type FunctionComponent, type ReactElement, type SVGAttributes, useCallback } from 'react';
3
- import { useDispatch } from 'react-redux';
4
3
 
5
4
  import SortDown from '@/icons/SortDown.svg';
6
5
  import SortUp from '@/icons/SortUp.svg';
7
- import { resultsSlice, selectResultsSort, useTranslate, useTypedSelector } from '@/state';
8
- import { type ResultColumnId, SortDirection, type TranslationKey } from '@/types';
6
+ import { useTranslate } from '@/state';
7
+ import { type Sort, SortDirection, type TranslationKey } from '@/types';
9
8
 
10
9
  import { Tooltip } from '../Tooltip';
11
10
 
12
- import styles from './Results.module.scss';
11
+ import styles from './Table.module.scss';
13
12
 
14
- interface Props {
15
- className: string;
13
+ interface Props<Id extends string> {
14
+ className?: string;
16
15
  Icon?: FunctionComponent<SVGAttributes<SVGElement>>;
17
- id: ResultColumnId;
16
+ id: Id;
17
+ primary?: boolean;
18
+ sort: Sort<Id>;
18
19
  translationKey: TranslationKey;
20
+ onSort: (id: Id) => void;
19
21
  }
20
22
 
21
- export const HeaderButton = ({ className, Icon, id, translationKey }: Props): ReactElement => {
22
- const dispatch = useDispatch();
23
+ export const HeaderButton = <Id extends string>({
24
+ className,
25
+ Icon,
26
+ id,
27
+ primary,
28
+ sort,
29
+ translationKey,
30
+ onSort,
31
+ }: Props<Id>): ReactElement => {
23
32
  const translate = useTranslate();
24
- const sort = useTypedSelector(selectResultsSort);
25
33
 
26
34
  const handleClick = useCallback(() => {
27
- dispatch(resultsSlice.actions.sort(id));
28
- }, [dispatch, id]);
35
+ onSort(id);
36
+ }, [id, onSort]);
29
37
 
30
38
  return (
31
39
  <Tooltip tooltip={translate(translationKey)}>
32
40
  <button
33
41
  aria-label={translate(translationKey)}
34
- className={classNames(styles.headerButton, className)}
42
+ className={classNames(styles.headerButton, className, { [styles.primary]: primary })}
35
43
  type="button"
36
44
  onClick={handleClick}
37
45
  >
38
- <span className={styles.cell}>
46
+ <span className={classNames(styles.cell, { [styles.primary]: primary })}>
39
47
  {Icon && <Icon aria-hidden="true" className={styles.headerButtonIcon} role="img" />}
40
48
 
41
49
  {!Icon && <span className={styles.headerButtonLabel}>{translate(translationKey)}</span>}