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 16:42:57 +00:00
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 16:42:57 +00:00
2023-11-19 08:57:14 +00:00
export const feedbackOptions = [
2024-01-25 16:32:45 +00:00
{ label: '🐞 Bug', value: 'bug' },
2023-11-19 08:57:14 +00:00
{
2024-01-25 16:32:45 +00:00
label: '💡 Suggestion',
value: 'suggestion'
2023-11-19 08:57:14 +00:00
},
2024-01-25 16:32:45 +00:00
{ label: '📂 Other', value: 'other' },
2023-11-19 08:57:14 +00:00
{
2024-01-25 16:32:45 +00:00
label: '❤️ Appreciation',
value: 'appreciate'
}
]
2023-11-19 08:57:14 +00:00
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 08:57:14 +00:00
}
2024-01-25 16:32:45 +00:00
export type FeedbackType = z.infer<typeof FeedbackSchema>