Skip to content

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

Added affected services, and dynamically render links to community support

Joshen Limbbab23e31dc1
diff --git a/studio/components/interfaces/Support/BestPracticesGuidance.tsx b/studio/components/interfaces/Support/BestPracticesGuidance.tsx
new file mode 100644
index 00000000000..01a665cf862
--- /dev/null
+++ b/studio/components/interfaces/Support/BestPracticesGuidance.tsx
@@ -0,0 +1,67 @@
+import { FC } from 'react'
+import Image from 'next/image'
+import SVG from 'react-inlinesvg'
+import { Button, IconMessageCircle } from 'ui'
+
+interface Props {}
+
+const BestPracticesGuidance: FC<Props> = ({}) => {
+ return (
+ <div className="px-6 space-y-4">
+ <div className="space-y-2">
+ <p>Tap into the community</p>
+ <p className="text-sm text-scale-1100">
+ Find the answers you need with fellow developers building with Supabase by joining our
+ GitHub discussions or on Discord - build the next best thing together.
+ </p>
+ </div>
+ <div className="flex items-center space-x-4">
+ <div
+ className="relative space-y-2 overflow-hidden rounded px-5 py-4 w-1/2 pb-20 shadow-md"
+ style={{ background: '#404EED' }}
+ >
+ <a
+ href="https://discord.supabase.com"
+ target="_blank"
+ className="dark block cursor-pointer"
+ >
+ <Image
+ className="absolute left-0 top-0 opacity-50"
+ src={'/img/support/discord-bg-small.jpg'}
+ layout="fill"
+ objectFit="cover"
+ alt="discord illustration header"
+ />
+ <Button
+ type="secondary"
+ icon={<SVG src={`/img/discord-icon.svg`} className="h-4 w-4" />}
+ >
+ <span style={{ color: '#404EED' }}>Join Discord server</span>
+ </Button>
+ </a>
+ </div>
+
+ <div className="relative space-y-2 overflow-hidden rounded px-5 py-4 w-1/2 pb-20 shadow-md">
+ <a
+ href="https://github.com/supabase/supabase/discussions"
+ target="_blank"
+ className="block cursor-pointer"
+ >
+ <Image
+ className="absolute left-0 top-0 opacity-50"
+ src={'/img/support/github-bg.jpg?v-1'}
+ layout="fill"
+ objectFit="cover"
+ alt="discord illustration header"
+ />
+ <Button type="secondary" icon={<IconMessageCircle />}>
+ GitHub Discussions
+ </Button>
+ </a>
+ </div>
+ </div>
+ </div>
+ )
+}
+
+export default BestPracticesGuidance
diff --git a/studio/components/interfaces/Support/ClientLibrariesGuidance.tsx b/studio/components/interfaces/Support/ClientLibrariesGuidance.tsx
new file mode 100644
index 00000000000..166700e45cb
--- /dev/null
+++ b/studio/components/interfaces/Support/ClientLibrariesGuidance.tsx
@@ -0,0 +1,43 @@
+import Link from 'next/link'
+import { FC } from 'react'
+import { Button, IconExternalLink } from 'ui'
+import { GITHUB_LINKS } from './Support.constants'
+
+interface Props {}
+
+const ClientLibrariesGuidance: FC<Props> = ({}) => {
+ return (
+ <div className="px-6 space-y-4">
+ <div className="space-y-2">
+ <p>Github Issues</p>
+ <p className="text-sm text-scale-1100">
+ Have a general issue or bug that you've found? Do submit it in our Github issues!
+ </p>
+ </div>
+ <div className="grid grid-cols-3 gap-4 content-start">
+ {GITHUB_LINKS.map((repo) => (
+ <div
+ key={repo.name}
+ className="rounded border border-scale-600 bg-scale-300 space-y-3 px-4 py-3"
+ >
+ <div className="space-y-1">
+ <p className="text-sm">{repo.name}</p>
+ <p className="text-sm text-scale-1100">{repo.description}</p>
+ </div>
+ <div>
+ <Link href={repo.url}>
+ <a target="_blank">
+ <Button type="default" icon={<IconExternalLink size={14} strokeWidth={1.5} />}>
+ View Github issues
+ </Button>
+ </a>
+ </Link>
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ )
+}
+
+export default ClientLibrariesGuidance
diff --git a/studio/components/interfaces/Support/DisabledStateForFreeTier.tsx b/studio/components/interfaces/Support/DisabledStateForFreeTier.tsx
new file mode 100644
index 00000000000..9be81b915d5
--- /dev/null
+++ b/studio/components/interfaces/Support/DisabledStateForFreeTier.tsx
@@ -0,0 +1,43 @@
+import Link from 'next/link'
+import { Button, IconAlertCircle, IconExternalLink } from 'ui'
+import InformationBox from 'components/ui/InformationBox'
+import { FC } from 'react'
+
+interface Props {
+ projectRef: string
+ category: string
+}
+
+const DisabledStateForFreeTier: FC<Props> = ({ projectRef, category }) => {
+ return (
+ <div className="px-6">
+ <InformationBox
+ hideCollapse
+ defaultVisibility={true}
+ icon={<IconAlertCircle className="text-scale-1200" size="large" strokeWidth={1.5} />}
+ title={`Support for ${category} is only available on the Pro tier`}
+ description={
+ <div className="space-y-4 mb-1">
+ <p>Upgrade your project to the Pro tier for support in this area</p>
+ <div className="flex items-center space-x-2">
+ <Link href={`/project/${projectRef}/settings/billing/update`}>
+ <a>
+ <Button>Upgrade project</Button>
+ </a>
+ </Link>
+ <Link href="https://supabase.com/pricing">
+ <a target="_blank">
+ <Button type="default" icon={<IconExternalLink size={14} />}>
+ About the Pro tier
+ </Button>
+ </a>
+ </Link>
+ </div>
+ </div>
+ }
+ />
+ </div>
+ )
+}
+
+export default DisabledStateForFreeTier
diff --git a/studio/components/interfaces/Support/Support.constants.ts b/studio/components/interfaces/Support/Support.constants.ts
index a6f093ff331..a5c996c1fe9 100644
--- a/studio/components/interfaces/Support/Support.constants.ts
+++ b/studio/components/interfaces/Support/Support.constants.ts
@@ -1,31 +1,23 @@
-export const DEFAULT_VALUES = {
- category: {
+export const CATEGORY_OPTIONS = [
+ {
value: 'Problem',
- error: '',
- },
- severity: {
- value: 'Low',
- error: '',
- },
- project: {
- value: '',
- error: '',
+ label: 'Issues with APIs / client libraries',
+ description: "Issues with your project's API and client libraries",
},
- subject: {
- value: '',
- error: '',
+ {
+ value: 'Unresponseive',
+ label: 'Database unresponsive',
+ description: 'Issues with connecting to your database',
},
- body: {
- value: '',
- error: '',
+ {
+ value: 'Performance',
+ label: 'Performance issues',
+ description: 'Reporting of performance issues is only available on the Pro tier',
},
-}
-
-export const CATEGORY_OPTIONS = [
{
- value: 'Problem',
- label: 'Issue with project / API / Client library / REST API',
- description: 'Issues with project API, client libraries',
+ value: 'Best-practices',
+ label: 'Questions on best practices',
+ description: 'Enquire on how best practices developing with Supabase',
},
{
value: 'Sales',
@@ -76,3 +68,66 @@ export const SEVERITY_OPTIONS = [
description: 'Business-critical system down (Unavailable for free projects)',
},
]
+
+export const SERVICE_OPTIONS = [
+ {
+ id: 1,
+ name: 'Authentication',
+ value: 'Authentication',
+ disabled: false,
+ },
+ {
+ id: 2,
+ name: 'Dashboard',
+ value: 'Dashboard',
+ disabled: false,
+ },
+ {
+ id: 3,
+ name: 'Database',
+ value: 'Database',
+ disabled: false,
+ },
+ {
+ id: 4,
+ name: 'Edge Functions',
+ value: 'Edge Functions',
+ disabled: false,
+ },
+ {
+ id: 5,
+ name: 'Realtime',
+ value: 'Realtime',
+ disabled: false,
+ },
+ {
+ id: 6,
+ name: 'Storage',
+ value: 'Storage',
+ disabled: false,
+ },
+ {
+ id: 7,
+ name: 'Others',
+ value: 'Others',
+ disabled: false,
+ },
+]
+
+export const GITHUB_LINKS = [
+ {
+ name: 'supabase-js',
+ description: 'For issues with our Javascript client',
+ url: 'https://github.com/supabase/supabase-js/issues',
+ },
+ {
+ name: 'supabase-flutter',
+ description: 'For issues with our Flutter integration',
+ url: 'https://github.com/supabase-community/supabase-flutter/issues',
+ },
+ {
+ name: 'supabase',
+ description: 'For other issues about our API',
+ url: 'https://github.com/supabase/supabase/issues',
+ },
+]
diff --git a/studio/components/interfaces/Support/SupportForm.tsx b/studio/components/interfaces/Support/SupportForm.tsx
index 6ce06de5534..c1be3161753 100644
--- a/studio/components/interfaces/Support/SupportForm.tsx
+++ b/studio/components/interfaces/Support/SupportForm.tsx
@@ -1,25 +1,32 @@
-import { isUndefined } from 'lodash'
import { useRouter } from 'next/router'
-import { useEffect, useReducer, useState, FC, ChangeEvent, useRef } from 'react'
+import { useEffect, useState, FC, ChangeEvent, useRef } from 'react'
import { observer } from 'mobx-react-lite'
-import { Button, IconMail, IconPlus, IconX, Input, Listbox } from 'ui'
+import { Button, IconMail, IconPlus, IconX, Input, Listbox, Form, IconLoader } from 'ui'
-import { useStore } from 'hooks'
import { Project } from 'types'
+import { useStore, useFlag } from 'hooks'
import { post, get } from 'lib/common/fetch'
import { API_URL, PRICING_TIER_PRODUCT_IDS } from 'lib/constants'
import Divider from 'components/ui/Divider'
-import Connecting from 'components/ui/Loading/Loading'
-import { formatMessage, formReducer, uploadAttachments } from './SupportForm.utils'
-import {
- DEFAULT_VALUES,
- CATEGORY_OPTIONS,
- SEVERITY_OPTIONS,
-} from 'components/interfaces/Support/Support.constants'
+import Connecting from 'components/ui/Loading'
+import MultiSelect from 'components/ui/MultiSelect'
+import { formatMessage, uploadAttachments } from './SupportForm.utils'
+import { CATEGORY_OPTIONS, SEVERITY_OPTIONS, SERVICE_OPTIONS } from './Support.constants'
+import DisabledStateForFreeTier from './DisabledStateForFreeTier'
+import BestPracticesGuidance from './BestPracticesGuidance'
+import ClientLibrariesGuidance from './ClientLibrariesGuidance'
const MAX_ATTACHMENTS = 5
+// [Joshen] Note to self - need to double check that this will work with the actual ticket submission to Hubspot too
+// Remaining
+// - Github issues link for problems
+// - Github discussions/discord link for best practices
+// Do a screen grab, get approval from Ant/Jonny
+// Integrate with API
+// Improve success state of submission
+
interface Props {
setSent: (value: boolean) => void
}
@@ -27,51 +34,28 @@ interface Props {
const SupportForm: FC<Props> = ({ setSent }) => {
const { ui, app } = useStore()
const router = useRouter()
- const projectRef = router.query.ref
- const category = router.query.category
+ const { ref, category } = router.query
const uploadButtonRef = useRef()
- const [loading, setLoading] = useState<boolean>(false)
- const [formState, formDispatch] = useReducer(formReducer, DEFAULT_VALUES)
-
+ const enableFreeSupport = useFlag('enableFreeSupport')
const [uploadedFiles, setUploadedFiles] = useState<File[]>([])
- const [uploadedDataUrls, setUploadedDataUrls] = useState<any>([])
+ const [uploadedDataUrls, setUploadedDataUrls] = useState<string[]>([])
+ const [selectedServices, setSelectedServices] = useState<string[]>([])
// Get all orgs and projects from global store
const sortedOrganizations = app.organizations.list()
const sortedProjects = app.projects.list()
const projectDefaults: Partial<Project>[] = [{ ref: 'no-project', name: 'No specific project' }]
-
const isInitialized = app.projects.isInitialized
const projects = [...sortedProjects, ...projectDefaults]
- useEffect(() => {
- if (isInitialized) {
- // set project default
- if (sortedProjects.length > 1) {
- const selectedProject = sortedProjects.find(
- (project: Project) => project.ref === projectRef
- )
- if (!isUndefined(selectedProject)) {
- handleOnChange({ name: 'project', value: selectedProject.ref })
- } else {
- handleOnChange({ name: 'project', value: sortedProjects[0].ref })
- }
- } else {
- // set as 'No specific project'
- handleOnChange({ name: 'project', value: projectDefaults[0].ref })
- }
-
- // Set category based on query param
- if (category) {
- const selectedCategory = CATEGORY_OPTIONS.find((option) => {
- if (option.value.toLowerCase() === category) return option
- })
- if (selectedCategory) handleOnChange({ name: 'category', value: selectedCategory.value })
- }
- }
- }, [isInitialized])
+ const planNames = {
+ [PRICING_TIER_PRODUCT_IDS.FREE]: 'Free',
+ [PRICING_TIER_PRODUCT_IDS.PRO]: 'Pro',
+ [PRICING_TIER_PRODUCT_IDS.PAYG]: 'Pro',
+ [PRICING_TIER_PRODUCT_IDS.ENTERPRISE]: 'Enterprise',
+ }
useEffect(() => {
if (!uploadedFiles) return
@@ -83,85 +67,29 @@ const SupportForm: FC<Props> = ({ setSent }) => {
}
}, [uploadedFiles])
- function handleOnChange(x: any) {
- formDispatch({
- name: x.name,
- value: x.value,
- error: x.error,
- })
- // Reset severity value when changing project to prevent selection of Critical
- if (x.name === 'project') {
- const selectedProject = projects.find((project: any) => project.ref === x.value)
- if (
- (selectedProject?.subscription_tier ?? PRICING_TIER_PRODUCT_IDS.FREE) ===
- PRICING_TIER_PRODUCT_IDS.FREE &&
- formState.severity.value === 'Critical'
- ) {
- formDispatch({
- name: 'severity',
- value: 'Low',
- error: '',
- })
- }
- }
+ if (!isInitialized) {
+ return (
+ <div className="w-[622px] py-48">
+ <Connecting />
+ </div>
+ )
}
- async function handleSubmit(e: any) {
- e.preventDefault()
-
- let errors: any = []
-
- if (!formState.subject.value) {
- const message = 'Please add a subject heading'
- handleOnChange({ name: 'subject', error: message })
- errors.push([...errors, message])
- }
-
- if (!formState.body.value) {
- const message = 'Please type in a message'
- handleOnChange({ name: 'body', error: message })
- errors.push([...errors, message])
- }
-
- if (errors.length === 0) {
- setLoading(true)
- const projectRef = formState.project.value
- const attachments = uploadedFiles ? await uploadAttachments(projectRef, uploadedFiles) : []
-
- const payload = {
- projectRef,
- message: formatMessage(formState.body.value, attachments),
- category: formState.category.value,
- verified: true,
- tags: ['dashboard-support-form'],
- subject: formState.subject.value,
- severity: formState.severity.value,
- siteUrl: '',
- additionalRedirectUrls: '',
- }
-
- if (projectRef !== 'no-project') {
- const URL = `${API_URL}/auth/${projectRef}/config`
- const authConfig = await get(URL)
- if (!authConfig.error) {
- payload.siteUrl = authConfig.SITE_URL
- payload.additionalRedirectUrls = authConfig.URI_ALLOW_LIST
- }
- }
-
- const response = await post(`${API_URL}/feedback/send`, payload)
- setLoading(false)
-
- if (response.error) {
- ui.setNotification({
- category: 'error',
- message: `Failed to submit support ticket: ${response.error.message}`,
- })
- } else {
- ui.setNotification({ category: 'success', message: 'Support request sent. Thank you!' })
- setSent(true)
- }
- }
+ const selectedProject = sortedProjects.find((project) => project.ref === ref)
+ const selectedCategory = CATEGORY_OPTIONS.find((option) => {
+ if (option.value.toLowerCase() === category) return option
+ })
+ const initialValues = {
+ category: selectedCategory !== undefined ? selectedCategory.value : CATEGORY_OPTIONS[0].value,
+ severity: 'Low',
+ projectRef:
+ selectedProject !== undefined
+ ? selectedProject.ref
+ : sortedProjects.length > 0
+ ? sortedProjects[0].ref
+ : 'no-project',
+ subject: '',
+ body: '',
}
const onFilesUpload = async (event: ChangeEvent<HTMLInputElement>) => {
@@ -191,202 +119,269 @@ const SupportForm: FC<Props> = ({ setSent }) => {
setUploadedDataUrls(updatedDataUrls)
}
- if (!isInitialized) {
- return (
- <div className="w-[622px] py-48">
- <Connecting />
- </div>
- )
+ const onValidate = (values: any) => {
+ const errors: any = {}
+ if (!values.subject) errors.subject = 'Please add a subject heading'
+ if (!values.body) errors.body = 'Please type in a message'
+ return errors
}
- return (
- <form onSubmit={(e) => handleSubmit(e)} className="space-y-8">
- <div className="px-6">
- <h4>What problem are you facing?</h4>
- </div>
+ const onSubmit = async (values: any, { setSubmitting }: any) => {
+ setSubmitting(true)
+ const attachments = uploadedFiles
+ ? await uploadAttachments(values.projectRef, uploadedFiles)
+ : []
+ const payload = {
+ ...values,
+ message: formatMessage(values.body, attachments),
+ verified: true,
+ tags: ['dashboard-support-form'],
+ siteUrl: '',
+ additionalRedirectUrls: '',
+ }
- <div className="space-y-6">
- <div className="px-6">
- <Listbox
- value={formState.category.value}
- label="Category"
- layout="horizontal"
- onChange={(value) => handleOnChange({ name: 'category', value })}
- >
- {CATEGORY_OPTIONS.map((option, i) => {
- return (
- <Listbox.Option
- key={`option-${option.value}`}
- label={option.label}
- value={option.value}
- children={({ active, selected }: any) => {
- return (
- <>
- <span>{option.label}</span>
- <span className="block text-xs opacity-50">{option.description}</span>
- </>
- )
- }}
- />
- )
- })}
- </Listbox>
- </div>
- <div className="px-6">
- <Listbox
- value={formState.project.value}
- label="Project"
- layout="horizontal"
- descriptionText="The project that is experiencing the problem"
- onChange={(value) => handleOnChange({ name: 'project', value })}
- >
- {projects.map((option) => {
- return (
- <Listbox.Option
- key={`option-${option.ref}`}
- label={option.name || ''}
- value={option.ref}
- children={({ active, selected }: any) => {
+ if (values.projectRef !== 'no-project') {
+ const URL = `${API_URL}/auth/${values.projectRef}/config`
+ const authConfig = await get(URL)
+ if (!authConfig.error) {
+ payload.siteUrl = authConfig.SITE_URL
+ payload.additionalRedirectUrls = authConfig.URI_ALLOW_LIST
+ }
+ }
+
+ const response = await post(`${API_URL}/feedback/send`, payload)
+ if (response.error) {
+ ui.setNotification({
+ category: 'error',
+ message: `Failed to submit support ticket: ${response.error.message}`,
+ })
+ } else {
+ ui.setNotification({ category: 'success', message: 'Support request sent. Thank you!' })
+ setSent(true)
+ }
+ setSubmitting(false)
+ }
+
+ return (
+ <Form id="support-form" initialValues={initialValues} validate={onValidate} onSubmit={onSubmit}>
+ {({ isSubmitting, values }: any) => {
+ const selectedCategory = CATEGORY_OPTIONS.find(
+ (category) => category.value === values.category
+ )
+ const selectedProject = projects.find((project) => project.ref === values.projectRef)
+ const isFreeProject =
+ (selectedProject?.subscription_tier ?? PRICING_TIER_PRODUCT_IDS.FREE) ===
+ PRICING_TIER_PRODUCT_IDS.FREE
+ const isDisabled =
+ !enableFreeSupport &&
+ isFreeProject &&
+ ['Performance', 'Problem', 'Best-practice'].includes(values.category)
+
+ useEffect(() => {
+ if (selectedProject && !selectedProject.subscription_tier) {
+ app.projects.fetchSubscriptionTier(selectedProject as Project)
+ }
+ }, [values.projectRef])
+
+ return (
+ <div className="space-y-8 w-[620px]">
+ <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>
+
+ <div className="px-6">
+ <div className="grid grid-cols-2 gap-4">
+ <Listbox id="projectRef" layout="vertical" label="Which project is affected?">
+ {projects.map((option) => {
const organization = sortedOrganizations.find(
(x) => x.id === option.organization_id
)
return (
- <div>
+ <Listbox.Option
+ key={`option-${option.ref}`}
+ label={option.name || ''}
+ value={option.ref}
+ >
<span>{option.name}</span>
<span className="block text-xs opacity-50">{organization?.name}</span>
- </div>
+ </Listbox.Option>
)
- }}
- />
- )
- })}
- </Listbox>
- </div>
-
- <div className="px-6">
- <Listbox
- value={formState.severity.value}
- label="Severity"
- layout="horizontal"
- onChange={(value) => handleOnChange({ name: 'severity', value })}
- >
- {SEVERITY_OPTIONS.map((option: any) => {
- const selectedProject = projects.find(
- (project: any) => project.ref === formState.project.value
- )
- const isAllowedCritical =
- (selectedProject?.subscription_tier ?? PRICING_TIER_PRODUCT_IDS.FREE) !==
- PRICING_TIER_PRODUCT_IDS.FREE
- return (
- <Listbox.Option
- key={`option-${option.value}`}
- label={option.label}
- value={option.value}
- disabled={option.value === 'Critical' && !isAllowedCritical}
- children={({ active, selected }: any) => {
+ })}
+ </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}
+ disabled={option.value === 'Critical' && isFreeProject}
+ >
<span>{option.label}</span>
<span className="block text-xs opacity-50">{option.description}</span>
- </>
+ </Listbox.Option>
)
- }}
- />
- )
- })}
- </Listbox>
- </div>
-
- <Divider light />
-
- <div className="px-6">
- <Input
- label="Subject"
- placeholder="Summary of the problem you have"
- onChange={(e) => handleOnChange({ name: 'subject', value: e.target.value })}
- value={formState.subject.value}
- error={formState.subject.error}
- />
- </div>
-
- <div className="text-area-text-sm px-6">
- <Input.TextArea
- label="Message"
- placeholder="Describe the issue you're facing, along with any relevant information. Please be as detailed and specific as possible."
- limit={500}
- labelOptional="500 character limit"
- onChange={(e) => handleOnChange({ name: 'body', value: e.target.value })}
- value={formState.body.value}
- error={formState.body.error}
- />
- </div>
- <div className="space-y-4 px-6">
- <div className="space-y-1">
- <p className="block text-sm text-scale-1100">Attachments</p>
- <p className="block text-sm text-scale-1000">
- Upload up to {MAX_ATTACHMENTS} screenshots that might be relevant to the issue that
- you're facing
- </p>
- </div>
- <div className="">
- <input
- multiple
- type="file"
- // @ts-ignore
- ref={uploadButtonRef}
- className="hidden"
- accept="image/png, image/jpeg"
- onChange={onFilesUpload}
- />
- </div>
- <div className="flex items-center space-x-2">
- {uploadedDataUrls.map((x: any, idx: number) => (
- <div
- key={idx}
- style={{ backgroundImage: `url("${x}")` }}
- className="relative h-14 w-14 rounded bg-cover bg-center bg-no-repeat"
- >
- <div
- className={[
- 'flex h-4 w-4 items-center justify-center rounded-full bg-red-900',
- 'absolute -top-1 -right-1 cursor-pointer',
- ].join(' ')}
- onClick={() => removeUploadedFile(idx)}
- >
- <IconX size={12} strokeWidth={2} />
- </div>
- </div>
- ))}
- {uploadedFiles.length < MAX_ATTACHMENTS && (
- <div
- className={[
- 'border border-scale-800 opacity-50 transition hover:opacity-100',
- 'group flex h-14 w-14 cursor-pointer items-center justify-center rounded',
- ].join(' ')}
- onClick={() => {
- if (uploadButtonRef.current) (uploadButtonRef.current as any).click()
- }}
- >
- <IconPlus strokeWidth={2} size={20} />
+ })}
+ </Listbox>
</div>
+ {selectedProject?.subscription_tier ? (
+ <p className="text-sm text-scale-1000 mt-2">
+ This project is on the{' '}
+ <span className="text-scale-1100">
+ {planNames[selectedProject?.subscription_tier]} plan
+ </span>
+ </p>
+ ) : (
+ <div className="flex items-center space-x-2 mt-2">
+ <IconLoader size={14} className="animate-spin" />
+ <p className="text-sm text-scale-1000">Checking project's plan</p>
+ </div>
+ )}
+ </div>
+
+ <Divider light />
+
+ {values.category === 'Problem' && (
+ <>
+ <ClientLibrariesGuidance />
+ <Divider light />
+ </>
+ )}
+
+ {values.category === 'Best-practices' && (
+ <>
+ <BestPracticesGuidance />
+ <Divider light />
+ </>
+ )}
+
+ {!isDisabled ? (
+ <>
+ <div className="px-6">
+ <Input
+ id="subject"
+ label="Subject"
+ placeholder="Summary of the problem you have"
+ />
+ </div>
+
+ <div className="px-6 space-y-2">
+ <p className="text-sm text-scale-1100">Which services are affected?</p>
+ <MultiSelect
+ options={SERVICE_OPTIONS}
+ value={selectedServices}
+ placeholder="No particular service"
+ searchPlaceholder="Search for a service"
+ onChange={setSelectedServices}
+ />
+ </div>
+
+ <div className="text-area-text-sm px-6">
+ <Input.TextArea
+ id="body"
+ label="Message"
+ placeholder="Describe the issue you're facing, along with any relevant information. Please be as detailed and specific as possible."
+ limit={500}
+ labelOptional="500 character limit"
+ />
+ </div>
+
+ <div className="space-y-4 px-6">
+ <div className="space-y-1">
+ <p className="block text-sm text-scale-1100">Attachments</p>
+ <p className="block text-sm text-scale-1000">
+ Upload up to {MAX_ATTACHMENTS} screenshots that might be relevant to the issue
+ that you're facing
+ </p>
+ </div>
+ <div>
+ <input
+ multiple
+ type="file"
+ // @ts-ignore
+ ref={uploadButtonRef}
+ className="hidden"
+ accept="image/png, image/jpeg"
+ onChange={onFilesUpload}
+ />
+ </div>
+ <div className="flex items-center space-x-2">
+ {uploadedDataUrls.map((x: any, idx: number) => (
+ <div
+ key={idx}
+ style={{ backgroundImage: `url("${x}")` }}
+ className="relative h-14 w-14 rounded bg-cover bg-center bg-no-repeat"
+ >
+ <div
+ className={[
+ 'flex h-4 w-4 items-center justify-center rounded-full bg-red-900',
+ 'absolute -top-1 -right-1 cursor-pointer',
+ ].join(' ')}
+ onClick={() => removeUploadedFile(idx)}
+ >
+ <IconX size={12} strokeWidth={2} />
+ </div>
+ </div>
+ ))}
+ {uploadedFiles.length < MAX_ATTACHMENTS && (
+ <div
+ className={[
+ 'border border-scale-800 opacity-50 transition hover:opacity-100',
+ 'group flex h-14 w-14 cursor-pointer items-center justify-center rounded',
+ ].join(' ')}
+ onClick={() => {
+ if (uploadButtonRef.current) (uploadButtonRef.current as any).click()
+ }}
+ >
+ <IconPlus strokeWidth={2} size={20} />
+ </div>
+ )}
+ </div>
+ </div>
+ <div className="px-6">
+ <div className="flex justify-end">
+ <Button
+ htmlType="submit"
+ size="small"
+ icon={<IconMail />}
+ disabled={isSubmitting}
+ loading={isSubmitting}
+ >
+ Send support request
+ </Button>
+ </div>
+ </div>
+ </>
+ ) : ['Problem', 'Best-practices', 'Performance'].includes(values.category) ? (
+ <DisabledStateForFreeTier
+ category={selectedCategory?.label ?? ''}
+ projectRef={values.projectRef}
+ />
+ ) : (
+ <></>
)}
</div>
- </div>
- </div>
- <div className="px-6">
- <div className="flex justify-end">
- <Button
- htmlType="submit"
- size="small"
- icon={<IconMail />}
- disabled={loading}
- loading={loading}
- >
- Send support request
- </Button>
- </div>
- </div>
- </form>
+ )
+ }}
+ </Form>
)
}
diff --git a/studio/components/interfaces/Support/SupportForm.utils.ts b/studio/components/interfaces/Support/SupportForm.utils.ts
index 3bbb04fb8b0..46f3ca577e5 100644
--- a/studio/components/interfaces/Support/SupportForm.utils.ts
+++ b/studio/components/interfaces/Support/SupportForm.utils.ts
@@ -19,16 +19,6 @@ const supportSupabaseClient = createClient(SUPPORT_API_URL, SUPPORT_API_KEY, {
},
})
-export function formReducer(state: any, action: any) {
- return {
- ...state,
- [action.name]: {
- value: action.value,
- error: action.error,
- },
- }
-}
-
export const uploadAttachments = async (ref: string, files: File[]) => {
const filesToUpload = Array.from(files)
const uploadedFiles = await Promise.all(
diff --git a/studio/components/ui/MultiSelect/index.tsx b/studio/components/ui/MultiSelect/index.tsx
index 085543693c7..e43ed33aee1 100644
--- a/studio/components/ui/MultiSelect/index.tsx
+++ b/studio/components/ui/MultiSelect/index.tsx
@@ -1,13 +1,6 @@
import { useRef, useEffect, useState, FormEvent, KeyboardEvent, ReactNode } from 'react'
import { orderBy, filter, without } from 'lodash'
-import {
- Popover,
- IconCheck,
- IconAlertCircle,
- IconSearch,
- IconPlus,
- IconChevronDown,
-} from 'ui'
+import { Popover, IconCheck, IconAlertCircle, IconSearch, IconPlus, IconChevronDown } from 'ui'
import { BadgeDisabled, BadgeSelected } from './Badges'
@@ -235,7 +228,9 @@ export default function MultiSelect({
].join(' ')}
>
{selectedOptions.length === 0 && placeholder && (
- <div className="px-2 text-sm text-scale-1000">{placeholder}</div>
+ <div className="px-2 text-sm text-scale-1000 h-full flex items-center">
+ {placeholder}
+ </div>
)}
{selectedOptions.map((value, idx) => {
const id = `${value}-${idx}`
@@ -257,8 +252,8 @@ export default function MultiSelect({
)
}
})}
- <div className="absolute inset-y-0 right-0 pl-3 pr-1 flex space-x-1 items-center cursor-pointer ">
- <IconChevronDown className="text-scale-900" />
+ <div className="absolute inset-y-0 right-0 pl-3 pr-2 flex space-x-1 items-center cursor-pointer ">
+ <IconChevronDown size={16} strokeWidth={2} className="text-scale-900" />
</div>
</div>
</Popover>
diff --git a/studio/pages/support/new.tsx b/studio/pages/support/new.tsx
index f9745dfe77e..f7a5d4c2781 100644
--- a/studio/pages/support/new.tsx
+++ b/studio/pages/support/new.tsx
@@ -19,17 +19,6 @@ const SupportPage = () => {
style={{ height: maxHeight, maxHeight }}
>
<div className="mx-auto my-8 max-w-2xl px-4 lg:px-6">
- <Button
- type="text"
- className="opacity-50 hover:opacity-100"
- style={{ background: 'none', padding: 0 }}
- onClick={function goBack() {
- window.history.back()
- }}
- icon={<IconArrowLeft />}
- >
- Go back
- </Button>
<div className="space-y-12 py-8">
<div className="flex items-center space-x-3">
<SVG src={`/img/supabase-logo.svg`} className="h-4 w-4" />
diff --git a/studio/stores/app/ProjectStore.ts b/studio/stores/app/ProjectStore.ts
index 77236369577..1cc2ad142c4 100644
--- a/studio/stores/app/ProjectStore.ts
+++ b/studio/stores/app/ProjectStore.ts
@@ -10,6 +10,7 @@ import pingPostgrest from 'lib/pingPostgrest'
export interface IProjectStore extends IPostgresMetaInterface<Project> {
fetchDetail: (projectRef: string, callback?: (project: Project) => void) => Promise<void>
+ fetchSubscriptionTier: (project: Project) => Promise<void>
}
export default class ProjectStore extends PostgresMetaInterface<Project> {