mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
## What Updates the Message field on the support form to encourage shorter, clearer requests. - Replaces the "Please be as detailed and specific as possible" placeholder with three plain questions: "What are you trying to do? What happened instead? What have you tried?" - Adds one line of guidance under the field, with a link to the KB article on formatting support requests - Replaces the static "5000 character limit" label with a live `count / 2,500` counter, and lowers the limit to 2,500 ## Why The old wording encouraged very long requests. Closes FE-4716: https://linear.app/supabase/issue/FE-4716/review-support-form-wording-to-encourage-shorter-clearer-requests Copy follows design feedback in the Slack thread. Layout changes to the wider support form are out of scope and tracked separately. The 2,500 limit comes from the proposed mockup on the ticket, which was marked as a proposal rather than an agreed change. Flagging it here so it gets confirmed in review. A prepopulated template is not included. A placeholder gives the same guidance without text users have to delete, and avoids conflicting with flows that prefill the message. ## How to test 1. Run `pnpm dev:studio` and open the support form 2. Check the placeholder shows the three questions, and disappears when you type 3. Check the line under the field links to the KB article via "Learn more" 4. Type in the field and check the counter goes up (`0 / 2,500` to `N / 2,500`) 5. Paste text longer than 2,500 characters and check it is cut off at the limit 6. Type `ipv4` in the message and check the IPv4 alert appears below the guidance, then delete it and check the alert disappears
69 lines
2.3 KiB
TypeScript
69 lines
2.3 KiB
TypeScript
import type { UseFormReturn } from 'react-hook-form'
|
|
// End of third-party imports
|
|
|
|
import { FormControl, FormField, TextArea } from 'ui'
|
|
import { Admonition } from 'ui-patterns/Admonition'
|
|
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
|
|
|
|
import { IPV4SuggestionAlert } from './IPV4SuggestionAlert'
|
|
import { IPV4_MIGRATION_STRINGS } from './Support.constants'
|
|
import type { SupportFormValues } from './SupportForm.schema'
|
|
import { InlineLink } from '@/components/ui/InlineLink'
|
|
|
|
const SUPPORT_REQUEST_TIPS_URL =
|
|
'https://supabase.com/kb/troubleshooting/formatting-support-requests-for-faster-resolution'
|
|
|
|
const MESSAGE_MAX_LENGTH = 2500
|
|
|
|
const MESSAGE_PLACEHOLDER = 'What are you trying to do? What happened instead? What have you tried?'
|
|
|
|
interface MessageFieldProps {
|
|
form: UseFormReturn<SupportFormValues>
|
|
originalError: string | null | undefined
|
|
}
|
|
|
|
export function MessageField({ form, originalError }: MessageFieldProps) {
|
|
return (
|
|
<FormField
|
|
name="message"
|
|
control={form.control}
|
|
render={({ field }) => (
|
|
<FormItemLayout
|
|
layout="vertical"
|
|
label="Message"
|
|
labelOptional={`${field.value.length.toLocaleString('en-US')} / ${MESSAGE_MAX_LENGTH.toLocaleString('en-US')}`}
|
|
description={
|
|
<div className="flex flex-col gap-y-3">
|
|
<p>
|
|
Short, specific requests get faster answers.{' '}
|
|
<InlineLink href={SUPPORT_REQUEST_TIPS_URL}>Learn more</InlineLink>
|
|
</p>
|
|
{IPV4_MIGRATION_STRINGS.some((str) => field.value.includes(str)) && (
|
|
<IPV4SuggestionAlert />
|
|
)}
|
|
</div>
|
|
}
|
|
>
|
|
<FormControl>
|
|
<TextArea
|
|
{...field}
|
|
rows={4}
|
|
maxLength={MESSAGE_MAX_LENGTH}
|
|
placeholder={MESSAGE_PLACEHOLDER}
|
|
/>
|
|
</FormControl>
|
|
{originalError && (
|
|
<Admonition
|
|
showIcon={false}
|
|
type="default"
|
|
className="mt-2 max-h-[150px] overflow-y-auto"
|
|
title="The error that you ran into will be included in your message for reference"
|
|
description={`Error: ${originalError}`}
|
|
/>
|
|
)}
|
|
</FormItemLayout>
|
|
)}
|
|
/>
|
|
)
|
|
}
|