FMHYedit/.vitepress/types/Feedback.ts
2023-11-19 12:04:11 +00:00

28 lines
700 B
TypeScript

import z from "zod";
export const FeedbackSchema = z.object({
message: z.string().min(5).max(1000),
type: z.enum(["bug", "suggestion", "appreciate", "other"]),
contact: z.string().optional(),
page: z.string().optional(),
});
export const feedbackOptions = [
{ label: "🐞 Bug", value: "bug" },
{
label: "💡 Suggestion",
value: "suggestion",
},
{ label: "📂 Other", value: "other" },
{
label: "❤️ Appreciation",
value: "appreciate",
},
];
export function getFeedbackOption(value: string): { label: string; value: string } {
return feedbackOptions.find((option) => option.value === value);
}
export type FeedbackType = z.infer<typeof FeedbackSchema>;