initial commit 3??
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
import { type Component, createSignal, Show, onMount, onCleanup } from 'solid-js';
|
||||
import { Layout } from './components/Layout';
|
||||
import { CriticalView } from './views/CriticalView';
|
||||
import { UrgencyView } from './views/UrgencyView';
|
||||
import { PriorityView } from './views/PriorityView';
|
||||
import { MatrixView } from './views/MatrixView';
|
||||
import { SettingsView } from './views/SettingsView';
|
||||
import { AuthCallback } from './components/Auth';
|
||||
import { pb } from './lib/pocketbase';
|
||||
import { initStore } from './store';
|
||||
|
||||
const App: Component = () => {
|
||||
// Basic routing state
|
||||
const [currentView, setCurrentView] = createSignal("matrix");
|
||||
const [isAuthenticated, setIsAuthenticated] = createSignal(pb.authStore.isValid);
|
||||
|
||||
onMount(() => {
|
||||
const removeListener = pb.authStore.onChange((token) => {
|
||||
setIsAuthenticated(!!token);
|
||||
if (token) {
|
||||
initStore();
|
||||
}
|
||||
}, true);
|
||||
|
||||
onCleanup(() => removeListener());
|
||||
});
|
||||
|
||||
return (
|
||||
<Show when={isAuthenticated()} fallback={<AuthCallback onSuccess={() => { }} />}>
|
||||
<Layout currentView={currentView()} setView={setCurrentView}>
|
||||
<Show when={currentView() === "critical"}><CriticalView /></Show>
|
||||
<Show when={currentView() === "urgency"}><UrgencyView /></Show>
|
||||
<Show when={currentView() === "priority"}><PriorityView /></Show>
|
||||
<Show when={currentView() === "matrix"}><MatrixView /></Show>
|
||||
<Show when={currentView() === "settings"}><SettingsView /></Show>
|
||||
</Layout>
|
||||
</Show>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
Reference in New Issue
Block a user