From 1ad5f7019ad5e47adc3ec2bc7057201a797537b6 Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Wed, 16 Apr 2025 10:18:18 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Feedback=20form=20(#1670)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/public/locales/en/app.json | 11 +- .../components/sidebar/app-sidebar.tsx | 2 + apps/web/src/features/feedback/actions.ts | 35 +++++ .../feedback/components/feedback-toggle.tsx | 123 ++++++++++++++++++ apps/web/src/features/feedback/schema.ts | 7 + apps/web/src/features/rate-limit/constants.ts | 1 + apps/web/src/features/rate-limit/index.ts | 44 +++++++ packages/ui/src/dialog.tsx | 2 +- 8 files changed, 216 insertions(+), 9 deletions(-) create mode 100644 apps/web/src/features/feedback/actions.ts create mode 100644 apps/web/src/features/feedback/components/feedback-toggle.tsx create mode 100644 apps/web/src/features/feedback/schema.ts create mode 100644 apps/web/src/features/rate-limit/constants.ts create mode 100644 apps/web/src/features/rate-limit/index.ts diff --git a/apps/web/public/locales/en/app.json b/apps/web/public/locales/en/app.json index c6845a44b..9dd127eb2 100644 --- a/apps/web/public/locales/en/app.json +++ b/apps/web/public/locales/en/app.json @@ -196,8 +196,6 @@ "upgradePromptTitle": "Upgrade to Pro", "upgradeOverlaySubtitle3": "Unlock these feature by upgrading to a Pro plan.", "home": "Home", - "groupPoll": "Group Poll", - "groupPollDescription": "Share your availability with a group of people and find the best time to meet.", "create": "Create", "upcoming": "Upcoming", "past": "Past", @@ -206,7 +204,6 @@ "upcomingEventsEmptyStateDescription": "When you schedule events, they will appear here.", "pastEventsEmptyStateTitle": "No Past Events", "pastEventsEmptyStateDescription": "When you schedule events, they will appear here.", - "activePollCount": "{activePollCount} Live", "createPoll": "Create poll", "addToCalendar": "Add to Calendar", "microsoft365": "Microsoft 365", @@ -306,10 +303,6 @@ "moreParticipants": "{count} more…", "noDates": "No dates", "commandMenuNoResults": "No results", - "selectedPolls": "{count} {count, plural, one {poll} other {polls}} selected", - "unselectAll": "Unselect All", - "deletePolls": "Delete Polls", - "deletePollsDescription": "Are you sure you want to delete these {count} polls? This action cannot be undone.", "commandMenu": "Command Menu", "commandMenuDescription": "Select a command", "eventsPageDesc": "View and manage your scheduled events", @@ -324,5 +317,7 @@ "paginationNext": "Next", "upgradeToProDesc": "Unlock all Pro features", "searchPollsPlaceholder": "Search polls by title...", - "poll": "Poll" + "poll": "Poll", + "sendFeedbackDesc": "Share your feedback with us.", + "sendFeedbackSuccess": "Thank you for your feedback!" } diff --git a/apps/web/src/app/[locale]/(space)/components/sidebar/app-sidebar.tsx b/apps/web/src/app/[locale]/(space)/components/sidebar/app-sidebar.tsx index d790cec95..c7b09b712 100644 --- a/apps/web/src/app/[locale]/(space)/components/sidebar/app-sidebar.tsx +++ b/apps/web/src/app/[locale]/(space)/components/sidebar/app-sidebar.tsx @@ -23,6 +23,7 @@ import * as React from "react"; import { LogoLink } from "@/app/components/logo-link"; import { Trans } from "@/components/trans"; import { getUser } from "@/data/get-user"; +import { FeedbackToggle } from "@/features/feedback/components/feedback-toggle"; import { getTranslation } from "@/i18n/server"; import { UpgradeButton } from "../upgrade-button"; @@ -42,6 +43,7 @@ export async function AppSidebar({
+ + + + + + + + + + + {!form.formState.isSubmitSuccessful ? ( + <> + + + + + + + + + +
+ { + const res = await submitFeedback(data); + + if (res.error) { + form.setError("content", { + message: res.error, + }); + } + })} + > + ( + +