From d8cab85a39c32d36ce6b5616b158181faef2fd57 Mon Sep 17 00:00:00 2001 From: Quentin Guillemin Date: Fri, 21 Apr 2023 16:05:33 +0200 Subject: [PATCH] feat: [WIP] Nextcloud save modal --- client/src/assets/scss/editor.scss | 4 +- client/src/assets/scss/nextcloudModal.scss | 98 ++++++++++++++++++++++ client/src/components/NextcloudModal.tsx | 41 +++++++++ client/src/locales/en.json | 6 ++ client/src/locales/fr.json | 6 ++ 5 files changed, 153 insertions(+), 2 deletions(-) create mode 100644 client/src/assets/scss/nextcloudModal.scss create mode 100644 client/src/components/NextcloudModal.tsx diff --git a/client/src/assets/scss/editor.scss b/client/src/assets/scss/editor.scss index b878687..b81cfec 100644 --- a/client/src/assets/scss/editor.scss +++ b/client/src/assets/scss/editor.scss @@ -3,9 +3,8 @@ $height: 40px; tldraw-editor { div.sharing-container { - pointer-events: all; - z-index: 2; position: absolute; + z-index: 2; left: 110px; display: flex; box-shadow: var(--shadows-panel); @@ -14,6 +13,7 @@ tldraw-editor { background-color: var(--colors-panel); border: 1px solid var(--colors-panelContrast); border-top: 0px; + pointer-events: all; div { display: flex; diff --git a/client/src/assets/scss/nextcloudModal.scss b/client/src/assets/scss/nextcloudModal.scss new file mode 100644 index 0000000..a3095fc --- /dev/null +++ b/client/src/assets/scss/nextcloudModal.scss @@ -0,0 +1,98 @@ +$height: 150px; + +tldraw-editor { + div.modal-background { + position: absolute; + z-index: 99998; + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + background-color: rgba(0, 0, 0, 0.15); + pointer-events: all; + + div.modal { + display: flex; + flex-direction: column; + font-family: var(--fonts-ui); + border: 1px solid var(--colors-panelContrast); + box-shadow: var(--shadows-panel); + background-color: var(--colors-panel); + border-radius: var(--radii-3); + padding: var(--space-3); + + p.modal-title { + margin-bottom: 20px; + color: var(--colors-text); + font-size: var(--fontSizes-2); + line-height: 1.5; + text-align: center; + max-width: 62%; + min-width: 0px; + align-self: center; + } + + div.modal-body { + display: flex; + flex-direction: column; + + div.choice-container { + display: flex; + flex-direction: row; + + button.choice-item { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + width: $height; + height: $height; + border: none; + border-radius: var(--radii-2); + background: none; + color: var(--colors-text); + word-break: break-word; + + svg { + margin-bottom: var(--space-3); + } + } + + button.choice-item:not(:last-child) { + margin-right: var(--space-3); + } + + button.choice-item:hover, + button.choice-item:focus { + background-color: var(--colors-hover); + } + } + } + + div.modal-footer { + width: 100%; + display: flex; + justify-content: space-between; + margin-top: var(--space-3); + + button { + display: inline-flex; + align-items: center; + justify-content: center; + font-size: var(--fontSizes-1); + line-height: 1; + color: var(--colors-text); + cursor: pointer; + border-radius: var(--radii-2); + padding: 0px 15px; + font-weight: normal; + height: 36px; + min-width: 48px; + border: none; + background: none; + } + } + } + } +} diff --git a/client/src/components/NextcloudModal.tsx b/client/src/components/NextcloudModal.tsx new file mode 100644 index 0000000..4000fda --- /dev/null +++ b/client/src/components/NextcloudModal.tsx @@ -0,0 +1,41 @@ +import { faCloud, faDownload } from "@fortawesome/free-solid-svg-icons"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import "../assets/scss/nextcloudModal.scss"; +import { useTranslation } from "react-i18next"; + +type Settings = { + onNextcloud: () => void; + onDownload: () => void; + onCancel: () => void; +}; + +function NextcloudModal({ onNextcloud, onDownload, onCancel }: Settings) { + const { t } = useTranslation(); + + return ( +
+
+

{t("nextcloud.modal.title")}

+
+
+ + +
+
+
+ +
+
+
+ ); +} + +export default NextcloudModal; diff --git a/client/src/locales/en.json b/client/src/locales/en.json index 1a3a248..e569433 100644 --- a/client/src/locales/en.json +++ b/client/src/locales/en.json @@ -20,6 +20,12 @@ "unknown": "Unknown error occurred", "unconfigured": "Nextcloud is unconfigured", "guest": "Your cas session has expired" + }, + "modal": { + "title": "What did you want to do?", + "save": "Save on Nextcloud", + "download": "Download", + "cancel": "Cancel" } } } diff --git a/client/src/locales/fr.json b/client/src/locales/fr.json index 3ee869f..3798dd2 100644 --- a/client/src/locales/fr.json +++ b/client/src/locales/fr.json @@ -20,6 +20,12 @@ "unknown": "Une erreur inconnue est survenue", "unconfigured": "Nextcloud n'est pas configuré", "guest": "Votre session cas a expirée" + }, + "modal": { + "title": "Que voulez-vous faire ?", + "save": "Sauvegarder sur Nextcloud", + "download": "Télécharger", + "cancel": "Annuler" } } }