docs/.vitepress/types/Feedback.ts

55f5761f3f7df37a25abb823a3dd0c77ed8de941
wotaku/docs/.vitepress/types/Feedback.ts
Duck Feedback icon fix05dbade9b0 6 months ago

70 lines · 1520 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  message: z.string().min(5).max(1000),
12  type: z.enum([
13    'submit',
14    'update',
15    'report',
16    'suggestion',
17    'appreciation',
18    'other'
19  ]),
20  page: z.string().url(),
21  // For heading based feedback
22  heading: z.string().min(3).max(20).optional()
23})
24
25export interface Option {
26  label: string
27  icon: string
28  value: FeedbackType['type']
29}
30
31export const feedbackOptions: Option[] = [
32  {
33    label: 'Submit link',
34    icon: 'i-lucide:circle-plus',
35    value: 'submit'
36  },
37  {
38    label: 'Update link',
39    icon: 'i-lucide:circle-alert',
40    value: 'update'
41  },
42  {
43    label: 'Report bad / dead link',
44    icon: 'i-lucide:circle-x',
45    value: 'report'
46  },
47  {
48    label: 'Suggest edit',
49    icon: 'i-lucide:lightbulb',
50    value: 'suggestion'
51  },
52  {
53    label: 'Love the wiki',
54    icon: 'i-lucide:heart',
55    value: 'appreciation'
56  },
57  {
58    label: 'Something else',
59    icon: 'i-lucide:message-circle',
60    value: 'other'
61  }
62]
63
64export function getFeedbackOption(
65  value: FeedbackType['type']
66): Option | undefined {
67  return feedbackOptions.find((option) => option.value === value)
68}
69
70export 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