diff --git a/bicorder-app/src/App.svelte b/bicorder-app/src/App.svelte index d29a4c2..4835d24 100644 --- a/bicorder-app/src/App.svelte +++ b/bicorder-app/src/App.svelte @@ -9,6 +9,7 @@ import FormRecommendation from './components/FormRecommendation.svelte'; import AnalysisTransitionBanner from './components/AnalysisTransitionBanner.svelte'; import HamburgerMenu from './components/HamburgerMenu.svelte'; + import Landing from './components/Landing.svelte'; import { BicorderClassifier } from './bicorder-classifier'; // Load bicorder data and model from build-time constants @@ -30,6 +31,32 @@ let refreshKey = 0; // Used to force component refresh in focused mode let isHelpOpen = false; + // Show the landing screen on first arrival. Returning users who already have + // a reading in progress skip straight to the diagnostic. Computed + // synchronously (not in onMount) so the landing never flashes for them. + function hasReadingInProgress(): boolean { + if (typeof localStorage === 'undefined') return false; + try { + const saved = localStorage.getItem('bicorder-state'); + if (!saved) return false; + const s = JSON.parse(saved); + const hasProtocol = !!s?.metadata?.protocol; + const hasValue = s?.diagnostic?.some( + (set: any) => set?.gradients?.some((g: any) => g?.value !== null && g?.value !== undefined) + ); + return hasProtocol || hasValue; + } catch { + return false; + } + } + + let started = hasReadingInProgress(); + + function startReading() { + started = true; + currentScreen = 0; + } + // Screen types type Screen = | { type: 'metadata' } @@ -432,6 +459,9 @@ +{#if !started} + +{:else}
@@ -519,12 +549,6 @@ {:else} - {#if currentScreen === 0} -
-

A diagnostic tool for the study of protocols

-
- {/if} -
{#if currentScreenData.type === 'metadata'}
@@ -679,6 +703,7 @@
{/if}
+{/if}