- Restructure §8 from "文档沉淀规则" to "文档管理规则" with 4 subsections - Add docs/ structure with features/ and knowledge-base/ directories - Add feature documentation template with 7 sections (概述/设计初衷/技术设计/预期作用/实际效果/演化路线/头脑风暴) - Add feature update trigger matrix (新增/修改/完成/问题/反馈) - Add documentation quality checklist - Add §16
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import { MessageCircle } from 'lucide-react';
|
|
import { motion } from 'framer-motion';
|
|
import { useFeedbackStore } from './feedbackStore';
|
|
import { Button } from '../ui';
|
|
|
|
interface FeedbackButtonProps {
|
|
onClick: () => void;
|
|
showCount?: boolean;
|
|
}
|
|
|
|
export function FeedbackButton({ onClick, showCount = true }: FeedbackButtonProps) {
|
|
const feedbackItems = useFeedbackStore((state) => state.feedbackItems);
|
|
const pendingCount = feedbackItems.filter((f) => f.status === 'pending' || f.status === 'submitted').length;
|
|
|
|
return (
|
|
<motion.div
|
|
whileHover={{ scale: 1.02 }}
|
|
whileTap={{ scale: 0.98 }}
|
|
>
|
|
<Button
|
|
variant="ghost"
|
|
size="sm"
|
|
onClick={onClick}
|
|
className="relative flex items-center gap-2 text-gray-600 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100"
|
|
>
|
|
<MessageCircle className="w-4 h-4" />
|
|
<span className="text-sm">Feedback</span>
|
|
{showCount && pendingCount > 0 && (
|
|
<motion.span
|
|
initial={{ scale: 0 }}
|
|
animate={{ scale: 1 }}
|
|
className="absolute -top-1 -right-1 w-4 h-4 bg-orange-500 text-white text-[10px] rounded-full flex items-center justify-center"
|
|
>
|
|
{pendingCount > 9 ? '9+' : pendingCount}
|
|
</motion.span>
|
|
)}
|
|
</Button>
|
|
</motion.div>
|
|
);
|
|
}
|