import { useStore } from '@nanostores/react'; import { uiState, closeMobileMenu, showHelp } from '../stores/ui'; import { $appSettings, updateAppSettings } from '../stores/appSettings'; import { VALUE_MODES, ValueMode } from '../utils/constants'; import { $input } from '../stores/input'; import { LucideIcon } from '../hooks/useLucideIcon'; import { useAudio } from '../hooks/useAudio'; function getValueModeLabel(mode: string): string { const labels: Record = { integer: 'Integer (0-255)', float: 'Float (0.0-1.0)', polar: 'Polar (angle-based)', distance: 'Distance (radial)', wave: 'Wave (ripple)', fractal: 'Fractal (recursive)', cellular: 'Cellular (automata)', noise: 'Noise (perlin-like)', warp: 'Warp (space deformation)', flow: 'Flow (fluid dynamics)', }; return labels[mode] || mode; } export function MobileMenu() { const ui = useStore(uiState); const settings = useStore($appSettings); const input = useStore($input); const { setupAudio, disableAudio } = useAudio(); const handleFullscreen = () => { closeMobileMenu(); if (!document.fullscreenElement) { document.documentElement.requestFullscreen(); } else { document.exitFullscreen(); } }; const handleShare = () => { closeMobileMenu(); // Implement share functionality }; const handleExportPNG = () => { closeMobileMenu(); const canvas = document.getElementById('canvas') as HTMLCanvasElement; if (canvas) { const link = document.createElement('a'); link.download = `bitfielder-${Date.now()}.png`; link.href = canvas.toDataURL('image/png'); link.click(); } }; const handleAudioToggle = async () => { closeMobileMenu(); if (input.audioEnabled) { disableAudio(); } else { await setupAudio(); } }; const handleHelp = () => { closeMobileMenu(); showHelp(); }; return ( <>
updateAppSettings({ uiOpacity: parseInt(e.target.value) / 100 }) } />
); }