// App shell: sidebar + routing const ROUTES = [ { key: 'home', label: 'ໜ້າຫຼັກ', group: null, icon: 'home' }, { key: 'small-in', label: 'ຄັງນ້ອຍ ລາຍຮັບ', group: 'ຄັງນ້ອຍ', icon: 'inflow' }, { key: 'small-out', label: 'ຄັງນ້ອຍ ລາຍຈ່າຍ', group: 'ຄັງນ້ອຍ', icon: 'outflow' }, { key: 'big-in', label: 'ຄັງໃຫຍ່ ລາຍຮັບ', group: 'ຄັງໃຫຍ່', icon: 'inflow' }, { key: 'big-out', label: 'ຄັງໃຫຍ່ ລາຍຈ່າຍ', group: 'ຄັງໃຫຍ່', icon: 'outflow' }, { key: 'report', label: 'ລາຍງານ', group: null, icon: 'report' }, ]; function App() { const [store, setStore] = useState(null); // null = ກຳລັງໂຫຼດ const [route, setRoute] = useState('home'); const [navOpen, setNavOpen] = useState(false); const [toastEl, showToast] = useToast(); // load from db.json on mount useEffect(() => { window.TF.loadStore().then(data => setStore(data)); }, []); // save to db.json whenever store changes useEffect(() => { if (store) window.TF.saveStore(store); }, [store]); const go = (r) => { setRoute(r); setNavOpen(false); window.scrollTo({ top: 0 }); }; // loading screen if (!store) { return (