mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 21:05:06 +03:00
## What kind of change does this PR introduce? UI improvement for self-debugging efforts. ## What is the current behavior? https://github.com/supabase/supabase/pull/40937 removed our gating on the feedback form (plus some related affordances) in an effort to concentrate support entry into the Help dropdown instead: | Before | After | | --- | --- | | <img width="1090" height="579" alt="Inventory Nuts Bolts Supabase" src="https://github.com/user-attachments/assets/c7dacf40-5ae8-401c-a167-5e56c4c0635d" /> | _Not applicable. This step is skipped in the new version._ | | <img width="1090" height="579" alt="Inventory Nuts Bolts Supabase" src="https://github.com/user-attachments/assets/9bd2489d-7e87-49e5-99af-13eb5f387f60" /> | <img width="1090" height="579" alt="Inventory Nuts Bolts Supabase" src="https://github.com/user-attachments/assets/fa499a40-6d70-4674-9eb6-c7bd96019b27" /> | | <img width="1090" height="579" alt="Inventory Nuts Bolts Supabase" src="https://github.com/user-attachments/assets/e253381b-e8ba-476c-bd36-9dd522209498" /> | <img width="1090" height="579" alt="Inventory Nuts Bolts Supabase" src="https://github.com/user-attachments/assets/b5cf614b-329c-4517-90e9-c4d1b49bd139" /> | Despite putting other measures in place such as client-side form detection, the result is that people are increasingly writing in to support via the Feedback form. ## What is the new behavior? - Restores the gating - But also reuses the same self-debugging help options from the Help dropdown Other: - Renames `HelpPopover` to `HelpDropdown` to match others - Adjusts font size of `CommandMenu` _Search..._ | Before | After | | --- | --- | | <img width="1024" height="756" alt="Spinner Toolshed Supabase" src="https://github.com/user-attachments/assets/12e3be32-743d-488a-a13d-bf400fd0fd8d" /> | <img width="1024" height="756" alt="Spinner Toolshed Supabase" src="https://github.com/user-attachments/assets/bb064ef1-a771-416d-9b5b-dbdd774efed3" /> | | _Not applicable. This step is skipped in the old version._ | <img width="1024" height="756" alt="Spinner Toolshed Supabase" src="https://github.com/user-attachments/assets/3bc0b1c2-7003-4973-8e9c-2c7ee93fb0b4" /> | | <img width="1024" height="756" alt="Spinner Toolshed Supabase" src="https://github.com/user-attachments/assets/0bb18df4-d093-4440-8379-680f6c5e3cf9" /> | <img width="1024" height="756" alt="Spinner Toolshed Supabase" src="https://github.com/user-attachments/assets/1ef801d3-9cd7-4005-9082-8d229b7cdd19" /> | | <img width="1090" height="579" alt="Inventory Nuts Bolts Supabase" src="https://github.com/user-attachments/assets/e253381b-e8ba-476c-bd36-9dd522209498" /> | <img width="1024" height="794" alt="Spinner Toolshed Supabase" src="https://github.com/user-attachments/assets/b80de142-2199-420f-9018-8622b6d24312" /> | ## To test To test the “thanks” end state, add something like the following to `feedback-send.ts`: ```ts if (MOCK_FEEDBACK_SUCCESS) { return {} as Awaited<ReturnType<typeof sendFeedback>> } ``` Where `MOCK_FEEDBACK_SUCCESS` is `true`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Introduced multi-stage feedback dropdown with Issue and Idea selection paths. * Added AI assistant integration in help menu for quick support access. * Enhanced help dropdown with expanded options: documentation, troubleshooting, Discord community, system status, and support links. * Added Community Support section featuring Discord community promotion. * **Style** * Refined command menu placeholder text sizing for improved visual hierarchy. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
126 lines
4.7 KiB
TypeScript
126 lines
4.7 KiB
TypeScript
import { IS_PLATFORM } from 'common'
|
|
import { SIDEBAR_KEYS } from 'components/layouts/ProjectLayout/LayoutSidebar/LayoutSidebarProvider'
|
|
import { useSelectedOrganizationQuery } from 'hooks/misc/useSelectedOrganization'
|
|
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
|
|
import { Lightbulb, TriangleAlert } from 'lucide-react'
|
|
import { useRouter } from 'next/router'
|
|
import { useState } from 'react'
|
|
import { useAiAssistantStateSnapshot } from 'state/ai-assistant-state'
|
|
import { useSidebarManagerSnapshot } from 'state/sidebar-manager-state'
|
|
import {
|
|
Button,
|
|
Popover_Shadcn_,
|
|
PopoverContent_Shadcn_,
|
|
PopoverSeparator_Shadcn_,
|
|
PopoverTrigger_Shadcn_,
|
|
} from 'ui'
|
|
|
|
import { ASSISTANT_SUGGESTIONS } from '../HelpDropdown/HelpDropdown.constants'
|
|
import { getSupportLinkQueryParams } from '../HelpDropdown/HelpDropdown.utils'
|
|
import { HelpSection } from '../HelpDropdown/HelpSection'
|
|
import { FeedbackWidget } from './FeedbackWidget'
|
|
|
|
export const FeedbackDropdown = ({ className }: { className?: string }) => {
|
|
const router = useRouter()
|
|
const { data: project } = useSelectedProjectQuery()
|
|
const { data: org } = useSelectedOrganizationQuery()
|
|
const snap = useAiAssistantStateSnapshot()
|
|
const { openSidebar } = useSidebarManagerSnapshot()
|
|
const [isOpen, setIsOpen] = useState(false)
|
|
const [stage, setStage] = useState<'select' | 'issue-options' | 'widget'>('select')
|
|
|
|
const projectRef = project?.parent_project_ref ?? (router.query.ref as string | undefined)
|
|
const supportLinkQueryParams = getSupportLinkQueryParams(
|
|
project,
|
|
org,
|
|
router.query.ref as string | undefined
|
|
)
|
|
|
|
return (
|
|
<Popover_Shadcn_
|
|
modal={false}
|
|
open={isOpen}
|
|
onOpenChange={(e) => {
|
|
setIsOpen(e)
|
|
if (!e) setStage('select')
|
|
}}
|
|
>
|
|
<PopoverTrigger_Shadcn_ asChild>
|
|
<Button
|
|
asChild
|
|
onClick={() => {
|
|
setIsOpen((isOpen) => !isOpen)
|
|
setStage('select')
|
|
}}
|
|
type="text"
|
|
className="rounded-full h-[32px] text-foreground-light hover:text-foreground"
|
|
>
|
|
<span className={className}>Feedback</span>
|
|
</Button>
|
|
</PopoverTrigger_Shadcn_>
|
|
<PopoverContent_Shadcn_
|
|
side="bottom"
|
|
align="end"
|
|
className="p-0 flex flex-col w-96"
|
|
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={() => setStage('issue-options')}>
|
|
<div className="grid gap-1.5 text-center">
|
|
<TriangleAlert size="28" className="mx-auto text-destructive-600" />
|
|
<div className="flex flex-col items-center">
|
|
<span className="text-base">Issue</span>
|
|
<span className="text-xs text-foreground-lighter">with my project</span>
|
|
</div>
|
|
</div>
|
|
</Button>
|
|
<Button type="default" className="h-32" onClick={() => setStage('widget')}>
|
|
<div className="grid gap-1.5 text-center">
|
|
<Lightbulb size="28" className="mx-auto text-warning" />
|
|
<div className="flex flex-col items-center">
|
|
<span className="text-base">Idea</span>
|
|
<span className="text-xs text-foreground-lighter">to improve Supabase</span>
|
|
</div>
|
|
</div>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
)}
|
|
{stage === 'issue-options' && (
|
|
<>
|
|
<div className="flex flex-col gap-4 p-4">
|
|
<HelpSection
|
|
excludeIds={[]}
|
|
isPlatform={IS_PLATFORM}
|
|
projectRef={projectRef}
|
|
supportLinkQueryParams={supportLinkQueryParams}
|
|
onAssistantClick={() => {
|
|
openSidebar(SIDEBAR_KEYS.AI_ASSISTANT)
|
|
snap.newChat(ASSISTANT_SUGGESTIONS)
|
|
setIsOpen(false)
|
|
}}
|
|
onSupportClick={() => setIsOpen(false)}
|
|
/>
|
|
</div>
|
|
<PopoverSeparator_Shadcn_ />
|
|
<div className="px-4 pt-4 pb-4">
|
|
<Button type="default" size="tiny" onClick={() => setStage('widget')}>
|
|
Leave feedback instead
|
|
</Button>
|
|
</div>
|
|
</>
|
|
)}
|
|
{stage === 'widget' && (
|
|
<FeedbackWidget
|
|
onClose={() => setIsOpen(false)}
|
|
onSwitchToIssueOptions={() => setStage('issue-options')}
|
|
/>
|
|
)}
|
|
</PopoverContent_Shadcn_>
|
|
</Popover_Shadcn_>
|
|
)
|
|
}
|