mirror of
https://github.com/fmhy/edit.git
synced 2025-07-31 00:02:17 +10:00
35 lines
834 B
TypeScript
35 lines
834 B
TypeScript
import z from 'zod'
|
|
|
|
export const FeedbackSchema = z.object({
|
|
message: z.string().min(5).max(1000),
|
|
type: z.enum(['suggestion', 'appreciation', 'other']),
|
|
page: z.string().min(3).max(20),
|
|
// For heading based feedback
|
|
heading: z.string().min(3).max(20).optional()
|
|
})
|
|
|
|
export interface Option {
|
|
label: string
|
|
value: FeedbackType['type']
|
|
}
|
|
|
|
export const feedbackOptions: Option[] = [
|
|
{
|
|
label: '💡 I have a suggestion',
|
|
value: 'suggestion'
|
|
},
|
|
{
|
|
label: '👍 I appreciate the work',
|
|
value: 'appreciation'
|
|
},
|
|
{ label: '📂 Something else', value: 'other' }
|
|
]
|
|
|
|
export function getFeedbackOption(
|
|
value: FeedbackType['type']
|
|
): Option | undefined {
|
|
return feedbackOptions.find((option) => option.value === value)
|
|
}
|
|
|
|
// prettier-ignore
|
|
export type FeedbackType = z.infer<typeof FeedbackSchema>;
|