@verdaccio/ui-theme 6.0.0-6-next.10 → 6.0.0-6-next.14

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 (309) hide show
  1. package/.babelrc +1 -1
  2. package/.eslintrc +0 -15
  3. package/CHANGELOG.md +30 -0
  4. package/jest/api/packages.json +42 -0
  5. package/jest/jest.config.js +2 -2
  6. package/jest/server-handlers.ts +9 -0
  7. package/jest/server.ts +6 -0
  8. package/jest/setup-env.ts +18 -0
  9. package/jest/setup.ts +2 -7
  10. package/jest/unit/components/__mocks__/token.ts +0 -1
  11. package/jest/unit/components/store/login.ts +1 -0
  12. package/package.json +49 -41
  13. package/src/App/App.test.tsx +75 -51
  14. package/src/App/App.tsx +7 -42
  15. package/src/App/AppRoute.tsx +3 -16
  16. package/src/App/Footer/Footer.test.tsx +0 -1
  17. package/src/App/Footer/Footer.tsx +35 -22
  18. package/src/App/Footer/__snapshots__/Footer.test.tsx.snap +208 -302
  19. package/src/App/Footer/styles.ts +2 -3
  20. package/src/App/Header/Header.test.tsx +53 -61
  21. package/src/App/Header/Header.tsx +13 -24
  22. package/src/App/Header/HeaderGreetings.tsx +0 -1
  23. package/src/App/Header/HeaderLeft.tsx +0 -1
  24. package/src/App/Header/HeaderMenu.tsx +11 -8
  25. package/src/App/Header/HeaderRight.tsx +1 -2
  26. package/src/App/Header/HeaderToolTip.tsx +0 -1
  27. package/src/App/Header/HeaderToolTipIcon.tsx +13 -11
  28. package/src/App/Header/LanguageSwitch.tsx +17 -79
  29. package/src/App/Header/LoginDialog/LoginDialog.test.tsx +25 -35
  30. package/src/App/Header/LoginDialog/LoginDialog.tsx +30 -47
  31. package/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx +1 -2
  32. package/src/App/Header/LoginDialog/LoginDialogForm.tsx +2 -2
  33. package/src/App/Header/LoginDialog/LoginDialogFormError.tsx +1 -2
  34. package/src/App/Header/LoginDialog/LoginDialogHeader.tsx +4 -4
  35. package/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +1 -3
  36. package/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx +15 -13
  37. package/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +3 -3
  38. package/src/App/Header/RegistryInfoDialog/styles.ts +0 -1
  39. package/src/App/Header/Search/Search.test.tsx +48 -43
  40. package/src/App/Header/Search/Search.tsx +23 -108
  41. package/src/App/Header/Search/__snapshots__/Search.test.tsx.snap +396 -28
  42. package/src/App/Header/styles.ts +2 -3
  43. package/src/App/index.ts +0 -1
  44. package/src/App/utils/loadable.tsx +2 -1
  45. package/src/components/ActionBar/ActionBar.test.tsx +13 -14
  46. package/src/components/ActionBar/ActionBar.tsx +0 -2
  47. package/src/components/ActionBar/ActionBarAction.tsx +11 -14
  48. package/src/components/ActionBar/__snapshots__/ActionBar.test.tsx.snap +198 -53
  49. package/src/components/AppBar.tsx +1 -1
  50. package/src/components/Author/Author.test.tsx +1 -4
  51. package/src/components/Author/Author.tsx +2 -4
  52. package/src/components/Author/__snapshots__/Author.test.tsx.snap +804 -48
  53. package/src/components/Author/styles.ts +0 -1
  54. package/src/components/AutoComplete/AutoComplete.tsx +85 -163
  55. package/src/components/AutoComplete/AutoCompleteV2.tsx +18 -14
  56. package/src/components/AutoComplete/styles.tsx +0 -15
  57. package/src/components/Avatar.tsx +1 -1
  58. package/src/components/Box.tsx +1 -1
  59. package/src/components/Button.tsx +1 -1
  60. package/src/components/Card.tsx +1 -1
  61. package/src/components/CardActions.tsx +1 -1
  62. package/src/components/CardContent.tsx +1 -1
  63. package/src/components/Chip.tsx +1 -1
  64. package/src/components/CircularProgress.tsx +2 -2
  65. package/src/components/CopyToClipBoard.tsx +2 -3
  66. package/src/components/Dialog.tsx +1 -1
  67. package/src/components/DialogActions.tsx +2 -2
  68. package/src/components/DialogContent.tsx +2 -2
  69. package/src/components/DialogTitle.tsx +1 -1
  70. package/src/components/Divider.tsx +1 -1
  71. package/src/components/FloatingActionButton.tsx +1 -1
  72. package/src/components/FormControl.tsx +1 -1
  73. package/src/components/FormHelperText.tsx +2 -2
  74. package/src/components/Grid.tsx +1 -1
  75. package/src/components/Heading.tsx +1 -1
  76. package/src/components/IconButton.tsx +1 -1
  77. package/src/components/Icons/index.ts +1 -17
  78. package/src/components/Input.tsx +1 -1
  79. package/src/components/InputAdornment/InputAdornment.tsx +2 -2
  80. package/src/components/InputLabel.tsx +1 -1
  81. package/src/components/Label/Label.test.tsx +0 -1
  82. package/src/components/Label/Label.tsx +1 -2
  83. package/src/components/Link.tsx +2 -1
  84. package/src/components/List.tsx +1 -1
  85. package/src/components/ListItem.tsx +1 -1
  86. package/src/components/ListItemText.tsx +1 -4
  87. package/src/components/Loading/Loading.test.tsx +0 -1
  88. package/src/components/Loading/Loading.tsx +1 -2
  89. package/src/components/Loading/Spinner/Spinner.test.tsx +1 -2
  90. package/src/components/Loading/Spinner/Spinner.tsx +1 -2
  91. package/src/components/Loading/Spinner/__snapshots__/Spinner.test.tsx.snap +114 -16
  92. package/src/components/Loading/__snapshots__/Loading.test.tsx.snap +63 -11
  93. package/src/components/Loading/styles.ts +1 -2
  94. package/src/components/Logo/Logo.test.tsx +0 -1
  95. package/src/components/Logo/Logo.tsx +1 -2
  96. package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +2 -0
  97. package/src/components/Menu.tsx +1 -1
  98. package/src/components/MenuItem.tsx +1 -1
  99. package/src/components/NotFound/NotFound.tsx +3 -4
  100. package/src/components/NotFound/Notfound.test.tsx +1 -2
  101. package/src/components/NotFound/__snapshots__/Notfound.test.tsx.snap +138 -11
  102. package/src/components/NotFound/styles.ts +0 -1
  103. package/src/components/Paper.tsx +1 -1
  104. package/src/components/SnackbarContent.tsx +1 -1
  105. package/src/components/SvgIcon.tsx +1 -1
  106. package/src/components/Tab.tsx +1 -1
  107. package/src/components/Tabs.tsx +1 -1
  108. package/src/components/Text/Text.tsx +1 -1
  109. package/src/components/Text/TextConfig.ts +1 -1
  110. package/src/components/TextField/TextField.test.tsx +0 -1
  111. package/src/components/TextField/TextField.tsx +2 -2
  112. package/src/components/TextField/__snapshots__/TextField.test.tsx.snap +218 -3
  113. package/src/components/Toolbar.tsx +1 -1
  114. package/src/components/Tooltip.tsx +1 -1
  115. package/src/design-tokens/ResetStyles.tsx +1 -1
  116. package/src/design-tokens/StyleBaseline.tsx +2 -2
  117. package/src/design-tokens/ThemeContext.ts +1 -1
  118. package/src/design-tokens/ThemeProvider.tsx +15 -12
  119. package/src/design-tokens/theme.ts +28 -26
  120. package/src/design-tokens/useTheme.ts +1 -1
  121. package/src/{design-tokens → hooks}/useLocalStorage.ts +0 -0
  122. package/src/{design-tokens → hooks}/useOnClickOutside.ts +0 -0
  123. package/src/i18n/ABOUT_TRANSLATIONS.md +13 -0
  124. package/src/i18n/__mocks__/loadTranslationFile.ts +5 -0
  125. package/src/i18n/config.ts +38 -0
  126. package/{i18n/translations/en-US.json → src/i18n/crowdin/ui.json} +1 -1
  127. package/src/i18n/download_translations/ar-SA/ui.json +170 -0
  128. package/{i18n/translations/cs-CZ.json → src/i18n/download_translations/cs-CZ/ui.json} +9 -7
  129. package/{i18n/translations/de-DE.json → src/i18n/download_translations/de-DE/ui.json} +51 -49
  130. package/{i18n/translations/es-ES.json → src/i18n/download_translations/es-ES/ui.json} +19 -17
  131. package/src/i18n/download_translations/fi-FI/ui.json +170 -0
  132. package/src/i18n/download_translations/fil-PH/ui.json +170 -0
  133. package/{i18n/translations/fr-FR.json → src/i18n/download_translations/fr-FR/ui.json} +28 -26
  134. package/src/i18n/download_translations/gl-ES/ui.json +170 -0
  135. package/src/i18n/download_translations/hi-IN/ui.json +170 -0
  136. package/src/i18n/download_translations/it-IT/ui.json +170 -0
  137. package/{i18n/translations/ja-JP.json → src/i18n/download_translations/ja-JP/ui.json} +29 -27
  138. package/{i18n/translations/km-KH.json → src/i18n/download_translations/km-KH/ui.json} +35 -33
  139. package/src/i18n/download_translations/ko-KR/ui.json +170 -0
  140. package/src/i18n/download_translations/pl-PL/ui.json +170 -0
  141. package/{i18n/translations/pt-BR.json → src/i18n/download_translations/pt-BR/ui.json} +17 -15
  142. package/src/i18n/download_translations/pt-PT/ui.json +170 -0
  143. package/src/i18n/download_translations/ro-RO/ui.json +170 -0
  144. package/{i18n/translations/ru-RU.json → src/i18n/download_translations/ru-RU/ui.json} +28 -26
  145. package/src/i18n/download_translations/si-LK/ui.json +170 -0
  146. package/src/i18n/download_translations/sr-CS/ui.json +170 -0
  147. package/src/i18n/download_translations/sr-SP/ui.json +170 -0
  148. package/src/i18n/download_translations/tg-TJ/ui.json +170 -0
  149. package/{i18n/translations/tr-TR.json → src/i18n/download_translations/tr-TR/ui.json} +34 -32
  150. package/{i18n/translations/uk-UA.json → src/i18n/download_translations/uk-UA/ui.json} +35 -33
  151. package/src/i18n/download_translations/vi-VN/ui.json +170 -0
  152. package/src/i18n/download_translations/yo-NG/ui.json +170 -0
  153. package/{i18n/translations/zh-CN.json → src/i18n/download_translations/zh-CN/ui.json} +33 -31
  154. package/{i18n/translations/zh-TW.json → src/i18n/download_translations/zh-TW/ui.json} +33 -28
  155. package/src/i18n/enabledLanguages.ts +35 -0
  156. package/src/i18n/loadTranslationFile.ts +14 -0
  157. package/src/index.tsx +13 -11
  158. package/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx +0 -2
  159. package/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx +1 -3
  160. package/src/pages/Version/DetailContainer/Dependencies/styles.ts +0 -1
  161. package/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx +1 -3
  162. package/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx +2 -3
  163. package/src/pages/Version/DetailContainer/DetailContainer.test.tsx +0 -1
  164. package/src/pages/Version/DetailContainer/DetailContainer.tsx +1 -3
  165. package/src/pages/Version/DetailContainer/DetailContainerContent.tsx +0 -1
  166. package/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx +0 -1
  167. package/src/pages/Version/DetailContainer/DetailContainerTabs.tsx +2 -2
  168. package/src/pages/Version/DetailContainer/NoItems/NoItems.tsx +0 -1
  169. package/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx +0 -1
  170. package/src/pages/Version/DetailContainer/NoItems/__snapshots__/Noitems.test.tsx.snap +10 -1
  171. package/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx +1 -2
  172. package/src/pages/Version/DetailContainer/Readme/Readme.tsx +1 -2
  173. package/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx +1 -9
  174. package/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx +1 -3
  175. package/src/pages/Version/DetailContainer/UpLinks/__snapshots__/UpLinks.test.tsx.snap +186 -28
  176. package/src/pages/Version/DetailContainer/UpLinks/styles.ts +2 -3
  177. package/src/pages/Version/DetailContainer/Versions/Versions.test.tsx +3 -5
  178. package/src/pages/Version/DetailContainer/Versions/Versions.tsx +1 -2
  179. package/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx +2 -4
  180. package/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx +1 -3
  181. package/src/pages/Version/DetailContainer/Versions/styles.ts +2 -3
  182. package/src/pages/Version/DetailContainer/__snapshots__/DetailContainer.test.tsx.snap +168 -34
  183. package/src/pages/Version/DetailSidebar/DetailSidebar.tsx +0 -2
  184. package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx +0 -2
  185. package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx +3 -3
  186. package/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx +0 -1
  187. package/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx +3 -5
  188. package/src/pages/Version/DetailSidebar/Developers/Developers.tsx +3 -5
  189. package/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx +0 -1
  190. package/src/pages/Version/DetailSidebar/Developers/__snapshots__/Developers.test.tsx.snap +328 -40
  191. package/src/pages/Version/DetailSidebar/Developers/styles.ts +0 -1
  192. package/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx +1 -3
  193. package/src/pages/Version/DetailSidebar/Dist/Dist.tsx +3 -4
  194. package/src/pages/Version/DetailSidebar/Dist/__snapshots__/Dist.test.tsx.snap +1436 -74
  195. package/src/pages/Version/DetailSidebar/Dist/styles.ts +2 -1
  196. package/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx +1 -3
  197. package/src/pages/Version/DetailSidebar/Engines/Engines.tsx +5 -5
  198. package/src/pages/Version/DetailSidebar/Engines/styles.ts +0 -1
  199. package/src/pages/Version/DetailSidebar/Install/Install.test.tsx +1 -3
  200. package/src/pages/Version/DetailSidebar/Install/Install.tsx +2 -3
  201. package/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx +0 -1
  202. package/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx +1 -3
  203. package/src/pages/Version/DetailSidebar/Repository/Repository.tsx +3 -4
  204. package/src/pages/Version/Version.test.tsx +5 -6
  205. package/src/pages/Version/Version.tsx +21 -6
  206. package/src/pages/Version/VersionContextProvider.tsx +16 -46
  207. package/src/pages/Version/VersionLayout.tsx +1 -1
  208. package/src/pages/Version/context.ts +1 -1
  209. package/src/pages/home/Home.tsx +9 -28
  210. package/src/pages/home/PackageList/Help/Help.test.tsx +0 -1
  211. package/src/pages/home/PackageList/Help/Help.tsx +0 -1
  212. package/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap +298 -59
  213. package/src/pages/home/PackageList/Help/styles.ts +0 -1
  214. package/src/pages/home/PackageList/Package/Package.test.tsx +5 -4
  215. package/src/pages/home/PackageList/Package/Package.tsx +26 -31
  216. package/src/pages/home/PackageList/Package/Tag/Tag.test.tsx +0 -1
  217. package/src/pages/home/PackageList/Package/styles.ts +5 -6
  218. package/src/pages/home/PackageList/PackageList.tsx +17 -17
  219. package/src/pages/home/PackageList/Packagelist.test.tsx +6 -5
  220. package/src/providers/API/api.test.ts +1 -0
  221. package/src/providers/API/api.ts +7 -3
  222. package/src/providers/config/AppConfigurationProvider.tsx +3 -3
  223. package/src/store/index.ts +1 -0
  224. package/src/store/models/configuration.ts +41 -0
  225. package/src/store/models/download.ts +30 -0
  226. package/src/store/models/index.ts +18 -0
  227. package/src/store/models/login.ts +96 -0
  228. package/src/store/models/manifest.ts +91 -0
  229. package/src/store/models/packages.ts +36 -0
  230. package/src/store/models/search.ts +81 -0
  231. package/src/store/store.ts +15 -0
  232. package/src/utils/login.test.ts +3 -4
  233. package/src/utils/package.test.ts +2 -3
  234. package/src/utils/package.ts +2 -1
  235. package/src/utils/sec-utils.ts +1 -1
  236. package/src/utils/test-react-testing-library.tsx +22 -5
  237. package/src/utils/url.test.ts +1 -1
  238. package/src/utils/url.ts +1 -0
  239. package/static/Dependencies.915355f5a928b489259e.js +2 -0
  240. package/static/Dependencies.915355f5a928b489259e.js.LICENSE.txt +78 -0
  241. package/static/Dist.915355f5a928b489259e.js +2 -0
  242. package/static/Dist.915355f5a928b489259e.js.LICENSE.txt +60 -0
  243. package/static/Engines.915355f5a928b489259e.js +2 -0
  244. package/static/Engines.915355f5a928b489259e.js.LICENSE.txt +66 -0
  245. package/static/Home.915355f5a928b489259e.js +2 -0
  246. package/static/Home.915355f5a928b489259e.js.LICENSE.txt +222 -0
  247. package/static/Install.915355f5a928b489259e.js +2 -0
  248. package/static/Install.915355f5a928b489259e.js.LICENSE.txt +66 -0
  249. package/static/NotFound.915355f5a928b489259e.js +2 -0
  250. package/static/NotFound.915355f5a928b489259e.js.LICENSE.txt +40 -0
  251. package/static/Provider.915355f5a928b489259e.js +2 -0
  252. package/static/Provider.915355f5a928b489259e.js.LICENSE.txt +32 -0
  253. package/static/Repository.915355f5a928b489259e.js +2 -0
  254. package/static/Repository.915355f5a928b489259e.js.LICENSE.txt +50 -0
  255. package/static/UpLinks.915355f5a928b489259e.js +2 -0
  256. package/static/UpLinks.915355f5a928b489259e.js.LICENSE.txt +56 -0
  257. package/static/Version.915355f5a928b489259e.js +2 -0
  258. package/static/Version.915355f5a928b489259e.js.LICENSE.txt +360 -0
  259. package/static/Versions.915355f5a928b489259e.js +2 -0
  260. package/static/Versions.915355f5a928b489259e.js.LICENSE.txt +64 -0
  261. package/static/index.html +1 -1
  262. package/static/main.915355f5a928b489259e.js +2 -0
  263. package/static/main.915355f5a928b489259e.js.LICENSE.txt +972 -0
  264. package/static/manifest.json +17 -3
  265. package/static/runtime.915355f5a928b489259e.js +2 -0
  266. package/static/{runtime.77e8bdb212b3a2239e58.js.LICENSE.txt → runtime.915355f5a928b489259e.js.LICENSE.txt} +2 -2
  267. package/static/vendors-node_modules_pnpm_mui_icons-material_5_2_5_f463eef15d59df5aa770d062739aa27b_node_modu-03c9e7.915355f5a928b489259e.js +2 -0
  268. package/static/vendors-node_modules_pnpm_mui_icons-material_5_2_5_f463eef15d59df5aa770d062739aa27b_node_modu-03c9e7.915355f5a928b489259e.js.LICENSE.txt +148 -0
  269. package/static/vendors-node_modules_pnpm_mui_icons-material_5_2_5_f463eef15d59df5aa770d062739aa27b_node_modu-e72974.915355f5a928b489259e.js +2 -0
  270. package/static/vendors-node_modules_pnpm_mui_icons-material_5_2_5_f463eef15d59df5aa770d062739aa27b_node_modu-e72974.915355f5a928b489259e.js.LICENSE.txt +218 -0
  271. package/static/vendors-node_modules_pnpm_mui_material_5_2_8_f5341c4d41f1e34c3a73251df9f98a19_node_modules_mu-6057aa.915355f5a928b489259e.js +2 -0
  272. package/static/vendors-node_modules_pnpm_mui_material_5_2_8_f5341c4d41f1e34c3a73251df9f98a19_node_modules_mu-6057aa.915355f5a928b489259e.js.LICENSE.txt +316 -0
  273. package/static/vendors.915355f5a928b489259e.js +103 -0
  274. package/static/{vendors.77e8bdb212b3a2239e58.js.LICENSE.txt → vendors.915355f5a928b489259e.js.LICENSE.txt} +1367 -971
  275. package/tools/dev.server.js +0 -1
  276. package/tools/webpack.dev.config.babel.js +1 -3
  277. package/tsconfig.json +1 -3
  278. package/types/index.ts +3 -20
  279. package/i18n/config.ts +0 -94
  280. package/src/App/AppContext.ts +0 -18
  281. package/src/App/AppContextProvider.tsx +0 -44
  282. package/src/App/Header/Search/SearchAdornment.tsx +0 -18
  283. package/src/components/Icons/Austria.tsx +0 -23
  284. package/src/components/Icons/Brazil.tsx +0 -44
  285. package/src/components/Icons/China.tsx +0 -33
  286. package/src/components/Icons/Czech.tsx +0 -21
  287. package/src/components/Icons/France.tsx +0 -27
  288. package/src/components/Icons/Germany.tsx +0 -27
  289. package/src/components/Icons/India.tsx +0 -44
  290. package/src/components/Icons/Japan.tsx +0 -23
  291. package/src/components/Icons/Khmer.tsx +0 -40
  292. package/src/components/Icons/Nicaragua.tsx +0 -66
  293. package/src/components/Icons/Russia.tsx +0 -27
  294. package/src/components/Icons/Spain.tsx +0 -43
  295. package/src/components/Icons/Taiwan.tsx +0 -25
  296. package/src/components/Icons/Turkey.tsx +0 -23
  297. package/src/components/Icons/Ukraine.tsx +0 -30
  298. package/src/components/Icons/Usa.tsx +0 -34
  299. package/src/design-tokens/emotion.ts +0 -5
  300. package/src/lib/constants.ts +0 -9
  301. package/src/pages/Version/DetailSidebar/ActionBar/ActionBar.test.tsx +0 -84
  302. package/src/pages/Version/DetailSidebar/ActionBar/__snapshots__/ActionBar.test.tsx.snap +0 -122
  303. package/src/pages/Version/is-package-version-valid.ts +0 -19
  304. package/src/providers/API/APIProvider.tsx +0 -109
  305. package/src/providers/API/index.ts +0 -1
  306. package/static/main.77e8bdb212b3a2239e58.js +0 -2
  307. package/static/main.77e8bdb212b3a2239e58.js.LICENSE.txt +0 -1588
  308. package/static/runtime.77e8bdb212b3a2239e58.js +0 -2
  309. package/static/vendors.77e8bdb212b3a2239e58.js +0 -2
