From 6085224a5dc0b45f23ae08fcbc9f2357554eadea Mon Sep 17 00:00:00 2001 From: Matthew Sevey Date: Wed, 25 May 2022 09:30:54 -0400 Subject: [PATCH 01/21] remove dashboard v2 files and update docker compose --- docker-compose.accounts.yml | 3 +- packages/dashboard-v2/.eslintignore | 4 - packages/dashboard-v2/.eslintrc.js | 6 - packages/dashboard-v2/.gitignore | 4 - packages/dashboard-v2/.prettierignore | 4 - packages/dashboard-v2/.prettierrc.json | 3 - packages/dashboard-v2/.storybook/main.js | 19 - packages/dashboard-v2/.storybook/preview.js | 20 - packages/dashboard-v2/Dockerfile | 18 - packages/dashboard-v2/README.md | 30 - packages/dashboard-v2/gatsby-browser.js | 32 - packages/dashboard-v2/gatsby-config.js | 57 - packages/dashboard-v2/gatsby-ssr.js | 32 - packages/dashboard-v2/package.json | 84 - packages/dashboard-v2/postcss.config.js | 3 - .../src/components/APIKeyList/APIKey.js | 157 - .../src/components/APIKeyList/APIKeyList.js | 14 - .../src/components/APIKeyList/index.js | 1 - .../components/APIKeyList/useAPIKeyEdit.js | 43 - .../components/APIKeyList/useAPIKeyRemoval.js | 41 - .../src/components/Alert/Alert.js | 10 - .../src/components/Alert/index.js | 1 - .../AvatarUploader/AvatarUploader.js | 36 - .../src/components/AvatarUploader/index.js | 1 - .../src/components/Button/Button.js | 47 - .../src/components/Button/Button.stories.js | 38 - .../src/components/Button/index.js | 1 - .../dashboard-v2/src/components/CopyButton.js | 50 - .../src/components/CurrentPlan/CurrentPlan.js | 52 - .../components/CurrentPlan/LatestPayment.js | 18 - .../components/CurrentPlan/SuggestedPlan.js | 24 - .../src/components/CurrentPlan/index.js | 3 - .../components/CurrentUsage/CurrentUsage.js | 116 - .../src/components/CurrentUsage/GraphBar.js | 37 - .../src/components/CurrentUsage/UsageGraph.js | 11 - .../src/components/CurrentUsage/index.js | 3 - .../components/DropdownMenu/DropdownMenu.js | 63 - .../DropdownMenu/DropdownMenu.stories.js | 25 - .../DropdownMenu/DropdownMenuLink.js | 22 - .../src/components/DropdownMenu/index.js | 2 - .../src/components/FileList/FileList.js | 57 - .../src/components/FileList/FileTable.js | 79 - .../src/components/FileList/MobileFileList.js | 84 - .../src/components/FileList/Pagination.js | 32 - .../src/components/FileList/index.js | 1 - .../FileList/useFormattedFilesData.js | 27 - .../components/FileList/useSkylinkOptions.js | 35 - .../components/FileList/useSkylinkSharing.js | 40 - .../src/components/Footer/Footer.js | 19 - .../src/components/Footer/index.js | 1 - .../src/components/Form/TextField.js | 56 - .../dashboard-v2/src/components/Form/index.js | 1 - .../src/components/HighlightedLink.js | 6 - .../src/components/IconButton/IconButton.js | 60 - .../IconButton/IconButton.stories.js | 39 - .../src/components/IconButton/index.js | 1 - .../IconButtonText/IconButtonText.js | 46 - .../IconButtonText/IconButtonText.stories.js | 29 - .../src/components/IconButtonText/index.js | 1 - .../src/components/Icons/Icons.stories.js | 37 - .../components/Icons/icons/ArrowRightIcon.js | 11 - .../components/Icons/icons/CheckmarkIcon.js | 25 - .../components/Icons/icons/ChevronDownIcon.js | 14 - .../Icons/icons/CircledArrowUpIcon.js | 18 - .../Icons/icons/CircledErrorIcon.js | 19 - .../Icons/icons/CircledProgressIcon.js | 22 - .../src/components/Icons/icons/CogIcon.js | 11 - .../src/components/Icons/icons/CopyIcon.js | 10 - .../Icons/icons/FolderUploadIcon.js | 24 - .../Icons/icons/ImportantNoteIcon.js | 11 - .../src/components/Icons/icons/InfoIcon.js | 11 - .../components/Icons/icons/LockClosedIcon.js | 11 - .../src/components/Icons/icons/PlusIcon.js | 14 - .../src/components/Icons/icons/SearchIcon.js | 10 - .../src/components/Icons/icons/ShareIcon.js | 18 - .../Icons/icons/SimpleUploadIcon.js | 10 - .../components/Icons/icons/SkynetLogoIcon.js | 8 - .../src/components/Icons/icons/TrashIcon.js | 10 - .../src/components/Icons/icons/UploadIcon.js | 40 - .../src/components/Icons/index.js | 17 - .../src/components/Icons/withIconProps.js | 19 - .../LatestActivity/ActivityTable.js | 45 - .../LatestActivity/LatestActivity.js | 13 - .../components/LatestActivity/ViewAllLink.js | 12 - .../src/components/LatestActivity/index.js | 3 - .../ContainerLoadingIndicator.js | 18 - .../FullScreenLoadingIndicator.js | 7 - .../src/components/LoadingIndicator/index.js | 2 - .../src/components/Metadata/Metadata.js | 42 - .../src/components/Metadata/index.js | 1 - .../src/components/Modal/Modal.js | 37 - .../src/components/Modal/ModalPortal.js | 16 - .../src/components/Modal/Overlay.js | 42 - .../src/components/Modal/index.js | 2 - .../src/components/NavBar/NavBar.js | 110 - .../src/components/NavBar/NavBar.stories.js | 15 - .../src/components/NavBar/NavBarLink.js | 19 - .../src/components/NavBar/NavBarSection.js | 3 - .../src/components/NavBar/index.js | 3 - .../components/PageContainer/PageContainer.js | 13 - .../src/components/PageContainer/index.js | 1 - .../src/components/Panel/Panel.js | 38 - .../src/components/Panel/Panel.stories.js | 65 - .../src/components/Panel/index.js | 1 - .../src/components/PopoverMenu/PopoverMenu.js | 103 - .../src/components/PopoverMenu/index.js | 1 - .../src/components/Select/Select.js | 105 - .../src/components/Select/Select.stories.js | 47 - .../src/components/Select/SelectOption.js | 29 - .../src/components/Select/hooks.js | 86 - .../src/components/Select/index.js | 2 - .../src/components/Slider/Bullets.js | 30 - .../src/components/Slider/Slide.js | 12 - .../src/components/Slider/Slider.js | 144 - .../src/components/Slider/index.js | 1 - .../components/Slider/useActiveBreakpoint.js | 38 - .../src/components/Switch/Switch.js | 91 - .../src/components/Switch/Switch.stories.js | 22 - .../src/components/Switch/index.js | 1 - .../src/components/Table/Table.js | 20 - .../src/components/Table/Table.stories.js | 93 - .../src/components/Table/TableBody.js | 6 - .../src/components/Table/TableCell.js | 13 - .../src/components/Table/TableHead.js | 6 - .../src/components/Table/TableHeadCell.js | 14 - .../src/components/Table/TableRow.js | 20 - .../src/components/Table/index.js | 6 - .../src/components/Tabs/ActiveTabIndicator.js | 43 - .../dashboard-v2/src/components/Tabs/Tab.js | 55 - .../src/components/Tabs/TabPanel.js | 49 - .../dashboard-v2/src/components/Tabs/Tabs.js | 110 - .../src/components/Tabs/Tabs.stories.js | 67 - .../dashboard-v2/src/components/Tabs/hooks.js | 33 - .../dashboard-v2/src/components/Tabs/index.js | 3 - .../components/TextIndicator/TextIndicator.js | 31 - .../TextIndicator/TextIndicator.stories.js | 27 - .../src/components/TextIndicator/index.js | 1 - .../TextInputBasic/TextInputBasic.js | 32 - .../TextInputBasic/TextInputBasic.stories.js | 18 - .../src/components/TextInputBasic/index.js | 1 - .../components/TextInputIcon/TextInputIcon.js | 60 - .../TextInputIcon/TextInputIcon.stories.js | 30 - .../src/components/TextInputIcon/index.js | 1 - .../src/components/Tooltip/Tooltip.js | 29 - .../src/components/Tooltip/index.js | 1 - .../src/components/Uploader/ProgressBar.js | 71 - .../Uploader/ProgressBar.stories.js | 37 - .../src/components/Uploader/Uploader.js | 139 - .../src/components/Uploader/UploaderItem.js | 130 - .../components/Uploader/UploaderItemIcon.js | 20 - .../Uploader/buildUploadErrorMessage.js | 37 - .../components/forms/AccountRemovalForm.js | 79 - .../components/forms/AccountSettingsForm.js | 111 - .../src/components/forms/AddAPIKeyForm.js | 108 - .../forms/AddSkylinkToSponsorKeyForm.js | 63 - .../src/components/forms/AddSponsorKeyForm.js | 199 - .../src/components/forms/LoginForm.js | 95 - .../src/components/forms/RecoveryForm.js | 57 - .../src/components/forms/ResetPasswordForm.js | 67 - .../src/components/forms/SignUpForm.js | 106 - .../src/components/forms/index.js | 1 - .../src/contexts/plans/PlansContext.js | 7 - .../src/contexts/plans/PlansProvider.js | 67 - .../dashboard-v2/src/contexts/plans/index.js | 2 - .../src/contexts/plans/usePlans.js | 5 - .../portal-settings/PortalSettingsContext.js | 9 - .../portal-settings/PortalSettingsProvider.js | 39 - .../src/contexts/portal-settings/index.js | 2 - .../portal-settings/usePortalSettings.js | 5 - .../src/contexts/user/UserContext.js | 6 - .../src/contexts/user/UserProvider.js | 41 - .../dashboard-v2/src/contexts/user/index.js | 2 - .../dashboard-v2/src/contexts/user/useUser.js | 5 - .../dashboard-v2/src/hooks/useActivePlan.js | 23 - .../src/hooks/useUpgradeRedirect.js | 30 - .../dashboard-v2/src/layouts/AuthLayout.js | 61 - .../src/layouts/DashboardLayout.js | 44 - .../src/layouts/UserSettingsLayout.js | 50 - packages/dashboard-v2/src/lib/config.js | 1 - packages/dashboard-v2/src/lib/cssHelpers.js | 21 - packages/dashboard-v2/src/lib/humanBytes.js | 21 - packages/dashboard-v2/src/lib/swrConfig.js | 22 - packages/dashboard-v2/src/lib/theme.js | 8 - packages/dashboard-v2/src/lib/tiers.js | 9 - packages/dashboard-v2/src/pages/404.js | 27 - packages/dashboard-v2/src/pages/auth/login.js | 36 - .../src/pages/auth/registration.js | 93 - .../src/pages/auth/reset-password.js | 49 - packages/dashboard-v2/src/pages/files.js | 24 - packages/dashboard-v2/src/pages/index.js | 87 - packages/dashboard-v2/src/pages/payments.js | 232 - .../src/pages/settings/developer-settings.js | 117 - .../dashboard-v2/src/pages/settings/export.js | 79 - .../dashboard-v2/src/pages/settings/index.js | 110 - .../src/pages/settings/notifications.js | 51 - .../dashboard-v2/src/pages/user/confirm.js | 79 - .../dashboard-v2/src/pages/user/recover.js | 57 - .../src/services/accountsService.js | 3 - .../dashboard-v2/src/services/skynetClient.js | 3 - packages/dashboard-v2/src/styles/global.css | 52 - .../static/apple-touch-icon-144x144.png | Bin 9842 -> 0 bytes .../static/apple-touch-icon-152x152.png | Bin 12071 -> 0 bytes .../dashboard-v2/static/favicon-16x16.png | Bin 453 -> 0 bytes .../dashboard-v2/static/favicon-32x32.png | Bin 1042 -> 0 bytes packages/dashboard-v2/static/favicon.ico | Bin 5430 -> 0 bytes .../dashboard-v2/static/images/api-keys.svg | 1 - .../dashboard-v2/static/images/auth-bg.svg | 1 - .../dashboard-v2/static/images/avatar-bg.svg | 1 - .../static/images/avatar-placeholder.svg | 1 - .../static/images/dashboard-bg.svg | 11 - .../static/images/import-export.svg | 1 - packages/dashboard-v2/static/images/inbox.svg | 1 - .../static/images/logo-black-text.svg | 19 - .../static/images/usage-graph-bg.svg | 35 - .../dashboard-v2/static/mstile-144x144.png | Bin 9842 -> 0 bytes packages/dashboard-v2/tailwind.config.js | 83 - packages/dashboard-v2/yarn.lock | 16295 ---------------- 217 files changed, 2 insertions(+), 23454 deletions(-) delete mode 100644 packages/dashboard-v2/.eslintignore delete mode 100644 packages/dashboard-v2/.eslintrc.js delete mode 100644 packages/dashboard-v2/.gitignore delete mode 100644 packages/dashboard-v2/.prettierignore delete mode 100644 packages/dashboard-v2/.prettierrc.json delete mode 100644 packages/dashboard-v2/.storybook/main.js delete mode 100644 packages/dashboard-v2/.storybook/preview.js delete mode 100644 packages/dashboard-v2/Dockerfile delete mode 100644 packages/dashboard-v2/README.md delete mode 100644 packages/dashboard-v2/gatsby-browser.js delete mode 100644 packages/dashboard-v2/gatsby-config.js delete mode 100644 packages/dashboard-v2/gatsby-ssr.js delete mode 100644 packages/dashboard-v2/package.json delete mode 100644 packages/dashboard-v2/postcss.config.js delete mode 100644 packages/dashboard-v2/src/components/APIKeyList/APIKey.js delete mode 100644 packages/dashboard-v2/src/components/APIKeyList/APIKeyList.js delete mode 100644 packages/dashboard-v2/src/components/APIKeyList/index.js delete mode 100644 packages/dashboard-v2/src/components/APIKeyList/useAPIKeyEdit.js delete mode 100644 packages/dashboard-v2/src/components/APIKeyList/useAPIKeyRemoval.js delete mode 100644 packages/dashboard-v2/src/components/Alert/Alert.js delete mode 100644 packages/dashboard-v2/src/components/Alert/index.js delete mode 100644 packages/dashboard-v2/src/components/AvatarUploader/AvatarUploader.js delete mode 100644 packages/dashboard-v2/src/components/AvatarUploader/index.js delete mode 100644 packages/dashboard-v2/src/components/Button/Button.js delete mode 100644 packages/dashboard-v2/src/components/Button/Button.stories.js delete mode 100644 packages/dashboard-v2/src/components/Button/index.js delete mode 100644 packages/dashboard-v2/src/components/CopyButton.js delete mode 100644 packages/dashboard-v2/src/components/CurrentPlan/CurrentPlan.js delete mode 100644 packages/dashboard-v2/src/components/CurrentPlan/LatestPayment.js delete mode 100644 packages/dashboard-v2/src/components/CurrentPlan/SuggestedPlan.js delete mode 100644 packages/dashboard-v2/src/components/CurrentPlan/index.js delete mode 100644 packages/dashboard-v2/src/components/CurrentUsage/CurrentUsage.js delete mode 100644 packages/dashboard-v2/src/components/CurrentUsage/GraphBar.js delete mode 100644 packages/dashboard-v2/src/components/CurrentUsage/UsageGraph.js delete mode 100644 packages/dashboard-v2/src/components/CurrentUsage/index.js delete mode 100644 packages/dashboard-v2/src/components/DropdownMenu/DropdownMenu.js delete mode 100644 packages/dashboard-v2/src/components/DropdownMenu/DropdownMenu.stories.js delete mode 100644 packages/dashboard-v2/src/components/DropdownMenu/DropdownMenuLink.js delete mode 100644 packages/dashboard-v2/src/components/DropdownMenu/index.js delete mode 100644 packages/dashboard-v2/src/components/FileList/FileList.js delete mode 100644 packages/dashboard-v2/src/components/FileList/FileTable.js delete mode 100644 packages/dashboard-v2/src/components/FileList/MobileFileList.js delete mode 100644 packages/dashboard-v2/src/components/FileList/Pagination.js delete mode 100644 packages/dashboard-v2/src/components/FileList/index.js delete mode 100644 packages/dashboard-v2/src/components/FileList/useFormattedFilesData.js delete mode 100644 packages/dashboard-v2/src/components/FileList/useSkylinkOptions.js delete mode 100644 packages/dashboard-v2/src/components/FileList/useSkylinkSharing.js delete mode 100644 packages/dashboard-v2/src/components/Footer/Footer.js delete mode 100644 packages/dashboard-v2/src/components/Footer/index.js delete mode 100644 packages/dashboard-v2/src/components/Form/TextField.js delete mode 100644 packages/dashboard-v2/src/components/Form/index.js delete mode 100644 packages/dashboard-v2/src/components/HighlightedLink.js delete mode 100644 packages/dashboard-v2/src/components/IconButton/IconButton.js delete mode 100644 packages/dashboard-v2/src/components/IconButton/IconButton.stories.js delete mode 100644 packages/dashboard-v2/src/components/IconButton/index.js delete mode 100644 packages/dashboard-v2/src/components/IconButtonText/IconButtonText.js delete mode 100644 packages/dashboard-v2/src/components/IconButtonText/IconButtonText.stories.js delete mode 100644 packages/dashboard-v2/src/components/IconButtonText/index.js delete mode 100644 packages/dashboard-v2/src/components/Icons/Icons.stories.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/ArrowRightIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/CheckmarkIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/ChevronDownIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/CircledArrowUpIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/CircledErrorIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/CircledProgressIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/CogIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/CopyIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/FolderUploadIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/ImportantNoteIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/InfoIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/LockClosedIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/PlusIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/SearchIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/ShareIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/SimpleUploadIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/SkynetLogoIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/TrashIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/icons/UploadIcon.js delete mode 100644 packages/dashboard-v2/src/components/Icons/index.js delete mode 100644 packages/dashboard-v2/src/components/Icons/withIconProps.js delete mode 100644 packages/dashboard-v2/src/components/LatestActivity/ActivityTable.js delete mode 100644 packages/dashboard-v2/src/components/LatestActivity/LatestActivity.js delete mode 100644 packages/dashboard-v2/src/components/LatestActivity/ViewAllLink.js delete mode 100644 packages/dashboard-v2/src/components/LatestActivity/index.js delete mode 100644 packages/dashboard-v2/src/components/LoadingIndicator/ContainerLoadingIndicator.js delete mode 100644 packages/dashboard-v2/src/components/LoadingIndicator/FullScreenLoadingIndicator.js delete mode 100644 packages/dashboard-v2/src/components/LoadingIndicator/index.js delete mode 100644 packages/dashboard-v2/src/components/Metadata/Metadata.js delete mode 100644 packages/dashboard-v2/src/components/Metadata/index.js delete mode 100644 packages/dashboard-v2/src/components/Modal/Modal.js delete mode 100644 packages/dashboard-v2/src/components/Modal/ModalPortal.js delete mode 100644 packages/dashboard-v2/src/components/Modal/Overlay.js delete mode 100644 packages/dashboard-v2/src/components/Modal/index.js delete mode 100644 packages/dashboard-v2/src/components/NavBar/NavBar.js delete mode 100644 packages/dashboard-v2/src/components/NavBar/NavBar.stories.js delete mode 100644 packages/dashboard-v2/src/components/NavBar/NavBarLink.js delete mode 100644 packages/dashboard-v2/src/components/NavBar/NavBarSection.js delete mode 100644 packages/dashboard-v2/src/components/NavBar/index.js delete mode 100644 packages/dashboard-v2/src/components/PageContainer/PageContainer.js delete mode 100644 packages/dashboard-v2/src/components/PageContainer/index.js delete mode 100644 packages/dashboard-v2/src/components/Panel/Panel.js delete mode 100644 packages/dashboard-v2/src/components/Panel/Panel.stories.js delete mode 100644 packages/dashboard-v2/src/components/Panel/index.js delete mode 100644 packages/dashboard-v2/src/components/PopoverMenu/PopoverMenu.js delete mode 100644 packages/dashboard-v2/src/components/PopoverMenu/index.js delete mode 100644 packages/dashboard-v2/src/components/Select/Select.js delete mode 100644 packages/dashboard-v2/src/components/Select/Select.stories.js delete mode 100644 packages/dashboard-v2/src/components/Select/SelectOption.js delete mode 100644 packages/dashboard-v2/src/components/Select/hooks.js delete mode 100644 packages/dashboard-v2/src/components/Select/index.js delete mode 100644 packages/dashboard-v2/src/components/Slider/Bullets.js delete mode 100644 packages/dashboard-v2/src/components/Slider/Slide.js delete mode 100644 packages/dashboard-v2/src/components/Slider/Slider.js delete mode 100644 packages/dashboard-v2/src/components/Slider/index.js delete mode 100644 packages/dashboard-v2/src/components/Slider/useActiveBreakpoint.js delete mode 100644 packages/dashboard-v2/src/components/Switch/Switch.js delete mode 100644 packages/dashboard-v2/src/components/Switch/Switch.stories.js delete mode 100644 packages/dashboard-v2/src/components/Switch/index.js delete mode 100644 packages/dashboard-v2/src/components/Table/Table.js delete mode 100644 packages/dashboard-v2/src/components/Table/Table.stories.js delete mode 100644 packages/dashboard-v2/src/components/Table/TableBody.js delete mode 100644 packages/dashboard-v2/src/components/Table/TableCell.js delete mode 100644 packages/dashboard-v2/src/components/Table/TableHead.js delete mode 100644 packages/dashboard-v2/src/components/Table/TableHeadCell.js delete mode 100644 packages/dashboard-v2/src/components/Table/TableRow.js delete mode 100644 packages/dashboard-v2/src/components/Table/index.js delete mode 100644 packages/dashboard-v2/src/components/Tabs/ActiveTabIndicator.js delete mode 100644 packages/dashboard-v2/src/components/Tabs/Tab.js delete mode 100644 packages/dashboard-v2/src/components/Tabs/TabPanel.js delete mode 100644 packages/dashboard-v2/src/components/Tabs/Tabs.js delete mode 100644 packages/dashboard-v2/src/components/Tabs/Tabs.stories.js delete mode 100644 packages/dashboard-v2/src/components/Tabs/hooks.js delete mode 100644 packages/dashboard-v2/src/components/Tabs/index.js delete mode 100644 packages/dashboard-v2/src/components/TextIndicator/TextIndicator.js delete mode 100644 packages/dashboard-v2/src/components/TextIndicator/TextIndicator.stories.js delete mode 100644 packages/dashboard-v2/src/components/TextIndicator/index.js delete mode 100644 packages/dashboard-v2/src/components/TextInputBasic/TextInputBasic.js delete mode 100644 packages/dashboard-v2/src/components/TextInputBasic/TextInputBasic.stories.js delete mode 100644 packages/dashboard-v2/src/components/TextInputBasic/index.js delete mode 100644 packages/dashboard-v2/src/components/TextInputIcon/TextInputIcon.js delete mode 100644 packages/dashboard-v2/src/components/TextInputIcon/TextInputIcon.stories.js delete mode 100644 packages/dashboard-v2/src/components/TextInputIcon/index.js delete mode 100644 packages/dashboard-v2/src/components/Tooltip/Tooltip.js delete mode 100644 packages/dashboard-v2/src/components/Tooltip/index.js delete mode 100644 packages/dashboard-v2/src/components/Uploader/ProgressBar.js delete mode 100644 packages/dashboard-v2/src/components/Uploader/ProgressBar.stories.js delete mode 100644 packages/dashboard-v2/src/components/Uploader/Uploader.js delete mode 100644 packages/dashboard-v2/src/components/Uploader/UploaderItem.js delete mode 100644 packages/dashboard-v2/src/components/Uploader/UploaderItemIcon.js delete mode 100644 packages/dashboard-v2/src/components/Uploader/buildUploadErrorMessage.js delete mode 100644 packages/dashboard-v2/src/components/forms/AccountRemovalForm.js delete mode 100644 packages/dashboard-v2/src/components/forms/AccountSettingsForm.js delete mode 100644 packages/dashboard-v2/src/components/forms/AddAPIKeyForm.js delete mode 100644 packages/dashboard-v2/src/components/forms/AddSkylinkToSponsorKeyForm.js delete mode 100644 packages/dashboard-v2/src/components/forms/AddSponsorKeyForm.js delete mode 100644 packages/dashboard-v2/src/components/forms/LoginForm.js delete mode 100644 packages/dashboard-v2/src/components/forms/RecoveryForm.js delete mode 100644 packages/dashboard-v2/src/components/forms/ResetPasswordForm.js delete mode 100644 packages/dashboard-v2/src/components/forms/SignUpForm.js delete mode 100644 packages/dashboard-v2/src/components/forms/index.js delete mode 100644 packages/dashboard-v2/src/contexts/plans/PlansContext.js delete mode 100644 packages/dashboard-v2/src/contexts/plans/PlansProvider.js delete mode 100644 packages/dashboard-v2/src/contexts/plans/index.js delete mode 100644 packages/dashboard-v2/src/contexts/plans/usePlans.js delete mode 100644 packages/dashboard-v2/src/contexts/portal-settings/PortalSettingsContext.js delete mode 100644 packages/dashboard-v2/src/contexts/portal-settings/PortalSettingsProvider.js delete mode 100644 packages/dashboard-v2/src/contexts/portal-settings/index.js delete mode 100644 packages/dashboard-v2/src/contexts/portal-settings/usePortalSettings.js delete mode 100644 packages/dashboard-v2/src/contexts/user/UserContext.js delete mode 100644 packages/dashboard-v2/src/contexts/user/UserProvider.js delete mode 100644 packages/dashboard-v2/src/contexts/user/index.js delete mode 100644 packages/dashboard-v2/src/contexts/user/useUser.js delete mode 100644 packages/dashboard-v2/src/hooks/useActivePlan.js delete mode 100644 packages/dashboard-v2/src/hooks/useUpgradeRedirect.js delete mode 100644 packages/dashboard-v2/src/layouts/AuthLayout.js delete mode 100644 packages/dashboard-v2/src/layouts/DashboardLayout.js delete mode 100644 packages/dashboard-v2/src/layouts/UserSettingsLayout.js delete mode 100644 packages/dashboard-v2/src/lib/config.js delete mode 100644 packages/dashboard-v2/src/lib/cssHelpers.js delete mode 100644 packages/dashboard-v2/src/lib/humanBytes.js delete mode 100644 packages/dashboard-v2/src/lib/swrConfig.js delete mode 100644 packages/dashboard-v2/src/lib/theme.js delete mode 100644 packages/dashboard-v2/src/lib/tiers.js delete mode 100644 packages/dashboard-v2/src/pages/404.js delete mode 100644 packages/dashboard-v2/src/pages/auth/login.js delete mode 100644 packages/dashboard-v2/src/pages/auth/registration.js delete mode 100644 packages/dashboard-v2/src/pages/auth/reset-password.js delete mode 100644 packages/dashboard-v2/src/pages/files.js delete mode 100644 packages/dashboard-v2/src/pages/index.js delete mode 100644 packages/dashboard-v2/src/pages/payments.js delete mode 100644 packages/dashboard-v2/src/pages/settings/developer-settings.js delete mode 100644 packages/dashboard-v2/src/pages/settings/export.js delete mode 100644 packages/dashboard-v2/src/pages/settings/index.js delete mode 100644 packages/dashboard-v2/src/pages/settings/notifications.js delete mode 100644 packages/dashboard-v2/src/pages/user/confirm.js delete mode 100644 packages/dashboard-v2/src/pages/user/recover.js delete mode 100644 packages/dashboard-v2/src/services/accountsService.js delete mode 100644 packages/dashboard-v2/src/services/skynetClient.js delete mode 100644 packages/dashboard-v2/src/styles/global.css delete mode 100644 packages/dashboard-v2/static/apple-touch-icon-144x144.png delete mode 100644 packages/dashboard-v2/static/apple-touch-icon-152x152.png delete mode 100644 packages/dashboard-v2/static/favicon-16x16.png delete mode 100644 packages/dashboard-v2/static/favicon-32x32.png delete mode 100644 packages/dashboard-v2/static/favicon.ico delete mode 100644 packages/dashboard-v2/static/images/api-keys.svg delete mode 100644 packages/dashboard-v2/static/images/auth-bg.svg delete mode 100644 packages/dashboard-v2/static/images/avatar-bg.svg delete mode 100644 packages/dashboard-v2/static/images/avatar-placeholder.svg delete mode 100644 packages/dashboard-v2/static/images/dashboard-bg.svg delete mode 100644 packages/dashboard-v2/static/images/import-export.svg delete mode 100644 packages/dashboard-v2/static/images/inbox.svg delete mode 100644 packages/dashboard-v2/static/images/logo-black-text.svg delete mode 100644 packages/dashboard-v2/static/images/usage-graph-bg.svg delete mode 100644 packages/dashboard-v2/static/mstile-144x144.png delete mode 100644 packages/dashboard-v2/tailwind.config.js delete mode 100644 packages/dashboard-v2/yarn.lock diff --git a/docker-compose.accounts.yml b/docker-compose.accounts.yml index 1e786c11..57eb442f 100644 --- a/docker-compose.accounts.yml +++ b/docker-compose.accounts.yml @@ -82,8 +82,9 @@ services: # ============================================================ # dashboard-v2: # build: - # context: ./packages/dashboard-v2 + # context: https://github.com/SkynetLabs/webportal-accounts-dashboard.git#master # dockerfile: Dockerfile + # image: skynetlabs/webportal-accounts-dashboard@1.0.0 # container_name: dashboard-v2 # restart: unless-stopped # logging: *default-logging diff --git a/packages/dashboard-v2/.eslintignore b/packages/dashboard-v2/.eslintignore deleted file mode 100644 index 65ea287b..00000000 --- a/packages/dashboard-v2/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules/ -.cache/ -public/ -storybook-build/ diff --git a/packages/dashboard-v2/.eslintrc.js b/packages/dashboard-v2/.eslintrc.js deleted file mode 100644 index 51d8f9b5..00000000 --- a/packages/dashboard-v2/.eslintrc.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - globals: { - __PATH_PREFIX__: true, - }, - extends: ["react-app", "plugin:storybook/recommended"], -}; diff --git a/packages/dashboard-v2/.gitignore b/packages/dashboard-v2/.gitignore deleted file mode 100644 index 65ea287b..00000000 --- a/packages/dashboard-v2/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules/ -.cache/ -public/ -storybook-build/ diff --git a/packages/dashboard-v2/.prettierignore b/packages/dashboard-v2/.prettierignore deleted file mode 100644 index 65ea287b..00000000 --- a/packages/dashboard-v2/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules/ -.cache/ -public/ -storybook-build/ diff --git a/packages/dashboard-v2/.prettierrc.json b/packages/dashboard-v2/.prettierrc.json deleted file mode 100644 index 963354f2..00000000 --- a/packages/dashboard-v2/.prettierrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "printWidth": 120 -} diff --git a/packages/dashboard-v2/.storybook/main.js b/packages/dashboard-v2/.storybook/main.js deleted file mode 100644 index 8a1198a4..00000000 --- a/packages/dashboard-v2/.storybook/main.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = { - stories: ["../src/**/*.stories.@(js|jsx|ts|tsx)"], - addons: [ - "@storybook/addon-links", - "@storybook/addon-essentials", - "storybook-addon-gatsby", - { - name: "@storybook/addon-postcss", - options: { - postcssLoaderOptions: { - implementation: require("postcss"), - }, - }, - }, - ], - core: { - builder: "webpack5", - }, -}; diff --git a/packages/dashboard-v2/.storybook/preview.js b/packages/dashboard-v2/.storybook/preview.js deleted file mode 100644 index de9fb8cb..00000000 --- a/packages/dashboard-v2/.storybook/preview.js +++ /dev/null @@ -1,20 +0,0 @@ -import "tailwindcss/tailwind.css"; -import "@fontsource/sora/300.css"; // light -import "@fontsource/sora/400.css"; // normal -import "@fontsource/sora/500.css"; // medium -import "@fontsource/sora/600.css"; // semibold -import "@fontsource/source-sans-pro/400.css"; // normal -import "@fontsource/source-sans-pro/600.css"; // semibold - -import "../src/styles/global.css"; - -export const parameters = { - actions: { argTypesRegex: "^on[A-Z].*" }, - controls: { - matchers: { - color: /(background|color)$/i, - date: /Date$/, - }, - }, - layout: "fullscreen", -}; diff --git a/packages/dashboard-v2/Dockerfile b/packages/dashboard-v2/Dockerfile deleted file mode 100644 index 86fe89bc..00000000 --- a/packages/dashboard-v2/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM node:16.14.2-alpine - -WORKDIR /usr/app - -COPY package.json \ - yarn.lock \ - ./ - -RUN yarn --frozen-lockfile - -COPY static ./static -COPY src ./src -COPY gatsby*.js \ - postcss.config.js \ - tailwind.config.js \ - ./ - -CMD ["sh", "-c", "yarn build && yarn serve --host 0.0.0.0 -p 9000"] diff --git a/packages/dashboard-v2/README.md b/packages/dashboard-v2/README.md deleted file mode 100644 index e8924bc3..00000000 --- a/packages/dashboard-v2/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Skynet Account Dashboard - -Code behind [account.skynetpro.net](https://account.skynetpro.net/) - -## Development - -This is a Gatsby application. To run it locally, all you need is: - -- `yarn install` -- `yarn start` - -## Accessing remote APIs - -To have a fully functioning local environment, you'll need to make the browser believe you're actually on the same domain as a working API (i.e. a remote dev or production server) -- otherwise the browser will block the session cookie. -To do the trick, configure proper environment variables in the `.env.development` file. -This file allows to easily control which domain name you want to use locally and which API you'd like to access. - -Example: - -```env -GATSBY_PORTAL_DOMAIN=skynetfree.net # Use skynetfree.net APIs -GATSBY_HOST=local.skynetfree.net # Address of your local build -``` - -> It's recommended to keep the 2LD the same, so any cookies dispatched by the API work without issues. - -With the file configured, run `yarn develop:secure` -- it will run `gatsby develop` with `--https -p=443` options. -If you're on macOS, you may need to `sudo` the command to successfully bind to port `443` (https). - -Gatsby will automatically add a proper entry to your `/etc/hosts` file and clean it up when process exits. diff --git a/packages/dashboard-v2/gatsby-browser.js b/packages/dashboard-v2/gatsby-browser.js deleted file mode 100644 index 927fd206..00000000 --- a/packages/dashboard-v2/gatsby-browser.js +++ /dev/null @@ -1,32 +0,0 @@ -import * as React from "react"; -import { SWRConfig } from "swr"; -import { Elements } from "@stripe/react-stripe-js"; -import { loadStripe } from "@stripe/stripe-js"; -import "@fontsource/sora/300.css"; // light -import "@fontsource/sora/400.css"; // normal -import "@fontsource/sora/500.css"; // medium -import "@fontsource/sora/600.css"; // semibold -import "@fontsource/source-sans-pro/400.css"; // normal -import "@fontsource/source-sans-pro/600.css"; // semibold -import "./src/styles/global.css"; -import swrConfig from "./src/lib/swrConfig"; -import { MODAL_ROOT_ID } from "./src/components/Modal"; -import { PortalSettingsProvider } from "./src/contexts/portal-settings"; - -const stripePromise = loadStripe(process.env.GATSBY_STRIPE_PUBLISHABLE_KEY); - -export function wrapPageElement({ element, props }) { - const Layout = element.type.Layout ?? React.Fragment; - return ( - - - - - {element} -
- - - - - ); -} diff --git a/packages/dashboard-v2/gatsby-config.js b/packages/dashboard-v2/gatsby-config.js deleted file mode 100644 index d087fa65..00000000 --- a/packages/dashboard-v2/gatsby-config.js +++ /dev/null @@ -1,57 +0,0 @@ -require("dotenv").config({ - path: `.env.${process.env.NODE_ENV}`, -}); - -const { createProxyMiddleware } = require("http-proxy-middleware"); - -const { GATSBY_PORTAL_DOMAIN } = process.env; - -module.exports = { - siteMetadata: { - title: `Account Dashboard`, - siteUrl: `https://account.${GATSBY_PORTAL_DOMAIN}`, - }, - pathPrefix: "/v2", - trailingSlash: "never", - plugins: [ - "gatsby-plugin-image", - "gatsby-plugin-provide-react", - "gatsby-plugin-react-helmet", - "gatsby-plugin-sharp", - "gatsby-transformer-sharp", - "gatsby-plugin-styled-components", - "gatsby-plugin-postcss", - { - resolve: "gatsby-source-filesystem", - options: { - name: "images", - path: "./static/images/", - }, - __key: "images", - }, - ], - developMiddleware: (app) => { - // Proxy Accounts service API requests: - app.use( - "/api/", - createProxyMiddleware({ - target: `https://account.${GATSBY_PORTAL_DOMAIN}`, - secure: false, // Do not reject self-signed certificates. - changeOrigin: true, - }) - ); - - // Proxy /skynet requests (e.g. uploads) - app.use( - ["/skynet", "/__internal/"], - createProxyMiddleware({ - target: `https://${GATSBY_PORTAL_DOMAIN}`, - secure: false, // Do not reject self-signed certificates. - changeOrigin: true, - pathRewrite: { - "^/skynet": "", - }, - }) - ); - }, -}; diff --git a/packages/dashboard-v2/gatsby-ssr.js b/packages/dashboard-v2/gatsby-ssr.js deleted file mode 100644 index 927fd206..00000000 --- a/packages/dashboard-v2/gatsby-ssr.js +++ /dev/null @@ -1,32 +0,0 @@ -import * as React from "react"; -import { SWRConfig } from "swr"; -import { Elements } from "@stripe/react-stripe-js"; -import { loadStripe } from "@stripe/stripe-js"; -import "@fontsource/sora/300.css"; // light -import "@fontsource/sora/400.css"; // normal -import "@fontsource/sora/500.css"; // medium -import "@fontsource/sora/600.css"; // semibold -import "@fontsource/source-sans-pro/400.css"; // normal -import "@fontsource/source-sans-pro/600.css"; // semibold -import "./src/styles/global.css"; -import swrConfig from "./src/lib/swrConfig"; -import { MODAL_ROOT_ID } from "./src/components/Modal"; -import { PortalSettingsProvider } from "./src/contexts/portal-settings"; - -const stripePromise = loadStripe(process.env.GATSBY_STRIPE_PUBLISHABLE_KEY); - -export function wrapPageElement({ element, props }) { - const Layout = element.type.Layout ?? React.Fragment; - return ( - - - - - {element} -
- - - - - ); -} diff --git a/packages/dashboard-v2/package.json b/packages/dashboard-v2/package.json deleted file mode 100644 index 53edfa12..00000000 --- a/packages/dashboard-v2/package.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "name": "accounts-dashboard", - "version": "1.0.0", - "private": true, - "description": "Accounts Dashboard", - "author": "Skynet Labs", - "keywords": [ - "gatsby" - ], - "scripts": { - "develop": "gatsby develop", - "develop:secure": "dotenv -e .env.development -- gatsby develop --https -p=443", - "start": "gatsby develop", - "build": "gatsby build --prefix-paths", - "serve": "gatsby serve --prefix-paths", - "clean": "gatsby clean", - "lint": "eslint .", - "prettier": "prettier .", - "storybook": "start-storybook -p 6006", - "build-storybook": "build-storybook -o storybook-build" - }, - "dependencies": { - "@fontsource/sora": "^4.5.3", - "@fontsource/source-sans-pro": "^4.5.3", - "@stripe/react-stripe-js": "^1.7.1", - "@stripe/stripe-js": "^1.27.0", - "classnames": "^2.3.1", - "copy-text-to-clipboard": "^3.0.1", - "dayjs": "^1.10.8", - "formik": "^2.2.9", - "gatsby": "^4.6.2", - "gatsby-plugin-postcss": "^5.7.0", - "http-status-codes": "^2.2.0", - "ky": "^0.30.0", - "nanoid": "^3.3.1", - "path-browserify": "^1.0.1", - "postcss": "^8.4.6", - "react": "^17.0.1", - "react-dom": "^17.0.1", - "react-dropzone": "^12.0.4", - "react-helmet": "^6.1.0", - "react-use": "^17.3.2", - "skynet-js": "4.0.27-beta", - "swr": "^1.2.2", - "tailwindcss": "^3.0.23", - "yup": "^0.32.11" - }, - "devDependencies": { - "@babel/core": "^7.17.4", - "@storybook/addon-actions": "^6.4.19", - "@storybook/addon-essentials": "^6.4.19", - "@storybook/addon-interactions": "^6.4.19", - "@storybook/addon-links": "^6.4.19", - "@storybook/addon-postcss": "^2.0.0", - "@storybook/builder-webpack5": "^6.4.19", - "@storybook/manager-webpack5": "^6.4.19", - "@storybook/react": "^6.4.19", - "@storybook/testing-library": "^0.0.9", - "autoprefixer": "^10.4.2", - "babel-eslint": "^10.1.0", - "babel-loader": "^8.2.3", - "babel-plugin-preval": "^5.1.0", - "babel-plugin-styled-components": "^2.0.2", - "dotenv": "^16.0.0", - "dotenv-cli": "^5.1.0", - "eslint": "^8.9.0", - "eslint-config-react-app": "^7.0.0", - "eslint-plugin-storybook": "^0.5.6", - "gatsby-plugin-alias-imports": "^1.0.5", - "gatsby-plugin-image": "^2.6.0", - "gatsby-plugin-preval": "^1.0.0", - "gatsby-plugin-provide-react": "^1.0.2", - "gatsby-plugin-react-helmet": "^5.6.0", - "gatsby-plugin-sharp": "^4.6.0", - "gatsby-plugin-styled-components": "^5.8.0", - "gatsby-source-filesystem": "^4.6.0", - "gatsby-transformer-sharp": "^4.6.0", - "http-proxy-middleware": "^1.3.1", - "prettier": "2.5.1", - "react-is": "^17.0.2", - "storybook-addon-gatsby": "^0.0.5", - "styled-components": "^5.3.3" - } -} diff --git a/packages/dashboard-v2/postcss.config.js b/packages/dashboard-v2/postcss.config.js deleted file mode 100644 index 3b35b010..00000000 --- a/packages/dashboard-v2/postcss.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - plugins: [require("tailwindcss/nesting"), require("tailwindcss"), require("autoprefixer")], -}; diff --git a/packages/dashboard-v2/src/components/APIKeyList/APIKey.js b/packages/dashboard-v2/src/components/APIKeyList/APIKey.js deleted file mode 100644 index b90a539e..00000000 --- a/packages/dashboard-v2/src/components/APIKeyList/APIKey.js +++ /dev/null @@ -1,157 +0,0 @@ -import dayjs from "dayjs"; -import cn from "classnames"; -import { useCallback, useState } from "react"; - -import { Alert } from "../Alert"; -import { Button } from "../Button"; -import { AddSkylinkToSponsorKeyForm } from "../forms/AddSkylinkToSponsorKeyForm"; -import { CogIcon, TrashIcon } from "../Icons"; -import { Modal } from "../Modal"; - -import { useAPIKeyEdit } from "./useAPIKeyEdit"; -import { useAPIKeyRemoval } from "./useAPIKeyRemoval"; - -export const APIKey = ({ apiKey, onRemoved, onEdited, onRemovalError }) => { - const { id, name, createdAt, skylinks } = apiKey; - const isSponsorKey = apiKey.public === "true"; - const [error, setError] = useState(null); - - const onSkylinkListEdited = useCallback(() => { - setError(null); - onEdited(); - }, [onEdited]); - - const onSkylinkListEditFailure = (errorMessage) => setError(errorMessage); - - const { - removalError, - removalInitiated, - prompt: promptRemoval, - abort: abortRemoval, - confirm: confirmRemoval, - } = useAPIKeyRemoval({ - key: apiKey, - onSuccess: onRemoved, - onFailure: onRemovalError, - }); - - const { - editInitiated, - prompt: promptEdit, - abort: abortEdit, - addSkylink, - removeSkylink, - } = useAPIKeyEdit({ - key: apiKey, - onSkylinkListUpdate: onSkylinkListEdited, - onSkylinkListUpdateFailure: onSkylinkListEditFailure, - }); - - const closeEditModal = useCallback(() => { - setError(null); - abortEdit(); - }, [abortEdit]); - - const skylinksNumber = skylinks?.length ?? 0; - const isNotConfigured = isSponsorKey && skylinksNumber === 0; - const skylinksPhrasePrefix = skylinksNumber === 0 ? "No" : skylinksNumber; - const skylinksPhrase = `${skylinksPhrasePrefix} ${skylinksNumber === 1 ? "skylink" : "skylinks"} sponsored`; - - return ( -
  • - - - {name || "unnamed key"} - {isSponsorKey && ( - - )} - - - - {dayjs(createdAt).format("MMM DD, YYYY")} - - {isSponsorKey && ( - - )} - - - - {removalInitiated && ( - -

    Delete API key

    -
    -

    Are you sure you want to delete the following API key?

    -

    {name || id}

    -
    - {removalError && {removalError}} - -
    - - -
    -
    - )} - {editInitiated && ( - -

    Sponsored skylinks

    - {skylinks?.length > 0 ? ( -
      - {skylinks.map((skylink) => ( -
    • - - {skylink} - - -
    • - ))} -
    - ) : ( - No skylinks here yet. You can add the first one below 🙃 - )} - -
    - {error && {error}} - -
    -
    - -
    -
    - )} -
  • - ); -}; diff --git a/packages/dashboard-v2/src/components/APIKeyList/APIKeyList.js b/packages/dashboard-v2/src/components/APIKeyList/APIKeyList.js deleted file mode 100644 index 3d3e504d..00000000 --- a/packages/dashboard-v2/src/components/APIKeyList/APIKeyList.js +++ /dev/null @@ -1,14 +0,0 @@ -import { APIKey } from "./APIKey"; - -export const APIKeyList = ({ keys, reloadKeys, title }) => { - return ( - <> -
    {title}
    -
      - {keys.map((key) => ( - - ))} -
    - - ); -}; diff --git a/packages/dashboard-v2/src/components/APIKeyList/index.js b/packages/dashboard-v2/src/components/APIKeyList/index.js deleted file mode 100644 index 8ade7744..00000000 --- a/packages/dashboard-v2/src/components/APIKeyList/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from "./APIKeyList"; diff --git a/packages/dashboard-v2/src/components/APIKeyList/useAPIKeyEdit.js b/packages/dashboard-v2/src/components/APIKeyList/useAPIKeyEdit.js deleted file mode 100644 index a821ca02..00000000 --- a/packages/dashboard-v2/src/components/APIKeyList/useAPIKeyEdit.js +++ /dev/null @@ -1,43 +0,0 @@ -import { useCallback, useState } from "react"; -import accountsService from "../../services/accountsService"; - -export const useAPIKeyEdit = ({ key, onSkylinkListUpdate, onSkylinkListUpdateFailure }) => { - const [editInitiated, setEditInitiated] = useState(false); - - const prompt = () => setEditInitiated(true); - const abort = () => setEditInitiated(false); - const updateSkylinkList = useCallback( - async (action, skylink) => { - try { - await accountsService.patch(`user/apikeys/${key.id}`, { - json: { - [action]: [skylink], - }, - }); - onSkylinkListUpdate(); - - return true; - } catch (err) { - if (err.response) { - const { message } = await err.response.json(); - onSkylinkListUpdateFailure(message); - } else { - onSkylinkListUpdateFailure("Unknown error occured, please try again."); - } - - return false; - } - }, - [onSkylinkListUpdate, onSkylinkListUpdateFailure, key] - ); - const addSkylink = (skylink) => updateSkylinkList("add", skylink); - const removeSkylink = (skylink) => updateSkylinkList("remove", skylink); - - return { - editInitiated, - prompt, - abort, - addSkylink, - removeSkylink, - }; -}; diff --git a/packages/dashboard-v2/src/components/APIKeyList/useAPIKeyRemoval.js b/packages/dashboard-v2/src/components/APIKeyList/useAPIKeyRemoval.js deleted file mode 100644 index b9c53bd9..00000000 --- a/packages/dashboard-v2/src/components/APIKeyList/useAPIKeyRemoval.js +++ /dev/null @@ -1,41 +0,0 @@ -import { useCallback, useState } from "react"; -import accountsService from "../../services/accountsService"; - -export const useAPIKeyRemoval = ({ key, onSuccess }) => { - const [removalInitiated, setRemovalInitiated] = useState(false); - const [removalError, setRemovalError] = useState(null); - - const prompt = () => { - setRemovalError(null); - setRemovalInitiated(true); - }; - const abort = () => setRemovalInitiated(false); - - const confirm = useCallback(async () => { - setRemovalError(null); - try { - await accountsService.delete(`user/apikeys/${key.id}`); - setRemovalInitiated(false); - onSuccess(); - } catch (err) { - let message = "There was an error processing your request. Please try again later."; - - if (err.response) { - const response = await err.response.json(); - if (response.message) { - message = response.message; - } - } - - setRemovalError(message); - } - }, [onSuccess, key]); - - return { - removalInitiated, - removalError, - prompt, - abort, - confirm, - }; -}; diff --git a/packages/dashboard-v2/src/components/Alert/Alert.js b/packages/dashboard-v2/src/components/Alert/Alert.js deleted file mode 100644 index 4db72620..00000000 --- a/packages/dashboard-v2/src/components/Alert/Alert.js +++ /dev/null @@ -1,10 +0,0 @@ -import styled from "styled-components"; -import cn from "classnames"; - -export const Alert = styled.div.attrs(({ $variant }) => ({ - className: cn("px-3 py-2 sm:px-6 sm:py-4 rounded border", { - "bg-blue-100 border-blue-200 text-palette-400": $variant === "info", - "bg-red-100 border-red-200 text-error": $variant === "error", - "bg-green-100 border-green-200 text-palette-400": $variant === "success", - }), -}))``; diff --git a/packages/dashboard-v2/src/components/Alert/index.js b/packages/dashboard-v2/src/components/Alert/index.js deleted file mode 100644 index b8e17a03..00000000 --- a/packages/dashboard-v2/src/components/Alert/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from "./Alert"; diff --git a/packages/dashboard-v2/src/components/AvatarUploader/AvatarUploader.js b/packages/dashboard-v2/src/components/AvatarUploader/AvatarUploader.js deleted file mode 100644 index f97ca2d5..00000000 --- a/packages/dashboard-v2/src/components/AvatarUploader/AvatarUploader.js +++ /dev/null @@ -1,36 +0,0 @@ -import { useEffect, useState } from "react"; - -import { useUser } from "../../contexts/user"; -// import { SimpleUploadIcon } from "../Icons"; - -import avatarPlaceholder from "../../../static/images/avatar-placeholder.svg"; - -export const AvatarUploader = (props) => { - const { user } = useUser(); - const [imageUrl, setImageUrl] = useState(avatarPlaceholder); - - useEffect(() => { - setImageUrl(user.avatarUrl ?? avatarPlaceholder); - }, [user]); - - return ( -
    -
    - -
    - {/* TODO: uncomment when avatar uploads work -
    - -
    - */} -
    - ); -}; diff --git a/packages/dashboard-v2/src/components/AvatarUploader/index.js b/packages/dashboard-v2/src/components/AvatarUploader/index.js deleted file mode 100644 index 74358cdc..00000000 --- a/packages/dashboard-v2/src/components/AvatarUploader/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from "./AvatarUploader"; diff --git a/packages/dashboard-v2/src/components/Button/Button.js b/packages/dashboard-v2/src/components/Button/Button.js deleted file mode 100644 index 2a49244e..00000000 --- a/packages/dashboard-v2/src/components/Button/Button.js +++ /dev/null @@ -1,47 +0,0 @@ -import cn from "classnames"; -import PropTypes from "prop-types"; -import styled from "styled-components"; - -/** - * Primary UI component for user interaction - */ -export const Button = styled.button.attrs(({ as: polymorphicAs, disabled, $primary, type }) => { - // We want to default to type=button in most cases, but sometimes we use this component - // as a polymorphic one (i.e. for links), and then we should avoid setting `type` property, - // as it breaks styling in Safari. - const typeAttr = polymorphicAs && polymorphicAs !== "button" ? undefined : type; - - return { - type: typeAttr, - className: cn( - "px-6 py-2.5 inline-block rounded-full font-sans uppercase text-xs tracking-wide transition-[opacity_filter]", - { - "bg-primary text-palette-600": $primary, - "bg-white border-2 border-black text-palette-600": !$primary, - "cursor-not-allowed opacity-60": disabled, - "hover:brightness-90": !disabled, - } - ), - }; -})``; - -Button.propTypes = { - /** - * Is this the principal call to action on the page? - */ - $primary: PropTypes.bool, - /** - * Prevent interaction on the button - */ - disabled: PropTypes.bool, - /** - * Type of button (button / submit) - */ - type: PropTypes.oneOf(["button", "submit"]), -}; - -Button.defaultProps = { - $primary: false, - disabled: false, - type: "button", -}; diff --git a/packages/dashboard-v2/src/components/Button/Button.stories.js b/packages/dashboard-v2/src/components/Button/Button.stories.js deleted file mode 100644 index 74f2ca90..00000000 --- a/packages/dashboard-v2/src/components/Button/Button.stories.js +++ /dev/null @@ -1,38 +0,0 @@ -import { Button } from "./Button"; - -// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export -export default { - title: "SkynetLibrary/Button", - component: Button, - // More on argTypes: https://storybook.js.org/docs/react/api/argtypes - argTypes: { - backgroundColor: { control: "color" }, - }, -}; - -// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args -const Template = (args) => - - Copied to clipboard - -
    - ); -}; diff --git a/packages/dashboard-v2/src/components/CurrentPlan/CurrentPlan.js b/packages/dashboard-v2/src/components/CurrentPlan/CurrentPlan.js deleted file mode 100644 index f9bc101a..00000000 --- a/packages/dashboard-v2/src/components/CurrentPlan/CurrentPlan.js +++ /dev/null @@ -1,52 +0,0 @@ -import dayjs from "dayjs"; -import relativeTime from "dayjs/plugin/relativeTime"; - -import { useUser } from "../../contexts/user"; -import useActivePlan from "../../hooks/useActivePlan"; -import humanBytes from "../../lib/humanBytes"; -import { ContainerLoadingIndicator } from "../LoadingIndicator"; - -import LatestPayment from "./LatestPayment"; -import SuggestedPlan from "./SuggestedPlan"; - -dayjs.extend(relativeTime); - -const CurrentPlan = () => { - const { user, error: userError } = useUser(); - const { plans, activePlan, error: plansError } = useActivePlan(user); - - if (!user || !activePlan) { - return ; - } - - if (userError || plansError) { - return ( -
    -

    An error occurred while loading this data.

    -

    We'll retry automatically.

    -
    - ); - } - - return ( -
    -

    {activePlan.name}

    -
    - {activePlan.price === 0 && activePlan.limits && ( -

    {humanBytes(activePlan.limits.storageLimit)} without paying a dime! 🎉

    - )} - {activePlan.price !== 0 && - (user.subscriptionCancelAtPeriodEnd ? ( -

    Your subscription expires {dayjs(user.subscribedUntil).fromNow()}

    - ) : ( -

    {dayjs(user.subscribedUntil).fromNow(true)} until the next payment

    - ))} - - {user.subscriptionStatus && } - -
    -
    - ); -}; - -export default CurrentPlan; diff --git a/packages/dashboard-v2/src/components/CurrentPlan/LatestPayment.js b/packages/dashboard-v2/src/components/CurrentPlan/LatestPayment.js deleted file mode 100644 index 8ca2ab9e..00000000 --- a/packages/dashboard-v2/src/components/CurrentPlan/LatestPayment.js +++ /dev/null @@ -1,18 +0,0 @@ -import dayjs from "dayjs"; - -// TODO: this is not an accurate information, we need this data from the backend -const LatestPayment = ({ user }) => ( -
    -
    - Latest payment - - {dayjs(user.subscribedUntil).subtract(1, "month").format("MM/DD/YYYY")} - -
    -
    - Success -
    -
    -); - -export default LatestPayment; diff --git a/packages/dashboard-v2/src/components/CurrentPlan/SuggestedPlan.js b/packages/dashboard-v2/src/components/CurrentPlan/SuggestedPlan.js deleted file mode 100644 index ed59c382..00000000 --- a/packages/dashboard-v2/src/components/CurrentPlan/SuggestedPlan.js +++ /dev/null @@ -1,24 +0,0 @@ -import { Link } from "gatsby"; -import { useMemo } from "react"; - -import { Button } from "../Button"; - -const SuggestedPlan = ({ plans, activePlan }) => { - const nextPlan = useMemo(() => plans.find(({ tier }) => tier > activePlan.tier), [plans, activePlan]); - - if (!nextPlan) { - return null; - } - - return ( -
    -

    Discover {nextPlan.name}

    -

    {nextPlan.description}

    - -
    - ); -}; - -export default SuggestedPlan; diff --git a/packages/dashboard-v2/src/components/CurrentPlan/index.js b/packages/dashboard-v2/src/components/CurrentPlan/index.js deleted file mode 100644 index 20390eab..00000000 --- a/packages/dashboard-v2/src/components/CurrentPlan/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import CurrentPlan from "./CurrentPlan"; - -export default CurrentPlan; diff --git a/packages/dashboard-v2/src/components/CurrentUsage/CurrentUsage.js b/packages/dashboard-v2/src/components/CurrentUsage/CurrentUsage.js deleted file mode 100644 index cac40771..00000000 --- a/packages/dashboard-v2/src/components/CurrentUsage/CurrentUsage.js +++ /dev/null @@ -1,116 +0,0 @@ -import { useEffect, useMemo, useState } from "react"; -import { Link } from "gatsby"; -import cn from "classnames"; -import useSWR from "swr"; - -import { useUser } from "../../contexts/user"; -import useActivePlan from "../../hooks/useActivePlan"; -import { ContainerLoadingIndicator } from "../LoadingIndicator"; - -import { GraphBar } from "./GraphBar"; -import { UsageGraph } from "./UsageGraph"; -import humanBytes from "../../lib/humanBytes"; - -const useUsageData = () => { - const { user } = useUser(); - const { activePlan, error } = useActivePlan(user); - const { data: stats, error: statsError } = useSWR("user/stats"); - - const [loading, setLoading] = useState(true); - const [usage, setUsage] = useState({}); - - const hasError = error || statsError; - const hasData = activePlan && stats; - - useEffect(() => { - if (hasData || hasError) { - setLoading(false); - } - - if (hasData && !hasError) { - setUsage({ - filesUsed: stats?.numUploads, - filesLimit: activePlan?.limits?.maxNumberUploads, - storageUsed: stats?.totalUploadsSize, - storageLimit: activePlan?.limits?.storageLimit, - }); - } - }, [hasData, hasError, stats, activePlan]); - - return { - error: error || statsError, - loading, - usage, - }; -}; - -const size = (bytes) => { - const text = humanBytes(bytes ?? 0, { precision: 0 }); - const [value, unit] = text.split(" "); - - return { - text, - value, - unit, - }; -}; - -const ErrorMessage = () => ( -
    -

    We were not able to fetch the current usage data.

    -

    We'll try again automatically.

    -
    -); - -export default function CurrentUsage() { - const { activePlan, plans } = useActivePlan(); - const { usage, error, loading } = useUsageData(); - const nextPlan = useMemo(() => plans.find(({ tier }) => tier > activePlan?.tier), [plans, activePlan]); - const storageUsage = size(usage.storageUsed); - const storageLimit = size(usage.storageLimit); - const filesUsedLabel = useMemo(() => ({ value: usage.filesUsed, unit: "files" }), [usage.filesUsed]); - - if (loading) { - return ; - } - - if (error) { - return ; - } - - return ( - <> -

    - {storageUsage.text} of {storageLimit.text} -

    -

    - {usage.filesUsed} of {usage.filesLimit} files -

    -
    -
    - Storage - {storageLimit.text} -
    - - - - -
    - Files - - - UPGRADE - {" "} - {usage.filesLimit} - -
    -
    - - ); -} diff --git a/packages/dashboard-v2/src/components/CurrentUsage/GraphBar.js b/packages/dashboard-v2/src/components/CurrentUsage/GraphBar.js deleted file mode 100644 index fd9a015e..00000000 --- a/packages/dashboard-v2/src/components/CurrentUsage/GraphBar.js +++ /dev/null @@ -1,37 +0,0 @@ -import styled from "styled-components"; - -const Bar = styled.div.attrs({ - className: `relative flex justify-end h-4 bg-primary rounded-l rounded-r-lg`, -})` - min-width: 1rem; - width: ${({ $percentage }) => $percentage}%; -`; - -const BarTip = styled.span.attrs({ - className: "relative w-4 h-4 border-2 rounded-full bg-white border-primary", -})``; - -const BarLabel = styled.span.attrs({ - className: "usage-label bg-white rounded border-2 border-palette-200 px-3 whitespace-nowrap absolute shadow", -})` - ${({ $percentage }) => ` - left: max(0%, ${$percentage}%); - top: -0.5rem; - transform: translateX(-${$percentage}%); - `} -`; - -export const GraphBar = ({ value, limit, label, className }) => { - const percentage = typeof limit !== "number" || limit === 0 ? 0 : (value / limit) * 100; - - return ( -
    - - - - - {label.value} {label.unit} - -
    - ); -}; diff --git a/packages/dashboard-v2/src/components/CurrentUsage/UsageGraph.js b/packages/dashboard-v2/src/components/CurrentUsage/UsageGraph.js deleted file mode 100644 index de4e7e46..00000000 --- a/packages/dashboard-v2/src/components/CurrentUsage/UsageGraph.js +++ /dev/null @@ -1,11 +0,0 @@ -import styled from "styled-components"; - -import usageGraphBg from "../../../static/images/usage-graph-bg.svg"; - -export const UsageGraph = styled.div.attrs({ - className: "w-full my-3 grid grid-flow-row grid-rows-2", -})` - height: 146px; - background: url(${usageGraphBg}) no-repeat; - background-size: cover; -`; diff --git a/packages/dashboard-v2/src/components/CurrentUsage/index.js b/packages/dashboard-v2/src/components/CurrentUsage/index.js deleted file mode 100644 index 802aa4e1..00000000 --- a/packages/dashboard-v2/src/components/CurrentUsage/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import CurrentUsage from "./CurrentUsage"; - -export default CurrentUsage; diff --git a/packages/dashboard-v2/src/components/DropdownMenu/DropdownMenu.js b/packages/dashboard-v2/src/components/DropdownMenu/DropdownMenu.js deleted file mode 100644 index 1bf6f001..00000000 --- a/packages/dashboard-v2/src/components/DropdownMenu/DropdownMenu.js +++ /dev/null @@ -1,63 +0,0 @@ -import { useRef, useState } from "react"; -import { useClickAway } from "react-use"; -import PropTypes from "prop-types"; -import styled, { css, keyframes } from "styled-components"; - -import { ChevronDownIcon } from "../Icons"; - -const dropDown = keyframes` - 0% { - transform: rotateX(-90deg); - } - 100% { - transform: rotateX(0deg); - } -`; - -const Container = styled.div.attrs({ className: `relative inline-flex` })``; - -const Trigger = styled.button.attrs({ - className: "flex items-center", -})``; - -const TriggerIcon = styled(ChevronDownIcon).attrs({ - className: "transition-transform text-primary", -})` - transform: ${({ open }) => (open ? "rotateX(180deg)" : "none")}; -`; - -const Flyout = styled.div.attrs(({ open }) => ({ - className: `absolute top-full right-0 p-0 z-10 - border rounded border-palette-100 - bg-white shadow-md shadow-palette-200/50 - ${open ? "visible" : "invisible"}`, -}))` - transform-origin: top center; - animation: ${({ open }) => - open - ? css` - ${dropDown} .15s ease-in-out forwards; - ` - : "none"}; -`; - -export const DropdownMenu = ({ title, children }) => { - const [open, setOpen] = useState(false); - const menuRef = useRef(); - - useClickAway(menuRef, () => setOpen(false)); - - return ( - - setOpen((open) => !open)}> - {title} - - {children} - - ); -}; - -DropdownMenu.propTypes = { - title: PropTypes.string.isRequired, - children: PropTypes.node.isRequired, -}; diff --git a/packages/dashboard-v2/src/components/DropdownMenu/DropdownMenu.stories.js b/packages/dashboard-v2/src/components/DropdownMenu/DropdownMenu.stories.js deleted file mode 100644 index 09e5a712..00000000 --- a/packages/dashboard-v2/src/components/DropdownMenu/DropdownMenu.stories.js +++ /dev/null @@ -1,25 +0,0 @@ -import { Panel } from "../Panel"; -import { DropdownMenu, DropdownMenuLink } from "."; -import { CogIcon, LockClosedIcon } from "../Icons"; - -export default { - title: "SkynetLibrary/DropdownMenu", - component: DropdownMenu, - subcomponents: { - DropdownMenuLink, - }, - decorators: [ - (Story) => ( - - - - ), - ], -}; - -export const NavigationDropdown = () => ( - - - - -); diff --git a/packages/dashboard-v2/src/components/DropdownMenu/DropdownMenuLink.js b/packages/dashboard-v2/src/components/DropdownMenu/DropdownMenuLink.js deleted file mode 100644 index 426501c4..00000000 --- a/packages/dashboard-v2/src/components/DropdownMenu/DropdownMenuLink.js +++ /dev/null @@ -1,22 +0,0 @@ -import styled from "styled-components"; -import PropTypes from "prop-types"; - -const DropdownLink = styled.a.attrs({ - className: `m-0 border-t border-palette-200/50 h-[60px] - whitespace-nowrap transition-colors - hover:bg-palette-100/50 flex items-center - pr-8 pl-6 py-4 gap-4 first:border-0`, -})``; - -export const DropdownMenuLink = ({ active, icon: Icon, label, ...props }) => ( - - {Icon ? : null} - {label} - -); - -DropdownMenuLink.propTypes = { - label: PropTypes.oneOfType([PropTypes.node, PropTypes.string]).isRequired, - active: PropTypes.bool, - icon: PropTypes.func, -}; diff --git a/packages/dashboard-v2/src/components/DropdownMenu/index.js b/packages/dashboard-v2/src/components/DropdownMenu/index.js deleted file mode 100644 index db833f26..00000000 --- a/packages/dashboard-v2/src/components/DropdownMenu/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./DropdownMenu"; -export * from "./DropdownMenuLink"; diff --git a/packages/dashboard-v2/src/components/FileList/FileList.js b/packages/dashboard-v2/src/components/FileList/FileList.js deleted file mode 100644 index ad6087ed..00000000 --- a/packages/dashboard-v2/src/components/FileList/FileList.js +++ /dev/null @@ -1,57 +0,0 @@ -import { useState } from "react"; -import useSWR from "swr"; -import { useMedia } from "react-use"; - -import theme from "../../lib/theme"; - -import { ContainerLoadingIndicator } from "../LoadingIndicator"; - -import FileTable from "./FileTable"; -import useFormattedFilesData from "./useFormattedFilesData"; -import { MobileFileList } from "./MobileFileList"; -import { Pagination } from "./Pagination"; - -const PAGE_SIZE = 10; - -const FileList = ({ type }) => { - const isMediumScreenOrLarger = useMedia(`(min-width: ${theme.screens.md})`); - const [offset, setOffset] = useState(0); - const baseUrl = `user/${type}?pageSize=${PAGE_SIZE}`; - const { - data, - error, - mutate: refreshList, - } = useSWR(`${baseUrl}&offset=${offset}`, { - revalidateOnMount: true, - }); - const items = useFormattedFilesData(data?.items || []); - const count = data?.count || 0; - - // Next page preloading - const hasMoreRecords = data ? data.offset + data.pageSize < data.count : false; - const nextPageOffset = hasMoreRecords ? data.offset + data.pageSize : offset; - useSWR(`${baseUrl}&offset=${nextPageOffset}`); - - if (!items.length) { - return ( -
    - {!data && !error && } - {!data && error &&

    An error occurred while loading this data.

    } - {data &&

    No {type} found.

    } -
    - ); - } - - return ( - <> - {isMediumScreenOrLarger ? ( - - ) : ( - - )} - - - ); -}; - -export default FileList; diff --git a/packages/dashboard-v2/src/components/FileList/FileTable.js b/packages/dashboard-v2/src/components/FileList/FileTable.js deleted file mode 100644 index 88477648..00000000 --- a/packages/dashboard-v2/src/components/FileList/FileTable.js +++ /dev/null @@ -1,79 +0,0 @@ -import { CogIcon, ShareIcon } from "../Icons"; -import { PopoverMenu } from "../PopoverMenu/PopoverMenu"; -import { Table, TableBody, TableCell, TableHead, TableHeadCell, TableRow } from "../Table"; -import { CopyButton } from "../CopyButton"; -import { useSkylinkOptions } from "./useSkylinkOptions"; -import { useSkylinkSharing } from "./useSkylinkSharing"; - -const SkylinkOptionsMenu = ({ skylink, onUpdated }) => { - const { inProgress, options } = useSkylinkOptions({ skylink, onUpdated }); - - return ( - - - - ); -}; - -const SkylinkSharingMenu = ({ skylink }) => { - const { options } = useSkylinkSharing(skylink); - - return ( - - - - ); -}; - -export default function FileTable({ items, onUpdated }) { - return ( -
    - - - - Name - Type - - Size - - Uploaded - Skylink - Activity - - - - {items.map((item) => { - const { id, name, type, size, date, skylink } = item; - - return ( - - {name} - {type} - - {size} - - {date} - -
    - - {skylink} -
    -
    - -
    - - -
    -
    -
    - ); - })} -
    -
    -
    - ); -} diff --git a/packages/dashboard-v2/src/components/FileList/MobileFileList.js b/packages/dashboard-v2/src/components/FileList/MobileFileList.js deleted file mode 100644 index bd11aa10..00000000 --- a/packages/dashboard-v2/src/components/FileList/MobileFileList.js +++ /dev/null @@ -1,84 +0,0 @@ -import { useState } from "react"; -import cn from "classnames"; - -import { ChevronDownIcon } from "../Icons"; -import { useSkylinkSharing } from "./useSkylinkSharing"; -import { ContainerLoadingIndicator } from "../LoadingIndicator"; -import { useSkylinkOptions } from "./useSkylinkOptions"; - -const SharingMenu = ({ skylink }) => { - const { options } = useSkylinkSharing(skylink); - - return ( -
    - {options.map(({ label, callback }, index) => ( - - ))} -
    - ); -}; - -const OptionsMenu = ({ skylink, onUpdated }) => { - const { inProgress, options } = useSkylinkOptions({ skylink, onUpdated }); - - return ( -
    -
    - {options.map(({ label, callback }, index) => ( - - ))} -
    - {inProgress && ( - - )} -
    - ); -}; - -const ListItem = ({ item, onUpdated }) => { - const { name, type, size, date, skylink } = item; - const [open, setOpen] = useState(false); - - const toggle = () => setOpen((open) => !open); - - return ( -
    -
    -
    -
    {name}
    -
    - {type} - {size} - {date} -
    -
    - -
    -
    - - -
    -
    - ); -}; - -export const MobileFileList = ({ items, onUpdated }) => { - return ( -
    - {items.map((item) => ( - - ))} -
    - ); -}; diff --git a/packages/dashboard-v2/src/components/FileList/Pagination.js b/packages/dashboard-v2/src/components/FileList/Pagination.js deleted file mode 100644 index 248c03a3..00000000 --- a/packages/dashboard-v2/src/components/FileList/Pagination.js +++ /dev/null @@ -1,32 +0,0 @@ -import { Button } from "../Button"; - -export const Pagination = ({ count, offset, setOffset, pageSize }) => { - const start = count ? offset + 1 : 0; - const end = offset + pageSize > count ? count : offset + pageSize; - - const showPaginationButtons = offset > 0 || count > end; - - return ( - - ); -}; diff --git a/packages/dashboard-v2/src/components/FileList/index.js b/packages/dashboard-v2/src/components/FileList/index.js deleted file mode 100644 index 93296508..00000000 --- a/packages/dashboard-v2/src/components/FileList/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from "./FileList"; diff --git a/packages/dashboard-v2/src/components/FileList/useFormattedFilesData.js b/packages/dashboard-v2/src/components/FileList/useFormattedFilesData.js deleted file mode 100644 index 10639458..00000000 --- a/packages/dashboard-v2/src/components/FileList/useFormattedFilesData.js +++ /dev/null @@ -1,27 +0,0 @@ -import { useMemo } from "react"; -import dayjs from "dayjs"; -import { DATE_FORMAT } from "../../lib/config"; -import humanBytes from "../../lib/humanBytes"; - -const parseFileName = (fileName) => { - const lastDotIndex = Math.max(0, fileName.lastIndexOf(".")) || Infinity; - - return [fileName.substr(0, lastDotIndex), fileName.substr(lastDotIndex)]; -}; - -const formatItem = ({ size, name: rawFileName, uploadedOn, downloadedOn, ...rest }) => { - const [name, type] = parseFileName(rawFileName); - const date = dayjs(uploadedOn || downloadedOn).format(DATE_FORMAT); - - return { - ...rest, - date, - size: humanBytes(size, { precision: 2 }), - type, - name, - }; -}; - -const useFormattedFilesData = (items) => useMemo(() => items.map(formatItem), [items]); - -export default useFormattedFilesData; diff --git a/packages/dashboard-v2/src/components/FileList/useSkylinkOptions.js b/packages/dashboard-v2/src/components/FileList/useSkylinkOptions.js deleted file mode 100644 index ad116cd4..00000000 --- a/packages/dashboard-v2/src/components/FileList/useSkylinkOptions.js +++ /dev/null @@ -1,35 +0,0 @@ -import { useMemo, useState } from "react"; - -import accountsService from "../../services/accountsService"; -import skynetClient from "../../services/skynetClient"; - -export const useSkylinkOptions = ({ skylink, onUpdated }) => { - const [inProgress, setInProgress] = useState(false); - - const options = useMemo( - () => [ - { - label: "Preview", - callback: async () => window.open(await skynetClient.getSkylinkUrl(skylink)), - }, - { - label: "Download", - callback: () => skynetClient.downloadFile(skylink), - }, - { - label: "Unpin", - callback: async () => { - setInProgress(true); - await accountsService.delete(`user/uploads/${skylink}`); - await onUpdated(); // No need to setInProgress(false), since at this point this hook should already be unmounted - }, - }, - ], - [skylink, onUpdated] - ); - - return { - inProgress, - options, - }; -}; diff --git a/packages/dashboard-v2/src/components/FileList/useSkylinkSharing.js b/packages/dashboard-v2/src/components/FileList/useSkylinkSharing.js deleted file mode 100644 index 0b09302b..00000000 --- a/packages/dashboard-v2/src/components/FileList/useSkylinkSharing.js +++ /dev/null @@ -1,40 +0,0 @@ -import { useEffect, useMemo, useState } from "react"; -import copy from "copy-text-to-clipboard"; - -import skynetClient from "../../services/skynetClient"; - -const COPY_LINK_LABEL = "Copy link"; - -export const useSkylinkSharing = (skylink) => { - const [copied, setCopied] = useState(false); - const [copyLabel, setCopyLabel] = useState(COPY_LINK_LABEL); - - useEffect(() => { - if (copied) { - setCopyLabel("Copied!"); - - const timeout = setTimeout(() => setCopied(false), 1500); - - return () => clearTimeout(timeout); - } else { - setCopyLabel(COPY_LINK_LABEL); - } - }, [copied]); - - const options = useMemo( - () => [ - { - label: copyLabel, - callback: async () => { - setCopied(true); - copy(await skynetClient.getSkylinkUrl(skylink)); - }, - }, - ], - [skylink, copyLabel] - ); - - return { - options, - }; -}; diff --git a/packages/dashboard-v2/src/components/Footer/Footer.js b/packages/dashboard-v2/src/components/Footer/Footer.js deleted file mode 100644 index 8096337a..00000000 --- a/packages/dashboard-v2/src/components/Footer/Footer.js +++ /dev/null @@ -1,19 +0,0 @@ -import * as React from "react"; -import styled from "styled-components"; - -import { PageContainer } from "../PageContainer"; - -const FooterLink = styled.a.attrs({ - className: "text-palette-400 underline decoration-dotted decoration-offset-4 decoration-1", - rel: "noreferrer", - target: "_blank", -})``; - -export const Footer = () => ( - -

    - Made by Skynet Labs. Open-sourced{" "} - on Github. -

    -
    -); diff --git a/packages/dashboard-v2/src/components/Footer/index.js b/packages/dashboard-v2/src/components/Footer/index.js deleted file mode 100644 index 5fca53f7..00000000 --- a/packages/dashboard-v2/src/components/Footer/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from "./Footer"; diff --git a/packages/dashboard-v2/src/components/Form/TextField.js b/packages/dashboard-v2/src/components/Form/TextField.js deleted file mode 100644 index 6ae35021..00000000 --- a/packages/dashboard-v2/src/components/Form/TextField.js +++ /dev/null @@ -1,56 +0,0 @@ -import PropTypes from "prop-types"; -import cn from "classnames"; -import { Field } from "formik"; - -export const TextField = ({ id, label, name, error, touched, className, ...props }) => { - return ( -
    - {label && ( - - )} - - {touched && error && ( -
    - {error} -
    - )} -
    - ); -}; - -/** Besides noted properties, it accepts all props accepted by: - * - a regular element - * - Formik's component - */ -TextField.propTypes = { - /** - * ID for the field. Used to couple