FMHYedit/.vitepress/types/Feedback.ts

30 lines
660 B
TypeScript
Raw Normal View History

2024-01-25 16:32:45 +00:00
import z from 'zod'
2023-11-12 22:12:57 +05:30
export const FeedbackSchema = z.object({
message: z.string().min(5).max(1000),
2024-01-25 16:32:45 +00:00
type: z.enum(['bug', 'suggestion', 'appreciate', 'other']),
page: z.string().optional()
})
2023-11-12 22:12:57 +05:30
2023-11-19 14:27:14 +05:30
export const feedbackOptions = [
2024-01-25 16:32:45 +00:00
{ label: '🐞 Bug', value: 'bug' },
2023-11-19 14:27:14 +05:30
{
2024-01-25 16:32:45 +00:00
label: '💡 Suggestion',
value: 'suggestion'
2023-11-19 14:27:14 +05:30
},
2024-01-25 16:32:45 +00:00
{ label: '📂 Other', value: 'other' },
2023-11-19 14:27:14 +05:30
{
2024-01-25 16:32:45 +00:00
label: '❤️ Appreciation',
value: 'appreciate'
}
]
2023-11-19 14:27:14 +05:30
2024-01-25 16:32:45 +00:00
export function getFeedbackOption(value: string): {
label: string
value: string
} {
return feedbackOptions.find((option) => option.value === value)
2023-11-19 14:27:14 +05:30
}
2024-01-25 16:32:45 +00:00
export type FeedbackType = z.infer<typeof FeedbackSchema>