import { Routes, Route, useLocation, A } from '@solidjs/router'; import { LedStripConfiguration } from './components/led-strip-configuration/led-strip-configuration'; import { WhiteBalance } from './components/white-balance/white-balance'; import { LedStripTest } from './components/led-strip-test/led-strip-test'; import { createEffect, createSignal } from 'solid-js'; import { invoke } from '@tauri-apps/api/core'; import { setLedStripStore } from './stores/led-strip.store'; import { LedStripConfigContainer } from './models/led-strip-config'; import { InfoIndex } from './components/info/info-index'; import { DisplayStateIndex } from './components/displays/display-state-index'; import { useLanguage } from './i18n/index'; function App() { const location = useLocation(); const [previousPath, setPreviousPath] = createSignal(''); const { t, locale, setLocale } = useLanguage(); // Monitor route changes and cleanup LED tests when leaving the test page createEffect(() => { const currentPath = location.pathname; const prevPath = previousPath(); // Check if we're leaving the LED test page const isLeavingTestPage = prevPath === '/led-strip-test' && currentPath !== '/led-strip-test'; if (isLeavingTestPage) { // The LED test component will handle stopping the test effect via onCleanup // We just need to ensure test mode is disabled to resume normal LED publishing invoke('disable_test_mode').catch((error) => { console.error('Failed to disable test mode:', error); }); } // Update previousPath after the condition check setPreviousPath(currentPath); }); createEffect(() => { invoke('read_config').then((config) => { setLedStripStore({ strips: config.strips, mappers: config.mappers, colorCalibration: config.color_calibration, }); }).catch((error) => { console.error('Failed to read config:', error); }); }); return (
{/* Fixed Navigation */} {/* Main Content - fills remaining height */}
} />
); } export default App;