import React, { useState } from 'react' import { actionsAPI } from '../api/client' import toast from 'react-hot-toast' import { useStore } from '../stores/appStore' interface QuickActionsProps { mobile?: boolean } const QuickActions: React.FC = ({ mobile = false }) => { const [isOpen, setIsOpen] = useState(false) const { settings } = useStore() const actions = [ { id: 'scorecard', label: 'Scorecard', icon: 'πŸ“Š', key: 't', description: 'Toggle scorecard', }, { id: 'rangefinder', label: 'Range Finder', icon: '🎯', key: 'r', description: 'Launch range finder', }, { id: 'heatmap', label: 'Heat Map', icon: 'πŸ—ΊοΈ', key: 'y', description: 'Toggle heat map', }, { id: 'flyover', label: 'Flyover', icon: '🚁', key: 'o', description: 'Hole preview', }, { id: 'pin', label: 'Pin Indicator', icon: '🚩', key: 'p', description: 'Show/hide pin', }, { id: 'freelook', label: 'Free Look', icon: 'πŸ‘€', key: 'f5', description: 'Unlock camera', }, { id: 'aimpoint', label: 'Aim Point', icon: 'πŸŽͺ', key: 'f3', description: 'Toggle aim point', }, { id: 'tracerclear', label: 'Clear Tracer', icon: 'πŸ’¨', key: 'f1', description: 'Clear ball tracer', }, ] const handleAction = async (action: typeof actions[0]) => { try { await actionsAPI.sendKey(action.key) toast.success(action.description) setIsOpen(false) // Haptic feedback if (settings.hapticFeedback && 'vibrate' in navigator) { navigator.vibrate(10) } } catch (error) { toast.error(`Failed to execute ${action.label}`) } } const handleToggle = () => { setIsOpen(!isOpen) // Haptic feedback if (settings.hapticFeedback && 'vibrate' in navigator) { navigator.vibrate(10) } } if (mobile) { // Mobile version - bottom sheet style return ( <> {/* Floating Action Button */} {/* Bottom Sheet */}

Quick Actions

{actions.map((action) => ( ))}
{/* Backdrop */} {isOpen && (
setIsOpen(false)} /> )} ) } // Desktop version - floating menu return (
{/* Action Menu */}
{actions.map((action) => ( ))}
{/* Floating Action Button */}
) } export default QuickActions