diff --git a/src/components/FeedbackFab.tsx b/src/components/FeedbackFab.tsx index b3eb92f..4b2df2d 100644 --- a/src/components/FeedbackFab.tsx +++ b/src/components/FeedbackFab.tsx @@ -1,6 +1,10 @@ import { useEffect, useRef, useState } from 'react'; import { motion, AnimatePresence } from 'motion/react'; -import { MessageCircleHeart, X, ChevronRight, ChevronLeft, Check, Sparkles, ImagePlus, Loader2, Inbox } from 'lucide-react'; +import { + MessageCircleHeart, X, ChevronRight, ChevronLeft, Check, Sparkles, + ImagePlus, Loader2, Inbox, Lightbulb, Bug, Palette, NotebookPen, + type LucideIcon, +} from 'lucide-react'; import { fetchJson } from '../auth/api-client'; import FeedbackHistoryDrawer from './FeedbackHistoryDrawer'; @@ -37,11 +41,25 @@ function readAsDataUrl(file: File): Promise { type FeedbackType = 'dimension' | 'bug' | 'ux' | 'other'; -const TYPE_OPTIONS: { key: FeedbackType; emoji: string; label: string; sub: string; color: string }[] = [ - { key: 'dimension', emoji: '💡', label: '想看新的统计维度', sub: '比如按 XX 维度分组', color: 'from-amber-50 to-orange-50 border-amber-100' }, - { key: 'bug', emoji: '🐛', label: '报告一个 bug', sub: '哪里看着不对劲', color: 'from-rose-50 to-red-50 border-rose-100' }, - { key: 'ux', emoji: '🎨', label: '界面 / 体验建议', sub: '哪里能更顺手', color: 'from-violet-50 to-fuchsia-50 border-violet-100' }, - { key: 'other', emoji: '📝', label: '其他想法', sub: '欢迎随便聊聊', color: 'from-slate-50 to-blue-50 border-slate-100' }, +interface TypeOption { + key: FeedbackType; + icon: LucideIcon; + label: string; + sub: string; + iconBg: string; + iconFg: string; + ring: string; +} + +const TYPE_OPTIONS: TypeOption[] = [ + { key: 'dimension', icon: Lightbulb, label: '想看新的统计维度', sub: '比如按 XX 维度切片', + iconBg: 'bg-amber-50', iconFg: 'text-amber-500', ring: 'ring-amber-200' }, + { key: 'bug', icon: Bug, label: '报告一个 Bug', sub: '哪里看着不对劲', + iconBg: 'bg-rose-50', iconFg: 'text-rose-500', ring: 'ring-rose-200' }, + { key: 'ux', icon: Palette, label: '界面 / 体验建议', sub: '哪里能更顺手', + iconBg: 'bg-violet-50', iconFg: 'text-violet-500', ring: 'ring-violet-200' }, + { key: 'other', icon: NotebookPen, label: '其他想法', sub: '欢迎随便聊聊', + iconBg: 'bg-blue-50', iconFg: 'text-blue-500', ring: 'ring-blue-200' }, ]; const MODULE_LABELS: Record = { @@ -286,22 +304,34 @@ export default function FeedbackFab({ module: moduleProp }: Props = {}) { {step === 1 && ( -

想反馈什么呢?

+

想反馈点什么?

+

选一个最贴近的类型

- {TYPE_OPTIONS.map(opt => ( - - ))} + {TYPE_OPTIONS.map((opt, i) => { + const Icon = opt.icon; + const selected = type === opt.key; + return ( + { setType(opt.key); setStep(2); }} + className={`text-left p-3.5 rounded-2xl border bg-white transition-all flex items-center gap-3 group ${selected ? `ring-2 ${opt.ring} border-transparent shadow-sm` : 'border-slate-100 hover:border-slate-200 hover:shadow-sm'}`} + > +
+ +
+
+
{opt.label}
+
{opt.sub}
+
+ +
+ ); + })}
)}