The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Chore: Reorder support form fields for better user flow and clarity (#26473)
Monica Khouryadcf22c9aa67
diff --git a/apps/studio/components/interfaces/Support/Success.tsx b/apps/studio/components/interfaces/Support/Success.tsxindex b58b409c17f..6e77979fdbb 100644--- a/apps/studio/components/interfaces/Support/Success.tsx+++ b/apps/studio/components/interfaces/Support/Success.tsx@@ -7,12 +7,21 @@ import { useProfile } from 'lib/profile'interface SuccessProps {sentCategory?: string+ selectedProject?: string+ projects?: any[]}-const Success = ({ sentCategory = '' }: SuccessProps) => {+const Success = ({+ sentCategory = '',+ selectedProject = 'no-project',+ projects = [],+}: SuccessProps) => {const { profile } = useProfile()const respondToEmail = profile?.primary_email ?? 'your email'+ const project = projects.find((p) => p.ref === selectedProject)+ const projectName = project ? project.name : 'No specific project'+const categoriesToShowAdditionalResources = ['Problem', 'Unresponsive', 'Performance']const selectedCategory = CATEGORY_OPTIONS.find((option) => option.value === sentCategory)@@ -29,8 +38,15 @@ const Success = ({ sentCategory = '' }: SuccessProps) => {<div className="flex items-center flex-col space-y-2"><h3 className="text-xl">Support request successfully sent!</h3><p className="text-sm text-foreground-light">- We will reach out to you at <span className="text-foreground">{respondToEmail}</span>+ We will reach out to you at <span className="text-foreground">{respondToEmail}</span>.</p>+ {selectedProject !== 'no-project' && (+ <p className="text-sm text-foreground-light">+ Your ticket has been logged for the project{' '}+ <span className="text-foreground">{projectName}</span>, reference ID:{' '}+ <span className="text-foreground">{selectedProject}</span>.+ </p>+ )}</div>{categoriesToShowAdditionalResources.includes(sentCategory) && (<>diff --git a/apps/studio/components/interfaces/Support/SupportForm.tsx b/apps/studio/components/interfaces/Support/SupportForm.tsxindex 28585d1b64d..d08c9919843 100644--- a/apps/studio/components/interfaces/Support/SupportForm.tsx+++ b/apps/studio/components/interfaces/Support/SupportForm.tsx@@ -40,9 +40,10 @@ const INCLUDE_DISCUSSIONS = ['Problem', 'Database_unresponsive']export interface SupportFormProps {setSentCategory: (value: string) => void+ setSelectedProject: (value: string) => void}-const SupportForm = ({ setSentCategory }: SupportFormProps) => {+const SupportForm = ({ setSentCategory, setSelectedProject }: SupportFormProps) => {const { isReady } = useRouter()const { ref, slug, subject, category, message } = useParams()@@ -74,6 +75,7 @@ const SupportForm = ({ setSentCategory }: SupportFormProps) => {onSuccess: (res, variables) => {toast.success('Support request sent. Thank you!')setSentCategory(variables.category)+ setSelectedProject(variables.projectRef ?? 'no-project')},onError: (error) => {toast.error(`Failed to submit support ticket: ${error.message}`)@@ -251,6 +253,7 @@ const SupportForm = ({ setSentCategory }: SupportFormProps) => {const selectedProject = projects.find((project) => project.ref === values.projectRef)const isFreeProject = (subscription?.plan.id ?? 'free') === 'free'+const isDisabled =!enableFreeSupport &&isFreeProject &&@@ -320,112 +323,6 @@ const SupportForm = ({ setSentCategory }: SupportFormProps) => {<div className="px-6"><h3 className="text-xl">How can we help?</h3></div>- <div className="px-6">- <Listbox- id="category"- layout="vertical"- label="What area are you having problems with?"- >- {CATEGORY_OPTIONS.map((option, i) => {- return (- <Listbox.Option- key={`option-${option.value}`}- label={option.label}- value={option.value}- className="min-w-[500px]"- >- <span>{option.label}</span>- <span className="block text-xs opacity-50">{option.description}</span>- </Listbox.Option>- )- })}- </Listbox>- </div>-- {values.category !== 'Login_issues' && (- <div className="px-6">- <div className="grid sm:grid-cols-2 sm:grid-rows-1 gap-4 grid-cols-1 grid-rows-2">- {isLoadingProjects && (- <div className="space-y-2">- <p className="text-sm prose">Which project is affected?</p>- <ShimmeringLoader className="!py-[19px]" />- </div>- )}- {isErrorProjects && (- <div className="space-y-2">- <p className="text-sm prose">Which project is affected?</p>- <div className="border rounded-md px-4 py-2 flex items-center space-x-2">- <AlertCircle size={16} strokeWidth={2} className="text-foreground-light" />- <p className="text-sm prose">Failed to retrieve projects</p>- </div>- </div>- )}- {isSuccessProjects && (- <Listbox- id="projectRef"- layout="vertical"- label="Which project is affected?"- onChange={(val) => {- setSelectedProjectRef(val)- }}- >- {projects.map((option) => {- const organization = organizations?.find(- (x) => x.id === option.organization_id- )- return (- <Listbox.Option- key={`option-${option.ref}`}- label={option.name || ''}- value={option.ref}- className="!w-72"- >- <span>{option.name}</span>- <span className="block text-xs opacity-50">{organization?.name}</span>- </Listbox.Option>- )- })}- </Listbox>- )}- <Listbox id="severity" layout="vertical" label="Severity">- {SEVERITY_OPTIONS.map((option: any) => {- return (- <Listbox.Option- key={`option-${option.value}`}- label={option.label}- value={option.value}- className="!w-72"- >- <span>{option.label}</span>- <span className="block text-xs opacity-50">{option.description}</span>- </Listbox.Option>- )- })}- </Listbox>- </div>-- {values.projectRef !== 'no-project' && subscription && isSuccessProjects ? (- <p className="text-sm text-foreground-light mt-2">- This project is on the{' '}- <span className="text-foreground-light">{subscription.plan.name} plan</span>- </p>- ) : isLoadingSubscription && selectedProjectRef !== 'no-project' ? (- <div className="flex items-center space-x-2 mt-2">- <Loader2 size={14} className="animate-spin" />- <p className="text-sm text-foreground-light">Checking project's plan</p>- </div>- ) : (- <></>- )}- {(values.severity === 'Urgent' || values.severity === 'High') && (- <p className="text-sm text-foreground-light mt-2">- We do our best to respond to everyone as quickly as possible; however,- prioritization will be based on production status. We ask that you reserve High- and Urgent severity for production-impacting issues only.- </p>- )}- </div>- )}{isSuccessProjects &&values.projectRef === 'no-project' &&@@ -468,68 +365,179 @@ const SupportForm = ({ setSentCategory }: SupportFormProps) => {</div>)}+ {isLoadingProjects && (+ <div className="space-y-2">+ <p className="text-sm prose">Which project is affected?</p>+ <ShimmeringLoader className="!py-[19px]" />+ </div>+ )}+ {isErrorProjects && (+ <div className="space-y-2">+ <p className="text-sm prose">Which project is affected?</p>+ <div className="border rounded-md px-4 py-2 flex items-center space-x-2">+ <HelpCircle strokeWidth={2} className="text-foreground-light" />+ <p className="text-sm prose">Failed to retrieve projects</p>+ </div>+ </div>+ )}+ {isSuccessProjects && (+ <div className="px-6">+ <Listbox+ id="projectRef"+ layout="vertical"+ label="Which project is affected?"+ onChange={(val) => {+ setSelectedProjectRef(val)+ }}+ className="w-full"+ >+ {projects.map((option) => {+ const organization = organizations?.find((x) => x.id === option.organization_id)+ return (+ <Listbox.Option+ key={`option-${option.ref}`}+ label={option.name || ''}+ value={option.ref}+ className="w-full"+ >+ <span>{option.name}</span>+ <span className="block text-xs opacity-50">{organization?.name}</span>+ </Listbox.Option>+ )+ })}+ </Listbox>+ {values.projectRef !== 'no-project' && subscription && isSuccessProjects ? (+ <p className="text-sm text-foreground-light mt-2">+ This project is on the{' '}+ <span className="text-foreground-light">{subscription.plan.name} plan</span>+ </p>+ ) : isLoadingSubscription && selectedProjectRef !== 'no-project' ? (+ <div className="flex items-center space-x-2 mt-2">+ <Loader2 size={14} className="animate-spin" />+ <p className="text-sm text-foreground-light">Checking project's plan</p>+ </div>+ ) : (+ <></>+ )}+ </div>+ )}+{subscription?.plan.id !== 'enterprise' && values.category !== 'Login_issues' && (<div className="px-6"><InformationBoxicon={<AlertCircle size={18} strokeWidth={2} />}defaultVisibility={true}hideCollapse={true}- title="Expected response times are based on your project's plan"- description={- <div className="space-y-4 mb-1">- {subscription?.plan.id === 'free' && (- <p>- Free plan support is available within the community and officially by the- team on a best efforts basis. For a guaranteed response we recommend- upgrading to the Pro plan. Enhanced SLAs for support are available on our- Enterprise Plan.- </p>- )}+ title={+ selectedProjectRef === 'no-project'+ ? 'Please note that no project has been selected'+ : "Expected response times are based on your project's plan"+ }+ {...(selectedProjectRef !== 'no-project' && {+ description: (+ <div className="space-y-4 mb-1">+ {subscription?.plan.id === 'free' && (+ <p>+ Free plan support is available within the community and officially by+ the team on a best efforts basis. For a guaranteed response we recommend+ upgrading to the Pro plan. Enhanced SLAs for support are available on+ our Enterprise Plan.+ </p>+ )}- {subscription?.plan.id === 'pro' && (- <p>- Pro Plan includes email-based support. You can expect an answer within 1- business day in most situation for all severities. We recommend upgrading- to the Team plan for prioritized ticketing on all issues and prioritized- escalation to product engineering teams. Enhanced SLAs for support are- available on our Enterprise Plan.- </p>- )}+ {subscription?.plan.id === 'pro' && (+ <p>+ Pro Plan includes email-based support. You can expect an answer within 1+ business day in most situations for all severities. We recommend+ upgrading to the Team plan for prioritized ticketing on all issues and+ prioritized escalation to product engineering teams. Enhanced SLAs for+ support are available on our Enterprise Plan.+ </p>+ )}- {subscription?.plan.id === 'team' && (- <p>- Team plan includes email-based support. You get prioritized ticketing on- all issues and prioritized escalation to product engineering teams. Low,- Normal, and High severity tickets will generally be handled within 1- business day, while Urgent issues, we respond within 1 day, 365 days a- year. Enhanced SLAs for support are available on our Enterprise Plan.- </p>- )}+ {subscription?.plan.id === 'team' && (+ <p>+ Team plan includes email-based support. You get prioritized ticketing on+ all issues and prioritized escalation to product engineering teams. Low,+ Normal, and High severity tickets will generally be handled within 1+ business day, while Urgent issues, we respond within 1 day, 365 days a+ year. Enhanced SLAs for support are available on our Enterprise Plan.+ </p>+ )}- <div className="flex flex-col sm:flex-row items-start sm:items-center gap-y-2 sm:gap-x-2">- <Button asChild>- <Link- href={`/org/${values.organizationSlug}/billing?panel=subscriptionPlan`}- >- Upgrade project- </Link>- </Button>- <Button asChild type="default" icon={<ExternalLink />}>- <Link- href="https://supabase.com/contact/enterprise"- target="_blank"- rel="noreferrer"- >- Enquire about Enterprise- </Link>- </Button>+ <div className="flex flex-col sm:flex-row items-start sm:items-center gap-y-2 sm:gap-x-2">+ <Button asChild>+ <Link+ href={`/org/${values.organizationSlug}/billing?panel=subscriptionPlan`}+ >+ Upgrade project+ </Link>+ </Button>+ <Button asChild type="default" icon={<ExternalLink size={14} />}>+ <Link+ href="https://supabase.com/contact/enterprise"+ target="_blank"+ rel="noreferrer"+ >+ Enquire about Enterprise+ </Link>+ </Button>+ </div></div>- </div>- }+ ),+ })}/></div>)}+ {values.category !== 'Login_issues' && (+ <div className="px-6">+ <div className="grid sm:grid-cols-2 sm:grid-rows-1 gap-4 grid-cols-1 grid-rows-2">+ <Listbox+ id="category"+ layout="vertical"+ label="What area are you having problems with?"+ >+ {CATEGORY_OPTIONS.map((option, i) => {+ return (+ <Listbox.Option+ key={`option-${option.value}`}+ label={option.label}+ value={option.value}+ className="min-w-[50px] !w-72"+ >+ <span>{option.label}</span>+ <span className="block text-xs opacity-50">{option.description}</span>+ </Listbox.Option>+ )+ })}+ </Listbox>+ <Listbox id="severity" layout="vertical" label="Severity">+ {SEVERITY_OPTIONS.map((option: any) => {+ return (+ <Listbox.Option+ key={`option-${option.value}`}+ label={option.label}+ value={option.value}+ className="!w-72"+ >+ <span>{option.label}</span>+ <span className="block text-xs opacity-50">{option.description}</span>+ </Listbox.Option>+ )+ })}+ </Listbox>+ </div>+ {(values.severity === 'Urgent' || values.severity === 'High') && (+ <p className="text-sm text-foreground-light mt-2">+ We do our best to respond to everyone as quickly as possible; however,+ prioritization will be based on production status. We ask that you reserve High+ and Urgent severity for production-impacting issues only.+ </p>+ )}+ </div>+ )}+<Separator />{!isDisabled ? (diff --git a/apps/studio/pages/support/new.tsx b/apps/studio/pages/support/new.tsxindex 6d512b0099f..e14b3515e15 100644--- a/apps/studio/pages/support/new.tsx+++ b/apps/studio/pages/support/new.tsx@@ -7,14 +7,18 @@ import Success from 'components/interfaces/Support/Success'import SupportForm from 'components/interfaces/Support/SupportForm'import { usePlatformStatusQuery } from 'data/platform/platform-status-query'import { withAuth } from 'hooks'+import { useProjectsQuery } from 'data/projects/projects-query'import { BASE_PATH } from 'lib/constants'import { Button, IconLoader, IconTool } from 'ui'const SupportPage = () => {const [sentCategory, setSentCategory] = useState<string>()+ const [selectedProject, setSelectedProject] = useState<string>('no-project')const { data, isLoading } = usePlatformStatusQuery()const isHealthy = data?.isHealthy+ const { data: projectsData, isLoading: isLoadingProjects } = useProjectsQuery()+return (<div className="relative flex overflow-y-auto overflow-x-hidden"><div className="mx-auto my-8 max-w-2xl w-full px-4 lg:px-6">@@ -82,9 +86,16 @@ const SupportPage = () => {].join(' ')}>{sentCategory !== undefined ? (- <Success sentCategory={sentCategory} />+ <Success+ sentCategory={sentCategory}+ selectedProject={selectedProject}+ projects={projectsData}+ />) : (- <SupportForm setSentCategory={setSentCategory} />+ <SupportForm+ setSentCategory={setSentCategory}+ setSelectedProject={setSelectedProject}+ />)}</div></div>