import { useState } from 'react'; import { Camera, Share2, MapPin, Bell, Copy, FileText, Globe, Wifi, WifiOff } from 'lucide-react'; import { motion, AnimatePresence } from 'framer-motion'; import { useNativeFeatures } from '../hooks/use-native-features'; export function MobileQuickActions() { const [isOpen, setIsOpen] = useState(false); const native = useNativeFeatures(); const [location, setLocation] = useState(''); const quickActions = [ { icon: , label: 'Camera', color: 'from-blue-500 to-cyan-500', action: async () => { const photo = await native.takePhoto(); if (photo) { native.showToast('Photo captured!'); native.vibrate('light'); } } }, { icon: , label: 'Share', color: 'from-purple-500 to-pink-500', action: async () => { await native.shareText('Check out AeThex OS!', 'AeThex OS'); } }, { icon: , label: 'Location', color: 'from-green-500 to-emerald-500', action: async () => { const position = await native.getCurrentLocation(); if (position) { const loc = `${position.coords.latitude.toFixed(4)}, ${position.coords.longitude.toFixed(4)}`; setLocation(loc); native.showToast(`Location: ${loc}`); native.vibrate('medium'); } } }, { icon: , label: 'Notify', color: 'from-orange-500 to-red-500', action: async () => { await native.sendLocalNotification('AeThex OS', 'Test notification from your OS!'); native.vibrate('light'); } }, { icon: , label: 'Clipboard', color: 'from-yellow-500 to-amber-500', action: async () => { await native.copyToClipboard('AeThex OS - The Future is Now'); } }, { icon: , label: 'Save File', color: 'from-indigo-500 to-blue-500', action: async () => { const success = await native.saveFile( JSON.stringify({ timestamp: Date.now(), app: 'AeThex OS' }), `aethex-${Date.now()}.json` ); if (success) native.vibrate('medium'); } }, { icon: , label: 'Browser', color: 'from-teal-500 to-cyan-500', action: async () => { await native.openInBrowser('https://github.com'); native.vibrate('light'); } }, { icon: native.networkStatus.connected ? : , label: native.networkStatus.connected ? 'Online' : 'Offline', color: native.networkStatus.connected ? 'from-green-500 to-emerald-500' : 'from-gray-500 to-slate-500', action: () => { native.showToast( `Network: ${native.networkStatus.connectionType} (${native.networkStatus.connected ? 'Connected' : 'Disconnected'})` ); } } ]; return ( <> {/* Floating Action Button */} setIsOpen(!isOpen)} whileTap={{ scale: 0.9 }} className="fixed bottom-24 right-6 w-14 h-14 rounded-full bg-gradient-to-br from-cyan-500 to-purple-600 shadow-lg shadow-cyan-500/50 flex items-center justify-center z-40" >
+
{/* Quick Actions Menu */} {isOpen && ( <> {/* Backdrop */} setIsOpen(false)} className="fixed inset-0 bg-black/50 backdrop-blur-sm z-30" /> {/* Actions Grid */}
{quickActions.map((action, i) => ( { action.action(); setIsOpen(false); }} className="flex flex-col items-center gap-1 p-2 rounded-xl active:scale-95 transition-transform" >
{action.icon}
{action.label}
))}
{location && (
Last Location:
{location}
)}
Network {native.networkStatus.connectionType}
)}
); }