docs/.vitepress/types/Feedback.ts

c739d46770b526bab469834941ec98439942ca2c
wotaku/docs/.vitepress/types/Feedback.ts
Duck a4d1d81cde0 2 months ago

71 lines · 1556 bytes

 1/**
 2 *  All Rights Reserved
 3 *
 4 *  Copyright (c) 2025 taskylizard
 5 *
 6 *  All rights reserved. This code and its associated files may not be copied, modified, distributed, sublicensed, or used in any form, in whole or in part, without prior written permission from the copyright holder.
 7 */
 8import z from 'zod'
 9
10export const FeedbackSchema = z.object({
11  content: z.string().min(5).max(2000),
12  type: z.enum([
13    'submit',
14    'update',
15    'report',
16    'suggestion',
17    'appreciation',
18    'other'
19  ]),
20  page: z.string().url(),
21  heading: z.string().min(3).max(50).optional(),
22  name: z.string().min(1).max(50).optional(),
23  visitorId: z.string().length(32)
24})
25
26export interface Option {
27  label: string
28  icon: string
29  value: FeedbackType['type']
30}
31
32export const feedbackOptions: Option[] = [
33  {
34    label: 'Submit URL',
35    icon: 'i-lucide:circle-plus',
36    value: 'submit'
37  },
38  {
39    label: 'Update URL',
40    icon: 'i-lucide:circle-alert',
41    value: 'update'
42  },
43  {
44    label: 'Report URL',
45    icon: 'i-lucide:circle-x',
46    value: 'report'
47  },
48  {
49    label: 'Suggest edit',
50    icon: 'i-lucide:lightbulb',
51    value: 'suggestion'
52  },
53  {
54    label: 'Love the wiki',
55    icon: 'i-lucide:heart',
56    value: 'appreciation'
57  },
58  {
59    label: 'Something else',
60    icon: 'i-lucide:message-circle',
61    value: 'other'
62  }
63]
64
65export function getFeedbackOption(
66  value: FeedbackType['type']
67): Option | undefined {
68  return feedbackOptions.find((option) => option.value === value)
69}
70
71export type FeedbackType = z.infer<typeof FeedbackSchema>
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form