mirror of
https://github.com/supabase/supabase.git
synced 2026-05-08 01:40:13 -04:00
4452e0ac2e
Refactors our help sidebar within Studio to include the actual support form itself when contact is selected. This PR also cleans up the initial state of the sidebar and the options within. ## To test: - Open an org and click the help icon top right - Click contact support - Submit a support ticket - Click done to return to support sidebar state <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Support form V3 and support sidebar with status button; direct-email helper and URL prefill * Success screen supports onFinish callback and customizable finish label * AI Assistant and Help options accept optional click callbacks; resource items gain keyboard/accessibility support * **Refactor** * Help panel split into home/support views with back navigation * Support components accept flexible align/className props and layout/styling tweaks * Initial URL params loader added for support form * **Tests** * New/updated tests for support flows, success screen, and help options interactions <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
105 lines
3.8 KiB
TypeScript
105 lines
3.8 KiB
TypeScript
// End of third-party imports
|
|
|
|
import { SupportCategories } from '@supabase/shared-types/out/constants'
|
|
import { ChevronRight } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
import type { UseFormReturn } from 'react-hook-form'
|
|
import {
|
|
Badge,
|
|
Collapsible_Shadcn_,
|
|
CollapsibleContent_Shadcn_,
|
|
CollapsibleTrigger_Shadcn_,
|
|
FormField,
|
|
Switch,
|
|
} from 'ui'
|
|
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
|
|
|
|
import type { ExtendedSupportCategories } from './Support.constants'
|
|
import type { SupportFormValues } from './SupportForm.schema'
|
|
|
|
export const DISABLE_SUPPORT_ACCESS_CATEGORIES: ExtendedSupportCategories[] = [
|
|
SupportCategories.ACCOUNT_DELETION,
|
|
SupportCategories.SALES_ENQUIRY,
|
|
SupportCategories.REFUND,
|
|
]
|
|
|
|
interface SupportAccessToggleProps {
|
|
form: UseFormReturn<SupportFormValues>
|
|
align?: 'left' | 'right'
|
|
className?: string
|
|
}
|
|
|
|
export function SupportAccessToggle({ form, align = 'left', className }: SupportAccessToggleProps) {
|
|
return (
|
|
<FormField
|
|
name="allowSupportAccess"
|
|
control={form.control}
|
|
render={({ field }) => {
|
|
return (
|
|
<FormItemLayout
|
|
hideMessage
|
|
name="allowSupportAccess"
|
|
className={className}
|
|
layout="flex"
|
|
align={align}
|
|
label={
|
|
<div className="flex items-center gap-x-2">
|
|
<span className="text-foreground">Allow support access to your project</span>
|
|
<Badge>Recommended</Badge>
|
|
</div>
|
|
}
|
|
description={
|
|
<div className="flex flex-col">
|
|
<span className="text-foreground-light">
|
|
Human support and AI diagnostic access.
|
|
</span>
|
|
<Collapsible_Shadcn_ className="mt-2">
|
|
<CollapsibleTrigger_Shadcn_
|
|
className={
|
|
'group flex items-center gap-x-1 group-data-open:text-foreground hover:text-foreground transition'
|
|
}
|
|
>
|
|
<ChevronRight
|
|
size={14}
|
|
className="transition-all group-data-open:rotate-90 text-foreground-muted -ml-1"
|
|
/>
|
|
<span className="text-sm">More information</span>
|
|
</CollapsibleTrigger_Shadcn_>
|
|
<CollapsibleContent_Shadcn_ className="text-sm text-foreground-light mt-2 space-y-2">
|
|
<p>
|
|
By enabling this, you grant permission for our support team to access your
|
|
project temporarily and, if applicable, to use AI tools to assist in
|
|
diagnosing and resolving issues. This access may involve analyzing database
|
|
configurations, query performance, and other relevant data to expedite
|
|
troubleshooting and enhance support accuracy.
|
|
</p>
|
|
<p>
|
|
We are committed to maintaining strict data privacy and security standards in
|
|
all support activities.{' '}
|
|
<Link
|
|
href="https://supabase.com/privacy"
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
className="text-foreground-light underline hover:text-foreground transition"
|
|
>
|
|
Privacy Policy
|
|
</Link>
|
|
</p>
|
|
</CollapsibleContent_Shadcn_>
|
|
</Collapsible_Shadcn_>
|
|
</div>
|
|
}
|
|
>
|
|
<Switch
|
|
size="large"
|
|
id="allowSupportAccess"
|
|
checked={field.value}
|
|
onCheckedChange={field.onChange}
|
|
/>
|
|
</FormItemLayout>
|
|
)
|
|
}}
|
|
/>
|
|
)
|
|
}
|