'use client' import React, { useState, useRef } from 'react' import Draggable from 'react-draggable' import { Folder, Calendar, Clock, Globe, Sparkle, Flask, DeviceMobile, Function, HardDrives, Code, Lightning, Key, Brain, ChatCircleDots, MusicNote } from '@phosphor-icons/react' import { DynamicClockIcon } from './DynamicClockIcon' import { DynamicCalendarIcon } from './DynamicCalendarIcon' interface DraggableDesktopIconProps { id: string label: string iconType: string initialPosition?: { x: number; y: number } onClick: () => void onDoubleClick: () => void } export function DraggableDesktopIcon({ id, label, iconType, initialPosition = { x: 0, y: 0 }, onClick, onDoubleClick }: DraggableDesktopIconProps) { const [selected, setSelected] = useState(false) const nodeRef = useRef(null) as React.MutableRefObject const handleClick = () => { setSelected(true) onClick() // Deselect after a short time setTimeout(() => setSelected(false), 3000) } const getIcon = () => { switch (iconType) { case 'files': return (
) case 'calendar': return (
) case 'clock': return (
) case 'messages': return (
) case 'flutter': return (
) case 'latex': return (
TEX
) case 'gemini': return (
) case 'harddrive': return (
) case 'vscode': return (
) case 'playground': return (
) case 'key': return (
) case 'quiz': return (
) case 'voice-app': return (
) default: return (
) } } return (
{getIcon()}
{label}
) }