From dbe1ade81fedf45b6a031361496754b78d4f042f Mon Sep 17 00:00:00 2001 From: Thibaut Sardan <33178835+Tbaut@users.noreply.github.com> Date: Thu, 24 Feb 2022 10:50:26 +0000 Subject: [PATCH] Access to the subscription whitelist button (#1959) * join beta * lingui extract * Apply suggestions from code review * lingui extract * switch to form * lingui extract * Update packages/files-ui/src/Components/Elements/BetaModal.tsx * lingui extract * Update packages/files-ui/src/Components/FilesRoutes.tsx Co-authored-by: Tanmoy Basak Anjan Co-authored-by: GitHub Actions Co-authored-by: Tanmoy Basak Anjan Co-authored-by: Michael Yankelev <12774278+FSM1@users.noreply.github.com> --- .../src/Components/Elements/BetaModal.tsx | 80 +++++++++++++++++++ .../files-ui/src/Components/FilesRoutes.tsx | 3 +- .../src/Components/Layouts/AppHeader.tsx | 15 ++++ packages/files-ui/src/locales/de/messages.po | 9 +++ packages/files-ui/src/locales/en/messages.po | 9 +++ packages/files-ui/src/locales/es/messages.po | 9 +++ packages/files-ui/src/locales/fr/messages.po | 9 +++ packages/files-ui/src/locales/no/messages.po | 9 +++ 8 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 packages/files-ui/src/Components/Elements/BetaModal.tsx diff --git a/packages/files-ui/src/Components/Elements/BetaModal.tsx b/packages/files-ui/src/Components/Elements/BetaModal.tsx new file mode 100644 index 0000000000..a099198e33 --- /dev/null +++ b/packages/files-ui/src/Components/Elements/BetaModal.tsx @@ -0,0 +1,80 @@ +import { Button, Typography } from "@chainsafe/common-components" +import { createStyles, makeStyles } from "@chainsafe/common-theme" +import { Trans } from "@lingui/macro" +import React, { useCallback } from "react" +import { CSFTheme } from "../../Themes/types" +import { ROUTE_LINKS } from "../FilesRoutes" +import CustomModal from "./CustomModal" + +const useStyles = makeStyles( + ({ constants }: CSFTheme) => { + return createStyles({ + root: { + padding: `${constants.generalUnit * 6}px ${constants.generalUnit * 4}px`, + flexDirection: "column", + display: "flex", + alignItems: "center" + }, + title: { + marginBottom: constants.generalUnit * 3 + }, + modalInner: { + maxWidth: "600px !important" + }, + buttonContainer: { + width: "100%" + }, + nextButton: { + margin: "auto", + marginTop: constants.generalUnit * 3 + } + }) + }) + +interface Props { + onHide: () => void +} + +const BetaModal = ({ onHide }: Props) => { + const classes = useStyles() + + const onFormdButtonClick = useCallback(() => { + window.open(ROUTE_LINKS.DiscordInvite, "_blank") + onHide() + }, [onHide]) + + return ( + +
+ + Need more storage? + + + + Join our new limited-access subscription plans to upgrade to a plan with more storage. + + +
+ +
+
+
+ )} + +export default BetaModal diff --git a/packages/files-ui/src/Components/FilesRoutes.tsx b/packages/files-ui/src/Components/FilesRoutes.tsx index 6f7cb96954..3ffa753164 100644 --- a/packages/files-ui/src/Components/FilesRoutes.tsx +++ b/packages/files-ui/src/Components/FilesRoutes.tsx @@ -43,7 +43,8 @@ export const ROUTE_LINKS = { const adjustedRawCurrentPath = !rawCurrentPath ? "/" : rawCurrentPath return `/shared/${bucketId}${adjustedRawCurrentPath}` }, - DiscordInvite: "https://discord.gg/zAEY37fNb2" + DiscordInvite: "https://discord.gg/zAEY37fNb2", + SubscriptionWhitelistForm: "https://chainsafe.typeform.com/to/unZ0veao" } export const permissionPath = (permission: NonceResponsePermission) => permission === "read" ? "read" : "edit" diff --git a/packages/files-ui/src/Components/Layouts/AppHeader.tsx b/packages/files-ui/src/Components/Layouts/AppHeader.tsx index c80555f2a0..1acca783a0 100644 --- a/packages/files-ui/src/Components/Layouts/AppHeader.tsx +++ b/packages/files-ui/src/Components/Layouts/AppHeader.tsx @@ -8,6 +8,7 @@ import { Trans } from "@lingui/macro" import { useThresholdKey } from "../../Contexts/ThresholdKeyContext" import { CSFTheme } from "../../Themes/types" import { useFilesApi } from "../../Contexts/FilesApiContext" +import BetaModal from "../Elements/BetaModal" import NotificationsDropdown from "../Elements/Notifications/NotificationsDropdown" const useStyles = makeStyles( @@ -143,11 +144,16 @@ const AppHeader = ({ navOpen, setNavOpen }: IAppHeader) => { const { isLoggedIn, secured } = useFilesApi() const { publicKey, isNewDevice, shouldInitializeAccount } = useThresholdKey() const [searchActive, setSearchActive] = useState(false) + const [isBetaModalOpen, setIsBetaModalOpen] = useState(false) const onReportBugClick = useCallback(() => { window.open(ROUTE_LINKS.DiscordInvite, "_blank") }, []) + const onJoinBetaClick = useCallback(() => { + setIsBetaModalOpen(true) + }, []) + return (
{ > Report a bug +
@@ -234,6 +248,7 @@ const AppHeader = ({ navOpen, setNavOpen }: IAppHeader) => { } )} + {isBetaModalOpen && setIsBetaModalOpen(false)}/>}
) } diff --git a/packages/files-ui/src/locales/de/messages.po b/packages/files-ui/src/locales/de/messages.po index 3e70fec54c..597fd34b6e 100644 --- a/packages/files-ui/src/locales/de/messages.po +++ b/packages/files-ui/src/locales/de/messages.po @@ -481,6 +481,9 @@ msgstr "" msgid "I’m done saving my backup secret phrase" msgstr "Ich bin fertig mit dem Speichern meines Sixherungsgeheimsatzes" +msgid "Join our new limited-access subscription plans to upgrade to a plan with more storage." +msgstr "" + msgid "Keep original files" msgstr "" @@ -538,6 +541,9 @@ msgstr "Meine Dateien" msgid "Name" msgstr "Name" +msgid "Need more storage?" +msgstr "" + msgid "New folder" msgstr "Neuer Ordner" @@ -742,6 +748,9 @@ msgstr "Datei melden" msgid "Report a bug" msgstr "Fehler melden" +msgid "Request access!" +msgstr "" + msgid "Requested from" msgstr "Angefordert von" diff --git a/packages/files-ui/src/locales/en/messages.po b/packages/files-ui/src/locales/en/messages.po index dc81ee9b18..d07dd9a1ab 100644 --- a/packages/files-ui/src/locales/en/messages.po +++ b/packages/files-ui/src/locales/en/messages.po @@ -484,6 +484,9 @@ msgstr "Invoice outstanding" msgid "I’m done saving my backup secret phrase" msgstr "I’m done saving my backup secret phrase" +msgid "Join our new limited-access subscription plans to upgrade to a plan with more storage." +msgstr "Join our new limited-access subscription plans to upgrade to a plan with more storage." + msgid "Keep original files" msgstr "Keep original files" @@ -541,6 +544,9 @@ msgstr "My Files" msgid "Name" msgstr "Name" +msgid "Need more storage?" +msgstr "Need more storage?" + msgid "New folder" msgstr "New folder" @@ -745,6 +751,9 @@ msgstr "Report a File" msgid "Report a bug" msgstr "Report a bug" +msgid "Request access!" +msgstr "Request access!" + msgid "Requested from" msgstr "Requested from" diff --git a/packages/files-ui/src/locales/es/messages.po b/packages/files-ui/src/locales/es/messages.po index 584c1d2528..e4ee3965ea 100644 --- a/packages/files-ui/src/locales/es/messages.po +++ b/packages/files-ui/src/locales/es/messages.po @@ -485,6 +485,9 @@ msgstr "" msgid "I’m done saving my backup secret phrase" msgstr "" +msgid "Join our new limited-access subscription plans to upgrade to a plan with more storage." +msgstr "" + msgid "Keep original files" msgstr "" @@ -542,6 +545,9 @@ msgstr "Mis Archivos" msgid "Name" msgstr "Nombre" +msgid "Need more storage?" +msgstr "" + msgid "New folder" msgstr "Nuevo Folder" @@ -746,6 +752,9 @@ msgstr "" msgid "Report a bug" msgstr "" +msgid "Request access!" +msgstr "" + msgid "Requested from" msgstr "Solicitado a" diff --git a/packages/files-ui/src/locales/fr/messages.po b/packages/files-ui/src/locales/fr/messages.po index 95802aab3e..0ec828fbe0 100644 --- a/packages/files-ui/src/locales/fr/messages.po +++ b/packages/files-ui/src/locales/fr/messages.po @@ -485,6 +485,9 @@ msgstr "Facture non réglée" msgid "I’m done saving my backup secret phrase" msgstr "Phrase de sauvegarde secrète enregistrée" +msgid "Join our new limited-access subscription plans to upgrade to a plan with more storage." +msgstr "" + msgid "Keep original files" msgstr "Conserver les fichiers originaux" @@ -542,6 +545,9 @@ msgstr "Mes Fichiers" msgid "Name" msgstr "Nom" +msgid "Need more storage?" +msgstr "" + msgid "New folder" msgstr "Nouveau dossier" @@ -746,6 +752,9 @@ msgstr "Signaler un fichier" msgid "Report a bug" msgstr "Signaler une erreur" +msgid "Request access!" +msgstr "" + msgid "Requested from" msgstr "Envoyé par" diff --git a/packages/files-ui/src/locales/no/messages.po b/packages/files-ui/src/locales/no/messages.po index 64f22abff4..31f6f5e49f 100644 --- a/packages/files-ui/src/locales/no/messages.po +++ b/packages/files-ui/src/locales/no/messages.po @@ -481,6 +481,9 @@ msgstr "" msgid "I’m done saving my backup secret phrase" msgstr "" +msgid "Join our new limited-access subscription plans to upgrade to a plan with more storage." +msgstr "" + msgid "Keep original files" msgstr "" @@ -538,6 +541,9 @@ msgstr "Mine filer" msgid "Name" msgstr "Navn" +msgid "Need more storage?" +msgstr "" + msgid "New folder" msgstr "Ny mappe" @@ -742,6 +748,9 @@ msgstr "" msgid "Report a bug" msgstr "" +msgid "Request access!" +msgstr "" + msgid "Requested from" msgstr "Forespurt fra"