'use client' import React, { useState } from 'react' import { Folder, Calendar as CalendarIcon, Clock as ClockIcon, Sparkle, Trash, FolderOpen, Compass, Flask, DeviceMobile, Function, ChatCircleDots } from '@phosphor-icons/react' import { motion } from 'framer-motion' import { DynamicClockIcon } from './DynamicClockIcon' import { DynamicCalendarIcon } from './DynamicCalendarIcon' interface MinimizedApp { id: string label: string icon: React.ReactNode onRestore: () => void } interface DockProps { onOpenFileManager: (path: string) => void onOpenCalendar: () => void onOpenClock: () => void onOpenMessages: () => void onOpenGeminiChat: () => void onCloseAllApps?: () => void openApps: { [key: string]: boolean } minimizedApps?: MinimizedApp[] } interface DockItemProps { icon: React.ReactNode label: string onClick: () => void isActive?: boolean className?: string mouseX: React.MutableRefObject } const DockItem: React.FC = ({ icon, label, onClick, isActive = false, className = '', mouseX }) => { const [isHovered, setIsHovered] = useState(false) const ref = React.useRef(null) const handleClick = () => { console.log('Dock item clicked:', label) if (onClick) { onClick() } } return (
setIsHovered(true)} onMouseLeave={() => setIsHovered(false)} onClick={handleClick} className={`app-icon w-10 h-10 sm:w-11 sm:h-11 md:w-12 md:h-12 rounded-xl shadow-lg flex items-center justify-center cursor-pointer border transition-all ${className}`} title={label} > {icon}
) } export function Dock({ onOpenFileManager, onOpenCalendar, onOpenClock, onOpenMessages, onOpenGeminiChat, onCloseAllApps, openApps, minimizedApps = [] }: DockProps) { const mouseX = React.useRef(null) const dockItems = [ { icon: (
), label: 'Files', onClick: () => onOpenFileManager(''), isActive: openApps['files'], className: '' }, { icon: (
), label: 'Gemini', onClick: onOpenGeminiChat, isActive: openApps['gemini'], className: '' }, { icon: (
), label: 'Messages', onClick: onOpenMessages, isActive: openApps['messages'], className: '' }, { icon: (
), label: 'Clock', onClick: onOpenClock, isActive: openApps['clock'], className: 'rounded-full' }, { icon: (
), label: 'Calendar', onClick: onOpenCalendar, isActive: openApps['calendar'], className: '' } ] return (
mouseX.current = e.pageX} onMouseLeave={() => mouseX.current = null} > {dockItems.map((item, index) => ( ))} {/* Minimized apps section */} {minimizedApps.length > 0 && ( <>
{minimizedApps.map((app) => (
))} )} {/* Trash */}
} label="Trash" onClick={() => onCloseAllApps?.()} className="" mouseX={mouseX} />
) }