docs/.vitepress/types/Feedback.ts

2b1916f5415c9f94b9b6ab253f61210e33aacfc5
wotaku/docs/.vitepress/types/Feedback.ts
taskylizard chore: update license0dddca8d19 1 year ago

60 lines · 1319 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  value: FeedbackType['type']
28}
29
30export const feedbackOptions: Option[] = [
31  {
32    label: '➕ Submit link',
33    value: 'submit'
34  },
35  {
36    label: '❗ Update link',
37    value: 'update'
38  },
39  {
40    label: '❌ Report bad / dead link',
41    value: 'report'
42  },
43  {
44    label: '💡 Suggest edit',
45    value: 'suggestion'
46  },
47  {
48    label: '❤ Love the wiki',
49    value: 'appreciation'
50  },
51  { label: '💬 Something else', value: 'other' }
52]
53
54export function getFeedbackOption(
55  value: FeedbackType['type']
56): Option | undefined {
57  return feedbackOptions.find((option) => option.value === value)
58}
59
60export 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