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:
1 parent
d074322826
commit
093d5b2a11
22 files changed
+241
-204
No files matched your search
+4
-87
@@ -6,7 +6,7 @@
|
||||
browsers don't synthesize fake bold when CSS asks for 500/600+. */
|
||||
@font-face {
|
||||
font-family: 'DM Serif Display';
|
||||
src: url('/fonts/DMSerifDisplay-Regular.ttf') format('truetype');
|
||||
src: url('/fonts/DMSerifDisplay-Regular.woff2') format('woff2');
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
@@ -14,27 +14,12 @@
|
||||
|
||||
@font-face {
|
||||
font-family: 'DM Serif Display';
|
||||
src: url('/fonts/DMSerifDisplay-Italic.ttf') format('truetype');
|
||||
src: url('/fonts/DMSerifDisplay-Italic.woff2') format('woff2');
|
||||
font-weight: 400;
|
||||
font-style: italic;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'DM Sans';
|
||||
src: url('/fonts/DMSans-VariableFont_opsz,wght.ttf') format('truetype');
|
||||
font-weight: 100 900;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'DM Sans';
|
||||
src: url('/fonts/DMSans-Italic-VariableFont_opsz,wght.ttf') format('truetype');
|
||||
font-weight: 100 900;
|
||||
font-style: italic;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
:root {
|
||||
/* ── Paper palette — aligned to the Grove5 marketing site ─────────── */
|
||||
@@ -81,11 +66,11 @@
|
||||
--bag-fruit: #b78f6a; /* warm mushroom cap */
|
||||
|
||||
--font-serif: 'DM Serif Display', 'Baskervville', Georgia, serif;
|
||||
--font-sans: 'DM Sans', system-ui, sans-serif;
|
||||
--font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
|
||||
/* DM Serif Display has a single weight (400) that already reads as
|
||||
display-heavy, so --fw-display resolves to 400 for serif contexts.
|
||||
The sans tokens still drive real weight differences on DM Sans. */
|
||||
System fonts support variable weights for sans contexts. */
|
||||
--fw-display: 400;
|
||||
--fw-title: 500;
|
||||
--fw-body: 400;
|
||||
@@ -164,11 +149,6 @@ html, body {
|
||||
to { transform: translateX(0); }
|
||||
}
|
||||
|
||||
@keyframes slide-out-right {
|
||||
from { transform: translateX(0); }
|
||||
to { transform: translateX(100%); }
|
||||
}
|
||||
|
||||
@keyframes fade-in {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
@@ -179,37 +159,6 @@ html, body {
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
@keyframes shimmer-fruiting {
|
||||
0%, 100% { opacity: 0.85; transform: scale(1); }
|
||||
50% { opacity: 1; transform: scale(1.012); }
|
||||
}
|
||||
|
||||
@keyframes pulse-mycelium {
|
||||
0%, 100% { opacity: 0.85; }
|
||||
50% { opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes pulse-pinning {
|
||||
0%, 100% { opacity: 0.75; }
|
||||
50% { opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes pulse-contam-low {
|
||||
0%, 100% { opacity: 0.65; }
|
||||
50% { opacity: 0.95; }
|
||||
}
|
||||
|
||||
@keyframes pulse-contam-high {
|
||||
0%, 100% { opacity: 0.7; filter: brightness(0.95); }
|
||||
50% { opacity: 1; filter: brightness(1.15); }
|
||||
}
|
||||
|
||||
@keyframes flare {
|
||||
0% { opacity: 1; transform: scale(1); }
|
||||
50% { opacity: 1; transform: scale(1.08); filter: brightness(1.3); }
|
||||
100% { opacity: 1; transform: scale(1); filter: brightness(1); }
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Reusable helpers */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@@ -219,21 +168,12 @@ html, body {
|
||||
font-weight: var(--fw-title);
|
||||
font-feature-settings: 'ss01', 'liga';
|
||||
}
|
||||
.font-serif-body {
|
||||
font-family: var(--font-serif);
|
||||
font-weight: var(--fw-body);
|
||||
}
|
||||
.font-sans { font-family: var(--font-sans); }
|
||||
.italic { font-style: italic; }
|
||||
|
||||
/* Heavier weight utilities */
|
||||
.fw-display { font-weight: var(--fw-display); }
|
||||
.fw-title { font-weight: var(--fw-title); }
|
||||
.fw-body { font-weight: var(--fw-body); }
|
||||
|
||||
.text-ink { color: var(--ink); }
|
||||
.text-muted { color: var(--ink-muted); }
|
||||
.text-forest { color: var(--forest); }
|
||||
|
||||
.eyebrow {
|
||||
font-family: var(--font-sans);
|
||||
@@ -266,16 +206,9 @@ html, body {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pill-neutral { background: var(--paper-3); color: var(--ink-2); }
|
||||
.pill-inoculation { background: var(--paper-3); color: var(--ink-2); }
|
||||
.pill-colonization{ background: var(--forest-tint); color: var(--forest); }
|
||||
.pill-pinning { background: #dfe6ec; color: #3e5468; }
|
||||
.pill-fruiting { background: #eddfc9; color: #7a4a25; }
|
||||
.pill-harvest { background: #f0e0c6; color: var(--attention); }
|
||||
|
||||
.pill-contam-none { background: var(--paper-3); color: var(--ink-muted); }
|
||||
.pill-contam-low { background: #f3e1cb; color: var(--attention); }
|
||||
.pill-contam-high { background: #f0d2cf; color: var(--urgent); }
|
||||
|
||||
/* ── Buttons ────────────────────────────────────────────────────────── */
|
||||
|
||||
@@ -293,22 +226,6 @@ button:focus-visible {
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 10px 18px;
|
||||
border-radius: 999px;
|
||||
background: var(--forest);
|
||||
color: var(--paper);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.01em;
|
||||
transition: background 0.15s, transform 0.15s;
|
||||
}
|
||||
.btn-primary:hover { background: var(--forest-deep); }
|
||||
.btn-primary:active { transform: scale(0.985); }
|
||||
|
||||
.btn-ghost {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -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: {
|
||||
@@ -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,
|
||||
},
|
||||
};
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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> = {
|
||||
|
||||
@@ -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>
|
||||
@@ -14,8 +14,8 @@
|
||||
const { bagId, onBack }: Props = $props();
|
||||
|
||||
const bag = $derived.by<BagState | null>(() => {
|
||||
for (const chamber of cultivar.state.chambers) {
|
||||
for (const slot of chamber.slots) {
|
||||
for (const chamber of cultivar.state.chambers ?? []) {
|
||||
for (const slot of chamber.slots ?? []) {
|
||||
if (slot.bag?.bag_id === bagId) return slot.bag;
|
||||
}
|
||||
}
|
||||
@@ -155,7 +155,7 @@
|
||||
<div class="fact">
|
||||
<dt>
|
||||
Confidence
|
||||
<InfoHint title="Confidence" body="How sure Cultivar is about its reading from the photos. Low confidence usually means the camera lens needs a gentle wipe." side="bottom" />
|
||||
<InfoHint title="Confidence" body="How sure Cultivar is about its reading from the photos. Low confidence usually means the camera can't get a good view. Try giving the lens a gentle wipe or repositioning the bag for a clearer shot." side="bottom" />
|
||||
</dt>
|
||||
<dd class="font-serif">{Math.round(bag.vision.colonization_confidence * 100)}%</dd>
|
||||
</div>
|
||||
@@ -418,6 +418,7 @@
|
||||
.visual-col,
|
||||
.info-col {
|
||||
min-width: 0; /* prevent grid blowout from long inner content */
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.info-col {
|
||||
@@ -436,6 +437,7 @@
|
||||
.bag-twin-container {
|
||||
aspect-ratio: 3/4;
|
||||
max-height: 520px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -678,7 +680,7 @@
|
||||
top: 16px;
|
||||
}
|
||||
.bag-twin-container {
|
||||
max-height: 560px;
|
||||
max-height: calc(100vh - 250px);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+60
-25
@@ -35,8 +35,8 @@
|
||||
const history = $derived(cv.environment.history);
|
||||
const targets = $derived(cv.environment.targets);
|
||||
const hw = $derived(cv.hardware);
|
||||
const colChamber = $derived(chambers.find(c => c.type === 'colonization') ?? chambers[0]);
|
||||
const fruitChamber = $derived(chambers.find(c => c.type === 'fruiting') ?? chambers[1]);
|
||||
const colChamber = $derived(chambers.find(c => c.type === 'colonization') ?? chambers[0] ?? { type: 'colonization', slots: [] });
|
||||
const fruitChamber = $derived(chambers.find(c => c.type === 'fruiting') ?? chambers[1] ?? { type: 'fruiting', slots: [] });
|
||||
|
||||
const allBags = $derived(
|
||||
chambers.flatMap(c =>
|
||||
@@ -75,6 +75,7 @@
|
||||
));
|
||||
const highContam = $derived(allBags.filter(({ bag }) => bag.vision.contamination_risk === 'high'));
|
||||
const lowContam = $derived(allBags.filter(({ bag }) => bag.vision.contamination_risk === 'low' || bag.vision.contamination_risk === 'medium'));
|
||||
const contamConfidence = $derived(allBags.map(({ bag }) => bag.vision.contamination_confidence));
|
||||
|
||||
// ── Climate pattern detection ────────────────────────────────────
|
||||
// Is CO2e on the colonization side consistently high despite the fan working?
|
||||
@@ -112,13 +113,13 @@
|
||||
|
||||
// ── Briefing paragraphs (the "intern voice", now with bag locations) ─
|
||||
const growPara = $derived.by(() => {
|
||||
const sentences: string[] = [];
|
||||
const paragraphs: string[] = [];
|
||||
|
||||
// Harvest-ready
|
||||
if (harvestReady.length > 0) {
|
||||
const list = bagList(harvestReady, allBags);
|
||||
const verb = harvestReady.length === 1 ? 'is' : 'are';
|
||||
sentences.push(`${capFirst(list)} ${verb} ready to pick today, caps full right on schedule.`);
|
||||
paragraphs.push(`${capFirst(list)} ${verb} ready to pick today, caps full right on schedule.`);
|
||||
}
|
||||
|
||||
// Fruiting imminent
|
||||
@@ -128,15 +129,15 @@
|
||||
const label = bagLabel(bag, chamber, allBags);
|
||||
return `${label} (about ${d} day${d === 1 ? '' : 's'} out)`;
|
||||
});
|
||||
sentences.push(
|
||||
paragraphs.push(
|
||||
`${capFirst(joinHuman(items))} ${fruitingSoon.length === 1 ? 'is' : 'are'} fruiting and on track.`
|
||||
);
|
||||
}
|
||||
|
||||
// Pinning — only if we haven't said much yet
|
||||
if (pinning.length > 0 && sentences.length < 2) {
|
||||
if (pinning.length > 0 && paragraphs.length < 2) {
|
||||
const list = bagList(pinning, allBags);
|
||||
sentences.push(
|
||||
paragraphs.push(
|
||||
`${capFirst(list)} started pinning, so little primordia should be popping through the cuts.`
|
||||
);
|
||||
}
|
||||
@@ -145,35 +146,35 @@
|
||||
if (readyToMove.length > 0) {
|
||||
const list = bagList(readyToMove, allBags);
|
||||
const pct = readyToMove[0].bag.vision.colonization_pct;
|
||||
sentences.push(
|
||||
`Over on the colonization side, ${list} finished the mycelium run at ${pct}% and can move to fruiting when you have a minute.`
|
||||
paragraphs.push(
|
||||
`On to colonization...${list} is showing a strong mycelium network at ${pct}% coverage and can move to fruiting when you have a minute.`
|
||||
);
|
||||
}
|
||||
|
||||
// Contamination — kept specific but never alarmist
|
||||
if (highContam.length > 0) {
|
||||
const list = bagList(highContam, allBags);
|
||||
sentences.push(
|
||||
paragraphs.push(
|
||||
`The camera picked up a contamination signal on ${list}. Worth opening the door today and having a quick look.`
|
||||
);
|
||||
} else if (lowContam.length > 0) {
|
||||
const list = bagList(lowContam, allBags);
|
||||
sentences.push(
|
||||
`${capFirst(list)} shows a faint contamination hint, nothing serious, just one to glance at next time you're nearby.`
|
||||
paragraphs.push(
|
||||
`${capFirst(list)} shows a faint potential contamination signal. Nothing serious, just one to glance at next time you're nearby.`
|
||||
);
|
||||
}
|
||||
|
||||
// Calm day
|
||||
if (sentences.length === 0) {
|
||||
if (paragraphs.length === 0) {
|
||||
const total = allBags.length;
|
||||
sentences.push(
|
||||
paragraphs.push(
|
||||
total > 0
|
||||
? `All ${total} bags are tracking along today. Nothing needs you.`
|
||||
: `Your Cultivar is empty, resting until the next batch.`
|
||||
);
|
||||
}
|
||||
|
||||
return sentences.join(' ');
|
||||
return paragraphs;
|
||||
});
|
||||
|
||||
const climatePara = $derived.by(() => {
|
||||
@@ -531,10 +532,20 @@
|
||||
|
||||
<!-- The intern briefing — two short paragraphs of plain language -->
|
||||
<div class="briefing">
|
||||
<p class="brief-par">{growPara}</p>
|
||||
{#each growPara as para}
|
||||
<p class="brief-par">{para}</p>
|
||||
{/each}
|
||||
<p class="brief-par">{climatePara}</p>
|
||||
</div>
|
||||
|
||||
<!-- Decorative illustration for wide screens (fills whitespace) -->
|
||||
<img
|
||||
src="/img/illustration.webp"
|
||||
alt=""
|
||||
class="hero-illustration"
|
||||
loading="lazy"
|
||||
/>
|
||||
|
||||
<div class="hero-stats">
|
||||
|
||||
<div class="hs-item">
|
||||
@@ -582,6 +593,7 @@
|
||||
|
||||
<!-- ═══ Rhythm — everything you can / should do ═══ -->
|
||||
<aside class="rhythm" aria-label="On your list">
|
||||
<div>
|
||||
<div class="rhythm-head">
|
||||
<div class="eyebrow">Rhythm</div>
|
||||
<h3 class="rhythm-title font-serif">On your list</h3>
|
||||
@@ -651,12 +663,12 @@
|
||||
Nothing on your list. Cultivar's taking care of the rest.
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="rhythm-foot">
|
||||
<span class="rhythm-foot-line font-serif italic">
|
||||
Cultivar handles humidification, airflow, and lighting on its own.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rhythm-foot">
|
||||
<span class="rhythm-foot-line font-serif italic">
|
||||
Cultivar is handling humidification, CO₂ & O₂ exchange, and light intensity and timing.
|
||||
</span>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</section>
|
||||
@@ -757,6 +769,20 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
position: relative; /* for absolute positioning of illustration */
|
||||
}
|
||||
|
||||
.hero-illustration {
|
||||
display: none; /* hidden on smaller screens */
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
left: calc(50ch + 5%); /* to the right of briefing max-width */
|
||||
width: auto;
|
||||
height: 65%;
|
||||
object-fit: contain;
|
||||
opacity: 0.75;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.hero-head {
|
||||
@@ -784,7 +810,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
max-width: 62ch;
|
||||
max-width: 50ch;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.brief-par {
|
||||
@@ -835,8 +861,10 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
z-index: 1;
|
||||
min-width: 0;
|
||||
align-self: stretch;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.rhythm-head { display: flex; flex-direction: column; gap: 3px; }
|
||||
@@ -951,7 +979,7 @@
|
||||
/* ── Rhythm footer — soft reminder that Cultivar handles the rest ── */
|
||||
.rhythm-foot {
|
||||
margin-top: 4px;
|
||||
padding-top: 14px;
|
||||
padding-top: 20px;
|
||||
border-top: 1px dashed var(--line);
|
||||
}
|
||||
.rhythm-foot-line {
|
||||
@@ -985,10 +1013,17 @@
|
||||
.foot-sep { opacity: 0.4; }
|
||||
|
||||
/* ── Responsive ── */
|
||||
@media (max-width: 980px) {
|
||||
@media (min-width: 1100px) {
|
||||
.hero-illustration {
|
||||
display: block; /* show on very wide screens with whitespace */
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 950px) {
|
||||
.hero {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 24px;
|
||||
max-width: 50ch;
|
||||
}
|
||||
.hero-stats { margin-top: 6px; }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user