"use client"; import type { Transition, Variants } from "framer-motion"; import { motion, useAnimation } from "framer-motion"; import { useCallback, useEffect } from "react"; const playIconVariants: Variants = { normal: { x: 0, rotate: 0, }, animate: { x: [0, -1, 2, 0], rotate: [0, -10, 0, 0], transition: { duration: 0.5, times: [0, 0.2, 0.5, 1], stiffness: 260, damping: 20, }, }, }; const defaultTransition: Transition = { duration: 0.6, opacity: { duration: 0.2 }, }; const pathVariants: Variants = { normal: { pathLength: 1, opacity: 1, }, animate: { opacity: [0, 1], pathLength: [0.5, 1], }, }; // Higher-order component for icon animation const withIconAnimation = (IconComponent: React.ComponentType) => { const AnimatedIcon = ({ isHovered = false, className, ...props }: { isHovered?: boolean; className?: string; }) => { const controls = useAnimation(); useEffect(() => { if (isHovered) { controls.start("animate"); } else { controls.start("normal"); } }, [isHovered, controls]); return (
); }; AnimatedIcon.displayName = `Animated${IconComponent.displayName || IconComponent.name || 'Icon'}`; return AnimatedIcon; }; // Higher-order component for icon animation const withChartIconAnimation = (IconComponent: React.ComponentType) => { const AnimatedChartIcon = ({ isHovered = false, className, ...props }: { isHovered?: boolean; className?: string; }) => { const controls = useAnimation(); const handleHoverStart = useCallback(async () => { await controls.start((i) => ({ pathLength: 0, opacity: 0, transition: { delay: i * 0.1, duration: 0.3 }, })); await controls.start((i) => ({ pathLength: 1, opacity: 1, transition: { delay: i * 0.1, duration: 0.3 }, })); }, [controls]); const handleHoverEnd = useCallback(() => { controls.start("normal"); }, [controls]); useEffect(() => { if (isHovered) { handleHoverStart(); } else { handleHoverEnd(); } }, [isHovered, handleHoverStart, handleHoverEnd]); return (
); }; AnimatedChartIcon.displayName = `AnimatedChart${IconComponent.displayName || IconComponent.name || 'Icon'}`; return AnimatedChartIcon; }; // Base icon components const HomeIconBase = ({ controls }: { controls: any }) => ( ); // Example of another icon with animation const PlayIconBase = ({ controls }: { controls: any }) => ( ); const SettingsGearIconBase = ({ controls }: { controls: any }) => { return ( ); }; const lineChartVariants2: Variants = { visible: { pathLength: 1, opacity: 1 }, hidden: { pathLength: 0, opacity: 0 }, }; const ChartColumnIconBase = ({ controls }: { controls: any }) => { return ( ); }; // const defaultTransition: Transition = { // duration: 0.9, // ease: 'easeInOut', // }; // const pathVariants: Variants = { // normal: { // rotate: 0, // x: 0, // y: 0, // }, // hover: { // rotate: [0, 4, 2, -3, 1, 0], // x: [0, 0.7, -0.3, 0.5, 0.2, 0], // y: [0, -0.2, 0.3, -0.2, 0.4, 0], // }, // }; const transition = (custom: number): Transition => ({ duration: 0.25, delay: custom * 0.1, }); const variants: Variants = { default: { pathLength: 1, opacity: 1, }, normal: (custom: number) => ({ pathLength: 1, opacity: 1, transition: transition(custom), }), animate: (custom: number) => ({ pathLength: 0.5, opacity: 1, transition: transition(custom), }), }; const ActivityLogsIconBase = ({ controls }: { controls: any }) => { return ( ); }; const defaultTransition2: Transition = { type: "spring", stiffness: 200, damping: 10, }; const pathVariants2: Variants = { normal: { rotate: 0, }, animate: { rotate: -20, }, }; const KeyOneBase = ({ controls }: { controls: any }) => { return ( ); }; const frameVariants: Variants = { normal: { opacity: 1 }, animate: { opacity: 1 }, }; const lineVariants: Variants = { normal: { pathLength: 1, opacity: 1 }, animate: { pathLength: 0, opacity: 0 }, }; const ScanTextIconBase = ({ controls }: { controls: any }) => { return ( ); }; // Create animated versions of icons const HomeIcon = withIconAnimation(HomeIconBase); const PlayIcon = withIconAnimation(PlayIconBase); const SettingsGearIcon = withIconAnimation(SettingsGearIconBase); const ChartColumnIcon = withChartIconAnimation(ChartColumnIconBase); const ActivityLogsIcon = withIconAnimation(ActivityLogsIconBase); const ScanTextIcon = withIconAnimation(ScanTextIconBase); const KeyIcon = withIconAnimation(KeyOneBase); // Logout icon with animation const LogOutIconBase = ({ controls }: { controls: any }) => { return ( ); }; // External link icon with animation const ExternalLinkIconBase = ({ controls }: { controls: any }) => { return ( ); }; // File text icon with animation const FileTextIconBase = ({ controls }: { controls: any }) => { return ( ); }; // Book open icon with animation const BookOpenIconBase = ({ controls }: { controls: any }) => { return ( ); }; // Message square icon with animation const MessageSquareIconBase = ({ controls }: { controls: any }) => { return ( ); }; const LogOutIcon = withIconAnimation(LogOutIconBase); const ExternalLinkIcon = withIconAnimation(ExternalLinkIconBase); const FileTextIcon = withIconAnimation(FileTextIconBase); const BookOpenIcon = withIconAnimation(BookOpenIconBase); const MessageSquareIcon = withIconAnimation(MessageSquareIconBase); // Bell icon with animation const BellIconBase = ({ controls }: { controls: any }) => { return ( ); }; // Gift icon with animation const GiftIconBase = ({ controls }: { controls: any }) => { return ( {/* Gift box bottom */} {/* Gift lid with opening animation */} {/* Left bow */} {/* Right bow */} ); }; // HelpCircle icon with animation const HelpCircleIconBase = ({ controls }: { controls: any }) => { return ( ); }; const BellIcon = withIconAnimation(BellIconBase); const GiftIcon = withIconAnimation(GiftIconBase); const HelpCircleIcon = withIconAnimation(HelpCircleIconBase); // SquareArrowUp icon with animation (for Upgrade button) const SquareArrowUpIconBase = ({ controls }: { controls: any }) => { return ( ); }; const SquareArrowUpIcon = withIconAnimation(SquareArrowUpIconBase); // Code icon with animation const CodeIconBase = ({ controls }: { controls: any }) => { return ( ); }; const CodeIcon = withIconAnimation(CodeIconBase); // TestTube icon for Extract Playground (Lucide TestTube2 icon without bubble) const BeakerIconBase = ({ controls }: { controls: any }) => { return ( ); }; const BeakerIcon = withIconAnimation(BeakerIconBase); export { HomeIcon, PlayIcon, SettingsGearIcon, ChartColumnIcon, ActivityLogsIcon, KeyIcon, ScanTextIcon, LogOutIcon, ExternalLinkIcon, FileTextIcon, BookOpenIcon, MessageSquareIcon, BellIcon, GiftIcon, HelpCircleIcon, SquareArrowUpIcon, CodeIcon, BeakerIcon, };