From dee86d41d37c0e37eb69b3c9ed72ed142a7b69a3 Mon Sep 17 00:00:00 2001 From: Ronald Moesbergen Date: Sat, 11 May 2024 20:03:30 +0200 Subject: [PATCH] feat: add Sentry-based user feedback form (#55) --- .editorconfig | 1 + src/assets/translations/en.json | 4 + src/assets/translations/nl.json | 4 + src/lib/components/core/header/Header.svelte | 11 ++ .../core/popups/popups/Feedback.svelte | 105 ++++++++++++++++++ .../core/popups/popups/Warning.svelte | 47 ++++---- src/lib/components/ui/TextArea.svelte | 71 ++++++++++++ src/lib/components/ui/TextInput.svelte | 4 +- 8 files changed, 226 insertions(+), 21 deletions(-) create mode 100644 src/lib/components/core/popups/popups/Feedback.svelte create mode 100644 src/lib/components/ui/TextArea.svelte diff --git a/.editorconfig b/.editorconfig index cb2448c..c0fa561 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,6 +4,7 @@ root = true [*] charset = utf-8 indent_style = tab +indent_size = 4 insert_final_newline = true trim_trailing_whitespace = true diff --git a/src/assets/translations/en.json b/src/assets/translations/en.json index b4eaab1..3db8981 100644 --- a/src/assets/translations/en.json +++ b/src/assets/translations/en.json @@ -18,6 +18,8 @@ "MORE": "More...", "MORE_ABOUT": "About Easybloqs", "UPLOAD": "Upload to robot", + "SEND": "Send", + "NAME": "Your name...", "DRIVERINSTALLATIONINSTRUCTIONS_TITLE": "We are almost ready!", "DRIVERINSTALLATIONINSTRUCTIONS": "You will get two popups to install the USB driver. Click 'Yes' and then 'Install'.", "CONNECTIONINSTRUCTIONS_TITLE": "Robot not found", @@ -95,6 +97,8 @@ "UNKNOWN": "Unknown", "DEVICE_INFORMATION": "Device information", "EMAIL": "Email", + "FEEDBACK": "Suggestion / Feedback", + "FEEDBACK_SENT": "Your feedback has been sent, thank you!", "FLASH_FIRMWARE": "Flash firmware", "FLASHING": "Flashing firmware...", "FLASHED": "Firmware flashed", diff --git a/src/assets/translations/nl.json b/src/assets/translations/nl.json index 62dad89..c9104bc 100644 --- a/src/assets/translations/nl.json +++ b/src/assets/translations/nl.json @@ -18,6 +18,8 @@ "MORE": "Meer...", "MORE_ABOUT": "Over Easybloqs", "UPLOAD": "Upload naar robot", + "SEND": "Versturen", + "NAME": "Je naam...", "DRIVERINSTALLATIONINSTRUCTIONS_TITLE": "We zijn bijna klaar!", "DRIVERINSTALLATIONINSTRUCTIONS": "Je krijgt nu nog twee popups om de USB driver te installeren. Klik op 'Yes' en dan op 'Install'.", "CONNECTIONINSTRUCTIONS_TITLE": "Robot niet gevonden", @@ -95,6 +97,8 @@ "UNKNOWN": "Niet gevonden", "DEVICE_INFORMATION": "Apparaat informatie", "EMAIL": "E-mail", + "FEEDBACK": "Suggestie / Feedback", + "FEEDBACK_SENT": "Uw feedback is verstuurd, bedankt!", "FLASH_FIRMWARE": "Firmware flashen", "FLASHING": "Flashing de firmware...", "FLASHED": "Firmware succesvol geflashed", diff --git a/src/lib/components/core/header/Header.svelte b/src/lib/components/core/header/Header.svelte index b1c4b6d..2d82fa8 100644 --- a/src/lib/components/core/header/Header.svelte +++ b/src/lib/components/core/header/Header.svelte @@ -33,6 +33,7 @@ import { tempSave, } from "$state/workspace.svelte"; import { + faComment, faDownload, faEnvelope, faFile, @@ -58,6 +59,7 @@ import { get } from "svelte/store"; import MicroPythonIO from "../../../micropython"; import About from "../popups/popups/About.svelte"; import Examples from "../popups/popups/Examples.svelte"; +import Feedback from "../popups/popups/Feedback.svelte"; import SaveProject from "../popups/popups/Prompt.svelte"; import UploadLog from "../popups/popups/UploadLog.svelte"; import Uploader from "../popups/popups/Uploader.svelte"; @@ -190,6 +192,14 @@ function email() { window.open("mailto:helpdesk@leaphy.org", "_blank").focus(); } +function feedback() { + popups.open({ + component: Feedback, + data: {}, + allowInteraction: true, + }); +} + function about() { popups.open({ component: About, @@ -311,6 +321,7 @@ function runPython() { {open} /> + {/snippet} {#snippet moreContext(open: Writable)} {#snippet languageContext(open: Writable)} diff --git a/src/lib/components/core/popups/popups/Feedback.svelte b/src/lib/components/core/popups/popups/Feedback.svelte new file mode 100644 index 0000000..dada68b --- /dev/null +++ b/src/lib/components/core/popups/popups/Feedback.svelte @@ -0,0 +1,105 @@ + + +
+

{$_("FEEDBACK")}

+
+ + +
+ +
+ + +
+ + + + diff --git a/src/lib/components/ui/TextInput.svelte b/src/lib/components/ui/TextInput.svelte index f1bbd0d..c5bef28 100644 --- a/src/lib/components/ui/TextInput.svelte +++ b/src/lib/components/ui/TextInput.svelte @@ -8,6 +8,7 @@ interface Props { rounded: boolean; focus?: boolean; required?: boolean; + type?: string; } let { @@ -17,6 +18,7 @@ let { rounded, focus, required, + type = "text", }: Props = $props(); let input: HTMLInputElement; @@ -28,7 +30,7 @@ onMount(() => {