package/.babelrc CHANGED
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "@babel/preset-react"
14
14
  ],
15
- "plugins": ["react-hot-loader/babel", "@babel/transform-runtime", "emotion"],
15
+ "plugins": ["react-hot-loader/babel", "@babel/transform-runtime", "@emotion"],
16
16
  "env": {
17
17
  "test": {
18
18
  "presets": [
package/.eslintrc CHANGED
@@ -11,21 +11,6 @@
11
11
  "verdaccio"
12
12
  ],
13
13
  "rules": {
14
- "import/order": ["error", {
15
- "pathGroups": [
16
- {
17
- "pattern": "verdaccio-ui/**",
18
- "group": "external",
19
- "position": "after"
20
- }
21
- ],
22
- "pathGroupsExcludedImportTypes": ["verdaccio-ui"],
23
- "alphabetize": {
24
- "order": "asc",
25
- "caseInsensitive": true
26
- },
27
- "newlines-between": "always"
28
- }],
29
14
  "react/display-name": 0,
30
15
  "react/no-deprecated": 1,
31
16
  "react/jsx-no-target-blank": 1,
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @verdaccio/ui-theme
2
2
 
3
+ ## 6.0.0-6-next.14
4
+
5
+ ### Minor Changes
6
+
7
+ - 048ac95e: feat: align with v5 ui endpoints and ui small bugfix
8
+
9
+ ## 6.0.0-6-next.13
10
+
11
+ ### Major Changes
12
+
13
+ - 000d4374: feat: upgrade to material ui 5
14
+
15
+ ## 6.0.0-6-next.12
16
+
17
+ ### Major Changes
18
+
19
+ - 794af76c: Remove Node 12 support
20
+
21
+ - We need move to the new `undici` and does not support Node.js 12
22
+
23
+ ### Minor Changes
24
+
25
+ - 154b2ecd: refactor: remove @verdaccio/commons-api in favor @verdaccio/core and remove duplications
26
+
27
+ ## 6.0.0-6-next.11
28
+
29
+ ### Minor Changes
30
+
31
+ - 5fed1955: feat: integrate rematch for ui state storage
32
+
3
33
  ## 6.0.0-6-next.10
4
34
 
5
35
  ### Major Changes
@@ -0,0 +1,42 @@
1
+ [
2
+ {
3
+ "name": "test",
4
+ "version": "1.0.22",
5
+ "description": "test",
6
+ "main": "src/index.js",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "repository": {
11
+ "type": "http",
12
+ "url": "git+https://github.com/test/test.git"
13
+ },
14
+ "keywords": [],
15
+ "author": {
16
+ "name": "",
17
+ "email": "",
18
+ "url": "",
19
+ "avatar": "data:image/svg+xml;utf8,%3Csvg%20height%3D%22100%22%20viewBox%3D%22-27%2024%20100%20100%22%20width%3D%22100%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%3Cdefs%3E%3Ccircle%20cx%3D%2223%22%20cy%3D%2274%22%20id%3D%22a%22%20r%3D%2250%22%2F%3E%3C%2Fdefs%3E%3Cuse%20fill%3D%22%23F5EEE5%22%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23a%22%2F%3E%3CclipPath%20id%3D%22b%22%3E%3Cuse%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23a%22%2F%3E%3C%2FclipPath%3E%3Cg%20clip-path%3D%22url(%23b)%22%3E%3Cdefs%3E%3Cpath%20d%3D%22M36%2095.9c0%204%204.7%205.2%207.1%205.8%207.6%202%2022.8%205.9%2022.8%205.9%203.2%201.1%205.7%203.5%207.1%206.6v9.8H-27v-9.8c1.3-3.1%203.9-5.5%207.1-6.6%200%200%2015.2-3.9%2022.8-5.9%202.4-.6%207.1-1.8%207.1-5.8V85h26v10.9z%22%20id%3D%22c%22%2F%3E%3C%2Fdefs%3E%3Cuse%20fill%3D%22%23E6C19C%22%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23c%22%2F%3E%3CclipPath%20id%3D%22d%22%3E%3Cuse%20overflow%3D%22visible%22%20xlink%3Ahref%3D%22%23c%22%2F%3E%3C%2FclipPath%3E%3Cpath%20clip-path%3D%22url(%23d)%22%20d%3D%22M23.2%2035h.2c3.3%200%208.2.2%2011.4%202%203.3%201.9%207.3%205.6%208.5%2012.1%202.4%2013.7-2.1%2035.4-6.3%2042.4-4%206.7-9.8%209.2-13.5%209.4H23h-.1c-3.7-.2-9.5-2.7-13.5-9.4-4.2-7-8.7-28.7-6.3-42.4%201.2-6.5%205.2-10.2%208.5-12.1%203.2-1.8%208.1-2%2011.4-2h.2z%22%20fill%3D%22%23D4B08C%22%2F%3E%3C%2Fg%3E%3Cpath%20d%3D%22M22.6%2040c19.1%200%2020.7%2013.8%2020.8%2015.1%201.1%2011.9-3%2028.1-6.8%2033.7-4%205.9-9.8%208.1-13.5%208.3h-.5c-3.8-.3-9.6-2.5-13.6-8.4-3.8-5.6-7.9-21.8-6.8-33.8C2.3%2053.7%203.5%2040%2022.6%2040z%22%20fill%3D%22%23F2CEA5%22%2F%3E%3C%2Fsvg%3E"
20
+ },
21
+ "license": "ISC",
22
+ "dependencies": {
23
+ "lodash": "^4.17.21"
24
+ },
25
+ "readmeFilename": "README.md",
26
+ "bugs": {
27
+ "url": "https://github.com/test/test/issues"
28
+ },
29
+ "homepage": "https://github.com/test/test#readme",
30
+ "_id": "test@1.0.22",
31
+ "_nodeVersion": "14.17.4",
32
+ "_npmVersion": "7.20.5",
33
+ "dist": {
34
+ "integrity": "sha512-2IDD0lLzGUL7YJ+17Oh9VtbOwdKLqBLS+ZFATDXi5R22TL2hZ9LBFE10bzsDovNc4xtgwZAk1/K+5LHTye4ztg==",
35
+ "shasum": "c9152f57636bce762ccb5a83113c42a5831579bc",
36
+ "tarball": "http://localhost:4873/test/-/test-1.0.22.tgz"
37
+ },
38
+ "contributors": [],
39
+ "time": "2021-08-14T20:15:19.336Z",
40
+ "users": {}
41
+ }
42
+ ]
@@ -10,9 +10,9 @@ module.exports = Object.assign({}, config, {
10
10
  '^.+\\.(js|ts|tsx)$': 'babel-jest',
11
11
  },
12
12
  moduleFileExtensions: ['js', 'ts', 'tsx'],
13
- testURL: 'http://localhost',
13
+ testURL: 'http://localhost:9000/',
14
14
  rootDir: '..',
15
- setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'],
15
+ setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect', '<rootDir>/jest/setup-env.ts'],
16
16
  setupFiles: ['<rootDir>/jest/setup.ts'],
17
17
  transformIgnorePatterns: ['<rootDir>/node_modules/(?!react-syntax-highlighter)'],
18
18
  modulePathIgnorePatterns: [
@@ -0,0 +1,9 @@
1
+ import { rest } from 'msw';
2
+
3
+ const packagesPayload = require('./api/packages.json');
4
+
5
+ export const handlers = [
6
+ rest.get('http://localhost:9000/-/verdaccio/data/packages', (req, res, ctx) => {
7
+ return res(ctx.json(packagesPayload));
8
+ }),
9
+ ];
package/jest/server.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { setupServer } from 'msw/node';
2
+
3
+ import { handlers } from './server-handlers';
4
+
5
+ const server = setupServer(...handlers);
6
+ export { server };
@@ -0,0 +1,18 @@
1
+ import '@testing-library/jest-dom';
2
+ import '@testing-library/jest-dom/extend-expect';
3
+ import 'whatwg-fetch';
4
+
5
+ import { server } from './server';
6
+
7
+ // mock load translations to avoid warnings
8
+ jest.mock('../src/i18n/loadTranslationFile');
9
+
10
+ beforeAll(() => {
11
+ server.listen({
12
+ onUnhandledRequest: 'warn',
13
+ });
14
+ });
15
+ afterEach(() => server.resetHandlers());
16
+ afterAll(() => {
17
+ server.close();
18
+ });
package/jest/setup.ts CHANGED
@@ -2,29 +2,24 @@
2
2
  * Setup configuration for Jest
3
3
  * This file includes global settings for the JEST environment.
4
4
  */
5
- import { GlobalWithFetchMock } from 'jest-fetch-mock';
6
5
  import 'mutationobserver-shim';
7
6
 
8
7
  // @ts-ignore : Property '__VERDACCIO_BASENAME_UI_OPTIONS' does not exist on type 'Global'.
9
8
  global.__VERDACCIO_BASENAME_UI_OPTIONS = {
10
- base: 'http://localhost',
9
+ base: 'http://localhost:9000/',
11
10
  protocol: 'http',
12
11
  host: 'localhost',
13
12
  primaryColor: '#4b5e40',
14
13
  url_prefix: '',
15
14
  darkMode: false,
16
15
  language: 'en-US',
17
- uri: 'http://localhost:4873',
16
+ uri: 'http://localhost:9000/',
18
17
  pkgManagers: ['pnpm', 'yarn', 'npm'],
19
18
  title: 'Verdaccio Dev UI',
20
19
  scope: '',
21
20
  version: 'v1.0.0',
22
21
  };
23
22
 
24
- const customGlobal: GlobalWithFetchMock = global as GlobalWithFetchMock;
25
- customGlobal.fetch = require('jest-fetch-mock');
26
- customGlobal.fetchMock = customGlobal.fetch;
27
-
28
23
  // mocking few DOM methods
29
24
  // @ts-ignore : Property 'document' does not exist on type 'Global'.
30
25
  if (global.document) {
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * Token Utility
3
3
  */
4
-
5
4
  import dayjs from 'dayjs';
6
5
  import { Base64 } from 'js-base64';
7
6
 
@@ -1,4 +1,5 @@
1
1
  import { API_ERROR } from '../../../../lib/constants';
2
+
2
3
  /**
3
4
  * API mock for login endpoint
4
5
  * @param {object} config configuration of api call
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verdaccio/ui-theme",
3
- "version": "6.0.0-6-next.10",
3
+ "version": "6.0.0-6-next.14",
4
4
  "description": "Verdaccio User Interface",
5
5
  "author": {
6
6
  "name": "Verdaccio Contributors",
@@ -13,78 +13,86 @@
13
13
  "homepage": "https://verdaccio.org",
14
14
  "main": "index.js",
15
15
  "engines": {
16
- "node": ">=10",
16
+ "node": ">=14",
17
17
  "npm": ">=6"
18
18
  },
19
19
  "devDependencies": {
20
- "@emotion/core": "10.1.1",
21
- "@emotion/jest": "11.3.0",
22
- "@emotion/styled": "10.0.27",
23
- "@emotion/styled-base": "^10.0.31",
24
- "@material-ui/core": "4.11.4",
25
- "@material-ui/icons": "4.11.2",
26
- "@material-ui/styles": "4.11.4",
27
- "@testing-library/dom": "8.2.0",
28
- "@testing-library/jest-dom": "5.14.1",
29
- "@testing-library/react": "12.0.0",
30
- "@verdaccio/node-api": "6.0.0-6-next.20",
31
- "autosuggest-highlight": "3.1.1",
32
- "babel-loader": "8.2.2",
20
+ "@types/react": "17.0.38",
21
+ "@types/react-autosuggest": "10.1.5",
22
+ "@types/react-dom": "17.0.11",
23
+ "@types/react-helmet": "6.1.5",
24
+ "@types/redux": "3.6.0",
25
+ "@types/react-router-dom": "5.3.2",
26
+ "@types/react-virtualized": "9.21.16",
27
+ "@emotion/react": "11.7.1",
28
+ "@emotion/jest": "11.7.1",
29
+ "@emotion/styled": "11.6.0",
30
+ "@emotion/css": "11.7.1",
31
+ "@emotion/babel-plugin": "11.7.2",
32
+ "@mui/icons-material": "5.2.5",
33
+ "@mui/material": "5.2.8",
34
+ "@mui/styles": "5.2.3",
35
+ "@rematch/core": "2.2.0",
36
+ "@rematch/loading": "2.1.2",
37
+ "@testing-library/dom": "8.11.1",
38
+ "@testing-library/jest-dom": "5.16.1",
39
+ "@testing-library/react": "12.1.2",
40
+ "@verdaccio/node-api": "6.0.0-6-next.26",
41
+ "@verdaccio/types": "11.0.0-6-next.10",
42
+ "babel-loader": "8.2.3",
33
43
  "babel-plugin-dynamic-import-node": "2.3.3",
34
- "babel-plugin-emotion": "10.2.2",
35
44
  "bundlesize": "0.18.1",
36
- "css-loader": "6.2.0",
37
- "dayjs": "1.10.6",
38
- "emotion": "10.0.27",
39
- "emotion-theming": "10.0.27",
45
+ "css-loader": "6.5.1",
46
+ "dayjs": "1.10.7",
40
47
  "friendly-errors-webpack-plugin": "1.7.0",
41
48
  "github-markdown-css": "4.0.0",
42
49
  "harmony-reflect": "1.6.2",
43
50
  "history": "4.10.1",
44
- "html-webpack-plugin": "5.3.2",
45
- "i18next": "20.6.0",
51
+ "html-webpack-plugin": "5.5.0",
52
+ "i18next": "20.6.1",
46
53
  "in-publish": "2.0.1",
47
- "js-base64": "3.6.1",
54
+ "country-flag-icons": "1.4.19",
55
+ "js-base64": "3.7.2",
48
56
  "js-yaml": "3.14.1",
49
57
  "localstorage-memory": "1.0.3",
50
58
  "lodash": "4.17.21",
51
- "mini-css-extract-plugin": "2.2.2",
59
+ "mini-css-extract-plugin": "2.4.6",
52
60
  "mutationobserver-shim": "0.3.7",
53
- "node-mocks-http": "1.10.1",
61
+ "node-mocks-http": "1.11.0",
54
62
  "normalize.css": "8.0.1",
55
63
  "optimize-css-assets-webpack-plugin": "6.0.1",
56
64
  "ora": "5.4.1",
57
- "prop-types": "15.7.2",
58
65
  "react": "17.0.2",
59
- "react-autosuggest": "10.1.0",
60
66
  "react-dom": "17.0.2",
61
- "react-hook-form": "7.14.2",
67
+ "react-hook-form": "7.23.0",
62
68
  "react-hot-loader": "4.13.0",
63
- "react-i18next": "11.11.4",
69
+ "react-i18next": "11.15.3",
64
70
  "react-router": "5.2.1",
65
71
  "react-router-dom": "5.3.0",
66
72
  "react-virtualized": "9.22.3",
73
+ "react-redux": "7.2.6",
74
+ "redux": "4.1.2",
67
75
  "rimraf": "3.0.2",
68
- "standard-version": "9.3.1",
69
- "style-loader": "3.2.1",
76
+ "msw": "0.36.4",
77
+ "style-loader": "3.3.1",
70
78
  "stylelint": "13.13.1",
71
79
  "stylelint-config-recommended": "5.0.0",
72
80
  "stylelint-config-styled-components": "0.1.1",
73
81
  "stylelint-processor-styled-components": "1.10.0",
74
- "stylelint-webpack-plugin": "3.0.1",
75
- "supertest": "6.1.6",
76
- "terser-webpack-plugin": "5.2.3",
82
+ "stylelint-webpack-plugin": "3.1.0",
83
+ "supertest": "6.2.1",
84
+ "terser-webpack-plugin": "5.3.0",
77
85
  "url-loader": "4.1.1",
78
- "validator": "13.6.0",
79
- "webpack": "5.52.0",
80
- "webpack-bundle-analyzer": "4.4.2",
86
+ "validator": "13.7.0",
87
+ "webpack": "5.66.0",
88
+ "webpack-bundle-analyzer": "4.5.0",
81
89
  "webpack-bundle-size-analyzer": "3.1.0",
82
90
  "webpack-cli": "^4.7.2",
83
- "webpack-dev-server": "3.11.2",
84
- "webpack-manifest-plugin": "4.0.2",
91
+ "webpack-dev-server": "3.11.3",
92
+ "webpack-manifest-plugin": "4.1.1",
85
93
  "webpack-merge": "5.8.0",
86
94
  "whatwg-fetch": "3.6.2",
87
- "xss": "1.0.9"
95
+ "xss": "1.0.10"
88
96
  },
89
97
  "keywords": [
90
98
  "private",
@@ -129,7 +137,7 @@
129
137
  "type-check": "tsc --noEmit -p tsconfig.build.json",
130
138
  "start": "babel-node tools/dev.server.js",
131
139
  "test:clean": "jest --clearCache",
132
- "test": "cross-env BABEL_ENV=test cross-env NODE_ENV=test cross-env TZ=UTC jest --config ./jest/jest.config.js --maxWorkers 2 --passWithNoTests",
140
+ "test": "cross-env BABEL_ENV=test cross-env NODE_ENV=test cross-env TZ=UTC jest --config ./jest/jest.config.js --runInBand",
133
141
  "test:update-snapshot": "yarn run test -- -u",
134
142
  "test:size": "bundlesize",
135
143
  "lint": "pnpm lint:js && pnpm lint:css",
@@ -1,11 +1,15 @@
1
1
  import React from 'react';
2
-
3
- import storage from 'verdaccio-ui/utils/storage';
4
- import { render, waitFor, fireEvent } from 'verdaccio-ui/utils/test-react-testing-library';
2
+ import {
3
+ act,
4
+ fireEvent,
5
+ renderWithStore,
6
+ screen,
7
+ waitFor,
8
+ } from 'verdaccio-ui/utils/test-react-testing-library';
5
9
 
6
10
  // eslint-disable-next-line jest/no-mocks-import
7
11
  import { generateTokenWithTimeRange } from '../../jest/unit/components/__mocks__/token';
8
-
12
+ import { store } from '../store';
9
13
  import App from './App';
10
14
 
11
15
  jest.mock('verdaccio-ui/utils/storage', () => {
@@ -30,68 +34,88 @@ jest.mock('verdaccio-ui/utils/storage', () => {
30
34
  return new LocalStorageMock();
31
35
  });
32
36
 
33
- jest.mock('verdaccio-ui/providers/API/api', () => ({
34
- // eslint-disable-next-line jest/no-mocks-import
35
- request: require('../../jest/unit/components/__mocks__/api').default.request,
36
- }));
37
+ // force the windows to expand to display items
38
+ // https://github.com/bvaughn/react-virtualized/issues/493#issuecomment-640084107
39
+ jest.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockReturnValue(600);
40
+ jest.spyOn(HTMLElement.prototype, 'offsetWidth', 'get').mockReturnValue(600);
37
41
 
38
42
  /* eslint-disable react/jsx-no-bind*/
39
43
  describe('<App />', () => {
40
- // test('should display the Header component ', async () => {
41
- // const { queryByTestId } = render(<App />);
42
- //
43
- // expect(queryByTestId('loading')).toBeTruthy();
44
- //
45
- // // wait for the Header component appearance and return the element
46
- // const headerElement = await waitFor(() => queryByTestId('header'));
47
- // expect(headerElement).toBeTruthy();
48
- // });
49
-
50
- test('handleLogout - logouts the user and clear localstorage', async () => {
51
- storage.setItem('username', 'verdaccio');
52
- storage.setItem('token', generateTokenWithTimeRange(24));
53
-
54
- const { queryByTestId } = render(<App />);
44
+ describe('login - log out', () => {
45
+ test('handleLogout - logouts the user and clear localstorage', async () => {
46
+ const { queryByTestId } = renderWithStore(<App />, store);
47
+ store.dispatch.login.logInUser({
48
+ username: 'verdaccio',
49
+ token: generateTokenWithTimeRange(24),
50
+ });
51
+
52
+ // wait for the Account's circle element component appearance and return the element
53
+ const accountCircleElement = await waitFor(() => queryByTestId('logInDialogIcon'));
54
+ expect(accountCircleElement).toBeTruthy();
55
+
56
+ if (accountCircleElement) {
57
+ fireEvent.click(accountCircleElement);
58
+
59
+ // wait for the Button's logout element component appearance and return the element
60
+ const buttonLogoutElement = await waitFor(() => queryByTestId('logOutDialogIcon'));
61
+ expect(buttonLogoutElement).toBeTruthy();
62
+
63
+ if (buttonLogoutElement) {
64
+ fireEvent.click(buttonLogoutElement);
65
+
66
+ expect(queryByTestId('greetings-label')).toBeFalsy();
67
+ }
68
+ }
69
+ }, 10000);
55
70
 
56
- // wait for the Account's circle element component appearance and return the element
57
- const accountCircleElement = await waitFor(() => queryByTestId('header--menu-accountcircle'));
58
- expect(accountCircleElement).toBeTruthy();
71
+ test('isUserAlreadyLoggedIn: token already available in storage', async () => {
72
+ const { queryByTestId, queryAllByText } = renderWithStore(<App />, store);
73
+ store.dispatch.login.logInUser({
74
+ username: 'verdaccio',
75
+ token: generateTokenWithTimeRange(24),
76
+ });
59
77
 
60
- if (accountCircleElement) {
61
- fireEvent.click(accountCircleElement);
78
+ // wait for the Account's circle element component appearance and return the element
79
+ const accountCircleElement = await waitFor(() => queryByTestId('logInDialogIcon'));
80
+ expect(accountCircleElement).toBeTruthy();
62
81
 
63
- // wait for the Button's logout element component appearance and return the element
64
- const buttonLogoutElement = await waitFor(() => queryByTestId('header--button-logout'));
65
- expect(buttonLogoutElement).toBeTruthy();
82
+ if (accountCircleElement) {
83
+ fireEvent.click(accountCircleElement);
66
84
 
67
- if (buttonLogoutElement) {
68
- fireEvent.click(buttonLogoutElement);
85
+ // wait for the Greeting's label element component appearance and return the element
86
+ const greetingsLabelElement = await waitFor(() => queryByTestId('greetings-label'));
87
+ expect(greetingsLabelElement).toBeTruthy();
69
88
 
70
- expect(queryByTestId('greetings-label')).toBeFalsy();
89
+ if (greetingsLabelElement) {
90
+ expect(queryAllByText('verdaccio')).toBeTruthy();
91
+ }
71
92
  }
72
- }
93
+ }, 10000);
73
94
  });
74
95
 
75
- test('isUserAlreadyLoggedIn: token already available in storage', async () => {
76
- storage.setItem('username', 'verdaccio');
77
- storage.setItem('token', generateTokenWithTimeRange(24));
96
+ describe('list packages', () => {
97
+ test('should display the Header component', async () => {
98
+ renderWithStore(<App />, store);
78
99
 
79
- const { queryByTestId, queryAllByText } = render(<App />);
100
+ await waitFor(() => {
101
+ expect(screen.queryByTestId('loading')).toBeTruthy();
102
+ });
80
103
 
81
- // wait for the Account's circle element component appearance and return the element
82
- const accountCircleElement = await waitFor(() => queryByTestId('header--menu-accountcircle'));
83
- expect(accountCircleElement).toBeTruthy();
104
+ // wait for the Header component appearance and return the element
105
+ const headerElement = await waitFor(() => screen.queryByTestId('header'));
106
+ expect(headerElement).toBeTruthy();
107
+ });
84
108
 
85
- if (accountCircleElement) {
86
- fireEvent.click(accountCircleElement);
109
+ test('should display package lists', async () => {
110
+ act(() => {
111
+ renderWithStore(<App />, store);
112
+ });
87
113
 
88
- // wait for the Greeting's label element component appearance and return the element
89
- const greetingsLabelElement = await waitFor(() => queryByTestId('greetings-label'));
90
- expect(greetingsLabelElement).toBeTruthy();
114
+ await waitFor(() => {
115
+ expect(screen.getByTestId('package-item-list')).toBeInTheDocument();
116
+ });
91
117
 
92
- if (greetingsLabelElement) {
93
- expect(queryAllByText('verdaccio')).toBeTruthy();
94
- }
95
- }
118
+ expect(store.getState().packages.response).toHaveLength(1);
119
+ }, 10000);
96
120
  });
97
121
  });
package/src/App/App.tsx CHANGED
@@ -1,24 +1,18 @@
1
1
  /* eslint-disable react/jsx-max-depth */
2
2
  import styled from '@emotion/styled';
3
- import isNil from 'lodash/isNil';
4
- import React, { useState, useEffect, Suspense } from 'react';
3
+ import React, { Suspense, useEffect } from 'react';
5
4
  import { Router } from 'react-router-dom';
6
-
7
5
  import Box from 'verdaccio-ui/components/Box';
8
6
  import Loading from 'verdaccio-ui/components/Loading';
9
- import loadDayJSLocale from 'verdaccio-ui/design-tokens/load-dayjs-locale';
10
7
  import StyleBaseline from 'verdaccio-ui/design-tokens/StyleBaseline';
8
+ import loadDayJSLocale from 'verdaccio-ui/design-tokens/load-dayjs-locale';
11
9
  import { Theme } from 'verdaccio-ui/design-tokens/theme';
12
- import { isTokenExpire } from 'verdaccio-ui/utils/login';
13
- import storage from 'verdaccio-ui/utils/storage';
14
10
 
15
- import AppContextProvider from './AppContextProvider';
11
+ import '../i18n/config';
16
12
  import AppRoute, { history } from './AppRoute';
17
13
  import Footer from './Footer';
18
14
  import Header from './Header';
19
15
 
20
- import '../../i18n/config';
21
-
22
16
  const StyledBox = styled(Box)<{ theme?: Theme }>(({ theme }) => ({
23
17
  backgroundColor: theme?.palette.background.default,
24
18
  }));
@@ -32,35 +26,8 @@ const StyledBoxContent = styled(Box)<{ theme?: Theme }>(({ theme }) => ({
32
26
  },
33
27
  }));
34
28
 
35
- /* eslint-disable react/jsx-no-bind */
36
- /* eslint-disable react-hooks/exhaustive-deps */
37
29
  const App: React.FC = () => {
38
- const [user, setUser] = useState<undefined | { username: string | null }>();
39
- /**
40
- * Logout user
41
- * Required by: <Header />
42
- */
43
- const logout = () => {
44
- storage.removeItem('username');
45
- storage.removeItem('token');
46
- setUser(undefined);
47
- };
48
-
49
- const checkUserAlreadyLoggedIn = () => {
50
- // checks for token validity
51
- const token = storage.getItem('token');
52
- const username = storage.getItem('username');
53
-
54
- if (isTokenExpire(token) || isNil(username)) {
55
- logout();
56
- return;
57
- }
58
-
59
- setUser({ username });
60
- };
61
-
62
30
  useEffect(() => {
63
- checkUserAlreadyLoggedIn();
64
31
  loadDayJSLocale();
65
32
  }, []);
66
33
 
@@ -70,12 +37,10 @@ const App: React.FC = () => {
70
37
  <StyledBox display="flex" flexDirection="column" height="100%">
71
38
  <>
72
39
  <Router history={history}>
73
- <AppContextProvider user={user}>
74
- <Header />
75
- <StyledBoxContent flexGrow={1}>
76
- <AppRoute />
77
- </StyledBoxContent>
78
- </AppContextProvider>
40
+ <Header />
41
+ <StyledBoxContent flexGrow={1}>
42
+ <AppRoute />
43
+ </StyledBoxContent>
79
44
  </Router>
80
45
  <Footer />
81
46
  </>
@@ -1,9 +1,7 @@
1
1
  import { createBrowserHistory } from 'history';
2
- import React, { useContext } from 'react';
3
- import { useTranslation } from 'react-i18next';
4
- import { Route as ReactRouterDomRoute, Switch, Router } from 'react-router-dom';
2
+ import React from 'react';
3
+ import { Route as ReactRouterDomRoute, Router, Switch } from 'react-router-dom';
5
4
 
6
- import AppContext from './AppContext';
7
5
  import loadable from './utils/loadable';
8
6
 
9
7
  const NotFound = loadable(
@@ -28,22 +26,11 @@ export const history = createBrowserHistory({
28
26
  });
29
27
 
30
28
  const AppRoute: React.FC = () => {
31
- const appContext = useContext(AppContext);
32
- const { t } = useTranslation();
33
-
34
- if (!appContext) {
35
- throw Error(t('app-context-not-correct-used'));
36
- }
37
-
38
- const { user } = appContext;
39
-
40
- const isUserLoggedIn = user?.username;
41
-
42
29
  return (
43
30
  <Router history={history}>
44
31
  <Switch>
45
32
  <ReactRouterDomRoute exact={true} path={Route.ROOT}>
46
- <HomePage isUserLoggedIn={!!isUserLoggedIn} />
33
+ <HomePage />
47
34
  </ReactRouterDomRoute>
48
35
  <ReactRouterDomRoute exact={true} path={Route.PACKAGE}>
49
36
  <VersionContextProvider>
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
-
3
2
  import { render } from 'verdaccio-ui/utils/test-react-testing-library';
4
3
 
5
4
  import Footer from './Footer';