Switch from custom fonts to system fonts and remove unused styles

Replace DM Sans with system font stack, convert DM Serif Display to woff2 format, and remove unused animations, button styles, pill variants, and mock data file.
This commit is contained in:
grove5_admin committed 2026-04-27 18:39:38 -07:00
1 parent d074322826
commit 093d5b2a11
22 files changed
+241 -204

No files matched your search

+26 -28
View File
@@ -5,9 +5,9 @@ const HOUR = 3600;
function genEnvHistory(): EnvironmentReading[] {
const pts: EnvironmentReading[] = [];
for (let i = 1440; i >= 0; i--) {
for (let i = 200; i >= 0; i--) {
const t = NOW - i * 60;
const phase = (i / 1440) * Math.PI * 4;
const phase = (i / 200) * Math.PI * 4;
pts.push({
ts: t,
temp_c: 22.5 + Math.sin(phase) * 0.8 + (Math.random() - 0.5) * 0.2,
@@ -63,19 +63,16 @@ function genSnapshots(inoculatedTs: number, count: number): BagSnapshot[] {
return snaps;
}
// Colonization chamber inoculation dates (active grows)
const inoculatedA1 = NOW - 12 * HOUR * 24; // Blue Oyster, ~mid colonization
const inoculatedA2 = NOW - 8 * HOUR * 24; // Blue Oyster, earlier
const inoculatedB1 = NOW - 18 * HOUR * 24; // Golden Oyster, nearly done
const inoculatedB2 = NOW - 5 * HOUR * 24; // Lion's Mane, just started
const inoculatedA1 = NOW - 12 * HOUR * 24;
const inoculatedA2 = NOW - 8 * HOUR * 24;
const inoculatedB1 = NOW - 18 * HOUR * 24;
const inoculatedB2 = NOW - 5 * HOUR * 24;
const inoculatedF_A1 = NOW - 24 * HOUR * 24;
const inoculatedF_A2 = NOW - 28 * HOUR * 24;
const inoculatedF_B2 = NOW - 20 * HOUR * 24;
const inoculatedF_C1 = NOW - 22 * HOUR * 24;
// Fruiting chamber bags (already fully colonized, now pinning/fruiting)
const inoculatedF_A1 = NOW - 24 * HOUR * 24; // Lion's Mane, fruiting
const inoculatedF_A2 = NOW - 28 * HOUR * 24; // Golden Oyster, harvest-ready
const inoculatedF_B2 = NOW - 20 * HOUR * 24; // Shiitake, pinning
const inoculatedF_C1 = NOW - 22 * HOUR * 24; // Pink Oyster, fruiting
export const mockState: CultivarState = {
export const initialState: CultivarState = {
meta: {
device_id: 'CVR-0042',
firmware_version: '0.9.4',
@@ -100,7 +97,7 @@ export const mockState: CultivarState = {
id: 'a2',
type: 'co2_elevated',
severity: 'warn',
message: 'CO₂e is elevated on the colonization side — the air exchange ports may need a quick wipe. Or, open a window near the Cultivar to help air exchange.',
message: 'CO₂e is slightly elevated on the colonization side — the air exchange ports may need a quick wipe or a filter change. Alternatively, open a window near Cultivar to aid fresh air exchange.',
ts: NOW - 1800,
dismissed: false,
},
@@ -135,6 +132,7 @@ export const mockState: CultivarState = {
colonization_pct: 68,
colonization_confidence: 0.91,
contamination_risk: 'low',
contamination_confidence: 0.22,
stage: 'colonization',
snapshots: genSnapshots(inoculatedA1, 4),
projection: {
@@ -161,6 +159,7 @@ export const mockState: CultivarState = {
colonization_pct: 42,
colonization_confidence: 0.87,
contamination_risk: 'none',
contamination_confidence: 0.94,
stage: 'colonization',
snapshots: genSnapshots(inoculatedA2, 3),
projection: {
@@ -187,6 +186,7 @@ export const mockState: CultivarState = {
colonization_pct: 94,
colonization_confidence: 0.96,
contamination_risk: 'none',
contamination_confidence: 0.95,
stage: 'fruiting',
snapshots: genSnapshots(inoculatedB1, 6),
projection: {
@@ -213,6 +213,7 @@ export const mockState: CultivarState = {
colonization_pct: 18,
colonization_confidence: 0.79,
contamination_risk: 'none',
contamination_confidence: 0.88,
stage: 'inoculation',
snapshots: genSnapshots(inoculatedB2, 2),
projection: {
@@ -262,6 +263,7 @@ export const mockState: CultivarState = {
colonization_pct: 100,
colonization_confidence: 0.96,
contamination_risk: 'none',
contamination_confidence: 0.95,
stage: 'fruiting',
snapshots: genSnapshots(inoculatedF_A1, 5),
projection: {
@@ -288,6 +290,7 @@ export const mockState: CultivarState = {
colonization_pct: 100,
colonization_confidence: 0.97,
contamination_risk: 'none',
contamination_confidence: 0.96,
stage: 'harvest',
snapshots: genSnapshots(inoculatedF_A2, 6),
projection: {
@@ -319,6 +322,7 @@ export const mockState: CultivarState = {
colonization_pct: 100,
colonization_confidence: 0.94,
contamination_risk: 'none',
contamination_confidence: 0.93,
stage: 'pinning',
snapshots: genSnapshots(inoculatedF_B2, 5),
projection: {
@@ -345,6 +349,7 @@ export const mockState: CultivarState = {
colonization_pct: 100,
colonization_confidence: 0.92,
contamination_risk: 'none',
contamination_confidence: 0.91,
stage: 'fruiting',
snapshots: genSnapshots(inoculatedF_C1, 5),
projection: {
@@ -363,27 +368,22 @@ export const mockState: CultivarState = {
},
],
hardware: {
// Two fans — one per compartment, used for fresh-air exchange
fans: [
{ id: 'fan-col', chamber_id: 'main', speed_pct: 0, mode: 'auto' },
{ id: 'fan-col', chamber_id: 'main', speed_pct: 0, mode: 'auto' },
{ id: 'fan-fruit', chamber_id: 'second', speed_pct: 100, mode: 'auto' },
],
// One ultrasonic humidifier in the base, feeds both compartments via ducting
humidifier: { active: true, mode: 'auto', reservoir_pct: 72 },
// Per-compartment lighting. Colonization = utility (work + photo, off by default).
// Fruiting = display / mild grow light, always dim-warm by default.
lights: [
{ id: 'light-col-work', chamber_id: 'main', purpose: 'work', on: false, color_hex: '#f4ecd8', brightness: 0 },
{ id: 'light-col-photo', chamber_id: 'main', purpose: 'photo', on: false, color_hex: '#f4ecd8', brightness: 0 },
{ id: 'light-fruit-grow', chamber_id: 'second', purpose: 'grow', on: true, color_hex: '#f7f0dc', brightness: 0.55 },
{ id: 'light-col-work', chamber_id: 'main', purpose: 'work', on: false, color_hex: '#f4ecd8', brightness: 0 },
{ id: 'light-col-photo', chamber_id: 'main', purpose: 'photo', on: false, color_hex: '#f4ecd8', brightness: 0 },
{ id: 'light-fruit-grow', chamber_id: 'second', purpose: 'grow', on: true, color_hex: '#f7f0dc', brightness: 0.55 },
],
// Reed-switch door sensors — fruiting is showing open for the demo
doors: [
{ id: 'door-col', chamber_id: 'main', open: false },
{ id: 'door-col', chamber_id: 'main', open: false },
{ id: 'door-fruit', chamber_id: 'second', open: false },
],
cameras: [
{ id: 'cam-col', chamber_id: 'main', position: 'top', last_capture_ts: NOW - 180 },
{ id: 'cam-col', chamber_id: 'main', position: 'top', last_capture_ts: NOW - 180 },
{ id: 'cam-fruit', chamber_id: 'second', position: 'top', last_capture_ts: NOW - 180 },
],
},
@@ -404,9 +404,7 @@ export const mockState: CultivarState = {
],
},
maintenance: {
// Wiped 10 days ago — close to due (every 2 weeks)
last_wipe_ts: NOW - 10 * HOUR * 24,
// Reservoir cleaned 16 days ago — still a ways out (every 4 weeks)
last_reservoir_clean_ts: NOW - 16 * HOUR * 24,
},
ui: {
+46
View File
@@ -0,0 +1,46 @@
import type { CultivarState } from './types';
const NOW = Math.floor(Date.now() / 1000);
export const initialState: CultivarState = {
meta: {
device_id: '',
firmware_version: '',
uptime_s: 0,
wifi_rssi: 0,
timestamp_utc: NOW,
},
environment: {
history: [],
live: { temp_c: 0, rh_pct: 0, co2_ppm: 0, co2e_ppm: 0, voc_ppb: 0, vpd: 0 },
targets: { temp_c: 0, rh_pct: 0, co2_ppm: 0 },
alerts: [],
},
chambers: [],
hardware: {
fans: [],
humidifier: { active: false, mode: 'auto', reservoir_pct: 0 },
lights: [],
doors: [],
cameras: [],
},
recipe: {
id: '',
name: '',
species: '',
stage: 'inoculation',
stage_started_ts: 0,
stage_target_duration_h: 0,
stage_history: [],
next_actions: [],
},
maintenance: {
last_wipe_ts: 0,
last_reservoir_clean_ts: 0,
},
ui: {
scrubber_ts: null,
selected_bag_id: null,
onboarding_complete: false,
},
};
+3 -3
View File
@@ -1,12 +1,12 @@
import { mockState } from './mock';
import { initialState } from '@mock-data';
import type { CultivarState, EnvironmentReading, WsDiff } from './types';
function deepClone<T>(v: T): T {
return JSON.parse(JSON.stringify(v));
return structuredClone(v);
}
function createStore() {
let state = $state<CultivarState>(deepClone(mockState));
let state = $state<CultivarState>(deepClone(initialState));
// Mock WS diff interval
let mockInterval: ReturnType<typeof setInterval> | null = null;
+1 -1
View File
@@ -151,7 +151,7 @@
</div>
<button class="details-btn" onclick={onOpenDetails}>
See full history
See details
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" aria-hidden="true">
<path d="M5 3L9 7L5 11" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
+7 -7
View File
@@ -9,15 +9,15 @@
const { onBagClick }: Props = $props();
const chambers = $derived(cultivar.state.chambers);
const colonization = $derived(chambers.find(c => c.type === 'colonization') ?? chambers[0]);
const fruiting = $derived(chambers.find(c => c.type === 'fruiting') ?? chambers[1]);
const colonization = $derived(chambers.find(c => c.type === 'colonization') ?? chambers[0] ?? { slots: [] });
const fruiting = $derived(chambers.find(c => c.type === 'fruiting') ?? chambers[1] ?? { slots: [] });
const hw = $derived(cultivar.state.hardware);
const humidOn = $derived(hw.humidifier.active);
// Two fans — one per compartment, used for fresh-air exchange
const colFan = $derived(hw.fans.find(f => f.chamber_id === 'main') ?? hw.fans[0]);
const fruitFan = $derived(hw.fans.find(f => f.chamber_id === 'second') ?? hw.fans[1]);
const colFan = $derived(hw.fans.find(f => f.chamber_id === 'main') ?? hw.fans[0] ?? { speed_pct: 0 });
const fruitFan = $derived(hw.fans.find(f => f.chamber_id === 'second') ?? hw.fans[1] ?? { speed_pct: 0 });
function spinDur(speed: number): string {
return speed > 0 ? `${(0.5 + (1 - speed / 100) * 2.4).toFixed(2)}s` : '4s';
@@ -29,8 +29,8 @@
// Lights per compartment — colonization has utility lights (usually off),
// fruiting has a grow/display light
const colWorkLight = $derived(hw.lights.find(l => l.chamber_id === 'main' && l.purpose === 'work'));
const fruitGrowLight = $derived(hw.lights.find(l => l.chamber_id === 'second' && l.purpose === 'grow'));
const colWorkLight = $derived(hw.lights.find(l => l.chamber_id === 'main' && l.purpose === 'work') ?? { on: false, brightness: 0, color_hex: '#f4ecd8' });
const fruitGrowLight = $derived(hw.lights.find(l => l.chamber_id === 'second' && l.purpose === 'grow') ?? { on: false, brightness: 0, color_hex: '#f7f0dc' });
// Door state
const colDoorOpen = $derived(hw.doors.find(d => d.chamber_id === 'main')?.open ?? false);
@@ -132,7 +132,7 @@
// Humidity readout (live) — shown inside the fruiting compartment
// so users instantly associate the fog with humidity.
const fruitRh = $derived(fruiting.environment.rh_pct);
const fruitRh = $derived(fruiting.environment?.rh_pct ?? 0);
// Reservoir water level. The bottle's usable interior runs from y=4.4
// to y=20.9 in local coords (height 16.5). Water surface sits at
+1
View File
@@ -20,6 +20,7 @@ export type BagVision = {
colonization_pct: number;
colonization_confidence: number;
contamination_risk: 'none' | 'low' | 'medium' | 'high';
contamination_confidence: number;
stage: 'inoculation' | 'colonization' | 'pinning' | 'fruiting' | 'harvest';
snapshots: BagSnapshot[];
projection: {
+29 -26
View File
@@ -11,8 +11,11 @@
const winMs: Record<Win, number> = { '1h': 0, '6h': 30_000, '24h': 120_000 };
const chambers = $derived(cultivar.state.chambers);
const colonization = $derived(chambers.find(c => c.type === 'colonization') ?? chambers[0]);
const fruiting = $derived(chambers.find(c => c.type === 'fruiting') ?? chambers[1]);
const colonization = $derived(chambers.find(c => c.type === 'colonization') ?? chambers[0] ?? { type: 'colonization', environment: { temp_c: 0, rh_pct: 0 } });
const fruiting = $derived(chambers.find(c => c.type === 'fruiting') ?? chambers[1] ?? { type: 'fruiting', environment: { temp_c: 0, rh_pct: 0 } });
// Track which hint is currently open (only one at a time)
let openHintKey = $state<string | null>(null);
// Throttled snapshot of the global history
const history = $derived(cultivar.state.environment.history);
@@ -42,11 +45,11 @@
const live = (() => {
switch (key) {
case 'temp_c': return ch.environment.temp_c;
case 'rh_pct': return ch.environment.rh_pct;
case 'co2_ppm': return ch.environment.co2_ppm ?? ch.environment.co2e_ppm ?? 0;
case 'co2e_ppm': return ch.environment.co2e_ppm ?? ch.environment.co2_ppm ?? 0;
case 'voc_ppb': return ch.environment.voc_ppb;
case 'temp_c': return ch.environment?.temp_c ?? 0;
case 'rh_pct': return ch.environment?.rh_pct ?? 0;
case 'co2_ppm': return ch.environment?.co2_ppm ?? ch.environment?.co2e_ppm ?? 0;
case 'co2e_ppm': return ch.environment?.co2e_ppm ?? ch.environment?.co2_ppm ?? 0;
case 'voc_ppb': return ch.environment?.voc_ppb ?? 0;
}
})();
const baseline = (() => {
@@ -107,15 +110,13 @@
label: 'Temperature',
unit: '°C',
color: '#2b5a34',
valueFor: (ch) => ch.environment.temp_c.toFixed(1),
valueFor: (ch) => (ch.environment?.temp_c ?? 0).toFixed(1),
seriesFor: (ch) => sliceCh(ch, 'temp_c'),
rangeFor: (ch) => RANGES.temp[ch.type],
rangeLabel:(ch) => `${RANGES.temp[ch.type][0]}–${RANGES.temp[ch.type][1]}°C ideal`,
hint: (ch) => ({
title: `${ch.type === 'colonization' ? 'Colonization' : 'Fruiting'} temperature`,
body: ch.type === 'colonization'
? 'Cultivar follows your room — it has no heater or cooler. If this drifts, try moving the unit away from vents or sunny windows. Cooler seasons? Shiitake and Lion\'s Mane love the chill.'
: 'Fruiting likes it a little cooler than colonization (16–20°C is the sweet spot). Cultivar doesn\'t climate-control this — choose species that match your room, or move the unit to a slightly cooler corner.',
title: 'Temperature',
body: 'Cultivar follows your room temperature (it has no heater or cooler). If this drifts, try moving the unit away from vents or sunny windows. Fruiting likes it a little cooler than colonization (16–20°C is the sweet spot). The higher humidity tends to cool the fruiting air naturally. Choose species that match your room. Cooler seasons? Blue Oyster, Enoki, Shiitake and Lion\'s Mane love the chill. Warm house in the summer? Pink Oyster, Yellow Oyster, Paddy Straw, Almond Agaricus, and Reishi are all tropical species that thrive in the heat.'
}),
},
{
@@ -123,15 +124,13 @@
label: 'Humidity',
unit: '%',
color: '#4b6a84',
valueFor: (ch) => ch.environment.rh_pct.toFixed(0),
valueFor: (ch) => (ch.environment?.rh_pct ?? 0).toFixed(0),
seriesFor: (ch) => sliceCh(ch, 'rh_pct'),
rangeFor: (ch) => RANGES.humid[ch.type],
rangeLabel:(ch) => `${RANGES.humid[ch.type][0]}–${RANGES.humid[ch.type][1]}% ideal`,
hint: (ch) => ({
title: `${ch.type === 'colonization' ? 'Colonization' : 'Fruiting'} humidity`,
body: ch.type === 'colonization'
? 'Colonization likes moist-but-not-soaked air. If this drops, top up the base humidifier reservoir.'
: 'Fruiting needs very moist air so caps form without drying. Top up the base reservoir if this drifts down.',
title: 'Humidity',
body: 'Colonization likes moist-but-not-soaked air. Fruiting needs very moist air so caps form without drying. Top up the base reservoir or check your humidifier transducer (an easy and cheap replacement) if you notice humidity struggling to keep up.',
}),
},
{
@@ -140,16 +139,14 @@
unit: 'ppm',
color: '#8a6a3d',
valueFor: (ch) => (ch.type === 'colonization'
? (ch.environment.co2e_ppm ?? 0)
: (ch.environment.co2_ppm ?? 0)).toFixed(0),
? (ch.environment?.co2e_ppm ?? 0)
: (ch.environment?.co2_ppm ?? 0)).toFixed(0),
seriesFor: (ch) => sliceCh(ch, ch.type === 'colonization' ? 'co2e_ppm' : 'co2_ppm'),
rangeFor: (ch) => RANGES.co2[ch.type],
rangeLabel:(ch) => ch.type === 'colonization' ? '<1600 ppm ideal' : '<900 ppm ideal',
hint: (ch) => ({
title: `${ch.type === 'colonization' ? 'Colonization' : 'Fruiting'} CO₂`,
body: ch.type === 'colonization'
? 'Mycelium makes CO₂ as it grows — some is actually helpful. If it goes very high, the FAE fan kicks in to exchange air.'
: 'Fruiting mushrooms need fresh air — too much CO₂ and caps come out long-stemmed and small. The fruiting fan pulls in filtered fresh air automatically.',
title: `CO₂`,
body: 'Colonizing mycelium produces CO₂ as it grows — some is actually helpful. If it gets very high, Cultivar\'s colonization fan kicks in automatically to exchange air. Fruiting mushrooms need fresh air — too much CO₂ and caps come out long-stemmed and small. The fruiting fan exchanges filtered fresh air automatically as needed.',
}),
},
{
@@ -157,13 +154,13 @@
label: 'Air quality',
unit: 'ppb',
color: '#7a6d52',
valueFor: (ch) => ch.environment.voc_ppb.toFixed(0),
valueFor: (ch) => (ch.environment?.voc_ppb ?? 0).toFixed(0),
seriesFor: (ch) => sliceCh(ch, 'voc_ppb'),
rangeFor: (ch) => RANGES.voc[ch.type],
rangeLabel:(ch) => `<${RANGES.voc[ch.type][1]} ppb typical`,
hint: () => ({
title: 'Air quality (VOC)',
body: 'Volatile organic compounds. A sudden spike can be an early hint of contamination — it\'s a nose for the chamber.',
body: 'Volatile organic compounds. A sudden spike can be an early hint of contamination or a change in mycelial activity. Worth a quick eyes-on check in either case if you see a large swing.',
}),
},
];
@@ -224,7 +221,13 @@
<!-- Metric label (row header, spans both cells via grid) -->
<div class="row-label">
<span class="rl-name">{m.label}</span>
<InfoHint title={m.hint(colonization).title} body={m.hint(colonization).body} side="bottom" />
<InfoHint
title={m.hint(colonization).title}
body={m.hint(colonization).body}
side="bottom"
open={openHintKey === m.key}
onOpenChange={(open) => openHintKey = open ? m.key : null}
/>
</div>
<!-- Colonization cell -->
+31 -8
View File
@@ -6,18 +6,23 @@
side?: 'top' | 'bottom';
/** Icon size in px */
size?: number;
/** Controlled open state (optional) */
open?: boolean;
/** Callback when open state changes */
onOpenChange?: (open: boolean) => void;
}
const { title, body, side = 'top', size = 14 }: Props = $props();
const { title, body, side = 'top', size = 14, open: controlledOpen, onOpenChange }: Props = $props();
let open = $state(false);
let internalOpen = $state(false);
const open = $derived(controlledOpen ?? internalOpen);
let anchor: HTMLButtonElement | null = $state(null);
const HINT_W = 240;
const HINT_MAX_W = 260;
// Computed floating tooltip position (document-level, not clipped by parents)
let pos = $state<{ left: number; top: number; side: 'top' | 'bottom' }>({ left: 0, top: 0, side });
let pos = $state<{ left: number; top: number; side: 'top' | 'bottom' }>({ left: 0, top: 0, side: 'top' });
function recomputePos() {
if (!anchor) return;
@@ -47,17 +52,34 @@
function toggle(e: MouseEvent) {
e.stopPropagation();
if (!open) recomputePos();
open = !open;
const newOpen = !open;
if (newOpen) recomputePos();
if (controlledOpen !== undefined) {
onOpenChange?.(newOpen);
} else {
internalOpen = newOpen;
}
}
function handleDocClick(e: MouseEvent) {
if (!open) return;
if (anchor && !anchor.contains(e.target as Node)) open = false;
if (anchor && !anchor.contains(e.target as Node)) {
if (controlledOpen !== undefined) {
onOpenChange?.(false);
} else {
internalOpen = false;
}
}
}
function handleKey(e: KeyboardEvent) {
if (e.key === 'Escape') open = false;
if (e.key === 'Escape') {
if (controlledOpen !== undefined) {
onOpenChange?.(false);
} else {
internalOpen = false;
}
}
}
$effect(() => {
@@ -131,7 +153,7 @@
gap: 4px;
animation: rise-in 0.14s ease-out;
pointer-events: auto;
max-width: 260px;
max-width: 360px;
}
/* For top-side, translate up by the tooltip's own height */
.hint-top { transform: translateY(-100%); }
@@ -145,6 +167,7 @@
}
.hint-body {
text-transform: none;
font-size: 12px;
color: var(--ink-2);
line-height: 1.45;
+1 -1
View File
@@ -2,7 +2,7 @@
import { cultivar } from '../store.svelte';
const active = $derived(
cultivar.state.environment.alerts.filter(a => !a.dismissed)
(cultivar.state.environment?.alerts ?? []).filter(a => !a.dismissed)
);
const icons: Record<string, string> = {
+1 -1
View File
@@ -140,6 +140,6 @@
.meta { display: none; }
.live-label { display: none; }
.live { padding: 4px 8px; }
.topbar { padding: 12px 14px 10px; }
.topbar { padding: 12px 14px 10px; grid-template-columns: auto 1fr; }
}
</style>