Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore(studio): simplify feedback form (#40937)

Danny Whitebf39cdbaf311
diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackDropdown.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackDropdown.tsx
index 824965c256c..ccf1e1a59ba 100644
--- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackDropdown.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackDropdown.tsx
@@ -1,13 +1,10 @@
-import { Lightbulb, TriangleAlert } from 'lucide-react'
import { useState } from 'react'
-import { SupportLink } from 'components/interfaces/Support/SupportLink'
import { Button, PopoverContent_Shadcn_, PopoverTrigger_Shadcn_, Popover_Shadcn_ } from 'ui'
import { FeedbackWidget } from './FeedbackWidget'
export const FeedbackDropdown = ({ className }: { className?: string }) => {
const [isOpen, setIsOpen] = useState(false)
- const [stage, setStage] = useState<'select' | 'widget'>('select')
return (
<Popover_Shadcn_
@@ -15,7 +12,6 @@ export const FeedbackDropdown = ({ className }: { className?: string }) => {
open={isOpen}
onOpenChange={(e) => {
setIsOpen(e)
- if (!e) setStage('select')
}}
>
<PopoverTrigger_Shadcn_ asChild>
@@ -23,7 +19,6 @@ export const FeedbackDropdown = ({ className }: { className?: string }) => {
asChild
onClick={() => {
setIsOpen((isOpen) => !isOpen)
- setStage('select')
}}
type="text"
className="rounded-full h-[32px] text-foreground-light hover:text-foreground"
@@ -34,36 +29,11 @@ export const FeedbackDropdown = ({ className }: { className?: string }) => {
<PopoverContent_Shadcn_
side="bottom"
align="end"
- className="px-0 flex flex-col pt-1 pb-3 w-96"
+ className="p-0 flex flex-col w-[22rem]"
id="feedback-widget"
>
- {stage === 'select' && (
- <div className="flex flex-col gap-4 p-4">
- <div className="font-medium text-sm">What would you like to share?</div>
- <div className="grid grid-cols-2 gap-3">
- <Button type="default" className="h-32" onClick={() => setIsOpen(false)} asChild>
- <SupportLink>
- <span className="grid gap-1 text-center">
- <TriangleAlert size="28" className="mx-auto text-destructive-600" />
- <span className="text-base">Issue</span>
- <span className="text-xm text-foreground-lighter">with my project</span>
- </span>
- </SupportLink>
- </Button>
- <Button type="default" className="h-32" onClick={() => setStage('widget')}>
- <span className="grid gap-1 text-center">
- <Lightbulb size="28" className="mx-auto text-warning" />
- <span className="text-base">Idea</span>
- <span className="text-xm text-foreground-lighter">to improve Supabase</span>
- </span>
- </Button>
- </div>
- </div>
- )}
- {stage === 'widget' && <FeedbackWidget onClose={() => setIsOpen(false)} />}
+ <FeedbackWidget onClose={() => setIsOpen(false)} />
</PopoverContent_Shadcn_>
</Popover_Shadcn_>
)
}
-
-export default FeedbackDropdown
diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackDropdown.utils.ts b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackDropdown.utils.ts
index 497c8cca550..3430de35660 100644
--- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackDropdown.utils.ts
+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackDropdown.utils.ts
@@ -57,3 +57,80 @@ export const uploadAttachment = async ({ image, userId }: UploadAttachmentArgs)
})
return signedUrls[0]
}
+
+/**
+ * Client-side heuristic to quickly detect obvious support requests
+ * This provides immediate feedback before the AI classification completes
+ */
+export function isLikelySupportRequest(text: string): boolean {
+ if (!text || text.trim().length === 0) return false
+
+ const lowerText = text.toLowerCase()
+
+ // Common support request patterns
+ const supportPatterns = [
+ // Help requests
+ /need help/i,
+ /having trouble/i,
+ /having issues/i,
+ /having problems/i,
+ /can you help/i,
+ /could you help/i,
+ /please help/i,
+ /need help/i,
+ /how do/i,
+ /how can/i,
+ /how to/i,
+ /why isn't/i,
+ /why doesn't/i,
+ /why won't/i,
+ /why can't/i,
+
+ // Problem indicators
+ /it's not working/i,
+ /it doesn't work/i,
+ /it won't work/i,
+ /it can't work/i,
+ /isn't working/i,
+ /doesn't work/i,
+ /won't work/i,
+ /can't work/i,
+ /not work/i,
+ /i can't/i,
+ /i cannot/i,
+ /unable to/i,
+ /wrong/i,
+ /bad/i,
+
+ // Bug/error indicators
+ /\bbug\b/i,
+ /\bbroken\b/i,
+ /\berror\b/i,
+ /\berrors\b/i,
+ /\bfailed\b/i,
+ /\bfailure\b/i,
+ /\bfailing\b/i,
+ /\bcrash\b/i,
+ /\bcrashed\b/i,
+ /\bcrashing\b/i,
+
+ // Issue/problem keywords
+ /\bissue\b/i,
+ /\bissues\b/i,
+ /\bproblem\b/i,
+ /\bproblems\b/i,
+ /\btrouble\b/i,
+ /\bdifficulty\b/i,
+ /\bdifficulties\b/i,
+
+ // Support-specific phrases
+ /support ticket/i,
+ /contact support/i,
+ /get help/i,
+ /need assistance/i,
+ /require assistance/i,
+ /technical support/i,
+ ]
+
+ return supportPatterns.some((pattern) => pattern.test(lowerText))
+}
diff --git a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackWidget.tsx b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackWidget.tsx
index 69552a572c5..64cc91db9ba 100644
--- a/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackWidget.tsx
+++ b/apps/studio/components/layouts/ProjectLayout/LayoutHeader/FeedbackDropdown/FeedbackWidget.tsx
@@ -1,7 +1,7 @@
import { useDebounce } from '@uidotdev/usehooks'
import { AnimatePresence, motion } from 'framer-motion'
import { toPng } from 'html-to-image'
-import { Camera, CircleCheck, Image as ImageIcon, Upload, X } from 'lucide-react'
+import { Camera, CircleCheck, HelpCircle, Image as ImageIcon, Upload, X } from 'lucide-react'
import { useRouter } from 'next/router'
import { ChangeEvent, useEffect, useRef, useState } from 'react'
import { toast } from 'sonner'
@@ -14,7 +14,6 @@ import { useSendFeedbackMutation } from 'data/feedback/feedback-send'
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
-import { DOCS_URL } from 'lib/constants'
import { timeout } from 'lib/helpers'
import { useProfile } from 'lib/profile'
import {
@@ -29,7 +28,11 @@ import {
TextArea_Shadcn_,
} from 'ui'
import { Admonition } from 'ui-patterns'
-import { convertB64toBlob, uploadAttachment } from './FeedbackDropdown.utils'
+import {
+ convertB64toBlob,
+ isLikelySupportRequest,
+ uploadAttachment,
+} from './FeedbackDropdown.utils'
interface FeedbackWidgetProps {
onClose: () => void
@@ -60,6 +63,10 @@ export const FeedbackWidget = ({ onClose }: FeedbackWidgetProps) => {
const { data: category } = useFeedbackCategoryQuery({ prompt: debouncedFeedback })
+ // Use client-side heuristic for immediate feedback, AI result takes precedence when available
+ const isLikelySupport = isLikelySupportRequest(feedback)
+ const effectiveCategory = category ?? (isLikelySupport ? 'support' : null)
+
const { mutate: sendEvent } = useSendEventMutation()
const { mutate: submitFeedback } = useSendFeedbackMutation({
onSuccess: () => {
@@ -158,72 +165,49 @@ export const FeedbackWidget = ({ onClose }: FeedbackWidgetProps) => {
<ThanksMessage onClose={onClose} />
) : (
<>
- <div>
- <div className="px-5 pb-4">
- <TextArea_Shadcn_
- placeholder="It would be great if..."
- rows={5}
- value={feedback}
- onChange={(e) => setFeedback(e.target.value)}
- onPaste={handlePasteEvent}
- className="text-sm mt-4 mb-1"
- />
- </div>
+ <div className="p-4">
+ <TextArea_Shadcn_
+ placeholder="My idea for improving Supabase is..."
+ rows={6}
+ value={feedback}
+ onChange={(e) => setFeedback(e.target.value)}
+ onPaste={handlePasteEvent}
+ className="text-sm mb-1 resize-none"
+ />
+ </div>
- <AnimatePresence>
- {category === 'support' && (
- <motion.div
- key="support-alert"
- initial={{ opacity: 0, y: 16 }}
- animate={{ opacity: 1, y: 0 }}
- exit={{ opacity: 0, y: 16 }}
- transition={{ duration: 0.25 }}
+ <AnimatePresence>
+ {effectiveCategory === 'support' && (
+ <motion.div
+ key="support-alert"
+ initial={{ opacity: 0, y: 16 }}
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ opacity: 0, y: 16 }}
+ transition={{ duration: 0.2 }}
+ >
+ <Admonition
+ type="caution"
+ title="This looks like an issue that’s better handled by support"
+ className="rounded-none border-x-0 border-b-0 mb-0"
>
- <Admonition
- type="caution"
- title="This looks like an issue that's better handled by support"
- className="rounded-none border-x-0 border-b-0 mb-0 [&>h5]:text-xs [&>h5]:mb-0.5"
- >
- <p className="text-xs text-foreground-light !leading-tight">
- Please{' '}
- <SupportLink
- className={cn(
- InlineLinkClassName,
- 'text-foreground-light hover:text-foreground'
- )}
- queryParams={{ projectRef: slug, message: feedback }}
- >
- open a support ticket
- </SupportLink>{' '}
- to get help with this issue, as we do not reply to all product feedback.
- </p>
- </Admonition>
- </motion.div>
- )}
- </AnimatePresence>
- </div>
+ <p className="text-xs text-foreground-light !leading-normal !mb-0">
+ Please{' '}
+ <SupportLink
+ className={cn(InlineLinkClassName)}
+ queryParams={{ projectRef: slug, message: feedback }}
+ >
+ open a support ticket
+ </SupportLink>{' '}
+ to get help with this issue, as we do not reply to all product feedback.
+ </p>
+ </Admonition>
+ </motion.div>
+ )}
+ </AnimatePresence>
<PopoverSeparator_Shadcn_ />
- <div className="px-5 flex flex-row justify-between items-start mt-4">
- <div>
- <p className="text-xs text-foreground">Have a technical issue?</p>
- <p className="text-xs text-foreground-light">
- Contact{' '}
- <SupportLink>
- <span className="cursor-pointer text-brand-link transition-colors hover:text-brand-600">
- support
- </span>
- </SupportLink>{' '}
- or{' '}
- <a href={`${DOCS_URL}`} target="_blank" rel="noreferrer">
- <span className="cursor-pointer text-brand-link transition-colors hover:text-brand-600">
- see docs
- </span>
- </a>
- .
- </p>
- </div>
+ <div className="p-4 flex flex-row justify-end items-start">
<div className="flex items-center gap-2 flex-row">
{!!screenshot ? (
<div
@@ -312,24 +296,19 @@ const ThanksMessage = ({ onClose }: { onClose: () => void }) => {
return (
<div className="px-0 pt-3 pb-0">
<div className="grid gap-3">
- <div className="px-6 grid gap-3 py-2 text-center text-foreground-light">
+ <div className="px-6 grid gap-4 py-3 text-center text-foreground-light">
<CircleCheck className="mx-auto text-brand-500" size={24} />
- <p className="text-foreground text-base">Your feedback has been sent. Thanks!</p>
- <p className="text-sm ">
- We do not always respond to feedback. If you require assistance, please contact support
- instead.
- </p>
+ <div className="text-center flex flex-col">
+ <p className="text-foreground text-base">Your feedback has been sent. Thanks!</p>
+ <p className="text-sm text-balance">
+ We don’t always respond to feedback. If you require assistance, please contact support
+ via the <HelpCircle className="inline-block" size={12} aria-label="Help" /> menu
+ instead.
+ </p>
+ </div>
</div>
<PopoverSeparator_Shadcn_ />
- <div className="flex items-center justify-between px-4">
- <p className="text-xs text-foreground-light">
- <SupportLink>
- <span className="cursor-pointer text-brand transition-colors hover:text-brand-600">
- Create a Support Ticket
- </span>
- </SupportLink>
- </p>
-
+ <div className="flex items-center justify-end px-4">
<Button type="default" onClick={onClose}>
Close
</Button>