FMHYedit/.vitepress/types/Feedback.ts

28 lines
700 B
TypeScript
Raw Normal View History

2023-11-12 16:42:57 +00:00
import z from "zod";
export const FeedbackSchema = z.object({
message: z.string().min(5).max(1000),
type: z.enum(["bug", "suggestion", "appreciate", "other"]),
2023-11-19 11:27:54 +00:00
contact: z.string().optional(),
page: z.string().optional(),
2023-11-12 16:42:57 +00:00
});
2023-11-19 08:57:14 +00:00
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);
}
2023-11-12 16:42:57 +00:00
export type FeedbackType = z.infer<typeof FeedbackSchema>;