@verdaccio/ui-components 3.0.0-next.1 → 4.0.0-next-8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +1 -1
- package/CHANGELOG.md +108 -0
- package/build/AppTest/AppRoute.js +34 -0
- package/build/AppTest/pages/Front/Home.js +9 -0
- package/build/AppTest/pages/Front/index.js +14 -0
- package/build/AppTest/pages/Version/Version.js +34 -0
- package/build/AppTest/pages/Version/index.js +14 -0
- package/build/Theme/ResetStyles.js +2 -3
- package/build/Theme/StyleBaseline.js +2 -3
- package/build/Theme/ThemeProvider.js +3 -3
- package/build/Theme/colors.js +1 -2
- package/build/Theme/index.js +3 -3
- package/build/Theme/theme.js +17 -7
- package/build/__mocks__/react-markdown.js +1 -1
- package/build/components/ActionBar/ActionBar.js +13 -8
- package/build/components/ActionBar/ActionBarAction.js +26 -19
- package/build/components/ActionBar/index.js +1 -1
- package/build/components/Author/Author.js +12 -34
- package/build/components/Author/index.js +1 -1
- package/build/components/Author/styles.js +10 -28
- package/build/components/CopyClipboard/CopyToClipBoard.js +13 -13
- package/build/components/CopyClipboard/index.js +1 -1
- package/build/components/CopyClipboard/utils.js +3 -12
- package/build/components/Dependencies/Dependencies.js +31 -58
- package/build/components/Dependencies/DependencyBlock.js +102 -0
- package/build/components/Dependencies/index.js +1 -1
- package/build/components/Dependencies/utits.js +10 -0
- package/build/components/Deprecated/Deprecated.js +13 -22
- package/build/components/Deprecated/index.js +1 -1
- package/build/components/Developers/DeveloperType.js +12 -0
- package/build/components/Developers/Developers.js +26 -32
- package/build/components/Developers/Title.js +7 -13
- package/build/components/Developers/get-unique-developer-values.js +1 -2
- package/build/components/Developers/index.js +4 -4
- package/build/components/Distribution/Dist.js +3 -4
- package/build/components/Distribution/index.js +1 -1
- package/build/components/Distribution/styles.js +14 -31
- package/build/components/Engines/Engines.js +17 -12
- package/build/components/Engines/index.js +1 -1
- package/build/components/Engines/styles.js +9 -11
- package/build/components/ErrorBoundary/ErrorBoundary.js +2 -2
- package/build/components/ErrorBoundary/index.js +1 -1
- package/build/components/Forbidden/Forbidden.js +75 -0
- package/build/components/Forbidden/index.js +14 -0
- package/build/components/FundButton/FundButton.js +11 -13
- package/build/components/FundButton/index.js +1 -1
- package/build/components/HeaderInfoDialog/HeaderInfoDialog.js +5 -5
- package/build/components/HeaderInfoDialog/index.js +1 -1
- package/build/components/Heading/Heading.js +5 -6
- package/build/components/Heading/index.js +1 -1
- package/build/components/Help/Help.js +4 -5
- package/build/components/Help/index.js +1 -1
- package/build/components/Help/styles.js +2 -3
- package/build/components/Icons/DevsIcons/CommonJS.js +2 -13
- package/build/components/Icons/DevsIcons/ES6Module.js +3 -14
- package/build/components/Icons/DevsIcons/Git.js +2 -13
- package/build/components/Icons/DevsIcons/NodeJS.js +2 -13
- package/build/components/Icons/DevsIcons/TypeScript.js +2 -13
- package/build/components/Icons/Earth.js +3 -4
- package/build/components/Icons/FileBinary.js +14 -9
- package/build/components/Icons/Law.js +15 -10
- package/build/components/Icons/License.js +3 -4
- package/build/components/Icons/License.js.map +1 -1
- package/build/components/Icons/Managers/Npm.js +2 -13
- package/build/components/Icons/Managers/Pnpm.js +2 -13
- package/build/components/Icons/Managers/Yarn.js +2 -13
- package/build/components/Icons/SvgIcon.js +3 -4
- package/build/components/Icons/Time.js +3 -4
- package/build/components/Icons/Version.js +3 -4
- package/build/components/Install/Install.js +36 -29
- package/build/components/Install/InstallListItem.js +35 -48
- package/build/components/Install/index.js +1 -1
- package/build/components/Keywords/KeywordListItems.js +34 -0
- package/build/components/Keywords/Keywords.js +39 -0
- package/build/components/Keywords/index.js +14 -0
- package/build/components/Label/Label.js +3 -4
- package/build/components/Label/index.js +1 -1
- package/build/components/Link/Link.js +5 -19
- package/build/components/Link/index.js +2 -2
- package/build/components/LinkExternal/LinkExternal.js +32 -0
- package/build/components/LinkExternal/index.js +14 -0
- package/build/components/Loading/Loading.js +2 -3
- package/build/components/Loading/Spinner/Spinner.js +2 -3
- package/build/components/Loading/Spinner/index.js +1 -1
- package/build/components/Loading/index.js +1 -1
- package/build/components/Loading/styles.js +6 -7
- package/build/components/LoginDialog/LoginDialog.js +16 -6
- package/build/components/LoginDialog/LoginDialogCloseButton.js +5 -5
- package/build/components/LoginDialog/LoginDialogForm.js +7 -20
- package/build/components/LoginDialog/LoginDialogFormError.js +7 -7
- package/build/components/LoginDialog/LoginDialogHeader.js +2 -3
- package/build/components/LoginDialog/index.js +1 -1
- package/build/components/Logo/Logo.js +15 -9
- package/build/components/Logo/index.js +1 -1
- package/build/components/MenuItem/MenuItem.js +5 -6
- package/build/components/MenuItem/index.js +1 -1
- package/build/components/NoItems/NoItems.js +2 -3
- package/build/components/NoItems/index.js +1 -1
- package/build/components/NotFound/NotFound.js +20 -19
- package/build/components/NotFound/index.js +1 -1
- package/build/components/Package/Package.js +56 -40
- package/build/components/Package/index.js +2 -2
- package/build/components/Package/styles.js +59 -84
- package/build/components/PackageList/PackageList.js +2 -3
- package/build/components/PackageList/index.js +1 -1
- package/build/components/Person/Person.js +48 -0
- package/build/components/Person/PersonTooltip.js +22 -0
- package/build/components/Person/index.js +14 -0
- package/build/components/Person/utils.js +17 -0
- package/build/components/RawViewer/RawViewer.js +13 -9
- package/build/components/RawViewer/index.js +1 -1
- package/build/components/Readme/Readme.js +41 -21
- package/build/components/Readme/Readme.js.map +1 -1
- package/build/components/Readme/Readme.spec.js +20 -1
- package/build/components/Readme/Readme.spec.js.map +1 -1
- package/build/components/Readme/github-markdown.css +1198 -0
- package/build/components/Readme/index.js +1 -1
- package/build/components/Readme/utils.js +14 -17
- package/build/components/RegistryInfoDialog/RegistryInfoDialog.js +2 -3
- package/build/components/RegistryInfoDialog/index.js +1 -1
- package/build/components/RegistryInfoDialog/styles.js +13 -17
- package/build/components/Repository/Repository.js +23 -36
- package/build/components/Repository/index.js +1 -1
- package/build/components/Search/AutoComplete/AutoComplete.js +4 -5
- package/build/components/Search/AutoComplete/index.js +1 -1
- package/build/components/Search/AutoComplete/styles.js +6 -45
- package/build/components/Search/Search.js +11 -10
- package/build/components/Search/SearchItem.js +56 -45
- package/build/components/Search/index.js +1 -1
- package/build/components/Search/styles.js +3 -5
- package/build/components/Search/utils.js +23 -0
- package/build/components/SettingsMenu/SettingsMenu.js +49 -11
- package/build/components/SettingsMenu/index.js +1 -1
- package/build/components/SideBarTitle/SideBarTitle.js +104 -0
- package/build/components/SideBarTitle/index.js +14 -0
- package/build/components/{SideBarTittle → SideBarTitle}/utils.js +2 -3
- package/build/components/TextField/TextField.js +5 -6
- package/build/components/TextField/index.js +1 -1
- package/build/components/UpLinks/UpLinks.js +37 -9
- package/build/components/UpLinks/UplinkLink.js +22 -0
- package/build/components/UpLinks/index.js +1 -1
- package/build/components/UpLinks/styles.js +9 -11
- package/build/components/Versions/HistoryList.js +52 -18
- package/build/components/Versions/TagList.js +10 -7
- package/build/components/Versions/Versions.js +82 -15
- package/build/components/Versions/__partials__/data.json +1 -0
- package/build/components/Versions/__partials__/deprecated-versions.json +175 -0
- package/build/components/Versions/index.js +1 -1
- package/build/components/Versions/styles.js +3 -5
- package/build/hooks/index.js +1 -1
- package/build/hooks/useLocalStorage.js +1 -2
- package/build/hooks/useOnClickOutside.js +1 -2
- package/build/index.js +40 -8
- package/build/layouts/Version/Version.js +2 -3
- package/build/layouts/Version/index.js +1 -1
- package/build/providers/AppConfigurationProvider/AppConfigurationProvider.js +6 -5
- package/build/providers/AppConfigurationProvider/index.js +2 -2
- package/build/providers/PersistenceSettingProvider/PersistenceSettingProvider.js +7 -6
- package/build/providers/PersistenceSettingProvider/index.js +2 -2
- package/build/providers/TranslatorProvider/TranslatorProvider.js +4 -5
- package/build/providers/TranslatorProvider/TranslatorProvider.spec.js +3 -3
- package/build/providers/TranslatorProvider/index.js +2 -2
- package/build/providers/VersionProvider/VersionProvider.js +5 -7
- package/build/providers/VersionProvider/index.js +2 -2
- package/build/sections/Detail/ContainerContent.js +5 -7
- package/build/sections/Detail/Detail.js +13 -11
- package/build/sections/Detail/ReadmeSection.js +2 -3
- package/build/sections/Detail/Tabs.js +6 -8
- package/build/sections/Detail/index.js +1 -1
- package/build/sections/Footer/Footer.js +39 -11
- package/build/sections/Footer/index.js +1 -1
- package/build/sections/Footer/styles.js +19 -21
- package/build/sections/Header/Header.js +4 -5
- package/build/sections/Header/HeaderGreetings.js +2 -3
- package/build/sections/Header/HeaderLeft.js +16 -20
- package/build/sections/Header/HeaderMenu.js +3 -4
- package/build/sections/Header/HeaderRight.js +16 -8
- package/build/sections/Header/HeaderSettingsDialog.js +6 -10
- package/build/sections/Header/HeaderToolTip.js +2 -3
- package/build/sections/Header/HeaderToolTipIcon.js +4 -5
- package/build/sections/Header/LanguageSwitch.js +10 -13
- package/build/sections/Header/RegistryInfoContent/RegistryInfoContent.js +14 -24
- package/build/sections/Header/RegistryInfoContent/index.js +1 -1
- package/build/sections/Header/RegistryInfoContent/styles.js +3 -5
- package/build/sections/Header/index.js +1 -1
- package/build/sections/Header/styles.js +54 -106
- package/build/sections/Home/Home.js +4 -5
- package/build/sections/Home/index.js +1 -1
- package/build/sections/SideBar/Sidebar.js +23 -30
- package/build/sections/SideBar/index.js +1 -1
- package/build/sections/index.js +1 -1
- package/build/src/AppTest/App.stories.d.ts +8 -0
- package/build/src/AppTest/AppRoute.d.ts +3 -0
- package/build/src/AppTest/pages/Front/Home.d.ts +2 -0
- package/build/src/AppTest/pages/Front/index.d.ts +1 -0
- package/build/src/AppTest/pages/Version/Version.d.ts +3 -0
- package/build/src/AppTest/pages/Version/index.d.ts +1 -0
- package/build/src/Theme/ThemeProvider.test.d.ts +1 -0
- package/build/src/__mocks__/react-markdown.d.ts +2 -2
- package/build/src/components/Author/Author.d.ts +0 -5
- package/build/src/components/Author/styles.d.ts +0 -4
- package/build/src/components/CopyClipboard/CopyToClipBoard.d.ts +1 -1
- package/build/src/components/CopyClipboard/CopyToClipBoard.test.d.ts +1 -0
- package/build/src/components/Dependencies/DependencyBlock.d.ts +16 -0
- package/build/src/components/Dependencies/DependencyBlock.test.d.ts +1 -0
- package/build/src/components/Dependencies/utits.d.ts +3 -0
- package/build/src/components/Deprecated/Deprecated.d.ts +0 -1
- package/build/src/components/Developers/DeveloperType.d.ts +4 -0
- package/build/src/components/Developers/Developers.d.ts +1 -4
- package/build/src/components/Developers/Title.d.ts +1 -4
- package/build/src/components/Developers/index.d.ts +2 -1
- package/build/src/components/Distribution/styles.d.ts +0 -1
- package/build/src/components/ErrorBoundary/ErrorBoundary.test.d.ts +1 -0
- package/build/src/components/Forbidden/Forbidden.d.ts +3 -0
- package/build/src/components/Forbidden/Forbidden.test.d.ts +1 -0
- package/build/src/components/Forbidden/index.d.ts +1 -0
- package/build/src/components/HeaderInfoDialog/HeaderInfoDialog.test.d.ts +1 -0
- package/build/src/components/Heading/Heading.d.ts +1 -1
- package/build/src/components/Heading/Heading.test.d.ts +1 -0
- package/build/src/components/Icons/DevsIcons/CommonJS.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/ES6Module.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/Git.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/NodeJS.d.ts +2 -2
- package/build/src/components/Icons/DevsIcons/TypeScript.d.ts +2 -2
- package/build/src/components/Icons/Earth.d.ts +2 -2
- package/build/src/components/Icons/FileBinary.d.ts +2 -2
- package/build/src/components/Icons/Icons.test.d.ts +1 -0
- package/build/src/components/Icons/Law.d.ts +2 -2
- package/build/src/components/Icons/License.d.ts +2 -2
- package/build/src/components/Icons/Managers/Npm.d.ts +2 -2
- package/build/src/components/Icons/Managers/Pnpm.d.ts +2 -2
- package/build/src/components/Icons/Managers/Yarn.d.ts +2 -2
- package/build/src/components/Icons/SvgIcon.d.ts +1 -1
- package/build/src/components/Icons/Time.d.ts +2 -2
- package/build/src/components/Icons/Version.d.ts +2 -2
- package/build/src/components/Install/InstallListItem.d.ts +2 -0
- package/build/src/components/Keywords/KeywordListItems.d.ts +5 -0
- package/build/src/components/Keywords/Keywords.d.ts +6 -0
- package/build/src/components/Keywords/Keywords.stories.d.ts +5 -0
- package/build/src/components/Keywords/Keywords.test.d.ts +1 -0
- package/build/src/components/Keywords/index.d.ts +1 -0
- package/build/src/components/Link/Link.d.ts +1 -4
- package/build/src/components/Link/Link.test.d.ts +1 -0
- package/build/src/components/Link/index.d.ts +1 -1
- package/build/src/components/LinkExternal/LinkExternal.d.ts +3 -0
- package/build/src/components/LinkExternal/LinkExternal.test.d.ts +1 -0
- package/build/src/components/LinkExternal/index.d.ts +1 -0
- package/build/src/components/Loading/styles.d.ts +2 -2
- package/build/src/components/LoginDialog/LoginDialog.stories.d.ts +2 -2
- package/build/src/components/LoginDialog/LoginDialogForm.d.ts +1 -1
- package/build/src/components/LoginDialog/LoginDialogFormError.d.ts +1 -1
- package/build/src/components/Logo/Logo.d.ts +1 -0
- package/build/src/components/Logo/Logo.stories.d.ts +5 -0
- package/build/src/components/MenuItem/MenuItem.d.ts +1 -1
- package/build/src/components/Package/Package.d.ts +1 -1
- package/build/src/components/Package/styles.d.ts +7 -15
- package/build/src/components/Person/Person.d.ts +9 -0
- package/build/src/components/Person/Person.test.d.ts +1 -0
- package/build/src/components/Person/PersonTooltip.d.ts +6 -0
- package/build/src/components/Person/index.d.ts +1 -0
- package/build/src/components/Person/utils.d.ts +3 -0
- package/build/src/components/Readme/Readme.d.ts +1 -2
- package/build/src/components/RegistryInfoDialog/styles.d.ts +1 -1
- package/build/src/components/Search/AutoComplete/styles.d.ts +1 -9
- package/build/src/components/Search/Search.stories.d.ts +2 -2
- package/build/src/components/Search/SearchItem.d.ts +1 -1
- package/build/src/components/Search/styles.d.ts +1 -1
- package/build/src/components/Search/utils.d.ts +1 -0
- package/build/src/components/SettingsMenu/SettingsMenu.d.ts +2 -2
- package/build/src/components/SettingsMenu/SettingsMenu.test.d.ts +1 -0
- package/build/src/components/SideBarTitle/index.d.ts +1 -0
- package/build/src/components/TextField/TextField.d.ts +1 -1
- package/build/src/components/UpLinks/UplinkLink.d.ts +6 -0
- package/build/src/components/UpLinks/styles.d.ts +2 -2
- package/build/src/components/Versions/HistoryList.d.ts +1 -0
- package/build/src/components/Versions/Versions.d.ts +1 -0
- package/build/src/components/Versions/styles.d.ts +2 -2
- package/build/src/index.d.ts +6 -2
- package/build/src/sections/Detail/Detail.stories.d.ts +1 -0
- package/build/src/sections/Detail/Tabs.d.ts +1 -0
- package/build/src/sections/Footer/Footer.d.ts +2 -2
- package/build/src/sections/Footer/styles.d.ts +5 -5
- package/build/src/sections/Header/LanguageSwitch.d.ts +2 -2
- package/build/src/sections/Header/RegistryInfoContent/RegistryInfoContent.d.ts +3 -3
- package/build/src/sections/Header/RegistryInfoContent/styles.d.ts +2 -2
- package/build/src/sections/Header/styles.d.ts +4 -11
- package/build/src/sections/Home/Home.test.d.ts +1 -0
- package/build/src/store/models/manifest.d.ts +11 -0
- package/build/src/store/models/routes.d.ts +8 -0
- package/build/src/store/models/utils.d.ts +1 -0
- package/build/src/types/packageMeta.d.ts +8 -5
- package/build/src/utils/__partials__/packageMeta.d.ts +0 -1
- package/build/src/utils/loadable.d.ts +2 -2
- package/build/src/utils/routes.d.ts +1 -0
- package/build/src/utils/utils.d.ts +1 -0
- package/build/store/api.js +14 -9
- package/build/store/index.js +1 -1
- package/build/store/models/configuration.js +4 -4
- package/build/store/models/download.js +2 -4
- package/build/store/models/index.js +1 -2
- package/build/store/models/login.js +7 -7
- package/build/store/models/manifest.js +27 -8
- package/build/store/models/packages.js +6 -5
- package/build/store/models/routes.js +18 -0
- package/build/store/models/search.js +7 -6
- package/build/store/models/utils.js +10 -0
- package/build/store/storage.js +2 -3
- package/build/store/store.js +2 -3
- package/build/test/i18n-config.js +2 -3
- package/build/test/test-react-testing-library.js +1 -1
- package/build/utils/__partials__/packageMeta.js +1 -3
- package/build/utils/index.js +3 -3
- package/build/utils/loadable.js +2 -2
- package/build/utils/routes.js +2 -2
- package/build/utils/token.js +1 -1
- package/build/utils/url.js +1 -1
- package/build/utils/utils.js +22 -4
- package/package.json +34 -31
- package/src/AppTest/App.stories.tsx +32 -0
- package/src/AppTest/AppRoute.test.tsx +65 -0
- package/src/AppTest/AppRoute.tsx +42 -0
- package/src/AppTest/pages/Front/Home.ts +3 -0
- package/src/AppTest/pages/Front/index.ts +1 -0
- package/src/AppTest/pages/Version/Version.tsx +28 -0
- package/src/AppTest/pages/Version/index.ts +1 -0
- package/src/Theme/ThemeProvider.test.tsx +27 -0
- package/src/Theme/theme.ts +12 -5
- package/src/components/ActionBar/ActionBar.stories.tsx +1 -1
- package/src/components/ActionBar/ActionBar.test.tsx +44 -16
- package/src/components/ActionBar/ActionBar.tsx +17 -13
- package/src/components/ActionBar/ActionBarAction.tsx +22 -14
- package/src/components/Author/Author.test.tsx +7 -1
- package/src/components/Author/Author.tsx +4 -33
- package/src/components/Author/styles.ts +0 -6
- package/src/components/CopyClipboard/CopyToClipBoard.test.tsx +23 -0
- package/src/components/CopyClipboard/CopyToClipBoard.tsx +4 -3
- package/src/components/CopyClipboard/utils.ts +2 -13
- package/src/components/Dependencies/Dependencies.stories.tsx +11 -11
- package/src/components/Dependencies/Dependencies.test.tsx +1 -11
- package/src/components/Dependencies/Dependencies.tsx +30 -69
- package/src/components/Dependencies/DependencyBlock.test.tsx +46 -0
- package/src/components/Dependencies/DependencyBlock.tsx +83 -0
- package/src/components/Dependencies/utits.ts +3 -0
- package/src/components/Deprecated/Deprecated.tsx +6 -19
- package/src/components/Developers/DeveloperType.tsx +4 -0
- package/src/components/Developers/Developers.test.tsx +37 -10
- package/src/components/Developers/Developers.tsx +13 -13
- package/src/components/Developers/Title.tsx +1 -5
- package/src/components/Developers/index.ts +2 -1
- package/src/components/Distribution/Dist.test.tsx +1 -1
- package/src/components/Distribution/Dist.tsx +2 -4
- package/src/components/Distribution/styles.ts +0 -6
- package/src/components/Engines/Engines.tsx +10 -6
- package/src/components/Engines/styles.ts +1 -1
- package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +39 -0
- package/src/components/Forbidden/Forbidden.test.tsx +38 -0
- package/src/components/Forbidden/Forbidden.tsx +56 -0
- package/src/components/Forbidden/index.ts +1 -0
- package/src/components/FundButton/FundButton.tsx +5 -5
- package/src/components/HeaderInfoDialog/HeaderInfoDialog.test.tsx +51 -0
- package/src/components/HeaderInfoDialog/HeaderInfoDialog.tsx +2 -2
- package/src/components/Heading/Heading.test.tsx +20 -0
- package/src/components/Help/Help.test.tsx +10 -3
- package/src/components/Icons/DevsIcons/CommonJS.tsx +1 -7
- package/src/components/Icons/DevsIcons/ES6Module.tsx +2 -8
- package/src/components/Icons/DevsIcons/Git.tsx +1 -7
- package/src/components/Icons/DevsIcons/NodeJS.tsx +1 -7
- package/src/components/Icons/DevsIcons/TypeScript.tsx +1 -7
- package/src/components/Icons/FileBinary.tsx +2 -1
- package/src/components/Icons/Icons.stories.tsx +21 -5
- package/src/components/Icons/Icons.test.tsx +70 -0
- package/src/components/Icons/Law.tsx +2 -1
- package/src/components/Icons/Managers/Npm.tsx +1 -7
- package/src/components/Icons/Managers/Pnpm.tsx +1 -7
- package/src/components/Icons/Managers/Yarn.tsx +1 -7
- package/src/components/Install/Install.test.tsx +74 -41
- package/src/components/Install/Install.tsx +27 -15
- package/src/components/Install/InstallListItem.tsx +49 -31
- package/src/components/Keywords/KeywordListItems.tsx +22 -0
- package/src/components/Keywords/Keywords.stories.tsx +19 -0
- package/src/components/Keywords/Keywords.test.tsx +57 -0
- package/src/components/Keywords/Keywords.tsx +35 -0
- package/src/components/Keywords/index.ts +1 -0
- package/src/components/Link/Link.test.tsx +25 -0
- package/src/components/Link/Link.tsx +4 -18
- package/src/components/Link/index.ts +1 -1
- package/src/components/LinkExternal/LinkExternal.test.tsx +18 -0
- package/src/components/LinkExternal/LinkExternal.tsx +22 -0
- package/src/components/LinkExternal/index.ts +1 -0
- package/src/components/Loading/Loading.test.tsx +8 -4
- package/src/components/Loading/styles.ts +1 -0
- package/src/components/LoginDialog/LoginDialog.test.tsx +1 -1
- package/src/components/LoginDialog/LoginDialog.tsx +10 -1
- package/src/components/LoginDialog/LoginDialogCloseButton.tsx +1 -0
- package/src/components/LoginDialog/LoginDialogForm.tsx +0 -2
- package/src/components/LoginDialog/LoginDialogFormError.tsx +1 -1
- package/src/components/Logo/Logo.stories.tsx +16 -0
- package/src/components/Logo/Logo.test.tsx +8 -1
- package/src/components/Logo/Logo.tsx +19 -3
- package/src/components/NotFound/NotFound.tsx +6 -5
- package/src/components/NotFound/Notfound.test.tsx +6 -3
- package/src/components/Package/Package.test.tsx +47 -14
- package/src/components/Package/Package.tsx +51 -45
- package/src/components/Package/styles.ts +7 -17
- package/src/components/PackageList/Packagelist.test.tsx +1 -0
- package/src/components/Person/Person.test.tsx +50 -0
- package/src/components/Person/Person.tsx +45 -0
- package/src/components/Person/PersonTooltip.tsx +26 -0
- package/src/components/Person/index.ts +1 -0
- package/src/components/Person/utils.ts +20 -0
- package/src/components/RawViewer/RawViewer.tsx +9 -10
- package/src/components/Readme/Readme.spec.tsx +17 -0
- package/src/components/Readme/Readme.tsx +28 -12
- package/src/components/Readme/github-markdown.css +1198 -0
- package/src/components/Readme/utils.ts +15 -14
- package/src/components/RegistryInfoDialog/styles.ts +5 -4
- package/src/components/Repository/Repository.tsx +10 -17
- package/src/components/Search/AutoComplete/AutoComplete.tsx +1 -1
- package/src/components/Search/AutoComplete/styles.ts +7 -0
- package/src/components/Search/Search.test.tsx +38 -11
- package/src/components/Search/Search.tsx +4 -2
- package/src/components/Search/SearchItem.tsx +19 -8
- package/src/components/Search/utils.ts +17 -0
- package/src/components/SettingsMenu/SettingsMenu.test.tsx +41 -0
- package/src/components/SettingsMenu/SettingsMenu.tsx +64 -7
- package/src/components/{SideBarTittle/SideBarTittle.tsx → SideBarTitle/SideBarTitle.tsx} +20 -3
- package/src/components/SideBarTitle/index.ts +1 -0
- package/src/components/UpLinks/UpLinks.test.tsx +7 -0
- package/src/components/UpLinks/UpLinks.tsx +38 -15
- package/src/components/UpLinks/UplinkLink.tsx +20 -0
- package/src/components/UpLinks/styles.ts +1 -0
- package/src/components/Versions/HistoryList.tsx +39 -6
- package/src/components/Versions/TagList.tsx +4 -3
- package/src/components/Versions/Versions.test.tsx +40 -7
- package/src/components/Versions/Versions.tsx +88 -19
- package/src/components/Versions/__partials__/data.json +1 -0
- package/src/components/Versions/__partials__/deprecated-versions.json +175 -0
- package/src/index.ts +6 -2
- package/src/providers/AppConfigurationProvider/AppConfigurationProvider.tsx +2 -0
- package/src/providers/PersistenceSettingProvider/PersistenceSettingProvider.tsx +4 -0
- package/src/providers/VersionProvider/VersionProvider.test.tsx +3 -3
- package/src/sections/Detail/Detail.stories.tsx +10 -0
- package/src/sections/Detail/Detail.test.tsx +8 -1
- package/src/sections/Detail/Detail.tsx +11 -4
- package/src/sections/Detail/Tabs.tsx +6 -9
- package/src/sections/Footer/Footer.tsx +26 -12
- package/src/sections/Footer/styles.ts +4 -0
- package/src/sections/Header/Header.test.tsx +12 -10
- package/src/sections/Header/HeaderLeft.tsx +19 -11
- package/src/sections/Header/HeaderMenu.tsx +1 -1
- package/src/sections/Header/HeaderRight.tsx +14 -3
- package/src/sections/Header/HeaderSettingsDialog.tsx +2 -3
- package/src/sections/Header/LanguageSwitch.tsx +10 -7
- package/src/sections/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +1 -1
- package/src/sections/Header/RegistryInfoContent/RegistryInfoContent.tsx +2 -7
- package/src/sections/Header/styles.ts +4 -16
- package/src/sections/Home/Home.test.tsx +37 -0
- package/src/sections/Home/Home.tsx +0 -1
- package/src/sections/SideBar/Sidebar.test.tsx +52 -84
- package/src/sections/SideBar/Sidebar.tsx +11 -26
- package/src/store/api.test.ts +19 -2
- package/src/store/api.ts +13 -6
- package/src/store/models/configuration.ts +2 -1
- package/src/store/models/download.ts +0 -1
- package/src/store/models/login.ts +10 -12
- package/src/store/models/manifest.ts +25 -6
- package/src/store/models/packages.ts +4 -5
- package/src/store/models/routes.ts +10 -0
- package/src/store/models/search.ts +4 -2
- package/src/store/models/utils.ts +3 -0
- package/src/types/packageMeta.ts +8 -5
- package/src/utils/__partials__/packageMeta.ts +0 -1
- package/src/utils/routes.ts +1 -0
- package/src/utils/utils.test.ts +34 -0
- package/src/utils/utils.ts +20 -5
- package/tsconfig.json +1 -1
- package/build/components/Dependencies/styles.js +0 -68
- package/build/components/Developers/styles.js +0 -69
- package/build/components/Distribution/utils.js +0 -25
- package/build/components/Distribution/utilts.spec.js +0 -18
- package/build/components/Package/Tag/Tag.js +0 -15
- package/build/components/Package/Tag/index.js +0 -14
- package/build/components/Package/Tag/styles.js +0 -25
- package/build/components/SideBarTittle/SideBarTittle.js +0 -94
- package/build/components/SideBarTittle/index.js +0 -14
- package/build/sections/Header/RegistryInfoDialog/RegistryInfoDialog.js +0 -37
- package/build/sections/Header/RegistryInfoDialog/index.js +0 -14
- package/build/sections/Header/RegistryInfoDialog/styles.js +0 -49
- package/build/sections/Header/RegistryInfoDialog/types.js +0 -6
- package/build/src/components/Dependencies/styles.d.ts +0 -8
- package/build/src/components/Developers/styles.d.ts +0 -11
- package/build/src/components/Distribution/utils.d.ts +0 -7
- package/build/src/components/Package/Tag/Tag.d.ts +0 -6
- package/build/src/components/Package/Tag/index.d.ts +0 -1
- package/build/src/components/Package/Tag/styles.d.ts +0 -5
- package/build/src/components/SideBarTittle/index.d.ts +0 -1
- package/build/src/sections/Header/RegistryInfoDialog/RegistryInfoDialog.d.ts +0 -4
- package/build/src/sections/Header/RegistryInfoDialog/index.d.ts +0 -1
- package/build/src/sections/Header/RegistryInfoDialog/styles.d.ts +0 -13
- package/build/src/sections/Header/RegistryInfoDialog/types.d.ts +0 -7
- package/src/components/Dependencies/styles.ts +0 -26
- package/src/components/Developers/styles.ts +0 -31
- package/src/components/Distribution/utils.ts +0 -32
- package/src/components/Distribution/utilts.spec.ts +0 -17
- package/src/components/Package/Tag/Tag.test.tsx +0 -15
- package/src/components/Package/Tag/Tag.tsx +0 -11
- package/src/components/Package/Tag/index.ts +0 -1
- package/src/components/Package/Tag/styles.ts +0 -11
- package/src/components/Search/AutoComplete/styles.tsx +0 -42
- package/src/components/SideBarTittle/index.ts +0 -1
- package/src/sections/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +0 -31
- package/src/sections/Header/RegistryInfoDialog/index.ts +0 -1
- package/src/sections/Header/RegistryInfoDialog/styles.ts +0 -21
- package/src/sections/Header/RegistryInfoDialog/types.ts +0 -8
- /package/build/components/Icons/DevsIcons/{es6modules.svg → es6module.svg} +0 -0
- /package/build/src/{components/Package/Tag/Tag.test.d.ts → AppTest/AppRoute.test.d.ts} +0 -0
- /package/build/src/components/{SideBarTittle/SideBarTittle.d.ts → SideBarTitle/SideBarTitle.d.ts} +0 -0
- /package/build/src/components/{SideBarTittle/SideBarTittle.stories.d.ts → SideBarTitle/SideBarTitle.stories.d.ts} +0 -0
- /package/build/src/components/{SideBarTittle → SideBarTitle}/utils.d.ts +0 -0
- /package/src/components/Icons/DevsIcons/{es6modules.svg → es6module.svg} +0 -0
- /package/src/components/{SideBarTittle/SideBarTittle.stories.tsx → SideBarTitle/SideBarTitle.stories.tsx} +0 -0
- /package/src/components/{SideBarTittle → SideBarTitle}/utils.ts +0 -0
|
@@ -87,7 +87,7 @@ describe('<LoginDialog /> component', () => {
|
|
|
87
87
|
fireEvent.change(userNameInput, { target: { value: 'xyz' } });
|
|
88
88
|
|
|
89
89
|
const passwordInput = screen.getByPlaceholderText('form-placeholder.password');
|
|
90
|
-
expect(
|
|
90
|
+
expect(passwordInput).toBeInTheDocument();
|
|
91
91
|
fireEvent.focus(passwordInput);
|
|
92
92
|
|
|
93
93
|
await act(async () => {
|
|
@@ -21,7 +21,7 @@ const LoginDialog: React.FC<Props> = ({ onClose, open = false }) => {
|
|
|
21
21
|
const makeLogin = useCallback(
|
|
22
22
|
async (username?: string, password?: string): Promise<LoginBody | void> => {
|
|
23
23
|
// checks isEmpty
|
|
24
|
-
if (isEmpty(username) || isEmpty(password)) {
|
|
24
|
+
if (!username || !password || isEmpty(username) || isEmpty(password)) {
|
|
25
25
|
dispatch.login.addError({
|
|
26
26
|
type: 'error',
|
|
27
27
|
description: i18next.t('form-validation.username-or-password-cant-be-empty'),
|
|
@@ -29,6 +29,15 @@ const LoginDialog: React.FC<Props> = ({ onClose, open = false }) => {
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
// checks min username and password length
|
|
33
|
+
if (username.length < 2 || password.length < 2) {
|
|
34
|
+
dispatch.login.addError({
|
|
35
|
+
type: 'error',
|
|
36
|
+
description: i18next.t('form-validation.required-min-length', { length: 2 }),
|
|
37
|
+
});
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
try {
|
|
33
42
|
dispatch.login.getUser({ username, password });
|
|
34
43
|
// const response: LoginBody = await doLogin(username as string, password as string);
|
|
@@ -48,7 +48,6 @@ const LoginDialogForm = memo(({ onSubmit, error }: Props) => {
|
|
|
48
48
|
id="login--dialog-username"
|
|
49
49
|
{...register('username', {
|
|
50
50
|
required: { value: true, message: t('form-validation.required-field') },
|
|
51
|
-
minLength: { value: 2, message: t('form-validation.required-min-length', { length: 2 }) },
|
|
52
51
|
})}
|
|
53
52
|
label={t('form.username')}
|
|
54
53
|
margin="normal"
|
|
@@ -65,7 +64,6 @@ const LoginDialogForm = memo(({ onSubmit, error }: Props) => {
|
|
|
65
64
|
id="login--dialog-password"
|
|
66
65
|
{...register('password', {
|
|
67
66
|
required: { value: true, message: t('form-validation.required-field') },
|
|
68
|
-
minLength: { value: 2, message: t('form-validation.required-min-length', { length: 2 }) },
|
|
69
67
|
})}
|
|
70
68
|
data-testid="password"
|
|
71
69
|
label={t('form.password')}
|
|
@@ -30,7 +30,7 @@ const LoginDialogFormError = memo(({ error }: Props) => {
|
|
|
30
30
|
return (
|
|
31
31
|
<StyledSnackbarContent
|
|
32
32
|
message={
|
|
33
|
-
<Box alignItems="center" display="flex">
|
|
33
|
+
<Box alignItems="center" data-testid="error" display="flex">
|
|
34
34
|
<StyledErrorIcon />
|
|
35
35
|
{error.description}
|
|
36
36
|
</Box>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Box from '@mui/material/Box';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
import Logo from './Logo';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Components/Logo',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Icons: any = () => (
|
|
11
|
+
<Box sx={{ width: '100%' }}>
|
|
12
|
+
<Logo size="x-small" />
|
|
13
|
+
<Logo size="small" />
|
|
14
|
+
<Logo size="big" />
|
|
15
|
+
</Box>
|
|
16
|
+
);
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { render } from '../../test/test-react-testing-library';
|
|
3
|
+
import { render, screen } from '../../test/test-react-testing-library';
|
|
4
4
|
import Logo from './Logo';
|
|
5
5
|
|
|
6
6
|
describe('<Logo /> component', () => {
|
|
7
7
|
test('should render the component in default state', () => {
|
|
8
8
|
const { container } = render(<Logo />);
|
|
9
9
|
expect(container.firstChild).toMatchSnapshot();
|
|
10
|
+
expect(screen.getByTestId('default-logo')).toBeTruthy();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('should render custom logo', () => {
|
|
14
|
+
window.__VERDACCIO_BASENAME_UI_OPTIONS.logo = 'custom.png';
|
|
15
|
+
render(<Logo />);
|
|
16
|
+
expect(screen.getByTestId('custom-logo')).toBeTruthy();
|
|
10
17
|
});
|
|
11
18
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
+
import { useTheme } from '@mui/styles';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
4
5
|
import { Theme, useConfig } from '../../';
|
|
@@ -22,18 +23,33 @@ interface Props {
|
|
|
22
23
|
onClick?: () => void;
|
|
23
24
|
className?: string;
|
|
24
25
|
isDefault?: boolean;
|
|
26
|
+
title?: string;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
const Logo: React.FC<Props> = ({ size, onClick, className, isDefault = false }) => {
|
|
29
|
+
const Logo: React.FC<Props> = ({ size, onClick, className, isDefault = false, title = '' }) => {
|
|
28
30
|
const { configOptions } = useConfig();
|
|
31
|
+
const theme = useTheme();
|
|
29
32
|
if (!isDefault && configOptions?.logo) {
|
|
33
|
+
const logoSrc =
|
|
34
|
+
theme?.palette.mode === 'dark' && configOptions.logoDark
|
|
35
|
+
? configOptions.logoDark
|
|
36
|
+
: configOptions.logo;
|
|
30
37
|
return (
|
|
31
38
|
<ImageLogo className={className} onClick={onClick}>
|
|
32
|
-
<img alt=
|
|
39
|
+
<img alt={title} data-testid={'custom-logo'} height="40px" src={logoSrc} />
|
|
33
40
|
</ImageLogo>
|
|
34
41
|
);
|
|
35
42
|
}
|
|
36
|
-
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<StyledLogo
|
|
46
|
+
className={className}
|
|
47
|
+
data-testid={'default-logo'}
|
|
48
|
+
onClick={onClick}
|
|
49
|
+
size={size}
|
|
50
|
+
title={title}
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
37
53
|
};
|
|
38
54
|
|
|
39
55
|
export default Logo;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/* eslint-disable verdaccio/jsx-no-style */
|
|
1
2
|
import styled from '@emotion/styled';
|
|
3
|
+
import FolderOffIcon from '@mui/icons-material/FolderOff';
|
|
2
4
|
import Box from '@mui/material/Box';
|
|
3
5
|
import Button from '@mui/material/Button';
|
|
4
6
|
import React, { useCallback } from 'react';
|
|
@@ -7,8 +9,6 @@ import { useHistory } from 'react-router-dom';
|
|
|
7
9
|
|
|
8
10
|
import { Theme } from '../../';
|
|
9
11
|
import Heading from '../Heading';
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
import PackageImg from './img/package.svg';
|
|
12
12
|
|
|
13
13
|
const NotFound: React.FC = () => {
|
|
14
14
|
const history = useHistory();
|
|
@@ -28,7 +28,9 @@ const NotFound: React.FC = () => {
|
|
|
28
28
|
justifyContent="center"
|
|
29
29
|
p={2}
|
|
30
30
|
>
|
|
31
|
-
<
|
|
31
|
+
<Container>
|
|
32
|
+
<FolderOffIcon color="primary" style={{ fontSize: 236 }} />
|
|
33
|
+
</Container>
|
|
32
34
|
<StyledHeading className="not-found-text" variant="h4">
|
|
33
35
|
{t('error.404.sorry-we-could-not-find-it')}
|
|
34
36
|
</StyledHeading>
|
|
@@ -41,8 +43,7 @@ const NotFound: React.FC = () => {
|
|
|
41
43
|
|
|
42
44
|
export default NotFound;
|
|
43
45
|
|
|
44
|
-
const
|
|
45
|
-
width: '150px',
|
|
46
|
+
const Container = styled('div')({
|
|
46
47
|
margin: '0 auto',
|
|
47
48
|
});
|
|
48
49
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MemoryRouter } from 'react-router';
|
|
3
3
|
|
|
4
|
-
import { fireEvent, render } from '../../test/test-react-testing-library';
|
|
4
|
+
import { fireEvent, render, screen } from '../../test/test-react-testing-library';
|
|
5
5
|
import NotFound from './NotFound';
|
|
6
6
|
|
|
7
7
|
const mockHistory = jest.fn();
|
|
@@ -14,12 +14,15 @@ jest.mock('react-router-dom', () => ({
|
|
|
14
14
|
|
|
15
15
|
describe('<NotFound /> component', () => {
|
|
16
16
|
test('should load the component in default state', () => {
|
|
17
|
-
|
|
17
|
+
render(
|
|
18
18
|
<MemoryRouter>
|
|
19
19
|
<NotFound />
|
|
20
20
|
</MemoryRouter>
|
|
21
21
|
);
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
expect(screen.getByTestId('FolderOffIcon')).toBeInTheDocument();
|
|
24
|
+
expect(screen.getByText('button.go-to-the-home-page')).toBeInTheDocument();
|
|
25
|
+
expect(screen.getByText('error.404.sorry-we-could-not-find-it')).toBeInTheDocument();
|
|
23
26
|
});
|
|
24
27
|
|
|
25
28
|
test('go to Home Page button click', async () => {
|
|
@@ -2,7 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import { MemoryRouter } from 'react-router';
|
|
3
3
|
|
|
4
4
|
import { store } from '../../';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
cleanup,
|
|
7
|
+
fireEvent,
|
|
8
|
+
renderWithStore,
|
|
9
|
+
screen,
|
|
10
|
+
waitFor,
|
|
11
|
+
} from '../../test/test-react-testing-library';
|
|
6
12
|
import Package from './Package';
|
|
7
13
|
|
|
8
14
|
/**
|
|
@@ -11,29 +17,36 @@ import Package from './Package';
|
|
|
11
17
|
*/
|
|
12
18
|
const dateOneMonthAgo = (): Date => new Date(1544377770747);
|
|
13
19
|
|
|
20
|
+
const props = {
|
|
21
|
+
name: 'verdaccio',
|
|
22
|
+
version: '1.0.0',
|
|
23
|
+
time: String(dateOneMonthAgo()),
|
|
24
|
+
license: 'MIT',
|
|
25
|
+
description: 'Private NPM repository',
|
|
26
|
+
author: {
|
|
27
|
+
name: 'Sam',
|
|
28
|
+
},
|
|
29
|
+
dist: {
|
|
30
|
+
fileCount: 1,
|
|
31
|
+
unpackedSize: 171,
|
|
32
|
+
tarball: 'http://localhost:9000/verdaccio/-/verdaccio-1.0.0.tgz',
|
|
33
|
+
},
|
|
34
|
+
keywords: ['verdaccio-core'],
|
|
35
|
+
};
|
|
36
|
+
|
|
14
37
|
describe('<Package /> component', () => {
|
|
15
38
|
afterEach(() => {
|
|
16
39
|
cleanup();
|
|
17
40
|
});
|
|
18
41
|
|
|
19
42
|
test('should load the component', () => {
|
|
20
|
-
const props = {
|
|
21
|
-
name: 'verdaccio',
|
|
22
|
-
version: '1.0.0',
|
|
23
|
-
time: String(dateOneMonthAgo()),
|
|
24
|
-
license: 'MIT',
|
|
25
|
-
description: 'Private NPM repository',
|
|
26
|
-
author: {
|
|
27
|
-
name: 'Sam',
|
|
28
|
-
},
|
|
29
|
-
keywords: ['verdaccio'],
|
|
30
|
-
};
|
|
31
|
-
|
|
32
43
|
const wrapper = renderWithStore(
|
|
33
44
|
<MemoryRouter>
|
|
34
45
|
<Package
|
|
35
46
|
author={props.author}
|
|
36
47
|
description={props.description}
|
|
48
|
+
dist={props.dist}
|
|
49
|
+
keywords={props.keywords}
|
|
37
50
|
license={props.license}
|
|
38
51
|
name={props.name}
|
|
39
52
|
time={props.time}
|
|
@@ -50,5 +63,25 @@ describe('<Package /> component', () => {
|
|
|
50
63
|
expect(wrapper.getByText('MIT')).toBeInTheDocument();
|
|
51
64
|
});
|
|
52
65
|
|
|
53
|
-
test
|
|
66
|
+
// test if click on download button will trigger the download action
|
|
67
|
+
test('should download the package', async () => {
|
|
68
|
+
renderWithStore(
|
|
69
|
+
<MemoryRouter>
|
|
70
|
+
<Package
|
|
71
|
+
author={props.author}
|
|
72
|
+
description={props.description}
|
|
73
|
+
dist={props.dist}
|
|
74
|
+
keywords={props.keywords}
|
|
75
|
+
license={props.license}
|
|
76
|
+
name={props.name}
|
|
77
|
+
time={props.time}
|
|
78
|
+
version={props.version}
|
|
79
|
+
/>
|
|
80
|
+
</MemoryRouter>,
|
|
81
|
+
store
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
fireEvent.click(screen.getByTestId('download-tarball'));
|
|
85
|
+
await waitFor(() => expect(store.getState().loading.models.download).toBe(true));
|
|
86
|
+
});
|
|
54
87
|
});
|
|
@@ -3,19 +3,20 @@ import styled from '@emotion/styled';
|
|
|
3
3
|
import BugReport from '@mui/icons-material/BugReport';
|
|
4
4
|
import DownloadIcon from '@mui/icons-material/CloudDownload';
|
|
5
5
|
import HomeIcon from '@mui/icons-material/Home';
|
|
6
|
-
import
|
|
6
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
7
7
|
import Grid from '@mui/material/Grid';
|
|
8
|
+
import List from '@mui/material/List';
|
|
8
9
|
import ListItem from '@mui/material/ListItem';
|
|
9
10
|
import Tooltip from '@mui/material/Tooltip';
|
|
10
11
|
import React, { useCallback } from 'react';
|
|
11
12
|
import { useTranslation } from 'react-i18next';
|
|
12
13
|
import { useDispatch, useSelector } from 'react-redux';
|
|
13
14
|
|
|
14
|
-
import { Dispatch, Link, RootState, Theme } from '../../';
|
|
15
|
+
import { Dispatch, Link, LinkExternal, RootState, Theme } from '../../';
|
|
15
16
|
import { FileBinary, Law, Time, Version } from '../../components/Icons';
|
|
16
17
|
import { Author as PackageAuthor, PackageMetaInterface } from '../../types/packageMeta';
|
|
17
|
-
import { url, utils } from '../../utils';
|
|
18
|
-
import
|
|
18
|
+
import { Route, url, utils } from '../../utils';
|
|
19
|
+
import KeywordListItems from '../Keywords/KeywordListItems';
|
|
19
20
|
import {
|
|
20
21
|
Author,
|
|
21
22
|
Avatar,
|
|
@@ -27,7 +28,6 @@ import {
|
|
|
27
28
|
PackageListItemText,
|
|
28
29
|
PackageTitle,
|
|
29
30
|
Published,
|
|
30
|
-
TagContainer,
|
|
31
31
|
Wrapper,
|
|
32
32
|
WrapperLink,
|
|
33
33
|
} from './styles';
|
|
@@ -46,7 +46,7 @@ export interface PackageInterface {
|
|
|
46
46
|
time?: number | string;
|
|
47
47
|
author: PackageAuthor;
|
|
48
48
|
description?: string;
|
|
49
|
-
keywords?:
|
|
49
|
+
keywords?: PackageMetaInterface['latest']['keywords'];
|
|
50
50
|
license?: PackageMetaInterface['latest']['license'];
|
|
51
51
|
homepage?: string;
|
|
52
52
|
bugs?: Bugs;
|
|
@@ -60,7 +60,7 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
60
60
|
description,
|
|
61
61
|
dist,
|
|
62
62
|
homepage,
|
|
63
|
-
keywords
|
|
63
|
+
keywords,
|
|
64
64
|
license,
|
|
65
65
|
name: packageName,
|
|
66
66
|
time,
|
|
@@ -70,7 +70,7 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
70
70
|
const config = useSelector((state: RootState) => state.configuration.config);
|
|
71
71
|
const dispatch = useDispatch<Dispatch>();
|
|
72
72
|
const { t } = useTranslation();
|
|
73
|
-
const
|
|
73
|
+
const isLoading = useSelector((state: RootState) => state?.loading?.models.download);
|
|
74
74
|
|
|
75
75
|
const handleDownload = useCallback(
|
|
76
76
|
async (tarballDist: string) => {
|
|
@@ -92,21 +92,12 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
92
92
|
const renderAuthorInfo = (): React.ReactNode => {
|
|
93
93
|
const name = utils.getAuthorName(authorName);
|
|
94
94
|
return (
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
fontWeight: theme?.fontWeight.semiBold,
|
|
102
|
-
color:
|
|
103
|
-
theme?.palette.mode === 'light' ? theme?.palette.greyLight2 : theme?.palette.white,
|
|
104
|
-
}}
|
|
105
|
-
>
|
|
106
|
-
{name}
|
|
107
|
-
</div>
|
|
108
|
-
</Details>
|
|
109
|
-
</Author>
|
|
95
|
+
<OverviewItem>
|
|
96
|
+
<Author>
|
|
97
|
+
<Avatar alt={name} src={authorAvatar} />
|
|
98
|
+
<Details>{name}</Details>
|
|
99
|
+
</Author>
|
|
100
|
+
</OverviewItem>
|
|
110
101
|
);
|
|
111
102
|
};
|
|
112
103
|
|
|
@@ -130,33 +121,34 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
130
121
|
time && (
|
|
131
122
|
<OverviewItem>
|
|
132
123
|
<StyledTime />
|
|
133
|
-
<Published
|
|
134
|
-
|
|
124
|
+
<Published title={utils.formatDate(time)}>
|
|
125
|
+
{t('package.published-on', { time: utils.formatDateDistance(time) })}
|
|
126
|
+
</Published>
|
|
135
127
|
</OverviewItem>
|
|
136
128
|
);
|
|
137
129
|
|
|
138
130
|
const renderHomePageLink = (): React.ReactNode =>
|
|
139
131
|
homepage &&
|
|
140
132
|
url.isURL(homepage) && (
|
|
141
|
-
<
|
|
133
|
+
<LinkExternal to={homepage}>
|
|
142
134
|
<Tooltip aria-label={t('package.homepage')} title={t('package.visit-home-page')}>
|
|
143
135
|
<IconButton aria-label={t('package.homepage')} size="large">
|
|
144
136
|
<HomeIcon />
|
|
145
137
|
</IconButton>
|
|
146
138
|
</Tooltip>
|
|
147
|
-
</
|
|
139
|
+
</LinkExternal>
|
|
148
140
|
);
|
|
149
141
|
|
|
150
142
|
const renderBugsLink = (): React.ReactNode =>
|
|
151
143
|
bugs?.url &&
|
|
152
144
|
url.isURL(bugs.url) && (
|
|
153
|
-
<
|
|
145
|
+
<LinkExternal to={bugs.url}>
|
|
154
146
|
<Tooltip aria-label={t('package.bugs')} title={t('package.open-an-issue')}>
|
|
155
147
|
<IconButton aria-label={t('package.bugs')} size="large">
|
|
156
148
|
<BugReport />
|
|
157
149
|
</IconButton>
|
|
158
150
|
</Tooltip>
|
|
159
|
-
</
|
|
151
|
+
</LinkExternal>
|
|
160
152
|
);
|
|
161
153
|
|
|
162
154
|
const renderDownloadLink = (): React.ReactNode =>
|
|
@@ -172,8 +164,18 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
172
164
|
aria-label={t('package.download', { what: t('package.the-tar-file') })}
|
|
173
165
|
title={t('package.tarball')}
|
|
174
166
|
>
|
|
175
|
-
<IconButton
|
|
176
|
-
|
|
167
|
+
<IconButton
|
|
168
|
+
aria-label={t('package.download')}
|
|
169
|
+
data-testid="download-tarball"
|
|
170
|
+
size="large"
|
|
171
|
+
>
|
|
172
|
+
{isLoading ? (
|
|
173
|
+
<CircularProgress size={13}>
|
|
174
|
+
<DownloadIcon />
|
|
175
|
+
</CircularProgress>
|
|
176
|
+
) : (
|
|
177
|
+
<DownloadIcon />
|
|
178
|
+
)}
|
|
177
179
|
</IconButton>
|
|
178
180
|
</Tooltip>
|
|
179
181
|
</Link>
|
|
@@ -183,7 +185,7 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
183
185
|
return (
|
|
184
186
|
<Grid container={true} item={true} xs={12}>
|
|
185
187
|
<Grid item={true} xs={11}>
|
|
186
|
-
<WrapperLink to={
|
|
188
|
+
<WrapperLink to={`${Route.DETAIL}${packageName}`}>
|
|
187
189
|
<PackageTitle className="package-title" data-testid="package-title">
|
|
188
190
|
{packageName}
|
|
189
191
|
</PackageTitle>
|
|
@@ -194,6 +196,7 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
194
196
|
container={true}
|
|
195
197
|
item={true}
|
|
196
198
|
justify="flex-end"
|
|
199
|
+
spacing={3}
|
|
197
200
|
xs={true}
|
|
198
201
|
>
|
|
199
202
|
{renderHomePageLink()}
|
|
@@ -204,15 +207,7 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
204
207
|
);
|
|
205
208
|
};
|
|
206
209
|
|
|
207
|
-
const renderSecondaryComponent = (): React.ReactNode => {
|
|
208
|
-
const tags = keywords.sort().map((keyword, index) => <Tag key={index}>{keyword}</Tag>);
|
|
209
|
-
return (
|
|
210
|
-
<>
|
|
211
|
-
<Description>{description}</Description>
|
|
212
|
-
{tags.length > 0 && <TagContainer>{tags}</TagContainer>}
|
|
213
|
-
</>
|
|
214
|
-
);
|
|
215
|
-
};
|
|
210
|
+
const renderSecondaryComponent = (): React.ReactNode => <Description>{description}</Description>;
|
|
216
211
|
|
|
217
212
|
const renderPackageListItemText = (): React.ReactNode => (
|
|
218
213
|
<PackageListItemText
|
|
@@ -222,10 +217,21 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
222
217
|
/>
|
|
223
218
|
);
|
|
224
219
|
|
|
220
|
+
const renderKeywords = (): React.ReactNode => (
|
|
221
|
+
<ListItem alignItems={'flex-start'} sx={{ py: 0, my: 0 }}>
|
|
222
|
+
<List sx={{ p: 0, my: 0 }}>
|
|
223
|
+
<KeywordListItems keywords={keywords} />
|
|
224
|
+
</List>
|
|
225
|
+
</ListItem>
|
|
226
|
+
);
|
|
227
|
+
|
|
225
228
|
return (
|
|
226
229
|
<Wrapper className={'package'} data-testid="package-item-list">
|
|
227
|
-
<ListItem alignItems={'flex-start'}
|
|
228
|
-
|
|
230
|
+
<ListItem alignItems={'flex-start'} sx={{ mb: 0 }}>
|
|
231
|
+
{renderPackageListItemText()}
|
|
232
|
+
</ListItem>
|
|
233
|
+
{keywords && keywords?.length > 0 ? renderKeywords() : null}
|
|
234
|
+
<ListItem alignItems={'flex-start'} sx={{ mt: 0 }}>
|
|
229
235
|
{renderAuthorInfo()}
|
|
230
236
|
{renderVersionInfo()}
|
|
231
237
|
{renderPublishedInfo()}
|
|
@@ -239,8 +245,8 @@ const Package: React.FC<PackageInterface> = ({
|
|
|
239
245
|
export default Package;
|
|
240
246
|
|
|
241
247
|
const iconStyle = ({ theme }: { theme: Theme }) => css`
|
|
242
|
-
margin:
|
|
243
|
-
fill: ${theme?.palette.mode === 'light' ? theme?.palette.
|
|
248
|
+
margin: 0 10px 0 0;
|
|
249
|
+
fill: ${theme?.palette.mode === 'light' ? theme?.palette.greyDark : theme?.palette.white};
|
|
244
250
|
`;
|
|
245
251
|
|
|
246
252
|
const StyledVersion = styled(Version)`
|
|
@@ -11,8 +11,8 @@ import { Theme } from '../../';
|
|
|
11
11
|
export const OverviewItem = styled('span')<{ theme?: Theme }>(({ theme }) => ({
|
|
12
12
|
display: 'flex',
|
|
13
13
|
alignItems: 'center',
|
|
14
|
-
margin: '0 0 0
|
|
15
|
-
color: theme?.palette.mode === 'light' ? theme?.palette.
|
|
14
|
+
margin: '0 20px 0 0',
|
|
15
|
+
color: theme?.palette.mode === 'light' ? theme?.palette.greyDark2 : theme?.palette.white,
|
|
16
16
|
fontSize: 12,
|
|
17
17
|
[`@media (max-width: ${theme?.breakPoints.medium}px)`]: {
|
|
18
18
|
':nth-of-type(3)': {
|
|
@@ -26,10 +26,9 @@ export const OverviewItem = styled('span')<{ theme?: Theme }>(({ theme }) => ({
|
|
|
26
26
|
},
|
|
27
27
|
}));
|
|
28
28
|
|
|
29
|
-
export const Published = styled('span')
|
|
30
|
-
color: theme?.palette.mode === 'light' ? theme?.palette.greyLight2 : theme?.palette.white,
|
|
29
|
+
export const Published = styled('span')({
|
|
31
30
|
margin: '0 5px 0 0',
|
|
32
|
-
})
|
|
31
|
+
});
|
|
33
32
|
|
|
34
33
|
export const Details = styled('span')({
|
|
35
34
|
marginLeft: '5px',
|
|
@@ -59,6 +58,7 @@ export const PackageTitle = styled('span')<{ theme?: Theme }>(({ theme }) => ({
|
|
|
59
58
|
marginBottom: 12,
|
|
60
59
|
color: theme?.palette.mode == 'dark' ? theme?.palette.dodgerBlue : theme?.palette.eclipse,
|
|
61
60
|
cursor: 'pointer',
|
|
61
|
+
textDecoration: 'none',
|
|
62
62
|
[`@media (max-width: ${theme?.breakPoints.small}px)`]: {
|
|
63
63
|
fontSize: 14,
|
|
64
64
|
marginBottom: 8,
|
|
@@ -70,9 +70,9 @@ export const GridRightAligned = styled(Grid)({
|
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
export const Wrapper = styled(List)<{ theme?: Theme }>(({ theme }) => ({
|
|
73
|
-
'
|
|
73
|
+
'&:hover': {
|
|
74
74
|
backgroundColor:
|
|
75
|
-
theme?.palette?.type == 'dark' ? theme?.palette?.secondary.main : theme?.palette?.
|
|
75
|
+
theme?.palette?.type == 'dark' ? theme?.palette?.secondary.main : theme?.palette?.greyLight2,
|
|
76
76
|
},
|
|
77
77
|
}));
|
|
78
78
|
|
|
@@ -83,16 +83,6 @@ export const IconButton = styled(MuiIconButton)({
|
|
|
83
83
|
},
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
-
export const TagContainer = styled('span')<{ theme?: Theme }>(({ theme }) => ({
|
|
87
|
-
marginTop: 8,
|
|
88
|
-
marginBottom: 12,
|
|
89
|
-
display: 'flex',
|
|
90
|
-
flexWrap: 'wrap',
|
|
91
|
-
[`@media (max-width: ${theme?.breakPoints.medium}px)`]: {
|
|
92
|
-
display: 'none',
|
|
93
|
-
},
|
|
94
|
-
}));
|
|
95
|
-
|
|
96
86
|
export const PackageListItemText = styled(ListItemText)({
|
|
97
87
|
paddingRight: 0,
|
|
98
88
|
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { fireEvent, render, screen } from '../../test/test-react-testing-library';
|
|
4
|
+
import { Developer } from '../../types/packageMeta';
|
|
5
|
+
import Person from './Person';
|
|
6
|
+
|
|
7
|
+
const mockPerson: Developer = {
|
|
8
|
+
name: 'John Doe',
|
|
9
|
+
email: 'john.doe@example.com',
|
|
10
|
+
avatar: 'https://example.com/avatar.jpg',
|
|
11
|
+
url: 'https://example.com/~johndoe',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const mockPackageName = 'test-package';
|
|
15
|
+
const mockVersion = '1.0.0';
|
|
16
|
+
|
|
17
|
+
const ComponentToBeRendered: React.FC<{ withText?: boolean }> = ({ withText = false }) => {
|
|
18
|
+
return (
|
|
19
|
+
<Person
|
|
20
|
+
packageName={mockPackageName}
|
|
21
|
+
person={mockPerson}
|
|
22
|
+
version={mockVersion}
|
|
23
|
+
withText={withText}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
describe('Person component', () => {
|
|
29
|
+
test('should render avatar', () => {
|
|
30
|
+
render(<ComponentToBeRendered />);
|
|
31
|
+
const avatar = screen.getByAltText(mockPerson.name);
|
|
32
|
+
expect(avatar).toBeInTheDocument();
|
|
33
|
+
// but not include text
|
|
34
|
+
expect(screen.queryByText(mockPerson.name)).not.toBeInTheDocument();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('should render name when withText is true', () => {
|
|
38
|
+
render(<ComponentToBeRendered withText={true} />);
|
|
39
|
+
const name = screen.getByText(mockPerson.name);
|
|
40
|
+
expect(name).toBeInTheDocument();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('should not render name when withText is false', async () => {
|
|
44
|
+
render(<ComponentToBeRendered />);
|
|
45
|
+
// hover over the avatar
|
|
46
|
+
fireEvent.mouseEnter(screen.getByTestId(mockPerson.name));
|
|
47
|
+
// wait for the tooltip to appear
|
|
48
|
+
await screen.findByTestId(mockPerson.name + '-tooltip');
|
|
49
|
+
});
|
|
50
|
+
});
|