feat: feedback v2

This commit is contained in:
taskylizard 2024-08-25 11:00:20 +00:00
parent d17887ca75
commit 9faa251c86
No known key found for this signature in database
GPG key ID: 1820131ED1A24120
26 changed files with 1042 additions and 419 deletions

View file

@ -2,27 +2,34 @@ import z from 'zod'
export const FeedbackSchema = z.object({
message: z.string().min(5).max(1000),
type: z.enum(['bug', 'suggestion', 'appreciate', 'other']),
page: z.string().optional()
type: z.enum(['bug', 'suggestion', 'appreciation', 'other']),
page: z.string().min(3).max(20),
// For heading based feedback
heading: z.string().min(3).max(20).optional()
})
export const feedbackOptions = [
{ label: '🐞 Bug', value: 'bug' },
export interface Option {
label: string
value: FeedbackType['type']
}
export const feedbackOptions: Option[] = [
{
label: '💡 Suggestion',
label: '💡 I have a suggestion',
value: 'suggestion'
},
{ label: '📂 Other', value: 'other' },
{ label: '🐛 I want to report a website bug', value: 'bug' },
{
label: '❤️ Appreciation',
value: 'appreciate'
}
label: '👍 I appreciate the work',
value: 'appreciation'
},
{ label: '📂 Something else', value: 'other' }
]
export function getFeedbackOption(value: string): {
label: string
value: string
} {
export function getFeedbackOption(
value: FeedbackType['type']
): Option | undefined {
return feedbackOptions.find((option) => option.value === value)
}