All files / src/components/Feedback FeedbackButton.tsx

0% Statements 0/25
0% Branches 0/1
0% Functions 0/1
0% Lines 0/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41                                                                                 
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>
  );
}