mirror of
https://github.com/fmhy/edit.git
synced 2025-08-01 00:32:30 +10:00
feat: feedback v2
This commit is contained in:
parent
d17887ca75
commit
9faa251c86
26 changed files with 1042 additions and 419 deletions
|
@ -2,27 +2,34 @@ import z from 'zod'
|
|||
|
||||
export const FeedbackSchema = z.object({
|
||||
message: z.string().min(5).max(1000),
|
||||
type: z.enum(['bug', 'suggestion', 'appreciate', 'other']),
|
||||
page: z.string().optional()
|
||||
type: z.enum(['bug', 'suggestion', 'appreciation', 'other']),
|
||||
page: z.string().min(3).max(20),
|
||||
// For heading based feedback
|
||||
heading: z.string().min(3).max(20).optional()
|
||||
})
|
||||
|
||||
export const feedbackOptions = [
|
||||
{ label: '🐞 Bug', value: 'bug' },
|
||||
export interface Option {
|
||||
label: string
|
||||
value: FeedbackType['type']
|
||||
}
|
||||
|
||||
export const feedbackOptions: Option[] = [
|
||||
{
|
||||
label: '💡 Suggestion',
|
||||
label: '💡 I have a suggestion',
|
||||
value: 'suggestion'
|
||||
},
|
||||
{ label: '📂 Other', value: 'other' },
|
||||
|
||||
{ label: '🐛 I want to report a website bug', value: 'bug' },
|
||||
{
|
||||
label: '❤️ Appreciation',
|
||||
value: 'appreciate'
|
||||
}
|
||||
label: '👍 I appreciate the work',
|
||||
value: 'appreciation'
|
||||
},
|
||||
{ label: '📂 Something else', value: 'other' }
|
||||
]
|
||||
|
||||
export function getFeedbackOption(value: string): {
|
||||
label: string
|
||||
value: string
|
||||
} {
|
||||
export function getFeedbackOption(
|
||||
value: FeedbackType['type']
|
||||
): Option | undefined {
|
||||
return feedbackOptions.find((option) => option.value === value)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue