@verdaccio/ui-theme 3.1.0 → 6.0.0-6-next.11
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/.babelrc +33 -0
- package/.eslintrc +115 -0
- package/.stylelintrc +40 -0
- package/CHANGELOG.md +152 -554
- package/LICENSE +1 -1
- package/README.md +22 -95
- package/config/env.js +9 -0
- package/jest/api/packages.json +42 -0
- package/jest/identity.js +29 -0
- package/jest/jest.config.js +39 -0
- package/jest/jestEnvironment.js +1 -0
- package/jest/server-handlers.ts +9 -0
- package/jest/server.ts +6 -0
- package/jest/setup-env.ts +15 -0
- package/jest/setup.ts +31 -0
- package/jest/unit/components/__mocks__/api.ts +47 -0
- package/jest/unit/components/__mocks__/token.ts +31 -0
- package/jest/unit/components/store/login.ts +23 -0
- package/jest/unit/components/store/logo.ts +7 -0
- package/jest/unit/components/store/package.ts +174 -0
- package/jest/unit/components/store/packageMeta.ts +592 -0
- package/jest/unit/empty.ts +1 -0
- package/lib/constants.ts +9 -0
- package/package.json +153 -228
- package/src/App/App.test.tsx +123 -0
- package/src/App/App.tsx +54 -0
- package/src/App/AppError.tsx +38 -0
- package/src/App/AppRoute.tsx +63 -0
- package/src/App/Footer/Footer.test.tsx +20 -0
- package/src/App/Footer/Footer.tsx +111 -0
- package/src/App/Footer/__snapshots__/Footer.test.tsx.snap +456 -0
- package/src/App/Footer/index.ts +1 -0
- package/src/App/Footer/styles.ts +44 -0
- package/src/App/Header/Header.test.tsx +152 -0
- package/src/App/Header/Header.tsx +74 -0
- package/src/App/Header/HeaderGreetings.tsx +22 -0
- package/src/App/Header/HeaderInfoDialog.tsx +19 -0
- package/src/App/Header/HeaderLeft.tsx +31 -0
- package/src/App/Header/HeaderMenu.tsx +65 -0
- package/src/App/Header/HeaderRight.tsx +118 -0
- package/src/App/Header/HeaderToolTip.tsx +19 -0
- package/src/App/Header/HeaderToolTipIcon.tsx +75 -0
- package/src/App/Header/LanguageSwitch.tsx +125 -0
- package/src/App/Header/LoginDialog/LoginDialog.test.tsx +112 -0
- package/src/App/Header/LoginDialog/LoginDialog.tsx +81 -0
- package/src/App/Header/LoginDialog/LoginDialogCloseButton.tsx +32 -0
- package/src/App/Header/LoginDialog/LoginDialogForm.tsx +97 -0
- package/src/App/Header/LoginDialog/LoginDialogFormError.tsx +43 -0
- package/src/App/Header/LoginDialog/LoginDialogHeader.tsx +48 -0
- package/src/App/Header/LoginDialog/__snapshots__/LoginDialog.test.tsx.snap +3 -0
- package/src/App/Header/LoginDialog/index.ts +1 -0
- package/src/App/Header/RegistryInfoContent/RegistryInfoContent.test.tsx +27 -0
- package/src/App/Header/RegistryInfoContent/RegistryInfoContent.tsx +155 -0
- package/src/App/Header/RegistryInfoContent/index.ts +1 -0
- package/src/App/Header/RegistryInfoDialog/RegistryInfoDialog.tsx +30 -0
- package/src/App/Header/RegistryInfoDialog/index.ts +1 -0
- package/src/App/Header/RegistryInfoDialog/styles.ts +16 -0
- package/src/App/Header/RegistryInfoDialog/types.ts +7 -0
- package/src/App/Header/Search/Search.test.tsx +168 -0
- package/src/App/Header/Search/Search.tsx +127 -0
- package/src/App/Header/Search/SearchAdornment.tsx +18 -0
- package/src/App/Header/Search/__snapshots__/Search.test.tsx.snap +101 -0
- package/src/App/Header/Search/index.ts +1 -0
- package/src/App/Header/index.ts +1 -0
- package/src/App/Header/styles.ts +89 -0
- package/src/App/index.ts +1 -0
- package/src/App/utils/loadable.tsx +10 -0
- package/src/components/.eslintrc +7 -0
- package/src/components/ActionBar/ActionBar.test.tsx +91 -0
- package/src/components/ActionBar/ActionBar.tsx +45 -0
- package/src/components/ActionBar/ActionBarAction.tsx +75 -0
- package/src/components/ActionBar/__snapshots__/ActionBar.test.tsx.snap +122 -0
- package/src/components/ActionBar/index.ts +1 -0
- package/src/components/AppBar.tsx +10 -0
- package/src/components/Author/Author.test.tsx +75 -0
- package/src/components/Author/Author.tsx +47 -0
- package/src/components/Author/__snapshots__/Author.test.tsx.snap +353 -0
- package/src/components/Author/index.ts +1 -0
- package/src/components/Author/styles.ts +23 -0
- package/src/components/AutoComplete/AutoComplete.tsx +179 -0
- package/src/components/AutoComplete/AutoCompleteV2.tsx +296 -0
- package/src/components/AutoComplete/index.ts +1 -0
- package/src/components/AutoComplete/styles.tsx +58 -0
- package/src/components/AutoComplete/useAutoComplete.tsx +61 -0
- package/src/components/Avatar.tsx +3 -0
- package/src/components/Box.tsx +8 -0
- package/src/components/Button.tsx +10 -0
- package/src/components/Card.tsx +10 -0
- package/src/components/CardActions.tsx +13 -0
- package/src/components/CardContent.tsx +10 -0
- package/src/components/Chip.tsx +10 -0
- package/src/components/CircularProgress.tsx +15 -0
- package/src/components/CopyToClipBoard.tsx +45 -0
- package/src/components/Dialog.tsx +10 -0
- package/src/components/DialogActions.tsx +16 -0
- package/src/components/DialogContent.tsx +16 -0
- package/src/components/DialogTitle.tsx +10 -0
- package/src/components/Divider.tsx +10 -0
- package/src/components/FloatingActionButton.tsx +12 -0
- package/src/components/FormControl.tsx +10 -0
- package/src/components/FormHelperText.tsx +16 -0
- package/src/components/Grid.tsx +10 -0
- package/src/components/Heading.tsx +15 -0
- package/src/components/IconButton.tsx +10 -0
- package/src/components/Icons/.eslintrc +5 -0
- package/src/components/Icons/Earth.tsx +36 -0
- package/src/components/Icons/FileBinary.tsx +20 -0
- package/src/components/Icons/Law.tsx +20 -0
- package/src/components/Icons/License.tsx +18 -0
- package/src/components/Icons/Time.tsx +19 -0
- package/src/components/Icons/Version.tsx +20 -0
- package/src/components/Icons/index.ts +5 -0
- package/src/components/Input.tsx +10 -0
- package/src/components/InputAdornment/InputAdornment.tsx +16 -0
- package/src/components/InputAdornment/index.ts +1 -0
- package/src/components/InputLabel.tsx +10 -0
- package/src/components/Label/Label.test.tsx +15 -0
- package/src/components/Label/Label.tsx +35 -0
- package/src/components/Label/__snapshots__/Label.test.tsx.snap +14 -0
- package/src/components/Label/index.ts +1 -0
- package/src/components/Link.tsx +39 -0
- package/src/components/List.tsx +10 -0
- package/src/components/ListItem.tsx +23 -0
- package/src/components/ListItemText.tsx +16 -0
- package/src/components/Loading/Loading.test.tsx +12 -0
- package/src/components/Loading/Loading.tsx +17 -0
- package/src/components/Loading/Spinner/Spinner.test.tsx +14 -0
- package/src/components/Loading/Spinner/Spinner.tsx +35 -0
- package/src/components/Loading/Spinner/__snapshots__/Spinner.test.tsx.snap +148 -0
- package/src/components/Loading/Spinner/index.tsx +1 -0
- package/src/components/Loading/__snapshots__/Loading.test.tsx.snap +86 -0
- package/src/components/Loading/index.ts +1 -0
- package/src/components/Loading/styles.ts +17 -0
- package/src/components/Logo/Logo.test.tsx +12 -0
- package/src/components/Logo/Logo.tsx +55 -0
- package/src/components/Logo/__snapshots__/Logo.test.tsx.snap +19 -0
- package/src/components/Logo/img/logo-black-and-white.svg +1 -0
- package/src/components/Logo/img/logo.svg +1 -0
- package/src/components/Logo/index.ts +1 -0
- package/src/components/Menu.tsx +10 -0
- package/src/components/MenuItem.tsx +25 -0
- package/src/components/NotFound/NotFound.tsx +52 -0
- package/src/components/NotFound/Notfound.test.tsx +37 -0
- package/src/components/NotFound/__snapshots__/Notfound.test.tsx.snap +44 -0
- package/src/components/NotFound/img/package.svg +1 -0
- package/src/components/NotFound/index.ts +1 -0
- package/src/components/NotFound/styles.ts +40 -0
- package/src/components/Paper.tsx +10 -0
- package/src/components/SnackbarContent.tsx +15 -0
- package/src/components/SvgIcon.tsx +38 -0
- package/src/components/Tab.tsx +10 -0
- package/src/components/Tabs.tsx +14 -0
- package/src/components/Text/Text.tsx +17 -0
- package/src/components/Text/TextConfig.ts +7 -0
- package/src/components/Text/index.ts +2 -0
- package/src/components/TextField/TextField.test.tsx +16 -0
- package/src/components/TextField/TextField.tsx +23 -0
- package/src/components/TextField/__snapshots__/TextField.test.tsx.snap +19 -0
- package/src/components/TextField/index.ts +1 -0
- package/src/components/Toolbar.tsx +10 -0
- package/src/components/Tooltip.tsx +25 -0
- package/src/design-tokens/ResetStyles.tsx +44 -0
- package/src/design-tokens/StyleBaseline.tsx +14 -0
- package/src/design-tokens/ThemeContext.ts +13 -0
- package/src/design-tokens/ThemeProvider.tsx +44 -0
- package/src/design-tokens/emotion.ts +5 -0
- package/src/design-tokens/load-dayjs-locale.ts +98 -0
- package/src/design-tokens/theme.ts +159 -0
- package/src/design-tokens/useLocalStorage.ts +40 -0
- package/src/design-tokens/useOnClickOutside.ts +28 -0
- package/src/design-tokens/useTheme.ts +7 -0
- package/src/i18n/ABOUT_TRANSLATIONS.md +13 -0
- package/src/i18n/config.ts +52 -0
- package/src/i18n/crowdin/ui.json +170 -0
- package/src/i18n/deprecated_translations_dont_use/cs-CZ.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/de-DE.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/en-US.json +170 -0
- package/src/i18n/deprecated_translations_dont_use/es-ES.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/fr-FR.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/ja-JP.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/km-KH.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/pt-BR.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/ru-RU.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/tr-TR.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/uk-UA.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/zh-CN.json +168 -0
- package/src/i18n/deprecated_translations_dont_use/zh-TW.json +165 -0
- package/src/i18n/enabledLanguages.ts +35 -0
- package/src/index.tsx +36 -0
- package/src/lib/constants.ts +9 -0
- package/src/pages/Version/DetailContainer/Dependencies/Dependencies.test.tsx +93 -0
- package/src/pages/Version/DetailContainer/Dependencies/Dependencies.tsx +100 -0
- package/src/pages/Version/DetailContainer/Dependencies/index.ts +1 -0
- package/src/pages/Version/DetailContainer/Dependencies/styles.ts +26 -0
- package/src/pages/Version/DetailContainer/Dependencies/types.ts +7 -0
- package/src/pages/Version/DetailContainer/Deprecated/Deprecated.test.tsx +34 -0
- package/src/pages/Version/DetailContainer/Deprecated/Deprecated.tsx +31 -0
- package/src/pages/Version/DetailContainer/Deprecated/index.ts +1 -0
- package/src/pages/Version/DetailContainer/DetailContainer.test.tsx +13 -0
- package/src/pages/Version/DetailContainer/DetailContainer.tsx +37 -0
- package/src/pages/Version/DetailContainer/DetailContainerContent.tsx +41 -0
- package/src/pages/Version/DetailContainer/DetailContainerContentReadme.tsx +19 -0
- package/src/pages/Version/DetailContainer/DetailContainerTabs.tsx +36 -0
- package/src/pages/Version/DetailContainer/NoItems/NoItems.tsx +16 -0
- package/src/pages/Version/DetailContainer/NoItems/Noitems.test.tsx +16 -0
- package/src/pages/Version/DetailContainer/NoItems/__snapshots__/Noitems.test.tsx.snap +9 -0
- package/src/pages/Version/DetailContainer/NoItems/index.ts +1 -0
- package/src/pages/Version/DetailContainer/Readme/Readme.spec.tsx +19 -0
- package/src/pages/Version/DetailContainer/Readme/Readme.tsx +22 -0
- package/src/pages/Version/DetailContainer/Readme/__snapshots__/Readme.spec.tsx.snap +94 -0
- package/src/pages/Version/DetailContainer/Readme/index.ts +1 -0
- package/src/pages/Version/DetailContainer/Readme/types.ts +3 -0
- package/src/pages/Version/DetailContainer/UpLinks/UpLinks.test.tsx +58 -0
- package/src/pages/Version/DetailContainer/UpLinks/UpLinks.tsx +45 -0
- package/src/pages/Version/DetailContainer/UpLinks/__snapshots__/UpLinks.test.tsx.snap +247 -0
- package/src/pages/Version/DetailContainer/UpLinks/index.ts +1 -0
- package/src/pages/Version/DetailContainer/UpLinks/styles.ts +24 -0
- package/src/pages/Version/DetailContainer/Versions/Versions.test.tsx +60 -0
- package/src/pages/Version/DetailContainer/Versions/Versions.tsx +41 -0
- package/src/pages/Version/DetailContainer/Versions/VersionsHistoryList.tsx +40 -0
- package/src/pages/Version/DetailContainer/Versions/VersionsTagList.tsx +28 -0
- package/src/pages/Version/DetailContainer/Versions/__partials__/data.json +5984 -0
- package/src/pages/Version/DetailContainer/Versions/__snapshots__/Versions.test.tsx.snap +3 -0
- package/src/pages/Version/DetailContainer/Versions/index.ts +1 -0
- package/src/pages/Version/DetailContainer/Versions/styles.ts +30 -0
- package/src/pages/Version/DetailContainer/__snapshots__/DetailContainer.test.tsx.snap +103 -0
- package/src/pages/Version/DetailContainer/index.ts +1 -0
- package/src/pages/Version/DetailSidebar/DetailSidebar.tsx +55 -0
- package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.test.tsx +111 -0
- package/src/pages/Version/DetailSidebar/DetailSidebarFundButton.tsx +53 -0
- package/src/pages/Version/DetailSidebar/DetailSidebarTitle.tsx +40 -0
- package/src/pages/Version/DetailSidebar/Developers/Developers.test.tsx +117 -0
- package/src/pages/Version/DetailSidebar/Developers/Developers.tsx +90 -0
- package/src/pages/Version/DetailSidebar/Developers/DevelopersTitle.tsx +32 -0
- package/src/pages/Version/DetailSidebar/Developers/__snapshots__/Developers.test.tsx.snap +380 -0
- package/src/pages/Version/DetailSidebar/Developers/get-unique-developer-values.ts +16 -0
- package/src/pages/Version/DetailSidebar/Developers/index.ts +1 -0
- package/src/pages/Version/DetailSidebar/Developers/styles.ts +31 -0
- package/src/pages/Version/DetailSidebar/Dist/Dist.test.tsx +78 -0
- package/src/pages/Version/DetailSidebar/Dist/Dist.tsx +49 -0
- package/src/pages/Version/DetailSidebar/Dist/__snapshots__/Dist.test.tsx.snap +602 -0
- package/src/pages/Version/DetailSidebar/Dist/index.ts +1 -0
- package/src/pages/Version/DetailSidebar/Dist/styles.ts +27 -0
- package/src/pages/Version/DetailSidebar/Engines/Engines.test.tsx +71 -0
- package/src/pages/Version/DetailSidebar/Engines/Engines.tsx +58 -0
- package/src/pages/Version/DetailSidebar/Engines/img/node.png +0 -0
- package/src/pages/Version/DetailSidebar/Engines/index.ts +1 -0
- package/src/pages/Version/DetailSidebar/Engines/styles.ts +14 -0
- package/src/pages/Version/DetailSidebar/Install/Install.test.tsx +64 -0
- package/src/pages/Version/DetailSidebar/Install/Install.tsx +52 -0
- package/src/pages/Version/DetailSidebar/Install/InstallListItem.tsx +97 -0
- package/src/pages/Version/DetailSidebar/Install/__partials__/data.json +5984 -0
- package/src/pages/Version/DetailSidebar/Install/img/npm.svg +15 -0
- package/src/pages/Version/DetailSidebar/Install/img/pnpm.svg +1 -0
- package/src/pages/Version/DetailSidebar/Install/img/yarn.svg +1 -0
- package/src/pages/Version/DetailSidebar/Install/index.ts +1 -0
- package/src/pages/Version/DetailSidebar/Repository/Repository.test.tsx +78 -0
- package/src/pages/Version/DetailSidebar/Repository/Repository.tsx +93 -0
- package/src/pages/Version/DetailSidebar/Repository/__partials__/data.json +5984 -0
- package/src/pages/Version/DetailSidebar/Repository/__snapshots__/Repository.test.tsx.snap +3 -0
- package/src/pages/Version/DetailSidebar/Repository/img/git.png +0 -0
- package/src/pages/Version/DetailSidebar/Repository/index.ts +1 -0
- package/src/pages/Version/DetailSidebar/index.ts +1 -0
- package/src/pages/Version/Version.test.tsx +68 -0
- package/src/pages/Version/Version.tsx +41 -0
- package/src/pages/Version/VersionContextProvider.tsx +43 -0
- package/src/pages/Version/VersionLayout.tsx +20 -0
- package/src/pages/Version/__partials__/data.json +5984 -0
- package/src/pages/Version/context.ts +10 -0
- package/src/pages/Version/get-route-package-name.ts +9 -0
- package/src/pages/Version/index.ts +4 -0
- package/src/pages/Version/version-config.ts +19 -0
- package/src/pages/home/Home.tsx +25 -0
- package/src/pages/home/PackageList/Help/Help.test.tsx +12 -0
- package/src/pages/home/PackageList/Help/Help.tsx +56 -0
- package/src/pages/home/PackageList/Help/__snapshots__/Help.test.tsx.snap +159 -0
- package/src/pages/home/PackageList/Help/index.ts +1 -0
- package/src/pages/home/PackageList/Help/styles.ts +13 -0
- package/src/pages/home/PackageList/Package/Package.test.tsx +56 -0
- package/src/pages/home/PackageList/Package/Package.tsx +253 -0
- package/src/pages/home/PackageList/Package/Tag/Tag.test.tsx +16 -0
- package/src/pages/home/PackageList/Package/Tag/Tag.tsx +11 -0
- package/src/pages/home/PackageList/Package/Tag/__snapshots__/Tag.test.tsx.snap +21 -0
- package/src/pages/home/PackageList/Package/Tag/index.ts +1 -0
- package/src/pages/home/PackageList/Package/Tag/styles.ts +11 -0
- package/src/pages/home/PackageList/Package/index.ts +1 -0
- package/src/pages/home/PackageList/Package/styles.ts +112 -0
- package/src/pages/home/PackageList/PackageList.tsx +81 -0
- package/src/pages/home/PackageList/Packagelist.test.tsx +60 -0
- package/src/pages/home/PackageList/index.ts +1 -0
- package/src/pages/home/index.ts +1 -0
- package/src/providers/API/api.test.ts +136 -0
- package/src/providers/API/api.ts +73 -0
- package/src/providers/API/storage.ts +12 -0
- package/src/providers/config/AppConfigurationProvider.tsx +57 -0
- package/src/providers/config/index.ts +1 -0
- package/src/store/index.ts +1 -0
- package/src/store/models/configuration.ts +42 -0
- package/src/store/models/download.ts +31 -0
- package/src/store/models/index.ts +17 -0
- package/src/store/models/login.ts +90 -0
- package/src/store/models/manifest.ts +91 -0
- package/src/store/models/packages.ts +36 -0
- package/src/store/models/search.ts +81 -0
- package/src/store/store.ts +15 -0
- package/src/template/favicon.ico +0 -0
- package/src/template/index.html +21 -0
- package/src/utils/.eslintrc +5 -0
- package/src/utils/cli-utils.test.ts +66 -0
- package/src/utils/cli-utils.ts +38 -0
- package/src/utils/colors.ts +1 -0
- package/src/utils/constants.ts +5 -0
- package/src/utils/file-size.ts +13 -0
- package/src/utils/i18nForTests.ts +25 -0
- package/src/utils/login.test.ts +71 -0
- package/src/utils/login.ts +44 -0
- package/src/utils/package.test.ts +101 -0
- package/src/utils/package.ts +105 -0
- package/src/utils/sec-utils.ts +15 -0
- package/src/utils/storage.ts +12 -0
- package/src/utils/test-react-testing-library.tsx +38 -0
- package/src/utils/url.test.ts +28 -0
- package/src/utils/url.ts +58 -0
- package/src/utils/windows.ts +3 -0
- package/static/favicon.ico +0 -0
- package/static/index.html +21 -0
- package/static/main.c57129036f278d0c7acf.js +2 -0
- package/static/main.c57129036f278d0c7acf.js.LICENSE.txt +1456 -0
- package/static/manifest.json +5 -17
- package/static/runtime.c57129036f278d0c7acf.js +2 -0
- package/static/{runtime.f6e570dfe38870a45bf5.js.LICENSE.txt → runtime.c57129036f278d0c7acf.js.LICENSE.txt} +2 -2
- package/static/vendors.c57129036f278d0c7acf.js +2 -0
- package/static/vendors.c57129036f278d0c7acf.js.LICENSE.txt +2932 -0
- package/tools/.eslintrc +14 -0
- package/tools/_verdaccio.config.yaml +59 -0
- package/tools/dev.server.js +48 -0
- package/tools/getPackageJson.js +25 -0
- package/tools/verdaccio.js +31 -0
- package/tools/webpack.config.js +82 -0
- package/tools/webpack.dev.config.babel.js +60 -0
- package/tools/webpack.prod.config.babel.js +81 -0
- package/tsconfig.build.json +24 -0
- package/tsconfig.json +27 -0
- package/types/custom.d.ts +9 -0
- package/types/files.d.ts +9 -0
- package/types/index.ts +12 -0
- package/types/jest-dom.d.ts +1 -0
- package/types/packageMeta.ts +82 -0
- package/static/238.f6e570dfe38870a45bf5.js +0 -2
- package/static/238.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/718.f6e570dfe38870a45bf5.js +0 -2
- package/static/718.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/73.f6e570dfe38870a45bf5.js +0 -2
- package/static/73.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Dependencies.f6e570dfe38870a45bf5.js +0 -2
- package/static/Dependencies.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Dist.f6e570dfe38870a45bf5.js +0 -2
- package/static/Dist.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Engines.f6e570dfe38870a45bf5.js +0 -2
- package/static/Engines.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Home.f6e570dfe38870a45bf5.js +0 -2
- package/static/Home.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Install.f6e570dfe38870a45bf5.js +0 -2
- package/static/Install.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/NotFound.f6e570dfe38870a45bf5.js +0 -2
- package/static/NotFound.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Provider.f6e570dfe38870a45bf5.js +0 -2
- package/static/Provider.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Repository.f6e570dfe38870a45bf5.js +0 -2
- package/static/Repository.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/UpLinks.f6e570dfe38870a45bf5.js +0 -2
- package/static/UpLinks.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Version.f6e570dfe38870a45bf5.js +0 -2
- package/static/Version.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/Versions.f6e570dfe38870a45bf5.js +0 -2
- package/static/Versions.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/main.f6e570dfe38870a45bf5.js +0 -2
- package/static/main.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -10
- package/static/runtime.f6e570dfe38870a45bf5.js +0 -2
- package/static/vendors.f6e570dfe38870a45bf5.js +0 -2
- package/static/vendors.f6e570dfe38870a45bf5.js.LICENSE.txt +0 -98
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { css } from '@emotion/core';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
|
|
4
|
+
import AppBar from 'verdaccio-ui/components/AppBar';
|
|
5
|
+
import IconButton from 'verdaccio-ui/components/IconButton';
|
|
6
|
+
import Link from 'verdaccio-ui/components/Link';
|
|
7
|
+
import Toolbar from 'verdaccio-ui/components/Toolbar';
|
|
8
|
+
import { Theme } from 'verdaccio-ui/design-tokens/theme';
|
|
9
|
+
|
|
10
|
+
export const InnerNavBar = styled(Toolbar)({
|
|
11
|
+
justifyContent: 'space-between',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
padding: '0 15px',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const Greetings = styled('span')({
|
|
17
|
+
margin: '0 5px 0 0',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const RightSide = styled(Toolbar)({
|
|
21
|
+
display: 'flex',
|
|
22
|
+
padding: 0,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const LeftSide = styled(RightSide)({
|
|
26
|
+
flex: 1,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const MobileNavBar = styled('div')<{ theme?: Theme }>((props) => ({
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
display: 'flex',
|
|
32
|
+
borderBottom: `1px solid ${props.theme?.palette.greyLight}`,
|
|
33
|
+
padding: '8px',
|
|
34
|
+
position: 'relative',
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
export const InnerMobileNavBar = styled('div')<{ theme?: Theme }>((props) => ({
|
|
38
|
+
borderRadius: '4px',
|
|
39
|
+
backgroundColor: props.theme?.palette.greyLight,
|
|
40
|
+
color: props.theme?.palette.white,
|
|
41
|
+
width: '100%',
|
|
42
|
+
padding: '0 5px',
|
|
43
|
+
margin: '0 10px 0 0',
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
export const IconSearchButton = styled(IconButton)({
|
|
47
|
+
display: 'block',
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const SearchWrapper = styled('div')({
|
|
51
|
+
display: 'none',
|
|
52
|
+
width: '100%',
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const NavBar = styled(AppBar)<{ theme?: Theme }>(({ theme }) => ({
|
|
56
|
+
backgroundColor:
|
|
57
|
+
theme?.palette.type === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
|
|
58
|
+
color: theme?.palette.white,
|
|
59
|
+
minHeight: 60,
|
|
60
|
+
display: 'flex',
|
|
61
|
+
justifyContent: 'center',
|
|
62
|
+
[`@media (min-width: ${theme?.breakPoints.medium}px)`]: css`
|
|
63
|
+
${SearchWrapper} {
|
|
64
|
+
display: flex;
|
|
65
|
+
}
|
|
66
|
+
${IconSearchButton} {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
${MobileNavBar} {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|
|
72
|
+
`,
|
|
73
|
+
[`@media (min-width: ${theme?.breakPoints.large}px)`]: css`
|
|
74
|
+
${InnerNavBar} {
|
|
75
|
+
padding: 0 20px;
|
|
76
|
+
}
|
|
77
|
+
`,
|
|
78
|
+
[`@media (min-width: ${theme?.breakPoints.xlarge}px)`]: css`
|
|
79
|
+
${InnerNavBar} {
|
|
80
|
+
max-width: 1240px;
|
|
81
|
+
width: 100%;
|
|
82
|
+
margin: 0 auto;
|
|
83
|
+
}
|
|
84
|
+
`,
|
|
85
|
+
}));
|
|
86
|
+
|
|
87
|
+
export const StyledLink = styled(Link)<{ theme?: Theme }>(({ theme }) => ({
|
|
88
|
+
color: theme?.palette.white,
|
|
89
|
+
}));
|
package/src/App/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './App';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable verdaccio/jsx-spread */
|
|
2
|
+
import React, { lazy, Suspense } from 'react';
|
|
3
|
+
export default (importCallback: any) => {
|
|
4
|
+
const TargetComponent = lazy(importCallback);
|
|
5
|
+
return (props: any) => (
|
|
6
|
+
<Suspense fallback={null}>
|
|
7
|
+
<TargetComponent {...props} />
|
|
8
|
+
</Suspense>
|
|
9
|
+
);
|
|
10
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { renderWithStore, cleanup } from 'verdaccio-ui/utils/test-react-testing-library';
|
|
4
|
+
|
|
5
|
+
import { DetailContext, DetailContextProps } from '../../pages/Version';
|
|
6
|
+
import { store } from '../../store/store';
|
|
7
|
+
|
|
8
|
+
import ActionBar from './ActionBar';
|
|
9
|
+
|
|
10
|
+
const detailContextValue: DetailContextProps = {
|
|
11
|
+
packageName: 'foo',
|
|
12
|
+
readMe: 'test',
|
|
13
|
+
enableLoading: () => {},
|
|
14
|
+
isLoading: false,
|
|
15
|
+
hasNotBeenFound: false,
|
|
16
|
+
packageMeta: {
|
|
17
|
+
_uplinks: {},
|
|
18
|
+
latest: {
|
|
19
|
+
name: 'verdaccio-ui/local-storage',
|
|
20
|
+
version: '8.0.1-next.1',
|
|
21
|
+
dist: {
|
|
22
|
+
fileCount: 0,
|
|
23
|
+
unpackedSize: 0,
|
|
24
|
+
tarball: 'http://localhost:8080/bootstrap/-/bootstrap-4.3.1.tgz',
|
|
25
|
+
},
|
|
26
|
+
homepage: 'https://verdaccio.org',
|
|
27
|
+
bugs: {
|
|
28
|
+
url: 'https://github.com/verdaccio/monorepo/issues',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const ComponentToBeRendered: React.FC<{ contextValue: DetailContextProps }> = ({
|
|
35
|
+
contextValue,
|
|
36
|
+
}) => (
|
|
37
|
+
<DetailContext.Provider value={contextValue}>
|
|
38
|
+
<ActionBar />
|
|
39
|
+
</DetailContext.Provider>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
describe('<ActionBar /> component', () => {
|
|
43
|
+
afterEach(() => {
|
|
44
|
+
cleanup();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('should render the component in default state', () => {
|
|
48
|
+
const { container } = renderWithStore(
|
|
49
|
+
<ComponentToBeRendered contextValue={detailContextValue} />,
|
|
50
|
+
store
|
|
51
|
+
);
|
|
52
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('when there is no action bar data', () => {
|
|
56
|
+
const packageMeta = {
|
|
57
|
+
...detailContextValue.packageMeta,
|
|
58
|
+
latest: {
|
|
59
|
+
...detailContextValue.packageMeta.latest,
|
|
60
|
+
homepage: undefined,
|
|
61
|
+
bugs: undefined,
|
|
62
|
+
dist: {
|
|
63
|
+
...detailContextValue.packageMeta.latest.dist,
|
|
64
|
+
tarball: undefined,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const { container } = renderWithStore(
|
|
70
|
+
<ComponentToBeRendered contextValue={{ ...detailContextValue, packageMeta }} />,
|
|
71
|
+
store
|
|
72
|
+
);
|
|
73
|
+
expect(container.firstChild).toMatchSnapshot();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('when there is a button to download a tarball', () => {
|
|
77
|
+
const { getByTitle } = renderWithStore(
|
|
78
|
+
<ComponentToBeRendered contextValue={{ ...detailContextValue }} />,
|
|
79
|
+
store
|
|
80
|
+
);
|
|
81
|
+
expect(getByTitle('Download tarball')).toBeTruthy();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('when there is a button to open an issue', () => {
|
|
85
|
+
const { getByTitle } = renderWithStore(
|
|
86
|
+
<ComponentToBeRendered contextValue={{ ...detailContextValue }} />,
|
|
87
|
+
store
|
|
88
|
+
);
|
|
89
|
+
expect(getByTitle('Open an issue')).toBeTruthy();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { isURL } from 'verdaccio-ui/utils/url';
|
|
4
|
+
|
|
5
|
+
import { DetailContext } from '../../pages/Version';
|
|
6
|
+
import Box from '../Box';
|
|
7
|
+
|
|
8
|
+
import ActionBarAction, { ActionBarActionProps } from './ActionBarAction';
|
|
9
|
+
|
|
10
|
+
/* eslint-disable verdaccio/jsx-spread */
|
|
11
|
+
const ActionBar: React.FC = () => {
|
|
12
|
+
const detailContext = React.useContext(DetailContext);
|
|
13
|
+
|
|
14
|
+
const { packageMeta } = detailContext;
|
|
15
|
+
|
|
16
|
+
if (!packageMeta?.latest) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const { homepage, bugs, dist } = packageMeta.latest;
|
|
21
|
+
|
|
22
|
+
const actions: ActionBarActionProps[] = [];
|
|
23
|
+
|
|
24
|
+
if (homepage && isURL(homepage)) {
|
|
25
|
+
actions.push({ type: 'VISIT_HOMEPAGE', link: homepage });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (bugs?.url && isURL(bugs.url)) {
|
|
29
|
+
actions.push({ type: 'OPEN_AN_ISSUE', link: bugs.url });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (dist?.tarball && isURL(dist.tarball)) {
|
|
33
|
+
actions.push({ type: 'DOWNLOAD_TARBALL', link: dist.tarball });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Box alignItems="center" display="flex" marginBottom="14px">
|
|
38
|
+
{actions.map((action) => (
|
|
39
|
+
<ActionBarAction key={action.link} {...action} />
|
|
40
|
+
))}
|
|
41
|
+
</Box>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default ActionBar;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import BugReportIcon from '@material-ui/icons/BugReport';
|
|
3
|
+
import DownloadIcon from '@material-ui/icons/CloudDownload';
|
|
4
|
+
import HomeIcon from '@material-ui/icons/Home';
|
|
5
|
+
import React, { useCallback } from 'react';
|
|
6
|
+
import { useTranslation } from 'react-i18next';
|
|
7
|
+
import { useDispatch } from 'react-redux';
|
|
8
|
+
|
|
9
|
+
import { Theme } from 'verdaccio-ui/design-tokens/theme';
|
|
10
|
+
|
|
11
|
+
import { Dispatch } from '../../store/store';
|
|
12
|
+
import FloatingActionButton from '../FloatingActionButton';
|
|
13
|
+
import Link from '../Link';
|
|
14
|
+
import Tooltip from '../Tooltip';
|
|
15
|
+
|
|
16
|
+
export const Fab = styled(FloatingActionButton)<{ theme?: Theme }>(({ theme }) => ({
|
|
17
|
+
backgroundColor:
|
|
18
|
+
theme?.palette.type === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
|
|
19
|
+
color: theme?.palette.white,
|
|
20
|
+
marginRight: 10,
|
|
21
|
+
':hover': {
|
|
22
|
+
color: theme?.palette.type === 'light' ? theme?.palette.primary.main : theme?.palette.cyanBlue,
|
|
23
|
+
background: theme?.palette.white,
|
|
24
|
+
},
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
type ActionType = 'VISIT_HOMEPAGE' | 'OPEN_AN_ISSUE' | 'DOWNLOAD_TARBALL';
|
|
28
|
+
|
|
29
|
+
export interface ActionBarActionProps {
|
|
30
|
+
type: ActionType;
|
|
31
|
+
link: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* eslint-disable react/jsx-no-bind */
|
|
35
|
+
const ActionBarAction: React.FC<ActionBarActionProps> = ({ type, link }) => {
|
|
36
|
+
const { t } = useTranslation();
|
|
37
|
+
const dispatch = useDispatch<Dispatch>();
|
|
38
|
+
|
|
39
|
+
const handleDownload = useCallback(async () => {
|
|
40
|
+
dispatch.download.getTarball({ link });
|
|
41
|
+
}, [dispatch, link]);
|
|
42
|
+
|
|
43
|
+
switch (type) {
|
|
44
|
+
case 'VISIT_HOMEPAGE':
|
|
45
|
+
return (
|
|
46
|
+
<Tooltip title={t('action-bar-action.visit-home-page')}>
|
|
47
|
+
<Link external={true} to={link}>
|
|
48
|
+
<Fab size="small">
|
|
49
|
+
<HomeIcon />
|
|
50
|
+
</Fab>
|
|
51
|
+
</Link>
|
|
52
|
+
</Tooltip>
|
|
53
|
+
);
|
|
54
|
+
case 'OPEN_AN_ISSUE':
|
|
55
|
+
return (
|
|
56
|
+
<Tooltip title={t('action-bar-action.open-an-issue')}>
|
|
57
|
+
<Link external={true} to={link}>
|
|
58
|
+
<Fab size="small">
|
|
59
|
+
<BugReportIcon />
|
|
60
|
+
</Fab>
|
|
61
|
+
</Link>
|
|
62
|
+
</Tooltip>
|
|
63
|
+
);
|
|
64
|
+
case 'DOWNLOAD_TARBALL':
|
|
65
|
+
return (
|
|
66
|
+
<Tooltip title={t('action-bar-action.download-tarball')}>
|
|
67
|
+
<Fab data-testid="download-tarball-btn" onClick={handleDownload} size="small">
|
|
68
|
+
<DownloadIcon />
|
|
69
|
+
</Fab>
|
|
70
|
+
</Tooltip>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default ActionBarAction;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<ActionBar /> component should render the component in default state 1`] = `
|
|
4
|
+
.emotion-0 {
|
|
5
|
+
background-color: #4b5e40;
|
|
6
|
+
color: #fff;
|
|
7
|
+
margin-right: 10px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.emotion-0:hover {
|
|
11
|
+
color: #4b5e40;
|
|
12
|
+
background: #fff;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
class="MuiBox-root MuiBox-root-1"
|
|
17
|
+
>
|
|
18
|
+
<a
|
|
19
|
+
class=""
|
|
20
|
+
href="https://verdaccio.org"
|
|
21
|
+
rel="noopener noreferrer"
|
|
22
|
+
target="_blank"
|
|
23
|
+
title="Visit homepage"
|
|
24
|
+
>
|
|
25
|
+
<span
|
|
26
|
+
class="MuiTypography-root MuiTypography-subtitle1"
|
|
27
|
+
>
|
|
28
|
+
<button
|
|
29
|
+
class="MuiButtonBase-root MuiFab-root emotion-0 emotion-1 MuiFab-sizeSmall"
|
|
30
|
+
data-testid="fab"
|
|
31
|
+
tabindex="0"
|
|
32
|
+
type="button"
|
|
33
|
+
>
|
|
34
|
+
<span
|
|
35
|
+
class="MuiFab-label"
|
|
36
|
+
>
|
|
37
|
+
<svg
|
|
38
|
+
aria-hidden="true"
|
|
39
|
+
class="MuiSvgIcon-root"
|
|
40
|
+
focusable="false"
|
|
41
|
+
viewBox="0 0 24 24"
|
|
42
|
+
>
|
|
43
|
+
<path
|
|
44
|
+
d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"
|
|
45
|
+
/>
|
|
46
|
+
</svg>
|
|
47
|
+
</span>
|
|
48
|
+
<span
|
|
49
|
+
class="MuiTouchRipple-root"
|
|
50
|
+
/>
|
|
51
|
+
</button>
|
|
52
|
+
</span>
|
|
53
|
+
</a>
|
|
54
|
+
<a
|
|
55
|
+
class=""
|
|
56
|
+
href="https://github.com/verdaccio/monorepo/issues"
|
|
57
|
+
rel="noopener noreferrer"
|
|
58
|
+
target="_blank"
|
|
59
|
+
title="Open an issue"
|
|
60
|
+
>
|
|
61
|
+
<span
|
|
62
|
+
class="MuiTypography-root MuiTypography-subtitle1"
|
|
63
|
+
>
|
|
64
|
+
<button
|
|
65
|
+
class="MuiButtonBase-root MuiFab-root emotion-0 emotion-1 MuiFab-sizeSmall"
|
|
66
|
+
data-testid="fab"
|
|
67
|
+
tabindex="0"
|
|
68
|
+
type="button"
|
|
69
|
+
>
|
|
70
|
+
<span
|
|
71
|
+
class="MuiFab-label"
|
|
72
|
+
>
|
|
73
|
+
<svg
|
|
74
|
+
aria-hidden="true"
|
|
75
|
+
class="MuiSvgIcon-root"
|
|
76
|
+
focusable="false"
|
|
77
|
+
viewBox="0 0 24 24"
|
|
78
|
+
>
|
|
79
|
+
<path
|
|
80
|
+
d="M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"
|
|
81
|
+
/>
|
|
82
|
+
</svg>
|
|
83
|
+
</span>
|
|
84
|
+
<span
|
|
85
|
+
class="MuiTouchRipple-root"
|
|
86
|
+
/>
|
|
87
|
+
</button>
|
|
88
|
+
</span>
|
|
89
|
+
</a>
|
|
90
|
+
<button
|
|
91
|
+
class="MuiButtonBase-root MuiFab-root emotion-0 emotion-1 MuiFab-sizeSmall"
|
|
92
|
+
data-testid="fab"
|
|
93
|
+
tabindex="0"
|
|
94
|
+
title="Download tarball"
|
|
95
|
+
type="button"
|
|
96
|
+
>
|
|
97
|
+
<span
|
|
98
|
+
class="MuiFab-label"
|
|
99
|
+
>
|
|
100
|
+
<svg
|
|
101
|
+
aria-hidden="true"
|
|
102
|
+
class="MuiSvgIcon-root"
|
|
103
|
+
focusable="false"
|
|
104
|
+
viewBox="0 0 24 24"
|
|
105
|
+
>
|
|
106
|
+
<path
|
|
107
|
+
d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z"
|
|
108
|
+
/>
|
|
109
|
+
</svg>
|
|
110
|
+
</span>
|
|
111
|
+
<span
|
|
112
|
+
class="MuiTouchRipple-root"
|
|
113
|
+
/>
|
|
114
|
+
</button>
|
|
115
|
+
</div>
|
|
116
|
+
`;
|
|
117
|
+
|
|
118
|
+
exports[`<ActionBar /> component when there is no action bar data 1`] = `
|
|
119
|
+
<div
|
|
120
|
+
class="MuiBox-root MuiBox-root-2"
|
|
121
|
+
/>
|
|
122
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ActionBar';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as MaterialUIAppBar, AppBarProps } from '@material-ui/core/AppBar';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
|
|
4
|
+
type AppBarRef = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];
|
|
5
|
+
|
|
6
|
+
const AppBar = forwardRef<AppBarRef, AppBarProps>(function AppBar(props, ref) {
|
|
7
|
+
return <MaterialUIAppBar {...props} ref={ref} />;
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default AppBar;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render, cleanup } from 'verdaccio-ui/utils/test-react-testing-library';
|
|
4
|
+
|
|
5
|
+
import { DetailContext } from '../../pages/Version';
|
|
6
|
+
|
|
7
|
+
import Authors from './Author';
|
|
8
|
+
|
|
9
|
+
const withAuthorComponent = (
|
|
10
|
+
packageMeta: React.ContextType<typeof DetailContext>['packageMeta']
|
|
11
|
+
): JSX.Element => (
|
|
12
|
+
<DetailContext.Provider value={{ packageMeta }}>
|
|
13
|
+
<Authors />
|
|
14
|
+
</DetailContext.Provider>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
describe('<Author /> component', () => {
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
jest.resetAllMocks();
|
|
20
|
+
cleanup();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('should render the component in default state', () => {
|
|
24
|
+
const packageMeta = {
|
|
25
|
+
latest: {
|
|
26
|
+
name: 'verdaccio',
|
|
27
|
+
version: '4.0.0',
|
|
28
|
+
author: {
|
|
29
|
+
name: 'verdaccio user',
|
|
30
|
+
email: 'verdaccio.user@verdaccio.org',
|
|
31
|
+
url: '',
|
|
32
|
+
avatar: 'https://www.gravatar.com/avatar/000000',
|
|
33
|
+
},
|
|
34
|
+
dist: { fileCount: 0, unpackedSize: 0 },
|
|
35
|
+
},
|
|
36
|
+
_uplinks: {},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const wrapper = render(withAuthorComponent(packageMeta));
|
|
40
|
+
expect(wrapper).toMatchSnapshot();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('should render the component when there is no author information available', () => {
|
|
44
|
+
const packageMeta = {
|
|
45
|
+
latest: {
|
|
46
|
+
name: 'verdaccio',
|
|
47
|
+
version: '4.0.0',
|
|
48
|
+
dist: { fileCount: 0, unpackedSize: 0 },
|
|
49
|
+
},
|
|
50
|
+
_uplinks: {},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const wrapper = render(withAuthorComponent(packageMeta));
|
|
54
|
+
expect(wrapper.queryAllByText('verdaccio')).toHaveLength(0);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
test('should render the component when there is no author email', () => {
|
|
58
|
+
const packageMeta = {
|
|
59
|
+
latest: {
|
|
60
|
+
name: 'verdaccio',
|
|
61
|
+
version: '4.0.0',
|
|
62
|
+
author: {
|
|
63
|
+
name: 'verdaccio user',
|
|
64
|
+
url: '',
|
|
65
|
+
avatar: 'https://www.gravatar.com/avatar/000000',
|
|
66
|
+
},
|
|
67
|
+
dist: { fileCount: 0, unpackedSize: 0 },
|
|
68
|
+
},
|
|
69
|
+
_uplinks: {},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const wrapper = render(withAuthorComponent(packageMeta));
|
|
73
|
+
expect(wrapper).toMatchSnapshot();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Avatar from '@material-ui/core/Avatar';
|
|
2
|
+
import React, { FC, useContext } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
|
|
5
|
+
import { getAuthorName } from 'verdaccio-ui/utils/package';
|
|
6
|
+
import { isEmail } from 'verdaccio-ui/utils/url';
|
|
7
|
+
|
|
8
|
+
import { DetailContext } from '../../pages/Version';
|
|
9
|
+
import List from '../List';
|
|
10
|
+
|
|
11
|
+
import { StyledText, AuthorListItem, AuthorListItemText } from './styles';
|
|
12
|
+
|
|
13
|
+
const Author: FC = () => {
|
|
14
|
+
const { packageMeta } = useContext(DetailContext);
|
|
15
|
+
const { t } = useTranslation();
|
|
16
|
+
|
|
17
|
+
if (!packageMeta) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { author, name: packageName, version } = packageMeta.latest;
|
|
22
|
+
|
|
23
|
+
if (!author) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const { email, name } = author;
|
|
28
|
+
|
|
29
|
+
const avatarComponent = <Avatar alt={author.name} src={author.avatar} />;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<List subheader={<StyledText variant={'subtitle1'}>{t('sidebar.author.title')}</StyledText>}>
|
|
33
|
+
<AuthorListItem button={true}>
|
|
34
|
+
{!email || !isEmail(email) ? (
|
|
35
|
+
avatarComponent
|
|
36
|
+
) : (
|
|
37
|
+
<a href={`mailto:${email}?subject=${packageName}@${version}`} target={'_top'}>
|
|
38
|
+
{avatarComponent}
|
|
39
|
+
</a>
|
|
40
|
+
)}
|
|
41
|
+
{name && <AuthorListItemText primary={getAuthorName(name)} />}
|
|
42
|
+
</AuthorListItem>
|
|
43
|
+
</List>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default Author;
|