Style & brand alignment. Basic version
This commit is contained in:
1 parent
92be365e0c
commit
d074322826
38 files changed
+4336
-2973
No files matched your search
@@ -0,0 +1,165 @@
|
||||
# Cultivar — Voice & Writing Style
|
||||
|
||||
This is the reference for every word that appears in the Cultivar app. When in
|
||||
doubt, re-read it. When you add copy, check it against the rules below.
|
||||
|
||||
## 1. Voice in one line
|
||||
|
||||
> A thoughtful friend who checked in on your grow while you were busy, and
|
||||
> wants to tell you about it over coffee.
|
||||
|
||||
Warm, specific, calm, quietly knowledgeable. Never anxious. Never condescending.
|
||||
Never marketing-speak.
|
||||
|
||||
## 2. Tone rules
|
||||
|
||||
### Do
|
||||
|
||||
- **Reassure first.** Lead with what's going well. Mention what needs attention
|
||||
as context, not as an alarm.
|
||||
- **Be specific.** Name the bag. Name the compartment. Name the number.
|
||||
Vagueness reads as hand-waving.
|
||||
- **Write short sentences.** Vary rhythm: a short one, then a medium one, then
|
||||
a short one again.
|
||||
- **Use the active voice.** "The fan kicked in" > "the fan has been activated".
|
||||
- **Speak in second person.** "Your Cultivar", "you'll see", never "the user".
|
||||
- **Use plain English.** "Keeps the air fresh" > "facilitates gas exchange".
|
||||
|
||||
### Don't
|
||||
|
||||
- **No anxiety vocabulary.** Banned phrases:
|
||||
- ~~"Keep an eye out"~~ ~~"Watch out"~~ ~~"Heads up"~~ ~~"Warning:"~~
|
||||
- ~~"Be careful"~~ ~~"Pay attention to"~~ ~~"Critical"~~ ~~"Act now"~~
|
||||
- ~~"Alert:"~~ ~~"Urgent:"~~ ~~"Issue detected"~~
|
||||
|
||||
Use instead:
|
||||
- "One small thing." · "A gentle nudge." · "When you have a minute."
|
||||
- "Something to look at today." · "Worth a peek."
|
||||
- **No em-dash overload.** Budget: **1 em-dash per paragraph**, max 2 in the
|
||||
whole briefing. If you catch yourself with more, convert to periods, commas,
|
||||
or parentheses. Three em-dashes in a row is a tell of AI writing.
|
||||
- **No exclamation points** except for genuine celebrations (first harvest,
|
||||
etc.). Even then, one per page at most.
|
||||
- **No technical jargon** unless it's explained in the same sentence.
|
||||
"VOC (volatile organic compounds)" on first mention, "VOC" thereafter.
|
||||
- **No false urgency.** Don't say "today" unless it genuinely is today.
|
||||
- **No marketing adjectives** ("revolutionary", "cutting-edge", "seamless").
|
||||
|
||||
## 3. Headline rules
|
||||
|
||||
Headlines drive the emotional register of the whole page. They are the
|
||||
first thing the reader sees. Always reassuring, never alarming.
|
||||
|
||||
| Situation | Good | Bad |
|
||||
|------------------------------------|--------------------------------|------------------------|
|
||||
| Everything fine | *All growing nicely.* | *No issues.* |
|
||||
| Harvest day | *Harvest day.* | *Action required.* |
|
||||
| Bag ready to move | *Time for the next step.* | *Bag ready to migrate* |
|
||||
| Low-risk contamination | *One small thing.* | *Keep an eye out.* |
|
||||
| High-risk contamination | *One thing worth checking.* | *Contamination alert!* |
|
||||
| Climate drifting | *The climate wants a nudge.* | *Climate is failing.* |
|
||||
|
||||
The italic accent word is always the softest, most human ending. **"Harvest
|
||||
*day*."** not **"Harvest *is ready*."**.
|
||||
|
||||
## 4. Bag references
|
||||
|
||||
Species names alone cause confusion when a species appears more than once.
|
||||
Always disambiguate with **location** when needed.
|
||||
|
||||
### The slot grid (each compartment)
|
||||
|
||||
```
|
||||
top-left top-right
|
||||
middle-left middle-right
|
||||
bottom-left bottom-right
|
||||
```
|
||||
|
||||
### Reference formula
|
||||
|
||||
Pick the **shortest unambiguous** form:
|
||||
|
||||
1. Just species (`Lion's Mane`) — only if it's the **only one in its compartment**
|
||||
2. Species + position (`the top-left Lion's Mane`) — if compartment is obvious
|
||||
from context
|
||||
3. Full (`the top-left Lion's Mane on the fruiting side`) — across compartments
|
||||
or when unclear
|
||||
|
||||
Use `bagLabel(bag, chamber, allBags, form)` from `@/Users/chris/Development/cultivar-c5/src/lib/bag-label.ts`
|
||||
to get the right form automatically.
|
||||
|
||||
### Examples
|
||||
|
||||
- **One Golden Oyster in fruiting, one in colonization** (two different stages):
|
||||
- Good: *"The Golden Oyster on the fruiting side is ready to pick. Over in
|
||||
colonization, the other Golden Oyster has finished growing."*
|
||||
- Bad: *"The Golden Oyster is ready to pick. The Golden Oyster has finished
|
||||
growing."*
|
||||
- **Two Blue Oysters in colonization:**
|
||||
- Good: *"The Blue Oysters on the top shelf are both on track."*
|
||||
- Good: *"The top-left Blue Oyster is slightly ahead of its neighbor."*
|
||||
- Bad: *"The Blue Oyster is ahead. The Blue Oyster is behind."*
|
||||
|
||||
## 5. Nature metaphors for compartments
|
||||
|
||||
The two sides of Cultivar mirror two moments in a mushroom's life.
|
||||
|
||||
- **Colonization** — underground, where mycelium runs through the soil.
|
||||
Descriptors: dark, still, warm, undisturbed, patient, quiet. Never
|
||||
*"empty"* or *"boring"*.
|
||||
|
||||
Captions:
|
||||
- *"Like a forest floor, underground."*
|
||||
- *"Dark and still, the way mycelium likes it."*
|
||||
|
||||
- **Fruiting** — a shaded glade after rain, where the fungus finally breaks
|
||||
through and makes caps. Descriptors: humid, lit, breezy, fresh, alive.
|
||||
Never *"chamber"* (too clinical) when *"side"* or *"compartment"* works.
|
||||
|
||||
Captions:
|
||||
- *"Like a shaded glade after rain."*
|
||||
- *"Lit and humid, ready to fruit."*
|
||||
|
||||
## 6. Sentence templates
|
||||
|
||||
When writing briefing paragraphs, try these patterns:
|
||||
|
||||
- **"The [location] [species] [is/has/will] [state]."**
|
||||
— *"The top-right Golden Oyster is ready to pick today."*
|
||||
- **"Over [on/in] the [compartment], [location] [species] [state]."**
|
||||
— *"Over on the colonization side, the middle-left Golden Oyster has
|
||||
finished its mycelium run."*
|
||||
- **"[Location] [species] and [location] [species] are both [state]."**
|
||||
— *"The top-left Lion's Mane and the bottom-left Pink Oyster are both
|
||||
fruiting nicely."*
|
||||
|
||||
## 7. Technical terms and hints
|
||||
|
||||
The app should explain technical concepts in the sentence they first appear,
|
||||
not hide them behind tooltips only.
|
||||
|
||||
- **VOC**: "a whiff of anything off-gassing"
|
||||
- **CO₂e**: "a combined estimate of carbon dioxide and CO₂-equivalent gases"
|
||||
- **FAE**: "fresh air exchange" or just "the fan swapping chamber air for room air"
|
||||
- **Pinning**: "little primordia popping through the cuts" or "mushroom pins
|
||||
forming"
|
||||
- **Substrate**: "the food the mycelium grew on"
|
||||
|
||||
## 8. Localization readiness
|
||||
|
||||
- Avoid regionalisms (*"y'all"*, *"mate"*, *"yonks"*).
|
||||
- Measurement: metric first, imperial in parentheses if both are common
|
||||
(*"~1 kg (about 2 lb)"*).
|
||||
- Dates: spell out month abbreviations (*"Apr 17"*), never all-numeric
|
||||
(*"4/17"* is ambiguous).
|
||||
|
||||
## 9. Review checklist
|
||||
|
||||
Before shipping any copy, scan it for:
|
||||
|
||||
- [ ] Any anxiety words from the banned list?
|
||||
- [ ] More than 2 em-dashes in a paragraph?
|
||||
- [ ] Any species reference that appears twice without disambiguation?
|
||||
- [ ] Any technical term not explained in plain English?
|
||||
- [ ] Does the headline reassure first?
|
||||
- [ ] Could the sentence be 20% shorter with no loss of meaning?
|
||||
+239
-93
@@ -1,15 +1,21 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* Cultivar · Paper shell with a contained dark "stage" for the chamber viz */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
/* DM Serif Display ships a single weight (400). Declare it honestly so
|
||||
browsers don't synthesize fake bold when CSS asks for 500/600+. */
|
||||
@font-face {
|
||||
font-family: 'Baskervville';
|
||||
src: url('/fonts/Baskervville-VariableFont_wght.ttf') format('truetype');
|
||||
font-weight: 100 900;
|
||||
font-family: 'DM Serif Display';
|
||||
src: url('/fonts/DMSerifDisplay-Regular.ttf') format('truetype');
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Baskervville';
|
||||
src: url('/fonts/Baskervville-Italic-VariableFont_wght.ttf') format('truetype');
|
||||
font-weight: 100 900;
|
||||
font-family: 'DM Serif Display';
|
||||
src: url('/fonts/DMSerifDisplay-Italic.ttf') format('truetype');
|
||||
font-weight: 400;
|
||||
font-style: italic;
|
||||
font-display: swap;
|
||||
}
|
||||
@@ -31,35 +37,83 @@
|
||||
}
|
||||
|
||||
:root {
|
||||
--color-bg: #070c08;
|
||||
--color-surface: #0e1410;
|
||||
--color-surface-2: #171d18;
|
||||
--color-border: #232922;
|
||||
--color-text: #e2ece0;
|
||||
--color-text-muted: #596056;
|
||||
--color-charcoal: #1e2520;
|
||||
/* ── Paper palette — aligned to the Grove5 marketing site ─────────── */
|
||||
--paper: #F7F5F0; /* cream — the main background */
|
||||
--paper-warm: #FDFCFA; /* warm-white — brightest surface */
|
||||
--paper-2: #EFEBE3; /* slightly recessed surfaces */
|
||||
--paper-3: #E2DDD6; /* dividers, inactive chips (= --border) */
|
||||
--ink: #1C1C1A; /* charcoal — primary text */
|
||||
--ink-2: #3A3A36; /* secondary text */
|
||||
--ink-muted: #6B6B67; /* muted — tertiary / captions */
|
||||
--line: #E2DDD6; /* hairline borders on paper (border) */
|
||||
--line-soft: #EDE8E0; /* even softer */
|
||||
|
||||
/* Brand — signature Cultivar green */
|
||||
--color-sage: #52cb78;
|
||||
--color-sage-dim: #1a4a2c;
|
||||
/* Green — Grove5 signature, olive-warm */
|
||||
--forest: #2D5016; /* --green */
|
||||
--forest-deep: #1E3A10; /* darker still for pressed states */
|
||||
--forest-mid: #4A7C28; /* --green-light (living foliage) */
|
||||
--forest-tint: #EDF2E6; /* --green-pale (mint-wash bg) */
|
||||
--accent: #3D6B1E; /* --accent (secondary green) */
|
||||
|
||||
/* Stage / biome */
|
||||
--color-mycelium: #c0c9b4; /* off-white — colonization */
|
||||
--color-fruiting: #18c8b2; /* vivid teal — clearly distinct from sage */
|
||||
--color-pinning: #7c9cf0; /* periwinkle blue */
|
||||
/* Semantic signal colours (muted on paper) */
|
||||
--good: #2D5016; /* same as --forest */
|
||||
--attention: #B8621E; /* burnt sienna — "look at this" */
|
||||
--urgent: #A83838; /* barn red — real contamination */
|
||||
|
||||
/* Contamination — unmissable signals */
|
||||
--color-contam-low: #f09038; /* amber orange */
|
||||
--color-contam-high: #e43a4c; /* hot red */
|
||||
/* ── Stage palette (inside the chamber viz only) ───────────────────── */
|
||||
--stage-bg: #13160f;
|
||||
--stage-surface: #1a1e17;
|
||||
--stage-line: #2a2e23;
|
||||
--stage-text: #e6e0cc;
|
||||
--stage-muted: #7d8274;
|
||||
--stage-glow: #7cc887; /* soft LED green inside the cabinet */
|
||||
|
||||
--font-serif: 'Baskervville', Georgia, serif;
|
||||
/* Cabinet exterior (reads white like the real product photo) */
|
||||
--cab-body: #f6f2e7;
|
||||
--cab-shadow: #c8bfab;
|
||||
--cab-trim: #b0a78f;
|
||||
--cab-dark: #111411; /* dark compartment interior */
|
||||
|
||||
/* Substrate / bag fills */
|
||||
--bag-grain: #d4c39b; /* uncolonized grain colour */
|
||||
--bag-mycelium: #f4ece0; /* white mycelium wash */
|
||||
--bag-pin: #eadfc9;
|
||||
--bag-fruit: #b78f6a; /* warm mushroom cap */
|
||||
|
||||
--font-serif: 'DM Serif Display', 'Baskervville', Georgia, serif;
|
||||
--font-sans: 'DM Sans', system-ui, sans-serif;
|
||||
|
||||
--radius-sm: 4px;
|
||||
--radius-md: 8px;
|
||||
--radius-lg: 12px;
|
||||
/* 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. */
|
||||
--fw-display: 400;
|
||||
--fw-title: 500;
|
||||
--fw-body: 400;
|
||||
|
||||
--radius-sm: 6px;
|
||||
--radius-md: 10px;
|
||||
--radius-lg: 16px;
|
||||
--radius-xl: 22px;
|
||||
|
||||
--transition-view: 320ms cubic-bezier(0.4, 0, 0.2, 1);
|
||||
|
||||
/* Legacy aliases — keep old component code working while we migrate */
|
||||
--color-bg: var(--paper);
|
||||
--color-surface: var(--paper-2);
|
||||
--color-surface-2: var(--paper-3);
|
||||
--color-border: var(--line);
|
||||
--color-text: var(--ink);
|
||||
--color-text-muted: var(--ink-muted);
|
||||
--color-charcoal: var(--ink);
|
||||
|
||||
--color-sage: var(--forest);
|
||||
--color-sage-dim: var(--forest-tint);
|
||||
--color-mycelium: var(--bag-mycelium);
|
||||
--color-fruiting: var(--bag-fruit);
|
||||
--color-pinning: #7a8fa8;
|
||||
|
||||
--color-contam-low: var(--attention);
|
||||
--color-contam-high: var(--urgent);
|
||||
}
|
||||
|
||||
*, *::before, *::after {
|
||||
@@ -71,12 +125,17 @@
|
||||
html, body {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background: var(--color-bg);
|
||||
color: var(--color-text);
|
||||
background: var(--paper);
|
||||
color: var(--ink);
|
||||
font-family: var(--font-sans);
|
||||
font-size: 14px;
|
||||
line-height: 1.45;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-rendering: optimizeLegibility;
|
||||
/* Prevent browsers from faking bold / italic when a weight isn't shipped
|
||||
(DM Serif Display only has weight 400). */
|
||||
font-synthesis: none;
|
||||
}
|
||||
|
||||
#app {
|
||||
@@ -85,57 +144,19 @@ html, body {
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background:
|
||||
radial-gradient(ellipse 900px 500px at 10% -10%, #eee6d2 0%, transparent 55%),
|
||||
radial-gradient(ellipse 700px 600px at 110% 110%, #e6dfce 0%, transparent 60%),
|
||||
var(--paper);
|
||||
}
|
||||
|
||||
/* Grain overlay */
|
||||
#app::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 9999;
|
||||
opacity: 0.03;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
|
||||
background-repeat: repeat;
|
||||
}
|
||||
|
||||
/* ---- Keyframe animations ---- */
|
||||
|
||||
@keyframes pulse-mycelium {
|
||||
0%, 100% { opacity: 0.7; }
|
||||
50% { opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes pulse-contam-low {
|
||||
0%, 100% { opacity: 0.65; }
|
||||
50% { opacity: 0.95; }
|
||||
}
|
||||
|
||||
@keyframes pulse-contam-high {
|
||||
0%, 100% { opacity: 0.6; filter: brightness(0.9); }
|
||||
50% { opacity: 1; filter: brightness(1.15); }
|
||||
}
|
||||
|
||||
@keyframes shimmer-fruiting {
|
||||
0%, 100% { opacity: 0.7; transform: scale(1); }
|
||||
33% { opacity: 0.9; transform: scale(1.01); }
|
||||
66% { opacity: 0.8; transform: scale(0.99); }
|
||||
}
|
||||
|
||||
@keyframes pulse-pinning {
|
||||
0%, 100% { opacity: 0.65; }
|
||||
50% { opacity: 0.9; }
|
||||
}
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Animations */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@keyframes dot-live {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.3; }
|
||||
}
|
||||
|
||||
@keyframes flare {
|
||||
0% { opacity: 1; transform: scale(1); }
|
||||
50% { opacity: 1; transform: scale(1.08); filter: brightness(1.4); }
|
||||
100% { opacity: 1; transform: scale(1); filter: brightness(1); }
|
||||
50% { opacity: 0.35; }
|
||||
}
|
||||
|
||||
@keyframes slide-in-right {
|
||||
@@ -153,34 +174,110 @@ html, body {
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
/* ---- Utility classes ---- */
|
||||
@keyframes rise-in {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.font-serif { font-family: var(--font-serif); }
|
||||
@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 */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
.font-serif {
|
||||
font-family: var(--font-serif);
|
||||
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); }
|
||||
.text-muted { color: var(--color-text-muted); }
|
||||
.text-sage { color: var(--color-sage); }
|
||||
.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);
|
||||
font-size: 10px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.18em;
|
||||
text-transform: uppercase;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
|
||||
.eyebrow::before {
|
||||
content: '— ';
|
||||
color: var(--forest);
|
||||
letter-spacing: 0;
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 100px;
|
||||
gap: 5px;
|
||||
padding: 3px 9px;
|
||||
border-radius: 999px;
|
||||
font-family: var(--font-sans);
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.02em;
|
||||
background: var(--forest-tint);
|
||||
color: var(--forest);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pill-inoculation { background: color-mix(in srgb, var(--color-text-muted) 20%, transparent); color: var(--color-text-muted); }
|
||||
.pill-colonization { background: color-mix(in srgb, var(--color-sage) 20%, transparent); color: var(--color-sage); }
|
||||
.pill-pinning { background: color-mix(in srgb, var(--color-pinning) 20%, transparent); color: var(--color-pinning); }
|
||||
.pill-fruiting { background: color-mix(in srgb, var(--color-fruiting) 20%, transparent); color: var(--color-fruiting); }
|
||||
.pill-harvest { background: color-mix(in srgb, var(--color-contam-low) 20%, transparent); color: var(--color-contam-low); }
|
||||
.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: transparent; color: var(--color-text-muted); border: 1px solid var(--color-border); }
|
||||
.pill-contam-low { background: color-mix(in srgb, var(--color-contam-low) 15%, transparent); color: var(--color-contam-low); }
|
||||
.pill-contam-high { background: color-mix(in srgb, var(--color-contam-high) 15%, transparent); color: var(--color-contam-high); }
|
||||
.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 ────────────────────────────────────────────────────────── */
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
@@ -191,6 +288,55 @@ button {
|
||||
}
|
||||
|
||||
button:focus-visible {
|
||||
outline: 2px solid var(--color-sage);
|
||||
outline: 2px solid var(--forest);
|
||||
outline-offset: 2px;
|
||||
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;
|
||||
gap: 6px;
|
||||
padding: 9px 14px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid var(--line);
|
||||
background: transparent;
|
||||
color: var(--ink);
|
||||
font-size: 13px;
|
||||
transition: border-color 0.15s, background 0.15s;
|
||||
}
|
||||
.btn-ghost:hover { border-color: var(--forest); background: var(--forest-tint); }
|
||||
|
||||
/* Card surface on paper */
|
||||
.card {
|
||||
background: #fbf7ec;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-lg);
|
||||
}
|
||||
|
||||
/* Subtle scrollbars where we have scrollable regions */
|
||||
.scroll-soft {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--line) transparent;
|
||||
}
|
||||
.scroll-soft::-webkit-scrollbar { width: 6px; height: 6px; }
|
||||
.scroll-soft::-webkit-scrollbar-thumb {
|
||||
background: var(--line);
|
||||
border-radius: 4px;
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
import type { BagState, Chamber } from './types';
|
||||
|
||||
/**
|
||||
* Human-friendly naming for bags. See STYLE.md section 4 for rules.
|
||||
*
|
||||
* The aim is to pick the shortest unambiguous form so copy doesn't feel
|
||||
* clumsy. If the species is unique in its context we use it alone; if
|
||||
* there's a collision we reach for location ("the top-left Blue Oyster").
|
||||
*/
|
||||
|
||||
const ROW_WORD: Record<string, string> = { A: 'top', B: 'middle', C: 'bottom' };
|
||||
const COL_WORD: Record<string, string> = { '1': 'left', '2': 'right' };
|
||||
|
||||
/** Translate a slot id like "B2" into a natural position phrase. */
|
||||
export function slotPosition(slotId: string): string {
|
||||
const row = slotId.charAt(0).toUpperCase();
|
||||
const col = slotId.charAt(1);
|
||||
const rowW = ROW_WORD[row];
|
||||
const colW = COL_WORD[col];
|
||||
if (!rowW || !colW) return slotId;
|
||||
return `${rowW}-${colW}`;
|
||||
}
|
||||
|
||||
export type BagWithChamber = { bag: BagState; chamber: Chamber };
|
||||
|
||||
export type LabelForm =
|
||||
| 'species' // just "Golden Oyster"
|
||||
| 'positioned' // "the top-left Golden Oyster"
|
||||
| 'full' // "the top-left Golden Oyster on the fruiting side"
|
||||
| 'short'; // "top-left" (ultra compact, for UI chips)
|
||||
|
||||
/** How many other bags share this bag's species in a given scope */
|
||||
function speciesCount(bag: BagState, scope: BagWithChamber[]): number {
|
||||
return scope.filter(s => s.bag.tag.strain_name === bag.tag.strain_name).length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pick a label automatically. The caller provides the visible scope — either
|
||||
* the full population of bags, or just the ones in the same chamber.
|
||||
*
|
||||
* `allBags` — every populated bag in Cultivar
|
||||
* `chamberBags` — just the bags in the same compartment as `bag`
|
||||
*/
|
||||
export function bagLabel(
|
||||
bag: BagState,
|
||||
chamber: Chamber,
|
||||
allBags: BagWithChamber[],
|
||||
form?: LabelForm,
|
||||
): string {
|
||||
const chamberBags = allBags.filter(b => b.chamber.id === chamber.id);
|
||||
const inChamber = speciesCount(bag, chamberBags);
|
||||
const overall = speciesCount(bag, allBags);
|
||||
const position = slotPosition(bag.slot_id);
|
||||
|
||||
if (form === 'short') return position;
|
||||
if (form === 'species') return bag.tag.strain_name;
|
||||
|
||||
// Auto-pick the shortest unambiguous phrase
|
||||
if (!form) {
|
||||
if (inChamber > 1) form = 'positioned';
|
||||
else if (overall > inChamber) form = 'full';
|
||||
else form = 'species';
|
||||
}
|
||||
|
||||
const compartment = chamber.type === 'colonization' ? 'colonization side' : 'fruiting side';
|
||||
|
||||
switch (form) {
|
||||
case 'positioned':
|
||||
return `the ${position} ${bag.tag.strain_name}`;
|
||||
case 'full':
|
||||
return `the ${position} ${bag.tag.strain_name} on the ${compartment}`;
|
||||
default:
|
||||
return bag.tag.strain_name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Group several bags for mention in a single sentence. Picks a label form
|
||||
* that disambiguates each one without being repetitive.
|
||||
*/
|
||||
export function bagList(
|
||||
bags: BagWithChamber[],
|
||||
allBags: BagWithChamber[],
|
||||
lastJoiner: string = 'and',
|
||||
): string {
|
||||
const names = bags.map(({ bag, chamber }) => bagLabel(bag, chamber, allBags));
|
||||
if (names.length === 0) return '';
|
||||
if (names.length === 1) return names[0];
|
||||
if (names.length === 2) return `${names[0]} ${lastJoiner} ${names[1]}`;
|
||||
return `${names.slice(0, -1).join(', ')}, ${lastJoiner} ${names[names.length - 1]}`;
|
||||
}
|
||||
@@ -13,17 +13,16 @@
|
||||
curve,
|
||||
inoculatedTs,
|
||||
estimatedReadyTs,
|
||||
width = 300,
|
||||
height = 120,
|
||||
width = 360,
|
||||
height = 160,
|
||||
}: Props = $props();
|
||||
|
||||
const PAD = { top: 16, right: 16, bottom: 28, left: 32 };
|
||||
const PAD = { top: 20, right: 18, bottom: 30, left: 34 };
|
||||
const NOW = $derived(Math.floor(Date.now() / 1000));
|
||||
|
||||
const plotW = $derived(width - PAD.left - PAD.right);
|
||||
const plotH = $derived(height - PAD.top - PAD.bottom);
|
||||
|
||||
// Split curve into past actuals vs projection
|
||||
const pastPoints = $derived(curve.filter(p => p.ts <= NOW));
|
||||
const projPoints = $derived(curve.filter(p => p.ts >= NOW));
|
||||
|
||||
@@ -47,7 +46,12 @@
|
||||
const pastPath = $derived(toPath(pastPoints));
|
||||
const projPath = $derived(toPath(projPoints));
|
||||
|
||||
// Confidence band for projection (±5%)
|
||||
const pastArea = $derived.by(() => {
|
||||
if (pastPoints.length < 2) return '';
|
||||
const lastX = px(pastPoints[pastPoints.length - 1].ts).toFixed(1);
|
||||
return `${pastPath} L${lastX},${(PAD.top + plotH).toFixed(1)} L${px(pastPoints[0].ts).toFixed(1)},${(PAD.top + plotH).toFixed(1)} Z`;
|
||||
});
|
||||
|
||||
const projBand = $derived.by(() => {
|
||||
if (projPoints.length < 2) return '';
|
||||
const upper = projPoints.map(p => ({ ts: p.ts, value: Math.min(100, p.value + 5) }));
|
||||
@@ -59,7 +63,6 @@
|
||||
|
||||
const nowX = $derived(px(NOW));
|
||||
|
||||
// X axis ticks
|
||||
const xTicks = $derived.by(() => {
|
||||
const ticks: { x: number; label: string }[] = [];
|
||||
const step = rangeTs / 4;
|
||||
@@ -68,116 +71,110 @@
|
||||
const d = new Date(ts * 1000);
|
||||
ticks.push({
|
||||
x: px(ts),
|
||||
label: `${d.getMonth() + 1}/${d.getDate()}`,
|
||||
label: `${d.toLocaleDateString([], { month: 'short', day: 'numeric' })}`,
|
||||
});
|
||||
}
|
||||
return ticks;
|
||||
});
|
||||
</script>
|
||||
|
||||
<svg {width} {height} viewBox="0 0 {width} {height}" class="curve-svg" aria-label="Colonization curve">
|
||||
<!-- Y axis labels -->
|
||||
<svg {width} {height} viewBox="0 0 {width} {height}" class="curve-svg" preserveAspectRatio="none" aria-label="Colonization curve">
|
||||
<defs>
|
||||
<linearGradient id="cc-fill" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0%" stop-color="var(--forest)" stop-opacity="0.22"/>
|
||||
<stop offset="100%" stop-color="var(--forest)" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
|
||||
<!-- Y axis gridlines -->
|
||||
{#each [0, 25, 50, 75, 100] as pct}
|
||||
<line
|
||||
x1={PAD.left} y1={py(pct)}
|
||||
x2={PAD.left + plotW} y2={py(pct)}
|
||||
stroke="var(--line-soft)" stroke-width="1"
|
||||
vector-effect="non-scaling-stroke"
|
||||
/>
|
||||
<text
|
||||
x={PAD.left - 6}
|
||||
y={py(pct) + 4}
|
||||
x={PAD.left - 8} y={py(pct) + 3.5}
|
||||
text-anchor="end"
|
||||
font-family="var(--font-sans)"
|
||||
font-size="9"
|
||||
fill="var(--color-text-muted)"
|
||||
font-size="10"
|
||||
fill="var(--ink-muted)"
|
||||
>{pct}%</text>
|
||||
<line
|
||||
x1={PAD.left}
|
||||
y1={py(pct)}
|
||||
x2={PAD.left + plotW}
|
||||
y2={py(pct)}
|
||||
stroke="var(--color-border)"
|
||||
stroke-width="0.5"
|
||||
opacity="0.6"
|
||||
/>
|
||||
{/each}
|
||||
|
||||
<!-- X axis ticks -->
|
||||
<!-- X axis labels -->
|
||||
{#each xTicks as tick}
|
||||
<text
|
||||
x={tick.x}
|
||||
y={height - 8}
|
||||
x={tick.x} y={height - 8}
|
||||
text-anchor="middle"
|
||||
font-family="var(--font-sans)"
|
||||
font-size="8"
|
||||
fill="var(--color-text-muted)"
|
||||
font-size="10"
|
||||
fill="var(--ink-muted)"
|
||||
>{tick.label}</text>
|
||||
{/each}
|
||||
|
||||
<!-- Projection confidence band -->
|
||||
{#if projBand}
|
||||
<path
|
||||
d={projBand}
|
||||
fill="var(--color-sage)"
|
||||
opacity="0.08"
|
||||
/>
|
||||
<path d={projBand} fill="var(--forest)" opacity="0.08"/>
|
||||
{/if}
|
||||
|
||||
<!-- Past area fill -->
|
||||
{#if pastArea}
|
||||
<path d={pastArea} fill="url(#cc-fill)"/>
|
||||
{/if}
|
||||
|
||||
<!-- Projection dashed line -->
|
||||
{#if projPath}
|
||||
<path
|
||||
d={projPath}
|
||||
fill="none"
|
||||
stroke="var(--color-sage)"
|
||||
stroke-width="1.5"
|
||||
stroke-dasharray="5 3"
|
||||
opacity="0.6"
|
||||
stroke-linecap="round"
|
||||
/>
|
||||
<path d={projPath}
|
||||
fill="none" stroke="var(--forest)"
|
||||
stroke-width="1.8" stroke-dasharray="5 4"
|
||||
opacity="0.55" stroke-linecap="round"
|
||||
vector-effect="non-scaling-stroke"/>
|
||||
{/if}
|
||||
|
||||
<!-- Past actuals solid line -->
|
||||
<!-- Past actuals -->
|
||||
{#if pastPath}
|
||||
<path
|
||||
d={pastPath}
|
||||
fill="none"
|
||||
stroke="var(--color-sage)"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
<path d={pastPath}
|
||||
fill="none" stroke="var(--forest)"
|
||||
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
||||
vector-effect="non-scaling-stroke"/>
|
||||
{/if}
|
||||
|
||||
<!-- "Now" vertical marker -->
|
||||
<!-- Now marker -->
|
||||
{#if nowX >= PAD.left && nowX <= PAD.left + plotW}
|
||||
<line
|
||||
x1={nowX}
|
||||
y1={PAD.top}
|
||||
x2={nowX}
|
||||
y2={PAD.top + plotH}
|
||||
stroke="var(--color-text-muted)"
|
||||
stroke-width="1"
|
||||
stroke-dasharray="2 2"
|
||||
opacity="0.5"
|
||||
x1={nowX} y1={PAD.top}
|
||||
x2={nowX} y2={PAD.top + plotH}
|
||||
stroke="var(--ink-muted)" stroke-width="1" stroke-dasharray="2 3" opacity="0.55"
|
||||
vector-effect="non-scaling-stroke"
|
||||
/>
|
||||
<text
|
||||
x={nowX + 3}
|
||||
y={PAD.top + 9}
|
||||
x={nowX + 4} y={PAD.top + 10}
|
||||
font-family="var(--font-sans)"
|
||||
font-size="8"
|
||||
fill="var(--color-text-muted)"
|
||||
letter-spacing="0.05em"
|
||||
font-size="9"
|
||||
fill="var(--ink-2)"
|
||||
letter-spacing="0.08em"
|
||||
>NOW</text>
|
||||
{/if}
|
||||
|
||||
<!-- Estimated ready marker -->
|
||||
<!-- Ready marker -->
|
||||
{#if estimatedReadyTs > NOW}
|
||||
{@const ex = px(estimatedReadyTs)}
|
||||
<line
|
||||
x1={ex}
|
||||
y1={PAD.top}
|
||||
x2={ex}
|
||||
y2={PAD.top + plotH}
|
||||
stroke="var(--color-sage)"
|
||||
stroke-width="0.8"
|
||||
stroke-dasharray="3 2"
|
||||
opacity="0.4"
|
||||
x1={ex} y1={PAD.top}
|
||||
x2={ex} y2={PAD.top + plotH}
|
||||
stroke="var(--forest)" stroke-width="1" stroke-dasharray="3 3" opacity="0.45"
|
||||
vector-effect="non-scaling-stroke"
|
||||
/>
|
||||
<text
|
||||
x={ex - 4} y={PAD.top + 10}
|
||||
text-anchor="end"
|
||||
font-family="var(--font-serif)"
|
||||
font-style="italic"
|
||||
font-size="10"
|
||||
fill="var(--forest)"
|
||||
>ready</text>
|
||||
{/if}
|
||||
</svg>
|
||||
|
||||
|
||||
@@ -1,127 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { EnvironmentReading } from '../types';
|
||||
|
||||
interface Props {
|
||||
history: EnvironmentReading[];
|
||||
targets: { temp_c: number; rh_pct: number; co2_ppm: number };
|
||||
windowPts: number;
|
||||
}
|
||||
|
||||
const { history, targets, windowPts }: Props = $props();
|
||||
|
||||
function scoreReading(r: EnvironmentReading): number {
|
||||
const tempP = Math.min(Math.abs(r.temp_c - targets.temp_c) / 3, 1) * 33;
|
||||
const rhP = Math.min(Math.abs(r.rh_pct - targets.rh_pct) / 10, 1) * 34;
|
||||
const co2P = Math.min(Math.abs((r.co2_ppm ?? r.co2e_ppm ?? 0) - targets.co2_ppm) / 500, 1) * 33;
|
||||
return Math.max(0, Math.round(100 - tempP - rhP - co2P));
|
||||
}
|
||||
|
||||
const pts = $derived(
|
||||
history.slice(-windowPts).map(r => ({ ts: r.ts, v: scoreReading(r) }))
|
||||
);
|
||||
|
||||
const current = $derived(pts.length > 0 ? pts[pts.length - 1].v : 100);
|
||||
|
||||
const lineColor = $derived(
|
||||
current >= 80 ? 'var(--color-sage)'
|
||||
: current >= 50 ? 'var(--color-contam-low)'
|
||||
: 'var(--color-contam-high)'
|
||||
);
|
||||
|
||||
// Normalized 0–100 coordinate space; SVG scales via CSS
|
||||
const linePath = $derived.by(() => {
|
||||
if (pts.length < 2) return '';
|
||||
const minTs = pts[0].ts;
|
||||
const span = (pts[pts.length - 1].ts - minTs) || 1;
|
||||
return pts.map((p, i) => {
|
||||
const x = ((p.ts - minTs) / span) * 100;
|
||||
const y = 100 - p.v;
|
||||
return `${i === 0 ? 'M' : 'L'}${x.toFixed(2)},${y.toFixed(2)}`;
|
||||
}).join(' ');
|
||||
});
|
||||
|
||||
const areaPath = $derived.by(() => {
|
||||
if (pts.length < 2 || !linePath) return '';
|
||||
const minTs = pts[0].ts;
|
||||
const span = (pts[pts.length - 1].ts - minTs) || 1;
|
||||
const lastX = (((pts[pts.length - 1].ts - minTs) / span) * 100).toFixed(2);
|
||||
return `${linePath} L${lastX},100 L0,100 Z`;
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="hs-root">
|
||||
<div class="hs-header">
|
||||
<span class="hs-label">Health</span>
|
||||
<span class="hs-score" style="color: {lineColor}">{current}</span>
|
||||
<span class="hs-max">/100</span>
|
||||
</div>
|
||||
|
||||
<div class="hs-chart">
|
||||
<svg viewBox="0 0 100 100" preserveAspectRatio="none">
|
||||
<defs>
|
||||
<linearGradient id="hs-fill" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0%" stop-color={lineColor} stop-opacity="0.3"/>
|
||||
<stop offset="100%" stop-color={lineColor} stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<line x1="0" y1="50" x2="100" y2="50"
|
||||
stroke="var(--color-border)" stroke-width="0.5"
|
||||
vector-effect="non-scaling-stroke"/>
|
||||
{#if areaPath}
|
||||
<path d={areaPath} fill="url(#hs-fill)"/>
|
||||
{/if}
|
||||
{#if linePath}
|
||||
<path d={linePath} fill="none" stroke={lineColor}
|
||||
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"
|
||||
vector-effect="non-scaling-stroke"/>
|
||||
{/if}
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.hs-root {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.hs-header {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 5px;
|
||||
flex-shrink: 0;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
.hs-label {
|
||||
font-size: 9px;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: var(--color-text-muted);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.hs-score {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 22px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.hs-max {
|
||||
font-size: 10px;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.hs-chart {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
svg {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -3,37 +3,45 @@
|
||||
|
||||
interface Props {
|
||||
data: TimeSeriesPoint[];
|
||||
label: string;
|
||||
value: string;
|
||||
color?: string;
|
||||
targetValue?: number | null;
|
||||
/** Optional healthy range [low, high] — shown as a soft green band */
|
||||
healthyRange?: [number, number] | null;
|
||||
yMin?: number | null;
|
||||
yMax?: number | null;
|
||||
/** Minimum height reserved for the plot (forced padding if series is flat) */
|
||||
smooth?: boolean;
|
||||
}
|
||||
|
||||
const {
|
||||
data,
|
||||
label,
|
||||
value,
|
||||
color = 'var(--color-sage)',
|
||||
targetValue = null,
|
||||
color = 'var(--forest)',
|
||||
healthyRange = null,
|
||||
yMin = null,
|
||||
yMax = null,
|
||||
smooth = false,
|
||||
}: Props = $props();
|
||||
|
||||
const uid = $derived(label.replace(/[^a-z0-9]/gi, '').toLowerCase());
|
||||
const uid = $derived(
|
||||
`lc-${color.replace(/[^a-z0-9]/gi, '').slice(0, 6)}-${Math.random().toString(36).slice(2, 6)}`
|
||||
);
|
||||
|
||||
const paths = $derived.by(() => {
|
||||
if (data.length < 2) return { line: '', area: '', targetY: null as number | null };
|
||||
if (data.length < 2) return { line: '', area: '', lo: 0, hi: 1, loP: 0, hiP: 1 };
|
||||
const minTs = data[0].ts;
|
||||
const span = (data[data.length - 1].ts - minTs) || 1;
|
||||
const vals = data.map(d => d.value);
|
||||
const lo = yMin ?? Math.min(...vals);
|
||||
const hi = yMax ?? Math.max(...vals);
|
||||
const range = hi - lo || 1;
|
||||
// Extend the domain to cover the healthy range, so it's always visible
|
||||
const loR = healthyRange ? Math.min(lo, healthyRange[0]) : lo;
|
||||
const hiR = healthyRange ? Math.max(hi, healthyRange[1]) : hi;
|
||||
const pad = Math.max((hiR - loR) * 0.12, 0.5);
|
||||
const loP = yMin ?? loR - pad;
|
||||
const hiP = yMax ?? hiR + pad;
|
||||
const range = hiP - loP || 1;
|
||||
|
||||
const px = (ts: number) => ((ts - minTs) / span) * 100;
|
||||
const py = (v: number) => 100 - ((v - lo) / range) * 100;
|
||||
const py = (v: number) => 100 - ((v - loP) / range) * 100;
|
||||
|
||||
const line = data.map((p, i) =>
|
||||
`${i === 0 ? 'M' : 'L'}${px(p.ts).toFixed(2)},${py(p.value).toFixed(2)}`
|
||||
@@ -42,94 +50,56 @@
|
||||
const lastX = px(data[data.length - 1].ts).toFixed(2);
|
||||
const area = `${line} L${lastX},100 L0,100 Z`;
|
||||
|
||||
const targetY = targetValue !== null ? py(targetValue) : null;
|
||||
return { line, area, lo, hi, loP, hiP };
|
||||
});
|
||||
|
||||
return { line, area, targetY };
|
||||
// Project healthy range onto 0-100 y space
|
||||
const healthyPx = $derived.by(() => {
|
||||
if (!healthyRange) return null;
|
||||
const { loP, hiP } = paths;
|
||||
const range = hiP - loP || 1;
|
||||
const yHi = 100 - ((healthyRange[1] - loP) / range) * 100;
|
||||
const yLo = 100 - ((healthyRange[0] - loP) / range) * 100;
|
||||
return { yHi, yLo, h: Math.max(0.1, yLo - yHi) };
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="lc">
|
||||
<div class="lc-overlay">
|
||||
<span class="lc-label">{label}</span>
|
||||
<span class="lc-value">{value}</span>
|
||||
</div>
|
||||
|
||||
<svg viewBox="0 0 100 100" preserveAspectRatio="none">
|
||||
<svg class="lc" viewBox="0 0 100 100" preserveAspectRatio="none" aria-hidden="true">
|
||||
<defs>
|
||||
<linearGradient id="lc-{uid}" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0%" stop-color={color} stop-opacity="0.28"/>
|
||||
<linearGradient id="{uid}" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0%" stop-color={color} stop-opacity="0.2"/>
|
||||
<stop offset="100%" stop-color={color} stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
|
||||
<!-- Midline when scale is fixed (health score) -->
|
||||
{#if yMin !== null && yMax !== null}
|
||||
<line x1="0" y1="50" x2="100" y2="50"
|
||||
stroke="var(--color-border)" stroke-width="0.8"
|
||||
<!-- Healthy-range band (green) -->
|
||||
{#if healthyPx}
|
||||
<rect x="0" y={healthyPx.yHi} width="100" height={healthyPx.h}
|
||||
fill="#2b5a34" opacity="0.075"/>
|
||||
<line x1="0" y1={healthyPx.yHi} x2="100" y2={healthyPx.yHi}
|
||||
stroke="#2b5a34" stroke-width="0.5" stroke-dasharray="2 2" opacity="0.35"
|
||||
vector-effect="non-scaling-stroke"/>
|
||||
<line x1="0" y1={healthyPx.yLo} x2="100" y2={healthyPx.yLo}
|
||||
stroke="#2b5a34" stroke-width="0.5" stroke-dasharray="2 2" opacity="0.35"
|
||||
vector-effect="non-scaling-stroke"/>
|
||||
{/if}
|
||||
|
||||
<!-- Target line -->
|
||||
{#if paths.targetY !== null}
|
||||
<line x1="0" y1={paths.targetY} x2="100" y2={paths.targetY}
|
||||
stroke={color} stroke-width="0.6" stroke-dasharray="2 2" opacity="0.5"
|
||||
vector-effect="non-scaling-stroke"/>
|
||||
{/if}
|
||||
|
||||
<!-- Area fill -->
|
||||
{#if paths.area}
|
||||
<path d={paths.area} fill="url(#lc-{uid})"/>
|
||||
<path d={paths.area} fill="url(#{uid})"/>
|
||||
{/if}
|
||||
|
||||
<!-- Line -->
|
||||
{#if paths.line}
|
||||
<path d={paths.line} fill="none" stroke={color}
|
||||
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"
|
||||
stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"
|
||||
vector-effect="non-scaling-stroke"/>
|
||||
{/if}
|
||||
</svg>
|
||||
</div>
|
||||
</svg>
|
||||
|
||||
<style>
|
||||
.lc {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
svg {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.lc-overlay {
|
||||
position: absolute;
|
||||
padding: 2px 4px;
|
||||
background-color: var(--color-bg);
|
||||
opacity: 0.9;
|
||||
border-radius: 4px;
|
||||
top: 5px;
|
||||
left: 8px;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.lc-label {
|
||||
font-size: 9px;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: var(--color-text-muted);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.lc-value {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 20px;
|
||||
line-height: 1;
|
||||
color: var(--color-text);
|
||||
overflow: visible;
|
||||
}
|
||||
</style>
|
||||
@@ -1,139 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { TimeSeriesPoint } from '../types';
|
||||
|
||||
interface Props {
|
||||
data: TimeSeriesPoint[];
|
||||
width?: number;
|
||||
height?: number;
|
||||
color?: string;
|
||||
targetValue?: number | null;
|
||||
scrubberTs?: number | null;
|
||||
}
|
||||
|
||||
const {
|
||||
data,
|
||||
width = 120,
|
||||
height = 32,
|
||||
color = 'var(--color-sage)',
|
||||
targetValue = null,
|
||||
scrubberTs = null,
|
||||
}: Props = $props();
|
||||
|
||||
const PAD_X = 2;
|
||||
const PAD_Y = 3;
|
||||
|
||||
const path = $derived.by(() => {
|
||||
if (data.length < 2) return '';
|
||||
const minTs = data[0].ts;
|
||||
const maxTs = data[data.length - 1].ts;
|
||||
const vals = data.map(p => p.value);
|
||||
const minV = Math.min(...vals);
|
||||
const maxV = Math.max(...vals);
|
||||
const rangeV = maxV - minV || 1;
|
||||
const rangeTs = maxTs - minTs || 1;
|
||||
|
||||
const px = (ts: number) => PAD_X + ((ts - minTs) / rangeTs) * (width - PAD_X * 2);
|
||||
const py = (v: number) => PAD_Y + (1 - (v - minV) / rangeV) * (height - PAD_Y * 2);
|
||||
|
||||
return data
|
||||
.map((p, i) => `${i === 0 ? 'M' : 'L'}${px(p.ts).toFixed(1)},${py(p.value).toFixed(1)}`)
|
||||
.join(' ');
|
||||
});
|
||||
|
||||
const targetY = $derived.by(() => {
|
||||
if (targetValue === null || data.length < 2) return null;
|
||||
const vals = data.map(p => p.value);
|
||||
const minV = Math.min(...vals);
|
||||
const maxV = Math.max(...vals);
|
||||
const rangeV = maxV - minV || 1;
|
||||
return PAD_Y + (1 - (targetValue - minV) / rangeV) * (height - PAD_Y * 2);
|
||||
});
|
||||
|
||||
const scrubberX = $derived.by(() => {
|
||||
if (scrubberTs === null || data.length < 2) return null;
|
||||
const minTs = data[0].ts;
|
||||
const maxTs = data[data.length - 1].ts;
|
||||
const rangeTs = maxTs - minTs || 1;
|
||||
const x = PAD_X + ((scrubberTs - minTs) / rangeTs) * (width - PAD_X * 2);
|
||||
return Math.max(PAD_X, Math.min(width - PAD_X, x));
|
||||
});
|
||||
|
||||
const areaPath = $derived.by(() => {
|
||||
if (!path || data.length < 2) return '';
|
||||
const minTs = data[0].ts;
|
||||
const maxTs = data[data.length - 1].ts;
|
||||
const rangeTs = maxTs - minTs || 1;
|
||||
const vals = data.map(p => p.value);
|
||||
const minV = Math.min(...vals);
|
||||
const maxV = Math.max(...vals);
|
||||
const rangeV = maxV - minV || 1;
|
||||
const px = (ts: number) => PAD_X + ((ts - minTs) / rangeTs) * (width - PAD_X * 2);
|
||||
const bottom = height - PAD_Y;
|
||||
const firstX = px(data[0].ts).toFixed(1);
|
||||
const lastX = px(data[data.length - 1].ts).toFixed(1);
|
||||
return `${path} L${lastX},${bottom} L${firstX},${bottom} Z`;
|
||||
});
|
||||
</script>
|
||||
|
||||
<svg {width} {height} viewBox="0 0 {width} {height}" aria-hidden="true">
|
||||
<defs>
|
||||
<linearGradient id="spark-fill-{color.replace(/[^a-z0-9]/gi, '')}" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0%" stop-color={color} stop-opacity="0.18"/>
|
||||
<stop offset="100%" stop-color={color} stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
|
||||
<!-- Area fill -->
|
||||
{#if areaPath}
|
||||
<path
|
||||
d={areaPath}
|
||||
fill="url(#spark-fill-{color.replace(/[^a-z0-9]/gi, '')})"
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<!-- Target line -->
|
||||
{#if targetY !== null}
|
||||
<line
|
||||
x1={PAD_X}
|
||||
y1={targetY}
|
||||
x2={width - PAD_X}
|
||||
y2={targetY}
|
||||
stroke={color}
|
||||
stroke-width="0.5"
|
||||
stroke-dasharray="3 3"
|
||||
opacity="0.4"
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<!-- Main line -->
|
||||
{#if path}
|
||||
<path
|
||||
d={path}
|
||||
fill="none"
|
||||
stroke={color}
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<!-- Scrubber marker -->
|
||||
{#if scrubberX !== null}
|
||||
<line
|
||||
x1={scrubberX}
|
||||
y1={PAD_Y}
|
||||
x2={scrubberX}
|
||||
y2={height - PAD_Y}
|
||||
stroke={color}
|
||||
stroke-width="1"
|
||||
opacity="0.8"
|
||||
/>
|
||||
{/if}
|
||||
</svg>
|
||||
|
||||
<style>
|
||||
svg {
|
||||
display: block;
|
||||
overflow: visible;
|
||||
}
|
||||
</style>
|
||||
+99
-34
@@ -63,12 +63,17 @@ function genSnapshots(inoculatedTs: number, count: number): BagSnapshot[] {
|
||||
return snaps;
|
||||
}
|
||||
|
||||
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 inoculatedBx1 = NOW - 3 * HOUR * 24;
|
||||
const inoculatedBx2 = NOW - 15 * HOUR * 24;
|
||||
// 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
|
||||
|
||||
// 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 = {
|
||||
meta: {
|
||||
@@ -87,7 +92,7 @@ export const mockState: CultivarState = {
|
||||
id: 'a1',
|
||||
type: 'bag_ready',
|
||||
severity: 'info',
|
||||
message: 'Bag B1 (Golden Oyster, 94%) is ready to move to the fruiting chamber.',
|
||||
message: 'Bag B1 (Golden Oyster, 94%) is ready to move to the fruiting side.',
|
||||
ts: NOW - 3600,
|
||||
dismissed: false,
|
||||
},
|
||||
@@ -95,7 +100,7 @@ export const mockState: CultivarState = {
|
||||
id: 'a2',
|
||||
type: 'co2_elevated',
|
||||
severity: 'warn',
|
||||
message: 'CO₂e is elevated in Colonization (1380 ppm). Check that the FAE port is clear.',
|
||||
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.',
|
||||
ts: NOW - 1800,
|
||||
dismissed: false,
|
||||
},
|
||||
@@ -247,21 +252,21 @@ export const mockState: CultivarState = {
|
||||
bag_id: 'bag-005',
|
||||
slot_id: 'A1',
|
||||
tag: {
|
||||
strain_code: 'MSS-PLEOS-GRV-2024-005',
|
||||
strain_name: 'Blue Oyster',
|
||||
strain_code: 'MSS-HERER-GRV-2024-005',
|
||||
strain_name: "Lion's Mane",
|
||||
substrate: 'Master Mix',
|
||||
inoculated_ts: inoculatedBx1,
|
||||
batch_id: 'BTC-2024-05',
|
||||
inoculated_ts: inoculatedF_A1,
|
||||
batch_id: 'BTC-2024-01',
|
||||
},
|
||||
vision: {
|
||||
colonization_pct: 12,
|
||||
colonization_confidence: 0.74,
|
||||
colonization_pct: 100,
|
||||
colonization_confidence: 0.96,
|
||||
contamination_risk: 'none',
|
||||
stage: 'inoculation',
|
||||
snapshots: genSnapshots(inoculatedBx1, 1),
|
||||
stage: 'fruiting',
|
||||
snapshots: genSnapshots(inoculatedF_A1, 5),
|
||||
projection: {
|
||||
estimated_ready_ts: NOW + 18 * HOUR * 24,
|
||||
colonization_curve: genColonizationCurve(inoculatedBx1, 12),
|
||||
estimated_ready_ts: NOW + 3 * HOUR * 24,
|
||||
colonization_curve: genColonizationCurve(inoculatedF_A1, 100),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -269,7 +274,28 @@ export const mockState: CultivarState = {
|
||||
{
|
||||
slot_id: 'A2',
|
||||
position: { x: 1, y: 0, z: 2 },
|
||||
bag: null,
|
||||
bag: {
|
||||
bag_id: 'bag-007',
|
||||
slot_id: 'A2',
|
||||
tag: {
|
||||
strain_code: 'MSS-GFROND-GRV-2024-003',
|
||||
strain_name: 'Golden Oyster',
|
||||
substrate: 'Supplemented Sawdust',
|
||||
inoculated_ts: inoculatedF_A2,
|
||||
batch_id: 'BTC-2024-01',
|
||||
},
|
||||
vision: {
|
||||
colonization_pct: 100,
|
||||
colonization_confidence: 0.97,
|
||||
contamination_risk: 'none',
|
||||
stage: 'harvest',
|
||||
snapshots: genSnapshots(inoculatedF_A2, 6),
|
||||
projection: {
|
||||
estimated_ready_ts: NOW,
|
||||
colonization_curve: genColonizationCurve(inoculatedF_A2, 100),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
slot_id: 'B1',
|
||||
@@ -283,21 +309,21 @@ export const mockState: CultivarState = {
|
||||
bag_id: 'bag-006',
|
||||
slot_id: 'B2',
|
||||
tag: {
|
||||
strain_code: 'MSS-HERER-GRV-2024-001',
|
||||
strain_code: 'MSS-LEDOES-GRV-2024-001',
|
||||
strain_name: 'Shiitake',
|
||||
substrate: 'Supplemented Sawdust',
|
||||
inoculated_ts: inoculatedBx2,
|
||||
inoculated_ts: inoculatedF_B2,
|
||||
batch_id: 'BTC-2024-02',
|
||||
},
|
||||
vision: {
|
||||
colonization_pct: 82,
|
||||
colonization_confidence: 0.93,
|
||||
colonization_pct: 100,
|
||||
colonization_confidence: 0.94,
|
||||
contamination_risk: 'none',
|
||||
stage: 'pinning',
|
||||
snapshots: genSnapshots(inoculatedBx2, 5),
|
||||
snapshots: genSnapshots(inoculatedF_B2, 5),
|
||||
projection: {
|
||||
estimated_ready_ts: NOW + 5 * HOUR * 24,
|
||||
colonization_curve: genColonizationCurve(inoculatedBx2, 82),
|
||||
colonization_curve: genColonizationCurve(inoculatedF_B2, 100),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -305,7 +331,28 @@ export const mockState: CultivarState = {
|
||||
{
|
||||
slot_id: 'C1',
|
||||
position: { x: 0, y: 0, z: 0 },
|
||||
bag: null,
|
||||
bag: {
|
||||
bag_id: 'bag-008',
|
||||
slot_id: 'C1',
|
||||
tag: {
|
||||
strain_code: 'MSS-PLDJA-GRV-2024-001',
|
||||
strain_name: 'Pink Oyster',
|
||||
substrate: 'Straw + Hardwood',
|
||||
inoculated_ts: inoculatedF_C1,
|
||||
batch_id: 'BTC-2024-01',
|
||||
},
|
||||
vision: {
|
||||
colonization_pct: 100,
|
||||
colonization_confidence: 0.92,
|
||||
contamination_risk: 'none',
|
||||
stage: 'fruiting',
|
||||
snapshots: genSnapshots(inoculatedF_C1, 5),
|
||||
projection: {
|
||||
estimated_ready_ts: NOW + 4 * HOUR * 24,
|
||||
colonization_curve: genColonizationCurve(inoculatedF_C1, 100),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
slot_id: 'C2',
|
||||
@@ -316,16 +363,28 @@ export const mockState: CultivarState = {
|
||||
},
|
||||
],
|
||||
hardware: {
|
||||
// Two fans — one per compartment, used for fresh-air exchange
|
||||
fans: [
|
||||
{ id: 'fan-1', speed_pct: 60, mode: 'auto' },
|
||||
{ id: 'fan-2', 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 },
|
||||
],
|
||||
// Reed-switch door sensors — fruiting is showing open for the demo
|
||||
doors: [
|
||||
{ id: 'door-col', chamber_id: 'main', open: false },
|
||||
{ id: 'door-fruit', chamber_id: 'second', open: false },
|
||||
],
|
||||
heater: { active: false, duty_cycle: 0 },
|
||||
humidifier: { active: true, mode: 'auto' },
|
||||
leds: { mode: 'fruiting', color_hex: '#4a9e8a', brightness: 0.4 },
|
||||
cameras: [
|
||||
{ id: 'cam-1', position: 'top', last_capture_ts: NOW - 180 },
|
||||
{ id: 'cam-2', position: 'side', 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 },
|
||||
],
|
||||
},
|
||||
recipe: {
|
||||
@@ -340,10 +399,16 @@ export const mockState: CultivarState = {
|
||||
{ stage: 'colonization', started_ts: NOW - 8 * HOUR * 24, ended_ts: null },
|
||||
],
|
||||
next_actions: [
|
||||
{ type: 'mist', due_ts: NOW + 3600, description: 'Mist chamber walls' },
|
||||
{ type: 'mist', due_ts: NOW + 3600, description: 'Maintain humidity' },
|
||||
{ type: 'fae', due_ts: NOW + 7200, description: 'Fresh air exchange' },
|
||||
],
|
||||
},
|
||||
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: {
|
||||
scrubber_ts: null,
|
||||
selected_bag_id: null,
|
||||
|
||||
+11
-2
@@ -41,7 +41,7 @@ function createStore() {
|
||||
if (state.hardware.fans[i]) state.hardware.fans[i].speed_pct = spd;
|
||||
});
|
||||
}
|
||||
if (diff.hw.heater !== undefined) state.hardware.heater.active = diff.hw.heater;
|
||||
// Cultivar has no temperature control, so heater diffs are ignored
|
||||
if (diff.hw.humidifier !== undefined) state.hardware.humidifier.active = diff.hw.humidifier;
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,6 @@ function createStore() {
|
||||
},
|
||||
hw: {
|
||||
fans: state.hardware.fans.map(f => f.speed_pct),
|
||||
heater: state.hardware.heater.active,
|
||||
humidifier: state.hardware.humidifier.active,
|
||||
},
|
||||
});
|
||||
@@ -92,6 +91,14 @@ function createStore() {
|
||||
if (alert) alert.dismissed = true;
|
||||
}
|
||||
|
||||
function markWiped() {
|
||||
state.maintenance.last_wipe_ts = Math.floor(Date.now() / 1000);
|
||||
}
|
||||
|
||||
function markReservoirCleaned() {
|
||||
state.maintenance.last_reservoir_clean_ts = Math.floor(Date.now() / 1000);
|
||||
}
|
||||
|
||||
return {
|
||||
get state() { return state; },
|
||||
applyDiff,
|
||||
@@ -101,6 +108,8 @@ function createStore() {
|
||||
selectBag,
|
||||
completeOnboarding,
|
||||
dismissAlert,
|
||||
markWiped,
|
||||
markReservoirCleaned,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { BagState } from '../types';
|
||||
import { STAGE_LABELS } from '../types';
|
||||
|
||||
interface Props {
|
||||
bag: BagState | null;
|
||||
slotId: string;
|
||||
chamberId: string;
|
||||
theme: 'colonization' | 'fruiting';
|
||||
onBagClick: (bagId: string, el: HTMLElement) => void;
|
||||
}
|
||||
|
||||
const { bag, slotId, chamberId, theme, onBagClick }: Props = $props();
|
||||
|
||||
const stageColor = $derived.by(() => {
|
||||
if (!bag) return '#4a4a40';
|
||||
const risk = bag.vision.contamination_risk;
|
||||
const stage = bag.vision.stage;
|
||||
if (risk === 'high') return '#c94040';
|
||||
if (risk === 'low') return '#c9832a';
|
||||
if (stage === 'fruiting') return '#4a9e8a';
|
||||
if (stage === 'pinning') return '#3a7a8e';
|
||||
return '#c8caaa';
|
||||
});
|
||||
|
||||
const stageAnim = $derived.by(() => {
|
||||
if (!bag) return '';
|
||||
if (bag.vision.contamination_risk === 'high') return 'pulse-contam-high 2.2s ease-in-out infinite';
|
||||
if (bag.vision.contamination_risk === 'low') return 'pulse-contam-low 3s ease-in-out infinite';
|
||||
if (bag.vision.stage === 'fruiting') return 'shimmer-fruiting 5s ease-in-out infinite';
|
||||
if (bag.vision.stage === 'pinning') return 'pulse-pinning 4s ease-in-out infinite';
|
||||
return 'pulse-mycelium 4s ease-in-out infinite';
|
||||
});
|
||||
|
||||
const coveragePct = $derived(bag ? bag.vision.colonization_pct : 0);
|
||||
|
||||
let btnEl: HTMLButtonElement | null = $state(null);
|
||||
|
||||
function handleClick() {
|
||||
if (bag && btnEl) onBagClick(bag.bag_id, btnEl);
|
||||
}
|
||||
</script>
|
||||
|
||||
<button
|
||||
bind:this={btnEl}
|
||||
class="bag-slot"
|
||||
class:empty={!bag}
|
||||
aria-label={bag
|
||||
? `${bag.tag.strain_name}, ${STAGE_LABELS[bag.vision.stage]}, ${bag.vision.colonization_pct}% colonized`
|
||||
: `Slot ${slotId}: empty`}
|
||||
onclick={handleClick}
|
||||
disabled={!bag}
|
||||
>
|
||||
{#if bag}
|
||||
<!--
|
||||
viewBox 80×100: squarer ratio fills compact grid cells cleanly.
|
||||
Colonization gradient rises from bottom (substrate) to top (mycelium).
|
||||
-->
|
||||
<svg class="bag-svg" viewBox="0 0 80 100" preserveAspectRatio="xMidYMid meet" aria-hidden="true">
|
||||
<defs>
|
||||
<linearGradient id="bg-{chamberId}-{slotId}" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0%" stop-color={stageColor} stop-opacity="0.9"/>
|
||||
<stop offset="{Math.max(4, 100 - coveragePct)}%" stop-color={stageColor} stop-opacity="0.55"/>
|
||||
<stop offset="{Math.max(6, 104 - coveragePct)}%" stop-color="#2e1e0e" stop-opacity="0.98"/>
|
||||
<stop offset="100%" stop-color="#18100a" stop-opacity="1"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="halo-{chamberId}-{slotId}" cx="50%" cy="35%" r="60%">
|
||||
<stop offset="0%" stop-color={stageColor} stop-opacity="0.15"/>
|
||||
<stop offset="100%" stop-color={stageColor} stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
<!-- Glow -->
|
||||
<ellipse cx="40" cy="48" rx="36" ry="44"
|
||||
fill="url(#halo-{chamberId}-{slotId})"
|
||||
style="animation: {stageAnim}"
|
||||
/>
|
||||
|
||||
<!-- Bag body -->
|
||||
<rect x="3" y="3" width="74" height="94" rx="6"
|
||||
fill="url(#bg-{chamberId}-{slotId})"
|
||||
style="animation: {stageAnim}"
|
||||
/>
|
||||
|
||||
<!-- Bag outline -->
|
||||
<rect x="3" y="3" width="74" height="94" rx="6"
|
||||
fill="none" stroke={stageColor} stroke-width="0.6" stroke-opacity="0.28"
|
||||
/>
|
||||
|
||||
<!-- Filter patch: square -->
|
||||
<rect x="24" y="8" width="32" height="32" rx="2"
|
||||
fill="#dedad0" fill-opacity="0.82"
|
||||
/>
|
||||
{#each [0,1,2,3] as row}{#each [0,1,2,3] as col}
|
||||
<circle cx={28 + col * 8} cy={12 + row * 8} r="0.7" fill="#9a9888" opacity="0.38"/>
|
||||
{/each}{/each}
|
||||
|
||||
<!-- Tag placeholder: faint outline only -->
|
||||
<rect x="14" y="48" width="52" height="34" rx="3"
|
||||
fill={stageColor} fill-opacity="0.04"
|
||||
stroke={stageColor} stroke-width="0.5" stroke-opacity="0.16"
|
||||
/>
|
||||
|
||||
<!-- Injection port -->
|
||||
<circle cx="40" cy="89" r="5"
|
||||
fill="none" stroke={stageColor} stroke-width="0.5" stroke-opacity="0.25"
|
||||
/>
|
||||
<circle cx="40" cy="89" r="2"
|
||||
fill={stageColor} fill-opacity="0.16"
|
||||
/>
|
||||
</svg>
|
||||
|
||||
<!-- Colonization % -->
|
||||
<div class="bag-pct" style="color: {stageColor}">
|
||||
{bag.vision.colonization_pct}%
|
||||
</div>
|
||||
|
||||
<!-- Contamination badge -->
|
||||
{#if bag.vision.contamination_risk !== 'none'}
|
||||
<div class="contam-badge">⚠</div>
|
||||
{/if}
|
||||
|
||||
{:else}
|
||||
<!-- Empty slot: dashed outline matching new bag aspect ratio -->
|
||||
<svg class="bag-svg" viewBox="0 0 80 100" aria-hidden="true">
|
||||
<rect x="3" y="3" width="74" height="94" rx="6"
|
||||
fill="none"
|
||||
stroke="var(--color-border)"
|
||||
stroke-width="0.8"
|
||||
stroke-dasharray="3 4"
|
||||
opacity="0.4"
|
||||
/>
|
||||
</svg>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<style>
|
||||
.bag-slot {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background: none;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
padding: 2px;
|
||||
cursor: pointer;
|
||||
transition: filter 0.18s;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.bag-slot:hover:not(:disabled) { filter: brightness(1.15); }
|
||||
.bag-slot:focus-visible { outline: 2px solid var(--color-sage); outline-offset: 2px; }
|
||||
.bag-slot:disabled { cursor: default; }
|
||||
|
||||
.bag-svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.bag-pct {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 5px;
|
||||
font-family: var(--font-serif);
|
||||
font-size: 10px;
|
||||
line-height: 1;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.contam-badge {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
left: 5px;
|
||||
font-size: 9px;
|
||||
color: var(--color-contam-low);
|
||||
}
|
||||
</style>
|
||||
+158
-152
@@ -27,31 +27,38 @@
|
||||
);
|
||||
|
||||
const stageColor: Record<string, string> = {
|
||||
inoculation: 'var(--color-text-muted)',
|
||||
colonization: 'var(--color-mycelium)',
|
||||
pinning: 'var(--color-pinning)',
|
||||
fruiting: 'var(--color-fruiting)',
|
||||
harvest: 'var(--color-sage)',
|
||||
inoculation: 'var(--ink-muted)',
|
||||
colonization: 'var(--forest)',
|
||||
pinning: '#4b6a84',
|
||||
fruiting: '#7a4a25',
|
||||
harvest: 'var(--attention)',
|
||||
};
|
||||
|
||||
const contamCopy: Record<string, string> = {
|
||||
none: 'Healthy',
|
||||
low: 'Monitor',
|
||||
medium: 'Monitor',
|
||||
high: 'Attention',
|
||||
};
|
||||
|
||||
const contamColor: Record<string, string> = {
|
||||
none: 'var(--color-text-muted)',
|
||||
low: 'var(--color-contam-low)',
|
||||
medium: 'var(--color-contam-low)',
|
||||
high: 'var(--color-contam-high)',
|
||||
none: 'var(--forest)',
|
||||
low: 'var(--attention)',
|
||||
medium: 'var(--attention)',
|
||||
high: 'var(--urgent)',
|
||||
};
|
||||
|
||||
const POP_W = 288;
|
||||
const POP_H_EST = 268;
|
||||
const POP_W = 300;
|
||||
const POP_H_EST = 280;
|
||||
const MARGIN = 12;
|
||||
|
||||
let winW = $state(typeof window === 'undefined' ? 800 : window.innerWidth);
|
||||
let winH = $state(typeof window === 'undefined' ? 600 : window.innerHeight);
|
||||
|
||||
const pos = $derived.by(() => {
|
||||
let x = anchor.x + 18;
|
||||
let x = anchor.x + 20;
|
||||
let y = anchor.y - POP_H_EST / 2;
|
||||
if (x + POP_W > winW - MARGIN) x = anchor.x - POP_W - 18;
|
||||
if (x + POP_W > winW - MARGIN) x = anchor.x - POP_W - 20;
|
||||
if (x < MARGIN) x = MARGIN;
|
||||
if (y < MARGIN) y = MARGIN;
|
||||
if (y + POP_H_EST > winH - MARGIN) y = winH - POP_H_EST - MARGIN;
|
||||
@@ -82,7 +89,7 @@
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="popover-backdrop"
|
||||
class="backdrop"
|
||||
onclick={onClose}
|
||||
onkeydown={(e) => e.key === 'Escape' && onClose()}
|
||||
role="presentation"
|
||||
@@ -90,61 +97,62 @@
|
||||
|
||||
{#if bag}
|
||||
<div
|
||||
class="popover-card"
|
||||
class="card"
|
||||
style="left: {pos.x}px; top: {pos.y}px; width: {POP_W}px;"
|
||||
role="dialog"
|
||||
aria-label="Bag {bag.slot_id} info"
|
||||
aria-label="{bag.tag.strain_name} bag details"
|
||||
>
|
||||
<div class="pop-head">
|
||||
<div class="pop-slot">{bag.slot_id}</div>
|
||||
<div class="pop-pct">
|
||||
<span class="pct-num">{bag.vision.colonization_pct}%</span>
|
||||
<span class="pct-label">COLONIZED</span>
|
||||
<!-- Header -->
|
||||
<div class="head">
|
||||
<div class="head-left">
|
||||
<div class="slot">Slot {bag.slot_id}</div>
|
||||
<h3 class="strain font-serif">{bag.tag.strain_name}</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pop-strain">{bag.tag.strain_name}</div>
|
||||
<div class="pop-sub">{bag.tag.substrate}</div>
|
||||
|
||||
<div class="pop-stats">
|
||||
<div class="stat">
|
||||
<div class="stat-label">STAGE</div>
|
||||
<div class="stat-value" style="color: {stageColor[bag.vision.stage]}">
|
||||
<span class="pill pill-{bag.vision.stage}">
|
||||
{STAGE_LABELS[bag.vision.stage]}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Colonization bar -->
|
||||
<div class="bar-wrap">
|
||||
<div class="bar-top">
|
||||
<span class="bar-label">Colonized</span>
|
||||
<span class="bar-value font-serif">{bag.vision.colonization_pct}%</span>
|
||||
</div>
|
||||
<div class="bar-track">
|
||||
<div class="bar-fill" style="width: {bag.vision.colonization_pct}%"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Stats grid -->
|
||||
<div class="stats">
|
||||
<div class="stat">
|
||||
<div class="stat-key">Day</div>
|
||||
<div class="stat-val font-serif">{daysSinceInoc}</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat-label">DAY</div>
|
||||
<div class="stat-value">{daysSinceInoc}</div>
|
||||
</div>
|
||||
<div class="stat">
|
||||
<div class="stat-label">READY IN</div>
|
||||
<div class="stat-value">
|
||||
<div class="stat-key">Ready in</div>
|
||||
<div class="stat-val font-serif">
|
||||
{#if daysToReady > 0}{daysToReady}d{:else}Soon{/if}
|
||||
</div>
|
||||
</div>
|
||||
{#if bag.vision.contamination_risk !== 'none'}
|
||||
<div class="stat">
|
||||
<div class="stat-label">HEALTH</div>
|
||||
<div class="stat-value" style="color: {contamColor[bag.vision.contamination_risk]}">
|
||||
Monitor
|
||||
<div class="stat-key">Health</div>
|
||||
<div class="stat-val font-serif" style="color: {contamColor[bag.vision.contamination_risk]}">
|
||||
{contamCopy[bag.vision.contamination_risk]}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="stat">
|
||||
<div class="stat-label">HEALTH</div>
|
||||
<div class="stat-value" style="color: var(--color-sage)">Good</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="pop-meta">
|
||||
<div class="meta">
|
||||
<span>{bag.tag.substrate}</span>
|
||||
<span class="sep">·</span>
|
||||
<span>Started {formatDate(bag.tag.inoculated_ts)}</span>
|
||||
</div>
|
||||
|
||||
<button class="pop-details-btn" onclick={onOpenDetails}>
|
||||
View Details
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
|
||||
<button class="details-btn" onclick={onOpenDetails}>
|
||||
See full history
|
||||
<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>
|
||||
</button>
|
||||
@@ -152,24 +160,24 @@
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.popover-backdrop {
|
||||
.backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.25);
|
||||
background: rgba(40, 32, 16, 0.22);
|
||||
backdrop-filter: blur(2px);
|
||||
-webkit-backdrop-filter: blur(2px);
|
||||
z-index: 40;
|
||||
animation: fade-in 0.15s ease-out;
|
||||
}
|
||||
|
||||
.popover-card {
|
||||
.card {
|
||||
position: fixed;
|
||||
z-index: 41;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 14px 16px 12px;
|
||||
box-shadow: 0 12px 32px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.03) inset;
|
||||
background: #fbf7ec;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 16px 18px 14px;
|
||||
box-shadow: 0 18px 40px rgba(40, 32, 16, 0.22), 0 2px 4px rgba(40, 32, 16, 0.06);
|
||||
animation: pop-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.1);
|
||||
}
|
||||
|
||||
@@ -178,129 +186,127 @@
|
||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
||||
}
|
||||
|
||||
.pop-head {
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
gap: 10px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.slot {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 10px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--ink-muted);
|
||||
line-height: 1;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.strain {
|
||||
font-size: 22px;
|
||||
color: var(--ink);
|
||||
letter-spacing: -0.008em;
|
||||
line-height: 1.1;
|
||||
font-weight: var(--fw-display);
|
||||
}
|
||||
|
||||
/* ── Bar ── */
|
||||
.bar-wrap {
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.bar-top {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.pop-slot {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 22px;
|
||||
color: var(--color-text);
|
||||
line-height: 1;
|
||||
letter-spacing: 0.02em;
|
||||
.bar-label {
|
||||
font-size: 10px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
|
||||
.pop-pct {
|
||||
text-align: right;
|
||||
line-height: 1;
|
||||
padding: 4px 8px;
|
||||
border: 1px solid color-mix(in srgb, var(--color-sage) 40%, var(--color-border));
|
||||
border-radius: var(--radius-sm);
|
||||
.bar-value {
|
||||
font-size: 15px;
|
||||
color: var(--forest);
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
|
||||
.pct-num {
|
||||
display: block;
|
||||
font-family: var(--font-serif);
|
||||
font-size: 16px;
|
||||
color: var(--color-sage);
|
||||
}
|
||||
|
||||
.pct-label {
|
||||
display: block;
|
||||
font-family: var(--font-sans);
|
||||
font-size: 7px;
|
||||
letter-spacing: 0.18em;
|
||||
color: var(--color-text-muted);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.pop-strain {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 11px;
|
||||
color: var(--color-text);
|
||||
letter-spacing: 0.02em;
|
||||
.bar-track {
|
||||
height: 6px;
|
||||
border-radius: 3px;
|
||||
background: var(--paper-3);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.pop-sub {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 11px;
|
||||
color: var(--color-text-muted);
|
||||
.bar-fill {
|
||||
height: 100%;
|
||||
background: linear-gradient(to right, var(--forest-mid), var(--forest));
|
||||
border-radius: 3px;
|
||||
transition: width 0.4s;
|
||||
}
|
||||
|
||||
/* ── Stats ── */
|
||||
.stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 12px;
|
||||
padding: 12px 0;
|
||||
border-top: 1px solid var(--line-soft);
|
||||
border-bottom: 1px solid var(--line-soft);
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.pop-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 8px;
|
||||
margin-bottom: 10px;
|
||||
padding: 8px 0;
|
||||
border-top: 1px solid var(--color-border);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
.stat { display: flex; flex-direction: column; gap: 3px; }
|
||||
|
||||
.stat-key {
|
||||
font-size: 9px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
|
||||
.stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
min-width: 0;
|
||||
.stat-val {
|
||||
font-size: 16px;
|
||||
color: var(--ink);
|
||||
line-height: 1;
|
||||
letter-spacing: -0.005em;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 8px;
|
||||
letter-spacing: 0.16em;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 13px;
|
||||
color: var(--color-text);
|
||||
text-transform: capitalize;
|
||||
line-height: 1.1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pop-meta {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 10px;
|
||||
color: var(--color-text-muted);
|
||||
/* ── Meta ── */
|
||||
.meta {
|
||||
font-size: 11px;
|
||||
color: var(--ink-muted);
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
margin-bottom: 12px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.sep { opacity: 0.4; }
|
||||
|
||||
|
||||
.pop-details-btn {
|
||||
/* ── Details button ── */
|
||||
.details-btn {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
padding: 9px 14px;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid color-mix(in srgb, var(--color-sage) 40%, var(--color-border));
|
||||
background: color-mix(in srgb, var(--color-sage) 10%, var(--color-surface-2));
|
||||
color: var(--color-sage);
|
||||
gap: 8px;
|
||||
padding: 10px 14px;
|
||||
border-radius: 999px;
|
||||
background: var(--forest);
|
||||
color: var(--paper);
|
||||
font-family: var(--font-sans);
|
||||
font-size: 12px;
|
||||
font-size: 12.5px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.02em;
|
||||
transition: background 0.15s, border-color 0.15s;
|
||||
}
|
||||
|
||||
.pop-details-btn:hover {
|
||||
background: color-mix(in srgb, var(--color-sage) 18%, var(--color-surface-2));
|
||||
border-color: var(--color-sage);
|
||||
letter-spacing: 0.01em;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.details-btn:hover { background: var(--forest-deep); }
|
||||
</style>
|
||||
@@ -1,216 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { cultivar } from '../store.svelte';
|
||||
import BagGlyph from './BagGlyph.svelte';
|
||||
import type { ChamberSlot } from '../types';
|
||||
import { STAGE_LABELS } from '../types';
|
||||
|
||||
interface Props {
|
||||
onBagClick: (bagId: string, el: HTMLElement) => void;
|
||||
}
|
||||
const { onBagClick }: Props = $props();
|
||||
|
||||
const chambers = $derived(cultivar.state.chambers);
|
||||
|
||||
function sortedSlots(slots: ChamberSlot[]): ChamberSlot[] {
|
||||
return [...slots].sort((a, b) => {
|
||||
const zDiff = b.position.z - a.position.z; // top shelf first (z=2)
|
||||
if (zDiff !== 0) return zDiff;
|
||||
return a.position.x - b.position.x;
|
||||
});
|
||||
}
|
||||
|
||||
function fmtTemp(v: number) { return v.toFixed(1); }
|
||||
function fmtRh(v: number) { return v.toFixed(0); }
|
||||
function fmtCo2(v: number) { return v.toFixed(0); }
|
||||
function fmtVoc(v: number) { return v.toFixed(0); }
|
||||
|
||||
// Count bags with issues in a chamber
|
||||
function chamberAlert(slots: ChamberSlot[]): boolean {
|
||||
return slots.some(s => s.bag && s.bag.vision.contamination_risk !== 'none');
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="chambers-wrap">
|
||||
{#each chambers as chamber (chamber.id)}
|
||||
{@const isFruiting = chamber.type === 'fruiting'}
|
||||
{@const hasAlert = chamberAlert(chamber.slots)}
|
||||
|
||||
<div class="chamber-card" class:fruiting={isFruiting}>
|
||||
<!-- Chamber header -->
|
||||
<div class="ch-header">
|
||||
<div class="ch-title-row">
|
||||
<span class="ch-name">{chamber.label}</span>
|
||||
{#if hasAlert}
|
||||
<span class="ch-alert-badge">⚠</span>
|
||||
{:else}
|
||||
<span class="ch-status-dot"></span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Environment readings (compact, 4 sensors) -->
|
||||
<div class="ch-env">
|
||||
<div class="env-pill">
|
||||
<span class="env-val">{fmtTemp(chamber.environment.temp_c)}°</span>
|
||||
<span class="env-unit">Temp</span>
|
||||
</div>
|
||||
<div class="env-pill">
|
||||
<span class="env-val">{fmtRh(chamber.environment.rh_pct)}%</span>
|
||||
<span class="env-unit">RH</span>
|
||||
</div>
|
||||
<div class="env-pill">
|
||||
{#if chamber.type === 'colonization'}
|
||||
<span class="env-val">{fmtCo2(chamber.environment.co2e_ppm ?? 0)}</span>
|
||||
<span class="env-unit">CO₂e</span>
|
||||
{:else}
|
||||
<span class="env-val">{fmtCo2(chamber.environment.co2_ppm ?? 0)}</span>
|
||||
<span class="env-unit">CO₂</span>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="env-pill">
|
||||
<span class="env-val">{fmtVoc(chamber.environment.voc_ppb)}</span>
|
||||
<span class="env-unit">VOC</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Bag grid: 3 rows × 2 cols (top shelf first) -->
|
||||
<div class="bag-grid">
|
||||
{#each sortedSlots(chamber.slots) as slot (slot.slot_id)}
|
||||
<BagGlyph
|
||||
bag={slot.bag}
|
||||
slotId={slot.slot_id}
|
||||
chamberId={chamber.id}
|
||||
theme={isFruiting ? 'fruiting' : 'colonization'}
|
||||
onBagClick={onBagClick}
|
||||
/>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.chambers-wrap {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
padding: 10px 12px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* ---- Chamber card ---- */
|
||||
.chamber-card {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--color-border);
|
||||
padding: 10px;
|
||||
background: var(--color-surface);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Fruiting chamber: warm off-white */
|
||||
.chamber-card.fruiting {
|
||||
background: #f5f0e6;
|
||||
border-color: #d8ceba;
|
||||
color: #2a2416;
|
||||
}
|
||||
|
||||
/* ---- Header ---- */
|
||||
.ch-header {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.ch-title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.ch-name {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 15px;
|
||||
letter-spacing: 0.01em;
|
||||
line-height: 1;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.chamber-card.fruiting .ch-name {
|
||||
color: #2a2416;
|
||||
}
|
||||
|
||||
.ch-status-dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-sage);
|
||||
animation: dot-live 2.5s ease-in-out infinite;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ch-alert-badge {
|
||||
font-size: 11px;
|
||||
color: var(--color-contam-low);
|
||||
}
|
||||
|
||||
/* ---- Env row ---- */
|
||||
.ch-env {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.env-pill {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 1px;
|
||||
padding: 4px 2px;
|
||||
border-radius: 5px;
|
||||
background: rgba(0,0,0,0.12);
|
||||
}
|
||||
|
||||
.chamber-card.fruiting .env-pill {
|
||||
background: rgba(0,0,0,0.07);
|
||||
}
|
||||
|
||||
.env-val {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 13px;
|
||||
line-height: 1;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.env-unit {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 8px;
|
||||
letter-spacing: 0.08em;
|
||||
opacity: 0.6;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ---- Bag grid ---- */
|
||||
.bag-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: repeat(3, 1fr);
|
||||
gap: 6px;
|
||||
/* Height chosen so bags render near-square with the 80×100 viewBox */
|
||||
height: 240px;
|
||||
}
|
||||
|
||||
/* ---- Responsive ---- */
|
||||
@media (max-width: 900px) {
|
||||
.chambers-wrap {
|
||||
gap: 8px;
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,948 @@
|
||||
<script lang="ts">
|
||||
import { cultivar } from '../store.svelte';
|
||||
import type { Chamber, BagState } from '../types';
|
||||
|
||||
interface Props {
|
||||
onBagClick?: (bagId: string, el: HTMLElement) => void;
|
||||
}
|
||||
|
||||
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 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]);
|
||||
|
||||
function spinDur(speed: number): string {
|
||||
return speed > 0 ? `${(0.5 + (1 - speed / 100) * 2.4).toFixed(2)}s` : '4s';
|
||||
}
|
||||
const colFanSpinning = $derived((colFan?.speed_pct ?? 0) > 0);
|
||||
const fruitFanSpinning = $derived((fruitFan?.speed_pct ?? 0) > 0);
|
||||
const colFanDur = $derived(spinDur(colFan?.speed_pct ?? 0));
|
||||
const fruitFanDur = $derived(spinDur(fruitFan?.speed_pct ?? 0));
|
||||
|
||||
// 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'));
|
||||
|
||||
// Door state
|
||||
const colDoorOpen = $derived(hw.doors.find(d => d.chamber_id === 'main')?.open ?? false);
|
||||
const fruitDoorOpen = $derived(hw.doors.find(d => d.chamber_id === 'second')?.open ?? false);
|
||||
|
||||
// --- GEOMETRY (viewBox 480 × 360) ---
|
||||
type Rect = { x: number; y: number; w: number; h: number };
|
||||
// Compartment interiors. Height bumped from 242 → 297 (~+15% on the
|
||||
// overall appliance) for a less-squat proportion.
|
||||
const LEFT: Rect = { x: 36, y: 52, w: 192, h: 297 };
|
||||
const RIGHT: Rect = { x: 252, y: 52, w: 192, h: 297 };
|
||||
|
||||
function shelfYs(box: Rect): number[] {
|
||||
const rowH = box.h / 3;
|
||||
return [box.y, box.y + rowH, box.y + 2 * rowH];
|
||||
}
|
||||
|
||||
function gridOf(chamber: Chamber): (BagState | null)[][] {
|
||||
const rows: (BagState | null)[][] = [[null, null], [null, null], [null, null]];
|
||||
for (const slot of chamber.slots) {
|
||||
const row = 2 - slot.position.z;
|
||||
const col = slot.position.x;
|
||||
if (row >= 0 && row < 3 && col >= 0 && col < 2) rows[row][col] = slot.bag;
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
const colGrid = $derived(gridOf(colonization));
|
||||
const fruitGrid = $derived(gridOf(fruiting));
|
||||
|
||||
function bagRect(box: Rect, row: number, col: number): Rect {
|
||||
const rowH = box.h / 3;
|
||||
const colW = box.w / 2;
|
||||
const padX = 9;
|
||||
const padY = 7;
|
||||
return {
|
||||
x: box.x + col * colW + padX,
|
||||
y: box.y + row * rowH + padY,
|
||||
w: colW - padX * 2,
|
||||
h: rowH - padY * 2,
|
||||
};
|
||||
}
|
||||
|
||||
function contamColor(bag: BagState): string | null {
|
||||
if (bag.vision.contamination_risk === 'high') return '#d55a5a';
|
||||
if (bag.vision.contamination_risk === 'low') return '#d99050';
|
||||
return null;
|
||||
}
|
||||
|
||||
function bagPrimary(bag: BagState, chamberType: 'colonization' | 'fruiting'): string {
|
||||
if (chamberType === 'fruiting') {
|
||||
const days = Math.max(0, Math.ceil(
|
||||
(bag.vision.projection.estimated_ready_ts - Date.now() / 1000) / 86400
|
||||
));
|
||||
return days === 0 ? 'Ready' : `${days}d`;
|
||||
}
|
||||
return `${bag.vision.colonization_pct}%`;
|
||||
}
|
||||
|
||||
function bagSpeciesShort(bag: BagState): string {
|
||||
const name = bag.tag.strain_name;
|
||||
if (name.length <= 11) return name;
|
||||
// Truncate gracefully
|
||||
return name.slice(0, 10) + '…';
|
||||
}
|
||||
|
||||
function handleBagTap(bag: BagState, e: MouseEvent | KeyboardEvent) {
|
||||
const el = e.currentTarget as HTMLElement;
|
||||
if (onBagClick) onBagClick(bag.bag_id, el);
|
||||
}
|
||||
|
||||
// Fruiting chamber LED tint (display grow light)
|
||||
const fruitLedColor = $derived(fruitGrowLight?.on ? fruitGrowLight.color_hex : '#1a1d16');
|
||||
const fruitLedOpacity = $derived(fruitGrowLight?.on ? Math.max(0.25, fruitGrowLight.brightness * 0.55) : 0);
|
||||
|
||||
// Colonization LED (only lit when the work light is on, e.g. during a photo capture)
|
||||
const colLedColor = $derived(colWorkLight?.on ? colWorkLight.color_hex : '#131511');
|
||||
const colLedOpacity = $derived(colWorkLight?.on ? Math.max(0.25, colWorkLight.brightness * 0.45) : 0);
|
||||
|
||||
const occupiedCol = $derived(colonization.slots.filter(s => s.bag).length);
|
||||
const totalCol = $derived(colonization.slots.length);
|
||||
const occupiedFruit = $derived(fruiting.slots.filter(s => s.bag).length);
|
||||
const totalFruit = $derived(fruiting.slots.length);
|
||||
|
||||
// Low atmospheric fog bands — horizontal wisps that drift, not rise.
|
||||
// This reads more like ambient humidity than individual particles.
|
||||
const FOG_BANDS = [
|
||||
{ yFrac: 0.88, rx: 70, ry: 10, opacity: 0.78, dur: 9, delay: 0 },
|
||||
{ yFrac: 0.80, rx: 64, ry: 8, opacity: 0.55, dur: 11, delay: 2 },
|
||||
{ yFrac: 0.70, rx: 56, ry: 6, opacity: 0.35, dur: 13, delay: 4 },
|
||||
{ yFrac: 0.60, rx: 48, ry: 5, opacity: 0.22, dur: 15, delay: 6 },
|
||||
];
|
||||
|
||||
// A couple of gentle vertical wisps rising straight from the vent
|
||||
const FOG_WISPS = [
|
||||
{ xFrac: 0.38, dur: 8.5, delay: 0.0, sway: 4 },
|
||||
{ xFrac: 0.62, dur: 9.2, delay: 2.4, sway: -3 },
|
||||
];
|
||||
|
||||
// Humidity readout (live) — shown inside the fruiting compartment
|
||||
// so users instantly associate the fog with humidity.
|
||||
const fruitRh = $derived(fruiting.environment.rh_pct);
|
||||
|
||||
// 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
|
||||
// y=20.9 when empty and rises toward y=4.4 when full.
|
||||
const resPct = $derived(hw.humidifier.reservoir_pct);
|
||||
const resLow = $derived(resPct < 15);
|
||||
const waterY = $derived(20.9 - (resPct / 100) * 16.5);
|
||||
</script>
|
||||
|
||||
<div class="twin-wrap">
|
||||
<svg
|
||||
class="appliance"
|
||||
viewBox="0 0 480 425"
|
||||
role="img"
|
||||
aria-label="Your Cultivar — {occupiedCol + occupiedFruit} of {totalCol + totalFruit} bags growing"
|
||||
>
|
||||
<defs>
|
||||
<linearGradient id="body-grad" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0%" stop-color="#fbf7ec"/>
|
||||
<stop offset="55%" stop-color="#f4efe3"/>
|
||||
<stop offset="100%" stop-color="#e6ddc8"/>
|
||||
</linearGradient>
|
||||
|
||||
<linearGradient id="col-inner" x1="0.5" y1="0" x2="0.5" y2="1">
|
||||
<stop offset="0%" stop-color="#0c0f0a"/>
|
||||
<stop offset="100%" stop-color="#161a12"/>
|
||||
</linearGradient>
|
||||
|
||||
<linearGradient id="fruit-inner" x1="0.5" y1="0" x2="0.5" y2="1">
|
||||
<stop offset="0%" stop-color="#f0e8d2"/>
|
||||
<stop offset="100%" stop-color="#e1d6b9"/>
|
||||
</linearGradient>
|
||||
|
||||
<linearGradient id="glass-shine" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0%" stop-color="#ffffff" stop-opacity="0.16"/>
|
||||
<stop offset="22%" stop-color="#ffffff" stop-opacity="0.04"/>
|
||||
<stop offset="100%" stop-color="#ffffff" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
|
||||
<radialGradient id="col-led" cx="50%" cy="0%" r="120%" fy="0%">
|
||||
<stop offset="0%" stop-color={colLedColor} stop-opacity={colLedOpacity * 0.9}/>
|
||||
<stop offset="60%" stop-color={colLedColor} stop-opacity={colLedOpacity * 0.3}/>
|
||||
<stop offset="100%" stop-color={colLedColor} stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
|
||||
<radialGradient id="fruit-led" cx="50%" cy="0%" r="120%" fy="0%">
|
||||
<stop offset="0%" stop-color={fruitLedColor} stop-opacity={fruitLedOpacity}/>
|
||||
<stop offset="70%" stop-color={fruitLedColor} stop-opacity={fruitLedOpacity * 0.35}/>
|
||||
<stop offset="100%" stop-color={fruitLedColor} stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
|
||||
<!-- Warm amber "light leak" — used when a compartment door is ajar.
|
||||
Mercedes-style: soft outward bloom at the hinge edge + warm interior wash. -->
|
||||
<linearGradient id="ajar-leak-left" x1="0" y1="0" x2="1" y2="0">
|
||||
<stop offset="0%" stop-color="#ffb268" stop-opacity="0"/>
|
||||
<stop offset="35%" stop-color="#ffb268" stop-opacity="0.38"/>
|
||||
<stop offset="100%" stop-color="#ffd79a" stop-opacity="0.1"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="ajar-leak-right" x1="1" y1="0" x2="0" y2="0">
|
||||
<stop offset="0%" stop-color="#ffb268" stop-opacity="0"/>
|
||||
<stop offset="35%" stop-color="#ffb268" stop-opacity="0.38"/>
|
||||
<stop offset="100%" stop-color="#ffd79a" stop-opacity="0.1"/>
|
||||
</linearGradient>
|
||||
<radialGradient id="ajar-bloom-col" cx="0%" cy="50%" r="85%">
|
||||
<stop offset="0%" stop-color="#ffd79a" stop-opacity="0.85"/>
|
||||
<stop offset="40%" stop-color="#ffb268" stop-opacity="0.35"/>
|
||||
<stop offset="100%" stop-color="#ffb268" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="ajar-bloom-fruit" cx="100%" cy="50%" r="85%">
|
||||
<stop offset="0%" stop-color="#ffd79a" stop-opacity="0.85"/>
|
||||
<stop offset="40%" stop-color="#ffb268" stop-opacity="0.35"/>
|
||||
<stop offset="100%" stop-color="#ffb268" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
|
||||
<filter id="cab-shadow" x="-10%" y="-10%" width="120%" height="130%">
|
||||
<feGaussianBlur in="SourceAlpha" stdDeviation="6"/>
|
||||
<feOffset dx="0" dy="6"/>
|
||||
<feComponentTransfer><feFuncA type="linear" slope="0.22"/></feComponentTransfer>
|
||||
<feMerge>
|
||||
<feMergeNode/>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
|
||||
<!-- Mercedes-style bloom for the door-ajar light spill -->
|
||||
<filter id="ajar-bloom" x="-50%" y="-50%" width="200%" height="200%">
|
||||
<feGaussianBlur in="SourceGraphic" stdDeviation="2.4"/>
|
||||
</filter>
|
||||
|
||||
<!-- Soft drop shadow under a bag — like it's resting on the shelf -->
|
||||
<filter id="bag-shadow" x="-20%" y="-20%" width="140%" height="140%">
|
||||
<feGaussianBlur in="SourceAlpha" stdDeviation="0.7"/>
|
||||
<feOffset dx="0" dy="1.2"/>
|
||||
<feComponentTransfer><feFuncA type="linear" slope="0.35"/></feComponentTransfer>
|
||||
<feMerge>
|
||||
<feMergeNode/>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
|
||||
<!-- Label depth — printed sticker on the bag face -->
|
||||
<filter id="label-shadow" x="-10%" y="-10%" width="120%" height="140%">
|
||||
<feGaussianBlur in="SourceAlpha" stdDeviation="0.3"/>
|
||||
<feOffset dx="0" dy="0.5"/>
|
||||
<feComponentTransfer><feFuncA type="linear" slope="0.35"/></feComponentTransfer>
|
||||
<feMerge>
|
||||
<feMergeNode/>
|
||||
<feMergeNode in="SourceGraphic"/>
|
||||
</feMerge>
|
||||
</filter>
|
||||
|
||||
<!-- Soft specular highlight on the appliance body — like studio lighting -->
|
||||
<linearGradient id="body-highlight" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0%" stop-color="#ffffff" stop-opacity="0.55"/>
|
||||
<stop offset="40%" stop-color="#ffffff" stop-opacity="0.12"/>
|
||||
<stop offset="100%" stop-color="#ffffff" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
|
||||
<!-- Warm bloom at the top of the fruiting compartment when the grow light is on -->
|
||||
<radialGradient id="grow-bloom" cx="50%" cy="0%" r="80%" fy="0%">
|
||||
<stop offset="0%" stop-color="#ffe9b6" stop-opacity="0.65"/>
|
||||
<stop offset="40%" stop-color="#ffd890" stop-opacity="0.22"/>
|
||||
<stop offset="100%" stop-color="#ffd890" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
|
||||
<!-- Ultrasonic mist bloom -->
|
||||
<radialGradient id="mist-bloom" cx="50%" cy="50%" r="60%">
|
||||
<stop offset="0%" stop-color="#c0e4d3" stop-opacity="0.55"/>
|
||||
<stop offset="60%" stop-color="#c0e4d3" stop-opacity="0.12"/>
|
||||
<stop offset="100%" stop-color="#c0e4d3" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
|
||||
<!-- Soft blur for mist particles. Keep stdDeviation modest so the
|
||||
puff doesn't dilute below visibility. -->
|
||||
<filter id="mist-soften" x="-50%" y="-50%" width="200%" height="200%">
|
||||
<feGaussianBlur in="SourceGraphic" stdDeviation="0.8"/>
|
||||
</filter>
|
||||
|
||||
<!-- Radial fade for a single mist puff. Denser centre + a strong
|
||||
cream tone so it reads against the warm interior. -->
|
||||
<radialGradient id="mist-puff" cx="50%" cy="50%" r="60%">
|
||||
<stop offset="0%" stop-color="#ffffff" stop-opacity="1"/>
|
||||
<stop offset="50%" stop-color="#f4efe0" stop-opacity="0.75"/>
|
||||
<stop offset="100%" stop-color="#f4efe0" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
|
||||
<!-- Clip the mist so it never spills outside the fruiting interior -->
|
||||
<clipPath id="mist-clip">
|
||||
<rect x={RIGHT.x + 2} y={RIGHT.y + 2} width={RIGHT.w - 4} height={RIGHT.h - 4} rx="4"/>
|
||||
</clipPath>
|
||||
|
||||
<!-- Water gradients + interior clip for the reservoir -->
|
||||
<linearGradient id="water-full" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0%" stop-color="#aecdd6" stop-opacity="0.95"/>
|
||||
<stop offset="55%" stop-color="#6d9bae"/>
|
||||
<stop offset="100%" stop-color="#4a7d92"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="water-low" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="0%" stop-color="#e8b88a" stop-opacity="0.95"/>
|
||||
<stop offset="100%" stop-color="#b4702f"/>
|
||||
</linearGradient>
|
||||
<!-- Clips water & bubbles to the inside of the bottle body -->
|
||||
<clipPath id="reservoir-inside">
|
||||
<rect x="1.4" y="4.4" width="11.2" height="16.7" rx="1"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
|
||||
<!-- Ground shadow -->
|
||||
<ellipse cx="240" cy="403" rx="210" ry="8" fill="#b8ae94" opacity="0.35"/>
|
||||
|
||||
<!-- Appliance body -->
|
||||
<g filter="url(#cab-shadow)">
|
||||
<rect x="20" y="36" width="440" height="361" rx="14"
|
||||
fill="url(#body-grad)" stroke="#c0b69d" stroke-width="1"/>
|
||||
<!-- Studio specular highlight across the top of the body -->
|
||||
<rect x="22" y="38" width="436" height="44" rx="12"
|
||||
fill="url(#body-highlight)" pointer-events="none"/>
|
||||
</g>
|
||||
|
||||
<!-- Base strip (houses the humidifier + fan controller) -->
|
||||
<rect x="20" y="359" width="440" height="38" rx="0"
|
||||
fill="none"/>
|
||||
<line x1="20" y1="359" x2="460" y2="359" stroke="#cec3a9" stroke-width="0.8" opacity="0.7"/>
|
||||
|
||||
<!-- Wordmark -->
|
||||
<text x="34" y="388"
|
||||
font-family="DM Serif Display, Georgia, serif" font-size="8" font-weight="400"
|
||||
fill="#8b8269" letter-spacing="0.04em">Cultivar</text>
|
||||
|
||||
<!-- Seam between doors -->
|
||||
<line x1="240" y1="52" x2="240" y2="349"
|
||||
stroke="#cdc3aa" stroke-width="0.8" opacity="0.6"/>
|
||||
|
||||
<!-- ═══ LEFT COMPARTMENT · colonization ═══ -->
|
||||
<g aria-label="Colonization compartment">
|
||||
<rect x={LEFT.x - 8} y={LEFT.y - 8}
|
||||
width={LEFT.w + 16} height={LEFT.h + 16} rx="6"
|
||||
fill="none" stroke="#9d9377" stroke-width="0.6" opacity="0.55"/>
|
||||
|
||||
<rect x={LEFT.x} y={LEFT.y}
|
||||
width={LEFT.w} height={LEFT.h} rx="4"
|
||||
fill="url(#col-inner)" stroke="#2e2a20" stroke-width="0.6"/>
|
||||
|
||||
<!-- LED strip (only visible when colonization work light is on) -->
|
||||
<line x1={LEFT.x + 4} y1={LEFT.y + 3} x2={LEFT.x + LEFT.w - 4} y2={LEFT.y + 3}
|
||||
stroke={colLedColor}
|
||||
stroke-width={colWorkLight?.on ? 1.6 : 0.5}
|
||||
stroke-opacity={colWorkLight?.on ? 0.85 : 0.22}
|
||||
stroke-linecap="round"/>
|
||||
|
||||
<rect x={LEFT.x} y={LEFT.y} width={LEFT.w} height={LEFT.h} rx="4"
|
||||
fill="url(#col-led)" pointer-events="none"/>
|
||||
|
||||
{#each shelfYs(LEFT).slice(1) as sy}
|
||||
<line x1={LEFT.x + 2} y1={sy} x2={LEFT.x + LEFT.w - 2} y2={sy}
|
||||
stroke="#2d2f25" stroke-width="0.8" opacity="0.9"/>
|
||||
{/each}
|
||||
|
||||
{#each colGrid as row, ri}
|
||||
{#each row as bag, ci}
|
||||
{@const br = bagRect(LEFT, ri, ci)}
|
||||
{#if bag}
|
||||
{@const cc = contamColor(bag)}
|
||||
{@const fh = Math.max(4, (br.h - 4) * bag.vision.colonization_pct / 100)}
|
||||
<g
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="bag-group"
|
||||
aria-label="Bag {bag.slot_id}: {bag.tag.strain_name}, {bag.vision.colonization_pct}% colonized"
|
||||
onclick={(e) => handleBagTap(bag, e)}
|
||||
onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && handleBagTap(bag, e)}
|
||||
>
|
||||
<g filter="url(#bag-shadow)">
|
||||
<rect x={br.x} y={br.y} width={br.w} height={br.h} rx="3"
|
||||
fill="#29281e" stroke="#4a4332" stroke-width="0.5"/>
|
||||
<rect x={br.x + 1.5} y={br.y + 1.5} width={br.w - 3} height={br.h - 3} rx="2.5"
|
||||
fill="var(--bag-grain)" fill-opacity="0.78"/>
|
||||
<rect x={br.x + 1.5} y={br.y + 1.5 + (br.h - 3 - fh)}
|
||||
width={br.w - 3} height={fh} rx="2.5"
|
||||
fill="var(--bag-mycelium)" fill-opacity="0.9"/>
|
||||
</g>
|
||||
|
||||
<g filter="url(#label-shadow)" pointer-events="none">
|
||||
<rect x={br.x + br.w / 2 - 26} y={br.y + br.h / 2 - 12}
|
||||
width="52" height="24" rx="3"
|
||||
fill="#fbf7ec" fill-opacity="0.98"
|
||||
stroke="#2a2a22" stroke-width="0.3" stroke-opacity="0.35"/>
|
||||
<text
|
||||
x={br.x + br.w / 2} y={br.y + br.h / 2 - 1}
|
||||
text-anchor="middle"
|
||||
fill="#1b1f1a"
|
||||
style="font-size: 7.5px; font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; letter-spacing: -0.005em;"
|
||||
>{bagSpeciesShort(bag)}</text>
|
||||
<text
|
||||
x={br.x + br.w / 2} y={br.y + br.h / 2 + 8}
|
||||
text-anchor="middle"
|
||||
fill="#7a7e71"
|
||||
style="font-size: 7px; font-family: 'DM Sans', sans-serif; letter-spacing: 0.04em;"
|
||||
>{bagPrimary(bag, 'colonization')}</text>
|
||||
</g>
|
||||
|
||||
{#if cc}
|
||||
<rect x={br.x - 1.5} y={br.y - 1.5}
|
||||
width={br.w + 3} height={br.h + 3} rx="4"
|
||||
fill="none" stroke={cc} stroke-width="1.2"
|
||||
pointer-events="none"
|
||||
class={bag.vision.contamination_risk === 'high' ? 'contam-high' : 'contam-low'}/>
|
||||
{/if}
|
||||
</g>
|
||||
{:else}
|
||||
<rect x={br.x + 2} y={br.y + 2} width={br.w - 4} height={br.h - 4} rx="3"
|
||||
fill="none" stroke="#4a5040" stroke-width="0.7"
|
||||
stroke-dasharray="3 3" stroke-opacity="0.45"/>
|
||||
{/if}
|
||||
{/each}
|
||||
{/each}
|
||||
|
||||
<!-- Door-ajar visual (Mercedes-style light leak) — colonization hinges on the LEFT -->
|
||||
{#if colDoorOpen}
|
||||
<rect x={LEFT.x} y={LEFT.y} width={LEFT.w} height={LEFT.h} rx="4"
|
||||
fill="url(#ajar-bloom-col)" pointer-events="none" class="ajar-bloom"/>
|
||||
<rect x={LEFT.x - 14} y={LEFT.y - 2} width="14" height={LEFT.h + 4}
|
||||
fill="url(#ajar-leak-left)" pointer-events="none" class="ajar-leak"/>
|
||||
<circle cx={LEFT.x - 2} cy={LEFT.y + LEFT.h / 2} r="2.2"
|
||||
fill="#ffd79a" pointer-events="none" class="ajar-pulse"/>
|
||||
<g class="ajar-badge" transform="translate({LEFT.x + 4}, {LEFT.y - 22})" pointer-events="none">
|
||||
<rect x="0" y="0" width="78" height="18" rx="9"
|
||||
fill="#fbf4e3" stroke="#e0b376" stroke-width="0.8"/>
|
||||
<circle cx="11" cy="9" r="2.2" fill="#d99050"/>
|
||||
<text x="19" y="12.6"
|
||||
font-family="DM Sans, sans-serif" font-size="8"
|
||||
fill="#7a4a16" font-weight="600" letter-spacing="0.08em">DOOR AJAR</text>
|
||||
</g>
|
||||
{/if}
|
||||
</g>
|
||||
|
||||
<!-- ═══ RIGHT COMPARTMENT · fruiting ═══ -->
|
||||
<g aria-label="Fruiting compartment">
|
||||
<rect x={RIGHT.x - 8} y={RIGHT.y - 8}
|
||||
width={RIGHT.w + 16} height={RIGHT.h + 16} rx="6"
|
||||
fill="none" stroke="#9d9377" stroke-width="0.6" opacity="0.55"/>
|
||||
|
||||
<rect x={RIGHT.x} y={RIGHT.y}
|
||||
width={RIGHT.w} height={RIGHT.h} rx="4"
|
||||
fill="url(#fruit-inner)" stroke="#beb395" stroke-width="0.6"/>
|
||||
|
||||
<!-- Top LED strip -->
|
||||
<line x1={RIGHT.x + 4} y1={RIGHT.y + 3} x2={RIGHT.x + RIGHT.w - 4} y2={RIGHT.y + 3}
|
||||
stroke={fruitGrowLight?.on ? '#f2e8c6' : '#cfd9c0'}
|
||||
stroke-width={fruitGrowLight?.on ? 1.6 : 0.9}
|
||||
stroke-opacity={fruitGrowLight?.on ? 0.95 : 0.5}
|
||||
stroke-linecap="round"/>
|
||||
|
||||
<rect x={RIGHT.x} y={RIGHT.y} width={RIGHT.w} height={RIGHT.h} rx="4"
|
||||
fill="url(#fruit-led)" pointer-events="none"/>
|
||||
|
||||
<!-- Warm bloom emanating from the top LED strip when the grow light is on -->
|
||||
{#if fruitGrowLight?.on}
|
||||
<rect x={RIGHT.x + 2} y={RIGHT.y + 2} width={RIGHT.w - 4} height={46}
|
||||
fill="url(#grow-bloom)" pointer-events="none" class="grow-bloom-anim"/>
|
||||
{/if}
|
||||
|
||||
{#each shelfYs(RIGHT).slice(1) as sy}
|
||||
<line x1={RIGHT.x + 2} y1={sy} x2={RIGHT.x + RIGHT.w - 2} y2={sy}
|
||||
stroke="#b0a588" stroke-width="0.8" opacity="0.8"/>
|
||||
{/each}
|
||||
|
||||
{#each fruitGrid as row, ri}
|
||||
{#each row as bag, ci}
|
||||
{@const br = bagRect(RIGHT, ri, ci)}
|
||||
{#if bag}
|
||||
{@const cc = contamColor(bag)}
|
||||
{@const pct = bag.vision.colonization_pct}
|
||||
{@const fh = Math.max(4, (br.h - 4) * pct / 100)}
|
||||
{@const showFruits = pct >= 100 && (bag.vision.stage === 'fruiting' || bag.vision.stage === 'harvest')}
|
||||
<g
|
||||
role="button"
|
||||
tabindex="0"
|
||||
class="bag-group"
|
||||
aria-label="Bag {bag.slot_id}: {bag.tag.strain_name}, {bag.vision.stage}"
|
||||
onclick={(e) => handleBagTap(bag, e)}
|
||||
onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && handleBagTap(bag, e)}
|
||||
>
|
||||
<g filter="url(#bag-shadow)">
|
||||
<rect x={br.x} y={br.y} width={br.w} height={br.h} rx="3"
|
||||
fill="#c4ba9b" stroke="#928766" stroke-width="0.5"/>
|
||||
<rect x={br.x + 1.5} y={br.y + 1.5} width={br.w - 3} height={br.h - 3} rx="2.5"
|
||||
fill="var(--bag-grain)" fill-opacity="0.55"/>
|
||||
<rect x={br.x + 1.5} y={br.y + 1.5 + (br.h - 3 - fh)}
|
||||
width={br.w - 3} height={fh} rx="2.5"
|
||||
fill="var(--bag-mycelium)" fill-opacity="0.94"/>
|
||||
|
||||
{#if showFruits}
|
||||
<g transform="translate({br.x}, {br.y})" pointer-events="none">
|
||||
<ellipse cx={br.w * 0.28} cy="2" rx="5" ry="3" fill="var(--bag-fruit)" opacity="0.92"/>
|
||||
<ellipse cx={br.w * 0.55} cy="0.5" rx="6.5" ry="3.5" fill="#a17853" opacity="0.95"/>
|
||||
<ellipse cx={br.w * 0.78} cy="2.5" rx="4.5" ry="2.8" fill="var(--bag-fruit)" opacity="0.88"/>
|
||||
</g>
|
||||
{/if}
|
||||
</g>
|
||||
|
||||
<g filter="url(#label-shadow)" pointer-events="none">
|
||||
<rect x={br.x + br.w / 2 - 26} y={br.y + br.h / 2 - 12}
|
||||
width="52" height="24" rx="3"
|
||||
fill="#fbf7ec" fill-opacity="0.96"
|
||||
stroke="#6a5f44" stroke-width="0.3" stroke-opacity="0.4"/>
|
||||
<text
|
||||
x={br.x + br.w / 2} y={br.y + br.h / 2 - 1}
|
||||
text-anchor="middle"
|
||||
fill="#1b1f1a"
|
||||
style="font-size: 7.5px; font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; letter-spacing: -0.005em;"
|
||||
>{bagSpeciesShort(bag)}</text>
|
||||
<text
|
||||
x={br.x + br.w / 2} y={br.y + br.h / 2 + 8}
|
||||
text-anchor="middle"
|
||||
fill="#7a7e71"
|
||||
style="font-size: 7px; font-family: 'DM Sans', sans-serif; letter-spacing: 0.04em;"
|
||||
>{bagPrimary(bag, 'fruiting')}</text>
|
||||
</g>
|
||||
|
||||
{#if cc}
|
||||
<rect x={br.x - 1.5} y={br.y - 1.5}
|
||||
width={br.w + 3} height={br.h + 3} rx="4"
|
||||
fill="none" stroke={cc} stroke-width="1.2"
|
||||
pointer-events="none"
|
||||
class={bag.vision.contamination_risk === 'high' ? 'contam-high' : 'contam-low'}/>
|
||||
{/if}
|
||||
</g>
|
||||
{:else}
|
||||
<rect x={br.x + 2} y={br.y + 2} width={br.w - 4} height={br.h - 4} rx="3"
|
||||
fill="none" stroke="#a89d80" stroke-width="0.7"
|
||||
stroke-dasharray="3 3" stroke-opacity="0.55"/>
|
||||
{/if}
|
||||
{/each}
|
||||
{/each}
|
||||
|
||||
<!-- Glass door shine -->
|
||||
<rect x={RIGHT.x} y={RIGHT.y} width={RIGHT.w * 0.55} height={RIGHT.h}
|
||||
fill="url(#glass-shine)" pointer-events="none"/>
|
||||
|
||||
<!-- Glass door handle -->
|
||||
<rect x={RIGHT.x + RIGHT.w + 4} y={RIGHT.y + 12} width="3" height={RIGHT.h - 24} rx="1.5"
|
||||
fill="#b0a788" opacity="0.7"/>
|
||||
|
||||
<!-- Door-ajar visual (Mercedes-style) — fruiting hinges on the RIGHT -->
|
||||
{#if fruitDoorOpen}
|
||||
<rect x={RIGHT.x} y={RIGHT.y} width={RIGHT.w} height={RIGHT.h} rx="4"
|
||||
fill="url(#ajar-bloom-fruit)" pointer-events="none" class="ajar-bloom"/>
|
||||
<rect x={RIGHT.x + RIGHT.w} y={RIGHT.y - 2} width="14" height={RIGHT.h + 4}
|
||||
fill="url(#ajar-leak-right)" pointer-events="none" class="ajar-leak"/>
|
||||
<circle cx={RIGHT.x + RIGHT.w + 2} cy={RIGHT.y + RIGHT.h / 2} r="2.2"
|
||||
fill="#ffd79a" pointer-events="none" class="ajar-pulse"/>
|
||||
<g class="ajar-badge" transform="translate({RIGHT.x + RIGHT.w - 82}, {RIGHT.y - 22})" pointer-events="none">
|
||||
<rect x="0" y="0" width="78" height="18" rx="9"
|
||||
fill="#fbf4e3" stroke="#e0b376" stroke-width="0.8"/>
|
||||
<circle cx="11" cy="9" r="2.2" fill="#d99050"/>
|
||||
<text x="19" y="12.6"
|
||||
font-family="DM Sans, sans-serif" font-size="8"
|
||||
fill="#7a4a16" font-weight="600" letter-spacing="0.08em">DOOR AJAR</text>
|
||||
</g>
|
||||
{/if}
|
||||
</g>
|
||||
|
||||
<!-- ═══ BASE · humidifier + fans ═══ -->
|
||||
<g class="base-hw" aria-hidden="true">
|
||||
<!-- Humidifier icon (center of base) — ultrasonic disc -->
|
||||
<g transform="translate(240, 377)" aria-label="Humidifier">
|
||||
{#if humidOn}
|
||||
<!-- Ambient mist bloom -->
|
||||
<circle r="14" fill="url(#mist-bloom)" pointer-events="none" class="mist-bloom-anim"/>
|
||||
{/if}
|
||||
<circle r="6" fill={humidOn ? '#dff0ea' : '#e8e0c9'} stroke="#a89d80" stroke-width="0.6"/>
|
||||
{#if humidOn}
|
||||
{#each [0, 1, 2] as i}
|
||||
<circle r="6" fill="none" stroke="#7bb3a2" stroke-width="0.6" opacity="0">
|
||||
<animate attributeName="r" values="6;12" dur="2.2s" begin="{i * 0.6}s" repeatCount="indefinite"/>
|
||||
<animate attributeName="opacity" values="0.55;0" dur="2.2s" begin="{i * 0.6}s" repeatCount="indefinite"/>
|
||||
</circle>
|
||||
{/each}
|
||||
<path d="M-2,-1 Q-1,1 -2,2.5 M0,-1.5 Q1,0.5 0,2 M2,-1 Q3,1 2,2.5"
|
||||
stroke="#2b7a6b" stroke-width="0.6" fill="none" opacity="0.65"/>
|
||||
{/if}
|
||||
</g>
|
||||
|
||||
<!-- Water reservoir (right of humidifier) — vertical flask with
|
||||
a live water level, meniscus highlight, and rising bubbles
|
||||
while the humidifier is running. Derived values (`resPct`,
|
||||
`resLow`, `waterY`) live in the script block. -->
|
||||
<g transform="translate(258, 367)" aria-label="Water reservoir, {resPct}% full"
|
||||
class:reservoir-low={resLow}>
|
||||
<!-- Bottle silhouette: short neck, curved shoulders, rounded body -->
|
||||
<path
|
||||
d="M5 0.6
|
||||
L9 0.6
|
||||
L9 2.6
|
||||
Q9 3 9.4 3.3
|
||||
L11.8 4.4
|
||||
Q13 5 13 6.2
|
||||
L13 19.2
|
||||
Q13 21.1 11.1 21.1
|
||||
L2.9 21.1
|
||||
Q1 21.1 1 19.2
|
||||
L1 6.2
|
||||
Q1 5 2.2 4.4
|
||||
L4.6 3.3
|
||||
Q5 3 5 2.6
|
||||
Z"
|
||||
fill="#fbf8ec"
|
||||
stroke="#9d9377"
|
||||
stroke-width="0.7"
|
||||
stroke-linejoin="round"/>
|
||||
|
||||
<!-- Water + bubbles, clipped to the bottle interior -->
|
||||
<g clip-path="url(#reservoir-inside)">
|
||||
<!-- Water body -->
|
||||
<rect x="0" y={waterY} width="14" height="22"
|
||||
fill={resLow ? 'url(#water-low)' : 'url(#water-full)'}/>
|
||||
|
||||
<!-- Meniscus: bright specular line on the water surface -->
|
||||
<rect x="0" y={waterY} width="14" height="0.45"
|
||||
fill="#ffffff" opacity="0.55"/>
|
||||
<rect x="0" y={waterY + 0.5} width="14" height="0.35"
|
||||
fill="#ffffff" opacity="0.22"/>
|
||||
|
||||
<!-- Subtle rising bubbles (only when humidifier is active) -->
|
||||
{#if humidOn && !resLow}
|
||||
<circle cx="4.8" cy="20" r="0.45" fill="#ffffff" opacity="0">
|
||||
<animate attributeName="cy" values="20;{waterY + 0.8}"
|
||||
dur="3.2s" begin="0s" repeatCount="indefinite"/>
|
||||
<animate attributeName="opacity" values="0;0.85;0"
|
||||
keyTimes="0;0.3;1" dur="3.2s" begin="0s" repeatCount="indefinite"/>
|
||||
</circle>
|
||||
<circle cx="9.1" cy="20" r="0.35" fill="#ffffff" opacity="0">
|
||||
<animate attributeName="cy" values="20;{waterY + 0.8}"
|
||||
dur="4.1s" begin="1.4s" repeatCount="indefinite"/>
|
||||
<animate attributeName="opacity" values="0;0.75;0"
|
||||
keyTimes="0;0.3;1" dur="4.1s" begin="1.4s" repeatCount="indefinite"/>
|
||||
</circle>
|
||||
<circle cx="7" cy="20" r="0.3" fill="#ffffff" opacity="0">
|
||||
<animate attributeName="cy" values="20;{waterY + 0.8}"
|
||||
dur="4.6s" begin="2.7s" repeatCount="indefinite"/>
|
||||
<animate attributeName="opacity" values="0;0.7;0"
|
||||
keyTimes="0;0.3;1" dur="4.6s" begin="2.7s" repeatCount="indefinite"/>
|
||||
</circle>
|
||||
{/if}
|
||||
</g>
|
||||
|
||||
<!-- Glass left-edge highlight -->
|
||||
<path d="M2.1 7
|
||||
Q2.1 6 2.7 6
|
||||
L2.7 18
|
||||
Q2.7 19 2.1 19
|
||||
Z"
|
||||
fill="#ffffff" opacity="0.55"/>
|
||||
|
||||
<!-- Neck cap accent -->
|
||||
<line x1="5" y1="2.6" x2="9" y2="2.6"
|
||||
stroke="#8b8269" stroke-width="0.4" opacity="0.35"/>
|
||||
|
||||
<!-- Low-water warning halo -->
|
||||
{#if resLow}
|
||||
<path
|
||||
d="M5 0.6 L9 0.6 L9 2.6 Q9 3 9.4 3.3 L11.8 4.4 Q13 5 13 6.2
|
||||
L13 19.2 Q13 21.1 11.1 21.1 L2.9 21.1 Q1 21.1 1 19.2
|
||||
L1 6.2 Q1 5 2.2 4.4 L4.6 3.3 Q5 3 5 2.6 Z"
|
||||
fill="none" stroke="#d99050" stroke-width="1.1"
|
||||
class="reservoir-halo" pointer-events="none"/>
|
||||
{/if}
|
||||
</g>
|
||||
|
||||
<!-- Colonization fan (bottom-left of base) -->
|
||||
<g transform="translate(100, 377)" aria-label="Colonization fan">
|
||||
<circle r="7" fill="#f2ebd8" stroke="#b0a588" stroke-width="0.6"/>
|
||||
<g class="fan-blades" class:spinning={colFanSpinning} style="--fan-dur: {colFanDur}">
|
||||
{#each [0, 90, 180, 270] as a}
|
||||
<path transform="rotate({a})"
|
||||
d="M0,-0.7 Q1.3,-2.8 0,-4.8 Q-1.3,-2.8 0,-0.7 Z"
|
||||
fill={colFanSpinning ? 'var(--forest)' : '#b3a78b'}
|
||||
fill-opacity={colFanSpinning ? 0.85 : 0.6}/>
|
||||
{/each}
|
||||
</g>
|
||||
<circle r="1.1" fill="#94896c"/>
|
||||
</g>
|
||||
|
||||
<!-- Fruiting fan (bottom-right of base) -->
|
||||
<g transform="translate(380, 377)" aria-label="Fruiting fan">
|
||||
<circle r="7" fill="#f2ebd8" stroke="#b0a588" stroke-width="0.6"/>
|
||||
<g class="fan-blades" class:spinning={fruitFanSpinning} style="--fan-dur: {fruitFanDur}">
|
||||
{#each [0, 90, 180, 270] as a}
|
||||
<path transform="rotate({a})"
|
||||
d="M0,-0.7 Q1.3,-2.8 0,-4.8 Q-1.3,-2.8 0,-0.7 Z"
|
||||
fill={fruitFanSpinning ? 'var(--forest)' : '#b3a78b'}
|
||||
fill-opacity={fruitFanSpinning ? 0.85 : 0.6}/>
|
||||
{/each}
|
||||
</g>
|
||||
<circle r="1.1" fill="#94896c"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<!-- Humidity fog inside the fruiting compartment.
|
||||
Reads as atmospheric moisture by anchoring to a visible vent
|
||||
and layering low horizontal fog bands that drift sideways,
|
||||
rather than individual particles that rise straight up. -->
|
||||
{#if humidOn}
|
||||
{@const ventW = 60}
|
||||
{@const ventX = RIGHT.x + (RIGHT.w - ventW) / 2}
|
||||
{@const ventY = RIGHT.y + RIGHT.h - 8}
|
||||
|
||||
<!-- Mist-output vent at the bottom of the fruiting compartment -->
|
||||
<g pointer-events="none">
|
||||
<rect x={ventX} y={ventY} width={ventW} height="3" rx="1.2"
|
||||
fill="#9d9377" opacity="0.5"/>
|
||||
{#each [0, 1, 2, 3, 4, 5, 6, 7] as i}
|
||||
<line
|
||||
x1={ventX + 4 + i * 7} y1={ventY + 0.5}
|
||||
x2={ventX + 4 + i * 7} y2={ventY + 2.5}
|
||||
stroke="#6b6451" stroke-width="0.5" opacity="0.6"/>
|
||||
{/each}
|
||||
</g>
|
||||
|
||||
<!-- Low fog bands — horizontal drift, not vertical rise -->
|
||||
<g filter="url(#mist-soften)" clip-path="url(#mist-clip)" pointer-events="none">
|
||||
{#each FOG_BANDS as f, i}
|
||||
{@const cx = RIGHT.x + RIGHT.w / 2}
|
||||
{@const cy = RIGHT.y + RIGHT.h * f.yFrac}
|
||||
<ellipse
|
||||
cx={cx} cy={cy}
|
||||
rx={f.rx} ry={f.ry}
|
||||
fill="url(#mist-puff)"
|
||||
opacity={f.opacity}
|
||||
>
|
||||
<!-- Gentle horizontal drift, ping-pong -->
|
||||
<animate attributeName="cx"
|
||||
values="{cx};{cx + 14};{cx};{cx - 14};{cx}"
|
||||
keyTimes="0;0.25;0.5;0.75;1"
|
||||
dur="{f.dur}s" begin="{f.delay}s" repeatCount="indefinite"
|
||||
calcMode="spline" keySplines="0.4 0 0.6 1; 0.4 0 0.6 1; 0.4 0 0.6 1; 0.4 0 0.6 1"/>
|
||||
<!-- Subtle vertical bob so the band breathes -->
|
||||
<animate attributeName="cy"
|
||||
values="{cy};{cy - 2};{cy};{cy + 1};{cy}"
|
||||
keyTimes="0;0.25;0.5;0.75;1"
|
||||
dur="{f.dur}s" begin="{f.delay}s" repeatCount="indefinite"/>
|
||||
<!-- Subtle width breath so fog "rolls" -->
|
||||
<animate attributeName="rx"
|
||||
values="{f.rx};{f.rx * 1.08};{f.rx};{f.rx * 0.95};{f.rx}"
|
||||
keyTimes="0;0.3;0.5;0.7;1"
|
||||
dur="{f.dur}s" begin="{f.delay}s" repeatCount="indefinite"/>
|
||||
</ellipse>
|
||||
{/each}
|
||||
|
||||
<!-- A couple of slow vertical wisps rising out of the vent -->
|
||||
{#each FOG_WISPS as w, i}
|
||||
{@const startX = RIGHT.x + RIGHT.w * w.xFrac}
|
||||
{@const endX = startX + w.sway}
|
||||
{@const yStart = ventY - 2}
|
||||
{@const yEnd = RIGHT.y + RIGHT.h * 0.35}
|
||||
<ellipse
|
||||
cx={startX} cy={yStart}
|
||||
rx="8" ry="5"
|
||||
fill="url(#mist-puff)"
|
||||
opacity="0"
|
||||
>
|
||||
<animate attributeName="cy"
|
||||
values="{yStart};{yEnd}"
|
||||
dur="{w.dur}s" begin="{w.delay}s" repeatCount="indefinite"
|
||||
calcMode="spline" keySplines="0.5 0 0.7 1"/>
|
||||
<animate attributeName="cx"
|
||||
values="{startX};{endX}"
|
||||
dur="{w.dur}s" begin="{w.delay}s" repeatCount="indefinite"/>
|
||||
<animate attributeName="rx"
|
||||
values="8;20"
|
||||
dur="{w.dur}s" begin="{w.delay}s" repeatCount="indefinite"/>
|
||||
<animate attributeName="ry"
|
||||
values="5;10"
|
||||
dur="{w.dur}s" begin="{w.delay}s" repeatCount="indefinite"/>
|
||||
<animate attributeName="opacity"
|
||||
values="0;0.55;0.3;0"
|
||||
keyTimes="0;0.3;0.75;1"
|
||||
dur="{w.dur}s" begin="{w.delay}s" repeatCount="indefinite"/>
|
||||
</ellipse>
|
||||
{/each}
|
||||
</g>
|
||||
{/if}
|
||||
</svg>
|
||||
|
||||
<!-- Compartment labels below the appliance -->
|
||||
<div class="labels">
|
||||
<div class="label-card">
|
||||
<div class="lc-kicker">Left side · Colonization</div>
|
||||
<div class="lc-meta">
|
||||
<span class="lc-count">{occupiedCol}<span class="lc-total">/{totalCol}</span></span>
|
||||
<span class="lc-sep">·</span>
|
||||
<span class="lc-desc">{occupiedCol === 1 ? 'bag' : 'bags'} growing</span>
|
||||
</div>
|
||||
<div class="lc-poem font-serif italic">Like a forest floor, underground.</div>
|
||||
</div>
|
||||
|
||||
<div class="label-card right">
|
||||
<div class="lc-kicker">Right side · Fruiting</div>
|
||||
<div class="lc-meta">
|
||||
<span class="lc-count">{occupiedFruit}<span class="lc-total">/{totalFruit}</span></span>
|
||||
<span class="lc-sep">·</span>
|
||||
<span class="lc-desc">{occupiedFruit === 1 ? 'bag' : 'bags'} fruiting</span>
|
||||
</div>
|
||||
<div class="lc-poem font-serif italic">Like a shaded glade after rain.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.twin-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.appliance {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
max-width: 720px;
|
||||
margin: 0 auto;
|
||||
display: block;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/* Bags */
|
||||
.bag-group {
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
transition: filter 0.15s;
|
||||
}
|
||||
.bag-group:hover { filter: brightness(1.07); }
|
||||
.bag-group:focus-visible > rect:first-of-type {
|
||||
stroke: var(--forest);
|
||||
stroke-width: 1.5;
|
||||
}
|
||||
|
||||
/* Fan animation */
|
||||
.fan-blades {
|
||||
transform-box: fill-box;
|
||||
transform-origin: 50% 50%;
|
||||
}
|
||||
.fan-blades.spinning {
|
||||
animation: fan-spin var(--fan-dur) linear infinite;
|
||||
}
|
||||
@keyframes fan-spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.contam-high { animation: contam-pulse-high 1.8s ease-in-out infinite; }
|
||||
.contam-low { animation: contam-pulse-low 2.8s ease-in-out infinite; }
|
||||
|
||||
/* Door-ajar, Mercedes-style */
|
||||
.ajar-bloom { animation: ajar-breathe 4s ease-in-out infinite; }
|
||||
.ajar-leak { animation: ajar-breathe 4s ease-in-out infinite; }
|
||||
.ajar-pulse { animation: ajar-pulse 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
|
||||
.ajar-badge { animation: ajar-rise 0.4s ease-out both; }
|
||||
|
||||
/* Soft breathing on the grow-light bloom and the humidifier's mist halo */
|
||||
.grow-bloom-anim { animation: ambient-breathe 6s ease-in-out infinite; }
|
||||
.mist-bloom-anim { animation: ambient-breathe 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
|
||||
|
||||
/* Low-water reservoir halo: a slow amber pulse drawing the eye */
|
||||
.reservoir-halo { animation: reservoir-pulse 1.8s ease-in-out infinite; }
|
||||
@keyframes reservoir-pulse {
|
||||
0%, 100% { stroke-opacity: 0.25; }
|
||||
50% { stroke-opacity: 0.9; }
|
||||
}
|
||||
|
||||
@keyframes ambient-breathe {
|
||||
0%, 100% { opacity: 0.78; }
|
||||
50% { opacity: 1; }
|
||||
}
|
||||
|
||||
@keyframes ajar-breathe {
|
||||
0%, 100% { opacity: 0.85; }
|
||||
50% { opacity: 1; }
|
||||
}
|
||||
@keyframes ajar-pulse {
|
||||
0%, 100% { opacity: 0.7; transform: scale(1); }
|
||||
50% { opacity: 1; transform: scale(1.35); }
|
||||
}
|
||||
@keyframes ajar-rise {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
@keyframes contam-pulse-high {
|
||||
0%, 100% { stroke-opacity: 0.95; }
|
||||
50% { stroke-opacity: 0.35; }
|
||||
}
|
||||
@keyframes contam-pulse-low {
|
||||
0%, 100% { stroke-opacity: 0.75; }
|
||||
50% { stroke-opacity: 0.3; }
|
||||
}
|
||||
|
||||
/* ── Compartment labels below ── */
|
||||
.labels {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 24px;
|
||||
max-width: 680px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 0 8px;
|
||||
}
|
||||
|
||||
.label-card { display: flex; flex-direction: column; gap: 4px; }
|
||||
.label-card.right { text-align: right; }
|
||||
|
||||
.lc-kicker {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: var(--ink-2);
|
||||
}
|
||||
|
||||
.lc-meta {
|
||||
font-size: 12.5px;
|
||||
color: var(--ink-muted);
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 6px;
|
||||
}
|
||||
.label-card.right .lc-meta { justify-content: flex-end; }
|
||||
|
||||
.lc-poem {
|
||||
font-size: 12.5px;
|
||||
color: var(--ink-muted);
|
||||
letter-spacing: 0.005em;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.lc-count {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 15px;
|
||||
color: var(--forest);
|
||||
font-weight: var(--fw-display);
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
.lc-total { color: var(--ink-muted); font-size: 12px; }
|
||||
.lc-sep { opacity: 0.4; }
|
||||
.lc-desc { font-style: italic; font-family: var(--font-serif); color: var(--ink-2); }
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.labels { gap: 14px; }
|
||||
}
|
||||
</style>
|
||||
@@ -1,353 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { Chamber, BagState } from '../types';
|
||||
import { cultivar } from '../store.svelte';
|
||||
|
||||
interface Props {
|
||||
chamber: Chamber;
|
||||
}
|
||||
|
||||
const { chamber }: Props = $props();
|
||||
|
||||
const hw = $derived(cultivar.state.hardware);
|
||||
const fan = $derived(hw.fans[0]);
|
||||
const humidOn = $derived(hw.humidifier.active);
|
||||
const heaterOn = $derived(hw.heater.active);
|
||||
const leds = $derived(hw.leds);
|
||||
|
||||
const fanSpinning = $derived(fan.speed_pct > 0);
|
||||
const fanDur = $derived(
|
||||
fanSpinning ? `${(0.5 + (1 - fan.speed_pct / 100) * 2.4).toFixed(2)}s` : '4s'
|
||||
);
|
||||
|
||||
const ledColor = $derived(leds.brightness > 0 ? leds.color_hex : '#1a1d16');
|
||||
const ledOpacity = $derived(leds.brightness * 0.45);
|
||||
|
||||
// Uniform bag color by chamber type — only contamination changes appearance
|
||||
const BAG_BASE = $derived(chamber.type === 'colonization' ? '#bcc5b0' : '#18c8b2');
|
||||
|
||||
function contamColor(bag: BagState): string | null {
|
||||
if (bag.vision.contamination_risk === 'high') return '#e43a4c';
|
||||
if (bag.vision.contamination_risk === 'low') return '#f09038';
|
||||
return null;
|
||||
}
|
||||
|
||||
// Colonization: show %, Fruiting: show days to harvest
|
||||
function bagLabel(bag: BagState): string {
|
||||
if (chamber.type === 'fruiting') {
|
||||
const days = Math.max(0, Math.ceil(
|
||||
(bag.vision.projection.estimated_ready_ts - Date.now() / 1000) / 86400
|
||||
));
|
||||
return days === 0 ? 'Today' : `${days}d`;
|
||||
}
|
||||
return `${bag.vision.colonization_pct}%`;
|
||||
}
|
||||
|
||||
// rows[0]=top shelf (z=2), rows[1]=mid (z=1), rows[2]=bot (z=0)
|
||||
const grid = $derived.by(() => {
|
||||
const rows: (BagState | null)[][] = [[null, null], [null, null], [null, null]];
|
||||
for (const slot of chamber.slots) {
|
||||
const row = 2 - slot.position.z;
|
||||
const col = slot.position.x;
|
||||
if (row >= 0 && row < 3 && col >= 0 && col < 2)
|
||||
rows[row][col] = slot.bag;
|
||||
}
|
||||
return rows;
|
||||
});
|
||||
|
||||
// Bag rect geometry — front face: x=28..152, y=82..250 (124×168)
|
||||
// 3 shelf rows; dividers at y=138, y=194 (56px per row)
|
||||
const BAG_X = [33, 96];
|
||||
const BAG_W = 51;
|
||||
const BAG_TOPS = [87, 143, 199];
|
||||
const BAG_H = 48;
|
||||
|
||||
// Env reading shortcuts
|
||||
const temp = $derived(chamber.environment.temp_c.toFixed(1));
|
||||
const rh = $derived(chamber.environment.rh_pct.toFixed(0));
|
||||
const co2 = $derived(
|
||||
chamber.type === 'colonization'
|
||||
? (chamber.environment.co2e_ppm ?? 0).toFixed(0)
|
||||
: (chamber.environment.co2_ppm ?? 0).toFixed(0)
|
||||
);
|
||||
const co2Label = chamber.type === 'colonization' ? 'CO₂e' : 'CO₂';
|
||||
const voc = $derived(chamber.environment.voc_ppb.toFixed(0));
|
||||
</script>
|
||||
|
||||
<div class="wrap">
|
||||
<div class="ch-name">{chamber.label}</div>
|
||||
|
||||
<!--
|
||||
Cabinet geometry:
|
||||
Front face : x=28..152, y=82..250 (124×168)
|
||||
Depth : 20h / 12v
|
||||
Top face : 28,82 → 48,70 → 172,70 → 152,82
|
||||
Side face : 152,82 → 172,70 → 172,238 → 152,250
|
||||
Shelf lines: y=138, y=194
|
||||
-->
|
||||
<svg viewBox="20 60 155 200" class="iso" aria-hidden="true">
|
||||
<defs>
|
||||
<radialGradient id="led-{chamber.id}" cx="50%" cy="0%" r="110%" fy="0%">
|
||||
<stop offset="0%" stop-color={ledColor} stop-opacity={ledOpacity}/>
|
||||
<stop offset="80%" stop-color={ledColor} stop-opacity={ledOpacity * 0.15}/>
|
||||
<stop offset="100%" stop-color={ledColor} stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="heat-{chamber.id}" cx="50%" cy="100%" r="75%">
|
||||
<stop offset="0%" stop-color="#ff5020" stop-opacity={heaterOn ? 0.13 : 0}/>
|
||||
<stop offset="100%" stop-color="#ff5020" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
|
||||
<!-- TOP FACE -->
|
||||
<polygon points="28,82 48,70 172,70 152,82"
|
||||
fill="#0d1210" stroke="#222a20" stroke-width="0.8"/>
|
||||
<!-- LED strip -->
|
||||
<line x1="28" y1="82" x2="152" y2="82"
|
||||
stroke={ledColor}
|
||||
stroke-width={leds.brightness > 0 ? 3 : 0.6}
|
||||
stroke-opacity={leds.brightness > 0 ? 0.9 : 0.18}/>
|
||||
|
||||
<!-- RIGHT SIDE FACE -->
|
||||
<polygon points="152,82 172,70 172,238 152,250"
|
||||
fill="#0b0f0c" stroke="#222a20" stroke-width="0.8"/>
|
||||
|
||||
<!-- FRONT FACE -->
|
||||
<rect x="28" y="82" width="124" height="168"
|
||||
fill="#111810" fill-opacity="0.88"
|
||||
stroke="#222a20" stroke-width="0.8"/>
|
||||
<rect x="28" y="82" width="124" height="168" fill="url(#led-{chamber.id})"/>
|
||||
<rect x="28" y="82" width="124" height="168" fill="url(#heat-{chamber.id})"/>
|
||||
|
||||
<!-- SHELF DIVIDERS -->
|
||||
<line x1="28" y1="138" x2="152" y2="138" stroke="#1c2419" stroke-width="1"/>
|
||||
<line x1="28" y1="194" x2="152" y2="194" stroke="#1c2419" stroke-width="1"/>
|
||||
<line x1="90" y1="82" x2="90" y2="250" stroke="#181e15" stroke-width="0.6" stroke-opacity="0.7"/>
|
||||
|
||||
<!-- BAGS -->
|
||||
{#each grid as row, ri}
|
||||
{#each row as bag, ci}
|
||||
{@const bx = BAG_X[ci]}
|
||||
{@const by = BAG_TOPS[ri]}
|
||||
{#if bag}
|
||||
{@const cc = contamColor(bag)}
|
||||
<!-- Bag body (dim fill) -->
|
||||
<rect x={bx} y={by} width={BAG_W} height={BAG_H} rx="2.5"
|
||||
fill={BAG_BASE} fill-opacity="0.10"
|
||||
stroke={BAG_BASE} stroke-width="0.5" stroke-opacity="0.20"/>
|
||||
<!-- Colonization fill rising from bottom -->
|
||||
{@const fh = Math.max(3, BAG_H * bag.vision.colonization_pct / 100)}
|
||||
<rect x={bx} y={by + BAG_H - fh} width={BAG_W} height={fh} rx="2"
|
||||
fill={BAG_BASE} fill-opacity="0.52"/>
|
||||
<!-- Label -->
|
||||
<text
|
||||
x={bx + BAG_W / 2} y={by + BAG_H / 2 + 3.5}
|
||||
text-anchor="middle"
|
||||
fill={BAG_BASE} fill-opacity="0.9"
|
||||
style="font-size:8px; font-family: Georgia, serif;"
|
||||
>{bagLabel(bag)}</text>
|
||||
<!-- Contamination glow outline (pulsing) -->
|
||||
{#if cc}
|
||||
<!-- Outer halo -->
|
||||
<rect x={bx - 2} y={by - 2} width={BAG_W + 4} height={BAG_H + 4} rx="4"
|
||||
fill="none" stroke={cc} stroke-width="1" stroke-opacity="0.22"/>
|
||||
<!-- Inner border (animated) -->
|
||||
<rect x={bx} y={by} width={BAG_W} height={BAG_H} rx="2.5"
|
||||
fill="none" stroke={cc} stroke-width="1.8"
|
||||
class={bag.vision.contamination_risk === 'high' ? 'contam-high' : 'contam-low'}/>
|
||||
{/if}
|
||||
{:else}
|
||||
<!-- Empty slot -->
|
||||
<rect x={bx} y={by} width={BAG_W} height={BAG_H} rx="2.5"
|
||||
fill="#181e16" fill-opacity="0.55"
|
||||
stroke="#3a4236" stroke-width="1"
|
||||
stroke-dasharray="3 3" stroke-opacity="0.65"/>
|
||||
<line x1={bx + BAG_W/2 - 6} y1={by + BAG_H/2}
|
||||
x2={bx + BAG_W/2 + 6} y2={by + BAG_H/2}
|
||||
stroke="#4a5244" stroke-width="1" stroke-opacity="0.5"/>
|
||||
<line x1={bx + BAG_W/2} y1={by + BAG_H/2 - 6}
|
||||
x2={bx + BAG_W/2} y2={by + BAG_H/2 + 6}
|
||||
stroke="#4a5244" stroke-width="1" stroke-opacity="0.5"/>
|
||||
{/if}
|
||||
{/each}
|
||||
{/each}
|
||||
|
||||
<!-- HARDWARE: Fan -->
|
||||
<g transform="translate(162, 122)">
|
||||
<circle r="9" fill="#090e0a" stroke="#1e2820" stroke-width="0.7"/>
|
||||
<g class="fan-blades" class:spinning={fanSpinning}
|
||||
style="--fan-dur: {fanDur}">
|
||||
{#each [0, 90, 180, 270] as a}
|
||||
<path transform="rotate({a})"
|
||||
d="M0,-1 Q2,-4.5 0,-8 Q-2,-4.5 0,-1 Z"
|
||||
fill={fanSpinning ? '#52cb78' : '#323a2e'}
|
||||
fill-opacity={fanSpinning ? 0.8 : 0.4}/>
|
||||
{/each}
|
||||
</g>
|
||||
<circle r="1.8" fill="#1a2018"/>
|
||||
<circle r="9" fill="none"
|
||||
stroke={fanSpinning ? '#52cb78' : '#2a3428'}
|
||||
stroke-width="0.6" stroke-opacity={fanSpinning ? 0.55 : 0.2}/>
|
||||
</g>
|
||||
|
||||
<!-- HARDWARE: Humidifier -->
|
||||
<g transform="translate(162, 160)">
|
||||
<circle r="5"
|
||||
fill={humidOn ? '#0e2e2c' : '#0a0e0b'}
|
||||
fill-opacity="0.9"
|
||||
stroke={humidOn ? '#18c8b2' : '#1e2820'}
|
||||
stroke-width="0.6" stroke-opacity={humidOn ? 0.7 : 0.3}/>
|
||||
{#each [-1.5, 0, 1.5] as dx}
|
||||
<path d="M{dx},-2 Q{dx + 1},0 {dx},2"
|
||||
fill="none"
|
||||
stroke={humidOn ? '#18c8b2' : '#2a3428'}
|
||||
stroke-width="0.6" stroke-opacity={humidOn ? 0.8 : 0.25}/>
|
||||
{/each}
|
||||
</g>
|
||||
|
||||
<!-- HARDWARE: Heater -->
|
||||
<g transform="translate(162, 185)">
|
||||
<circle r="4"
|
||||
fill={heaterOn ? '#2e0e10' : '#0a0e0b'}
|
||||
fill-opacity="0.9"
|
||||
stroke={heaterOn ? '#e43a4c' : '#1e2820'}
|
||||
stroke-width="0.6" stroke-opacity={heaterOn ? 0.65 : 0.25}/>
|
||||
{#if heaterOn}
|
||||
{#each [0, 2, 4] as dy}
|
||||
<line x1="-2.5" y1={dy - 2} x2="2.5" y2={dy - 2}
|
||||
stroke="#e43a4c" stroke-width="0.6" stroke-opacity="0.7"/>
|
||||
{/each}
|
||||
{/if}
|
||||
</g>
|
||||
|
||||
<!-- MIST PARTICLES -->
|
||||
{#if humidOn}
|
||||
{#each [42, 78, 114] as mx, i}
|
||||
<circle cx={mx} cy="0" r="0" fill="#18c8b2">
|
||||
<animate attributeName="cy" values="248;82" dur="4.5s" begin="{i * 1.5}s" repeatCount="indefinite"/>
|
||||
<animate attributeName="r" values="1.5;4" dur="4.5s" begin="{i * 1.5}s" repeatCount="indefinite"/>
|
||||
<animate attributeName="opacity" values="0;0.3;0.22;0" keyTimes="0;0.08;0.75;1"
|
||||
dur="4.5s" begin="{i * 1.5}s" repeatCount="indefinite"/>
|
||||
</circle>
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
<!-- BOTTOM EDGES -->
|
||||
<line x1="28" y1="250" x2="152" y2="250" stroke="#222a20" stroke-width="0.8"/>
|
||||
<line x1="152" y1="250" x2="172" y2="238" stroke="#222a20" stroke-width="0.8"/>
|
||||
</svg>
|
||||
|
||||
<!-- Env stats pills -->
|
||||
<div class="env-pills">
|
||||
<div class="env-pill temp-pill">
|
||||
<span class="pv">{temp}°</span>
|
||||
<span class="pk">Temp</span>
|
||||
</div>
|
||||
<div class="env-pill rh-pill">
|
||||
<span class="pv">{rh}%</span>
|
||||
<span class="pk">RH</span>
|
||||
</div>
|
||||
<div class="env-pill co2-pill">
|
||||
<span class="pv">{co2}</span>
|
||||
<span class="pk">{co2Label}</span>
|
||||
</div>
|
||||
<div class="env-pill voc-pill">
|
||||
<span class="pv">{voc}</span>
|
||||
<span class="pk">VOC</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.ch-name {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 14px;
|
||||
letter-spacing: 0.02em;
|
||||
color: var(--color-text);
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.iso {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* ── Env pills ── */
|
||||
.env-pills {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
padding: 0 2px;
|
||||
}
|
||||
|
||||
.env-pill {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
padding: 5px 3px 4px;
|
||||
background: rgba(255, 255, 255, 0.025);
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--color-border);
|
||||
border-top-width: 2px;
|
||||
}
|
||||
|
||||
.temp-pill { border-top-color: var(--color-sage); }
|
||||
.rh-pill { border-top-color: var(--color-pinning); }
|
||||
.co2-pill { border-top-color: var(--color-fruiting); }
|
||||
.voc-pill { border-top-color: var(--color-text-muted); }
|
||||
|
||||
.pv {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
color: var(--color-text);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pk {
|
||||
font-size: 7px;
|
||||
letter-spacing: 0.09em;
|
||||
text-transform: uppercase;
|
||||
color: var(--color-text-muted);
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ── Fan animation ── */
|
||||
.fan-blades {
|
||||
transform-box: fill-box;
|
||||
transform-origin: 50% 50%;
|
||||
}
|
||||
.fan-blades.spinning {
|
||||
animation: fan-spin var(--fan-dur) linear infinite;
|
||||
}
|
||||
|
||||
@keyframes fan-spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* ── Contamination outline pulse ── */
|
||||
.contam-high {
|
||||
animation: contam-pulse-high 2s ease-in-out infinite;
|
||||
}
|
||||
.contam-low {
|
||||
animation: contam-pulse-low 3s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes contam-pulse-high {
|
||||
0%, 100% { stroke-opacity: 0.9; }
|
||||
50% { stroke-opacity: 0.3; }
|
||||
}
|
||||
@keyframes contam-pulse-low {
|
||||
0%, 100% { stroke-opacity: 0.75; }
|
||||
50% { stroke-opacity: 0.25; }
|
||||
}
|
||||
</style>
|
||||
@@ -1,36 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { cultivar } from '../store.svelte';
|
||||
import IsoChamber from './IsoChamber.svelte';
|
||||
|
||||
const chambers = $derived(cultivar.state.chambers);
|
||||
</script>
|
||||
|
||||
<div class="twin">
|
||||
{#each chambers as chamber (chamber.id)}
|
||||
<div class="twin-col">
|
||||
<IsoChamber {chamber} />
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.twin {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
padding: 12px 14px;
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.twin-col {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 639px) {
|
||||
.twin {
|
||||
gap: 8px;
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -376,93 +376,57 @@
|
||||
opacity="0.65"
|
||||
/>
|
||||
|
||||
<!-- ===== BAGTAG (center, semi-transparent, QR + QuroCode stacked) ===== -->
|
||||
<g>
|
||||
<!-- Tag carrier (nearly transparent plastic strip — just a border hint) -->
|
||||
<!-- ===== BAGTAG (minimal outline indicator) =====
|
||||
Previously drew full QR + QuroCode module grids which stole focus
|
||||
from the actual colonization state. Now just a ghost of the tag:
|
||||
two rounded code placeholders with tiny corner marks to suggest
|
||||
"there is a tag here" without visual noise. -->
|
||||
<g class="bag-tag-ghost">
|
||||
<!-- Tag carrier: dashed, very low-contrast -->
|
||||
<rect
|
||||
x={TAG_X} y={TAG_Y}
|
||||
width={TAG_W} height={TAG_H}
|
||||
rx="2"
|
||||
fill="#888880"
|
||||
fill-opacity="0.08"
|
||||
rx="3"
|
||||
fill="#f4f0de"
|
||||
fill-opacity="0.18"
|
||||
stroke="#8a8880"
|
||||
stroke-width="0.6"
|
||||
stroke-opacity="0.4"
|
||||
/>
|
||||
|
||||
<!-- QR code (top code, white bg) -->
|
||||
<g transform={`translate(${TAG_X + 5}, ${TAG_Y + 6})`}>
|
||||
<rect width={CODE_W} height={CODE_H} rx="1" fill="#f4f2e2"/>
|
||||
|
||||
<!-- Corner locators -->
|
||||
<rect x="4" y="4" width="14" height="14" fill="#0a0b09"/>
|
||||
<rect x="6" y="6" width="10" height="10" fill="#f4f2e2"/>
|
||||
<rect x="8" y="8" width="6" height="6" fill="#0a0b09"/>
|
||||
|
||||
<rect x={CODE_W - 18} y="4" width="14" height="14" fill="#0a0b09"/>
|
||||
<rect x={CODE_W - 16} y="6" width="10" height="10" fill="#f4f2e2"/>
|
||||
<rect x={CODE_W - 14} y="8" width="6" height="6" fill="#0a0b09"/>
|
||||
|
||||
<rect x="4" y={CODE_H - 18} width="14" height="14" fill="#0a0b09"/>
|
||||
<rect x="6" y={CODE_H - 16} width="10" height="10" fill="#f4f2e2"/>
|
||||
<rect x="8" y={CODE_H - 14} width="6" height="6" fill="#0a0b09"/>
|
||||
|
||||
<!-- Timing + data modules -->
|
||||
{#each Array.from({length: 16*14}) as _, idx (idx)}
|
||||
{@const r = Math.floor(idx / 16)}
|
||||
{@const c = idx % 16}
|
||||
{@const mx = 4 + c * 6}
|
||||
{@const my = 4 + r * 5.4}
|
||||
{@const inTL = r < 3 && c < 3}
|
||||
{@const inTR = r < 3 && c > 12}
|
||||
{@const inBL = r > 10 && c < 3}
|
||||
{@const on = ((r * 23 + c * 17 + 7) % 13) < 6}
|
||||
{#if !inTL && !inTR && !inBL && on}
|
||||
<rect x={mx} y={my} width="5" height="4.4" fill="#0a0b09"/>
|
||||
{/if}
|
||||
{/each}
|
||||
</g>
|
||||
|
||||
<!-- Divider line between codes -->
|
||||
<line
|
||||
x1={TAG_X + 6} y1={TAG_Y + 6 + CODE_H + 5}
|
||||
x2={TAG_X + TAG_W - 6} y2={TAG_Y + 6 + CODE_H + 5}
|
||||
stroke="#6a6a60"
|
||||
stroke-width="0.5"
|
||||
opacity="0.5"
|
||||
stroke-dasharray="2.5 2"
|
||||
stroke-opacity="0.35"
|
||||
/>
|
||||
|
||||
<!-- QuroCode (bottom code, dark bg + white modules) -->
|
||||
<g transform={`translate(${TAG_X + 5}, ${QURO_Y})`}>
|
||||
<rect width={CODE_W} height={CODE_H} rx="1" fill="#0a0b09"/>
|
||||
|
||||
<!-- Circular corner marks -->
|
||||
<circle cx="9" cy="9" r="6.5" fill="#0a0b09" stroke="#f0f0e0" stroke-width="1.5"/>
|
||||
<circle cx="9" cy="9" r="3.2" fill="#f0f0e0"/>
|
||||
|
||||
<circle cx={CODE_W - 9} cy="9" r="6.5" fill="#0a0b09" stroke="#f0f0e0" stroke-width="1.5"/>
|
||||
<circle cx={CODE_W - 9} cy="9" r="3.2" fill="#f0f0e0"/>
|
||||
|
||||
<circle cx="9" cy={CODE_H - 9} r="6.5" fill="#0a0b09" stroke="#f0f0e0" stroke-width="1.5"/>
|
||||
<circle cx="9" cy={CODE_H - 9} r="3.2" fill="#f0f0e0"/>
|
||||
|
||||
<!-- White data modules (large) -->
|
||||
{#each Array.from({length: 10*9}) as _, idx (idx)}
|
||||
{@const r = Math.floor(idx / 10)}
|
||||
{@const c = idx % 10}
|
||||
{@const mx = 6 + c * 9.5}
|
||||
{@const my = 6 + r * 8.4}
|
||||
{@const inTL = r < 2 && c < 2}
|
||||
{@const inTR = r < 2 && c > 7}
|
||||
{@const inBL = r > 6 && c < 2}
|
||||
{@const on = ((r * 13 + c * 11 + 5) % 9) < 4}
|
||||
{#if !inTL && !inTR && !inBL && on}
|
||||
<rect x={mx} y={my} width="7.5" height="6.5" rx="0.5" fill="#f0f0e0"/>
|
||||
{/if}
|
||||
{/each}
|
||||
<!-- Top code placeholder (QR-ish) — outline + three corner squares -->
|
||||
<g transform={`translate(${TAG_X + 5}, ${TAG_Y + 6})`} opacity="0.35">
|
||||
<rect width={CODE_W} height={CODE_H} rx="1.5"
|
||||
fill="none" stroke="#6a6a60" stroke-width="0.5"/>
|
||||
<rect x="5" y="5" width="11" height="11" fill="none"
|
||||
stroke="#6a6a60" stroke-width="1"/>
|
||||
<rect x={CODE_W - 16} y="5" width="11" height="11" fill="none"
|
||||
stroke="#6a6a60" stroke-width="1"/>
|
||||
<rect x="5" y={CODE_H - 16} width="11" height="11" fill="none"
|
||||
stroke="#6a6a60" stroke-width="1"/>
|
||||
</g>
|
||||
|
||||
<!-- Strain code text at bottom of tag -->
|
||||
<!-- Divider -->
|
||||
<line
|
||||
x1={TAG_X + 10} y1={TAG_Y + 6 + CODE_H + 5}
|
||||
x2={TAG_X + TAG_W - 10} y2={TAG_Y + 6 + CODE_H + 5}
|
||||
stroke="#6a6a60" stroke-width="0.4" opacity="0.25"
|
||||
/>
|
||||
|
||||
<!-- Bottom code placeholder (QuroCode-ish) — outline + three corner circles -->
|
||||
<g transform={`translate(${TAG_X + 5}, ${QURO_Y})`} opacity="0.35">
|
||||
<rect width={CODE_W} height={CODE_H} rx="1.5"
|
||||
fill="none" stroke="#6a6a60" stroke-width="0.5"/>
|
||||
<circle cx="10" cy="10" r="4.5" fill="none"
|
||||
stroke="#6a6a60" stroke-width="1"/>
|
||||
<circle cx={CODE_W - 10} cy="10" r="4.5" fill="none"
|
||||
stroke="#6a6a60" stroke-width="1"/>
|
||||
<circle cx="10" cy={CODE_H - 10} r="4.5" fill="none"
|
||||
stroke="#6a6a60" stroke-width="1"/>
|
||||
</g>
|
||||
|
||||
<!-- Strain code label inside bottom of the tag, very faint -->
|
||||
{#if strainCode}
|
||||
<text
|
||||
x={W / 2}
|
||||
@@ -470,9 +434,9 @@
|
||||
text-anchor="middle"
|
||||
font-family="var(--font-sans)"
|
||||
font-size="4"
|
||||
fill="#e0ddd0"
|
||||
letter-spacing="0.03em"
|
||||
opacity="0.85"
|
||||
fill="#7a7868"
|
||||
letter-spacing="0.04em"
|
||||
opacity="0.55"
|
||||
>{strainCode}</text>
|
||||
{/if}
|
||||
{#if inoculatedTs}
|
||||
@@ -484,6 +448,7 @@
|
||||
font-size="3.5"
|
||||
fill="#8e907e"
|
||||
letter-spacing="0.06em"
|
||||
opacity="0.7"
|
||||
>INOC {formatDate(inoculatedTs)}</text>
|
||||
{/if}
|
||||
</g>
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
|
||||
// no props needed — opacity/sizing controlled by parent CSS
|
||||
let canvas = $state<HTMLCanvasElement | null>(null);
|
||||
let stop: (() => void) | null = null;
|
||||
|
||||
onMount(() => {
|
||||
if (canvas) stop = run(canvas);
|
||||
});
|
||||
|
||||
onDestroy(() => { stop?.(); });
|
||||
|
||||
function run(el: HTMLCanvasElement): () => void {
|
||||
const ctx = el.getContext('2d')!;
|
||||
const dpr = Math.min(window.devicePixelRatio || 1, 2);
|
||||
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
let W = 0, H = 0;
|
||||
let hyphae: Hypha[] = [];
|
||||
let lastSpawn = 0;
|
||||
let active = true;
|
||||
|
||||
function resize() {
|
||||
const r = el.getBoundingClientRect();
|
||||
W = Math.max(1, r.width);
|
||||
H = Math.max(1, r.height);
|
||||
el.width = W * dpr;
|
||||
el.height = H * dpr;
|
||||
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
||||
}
|
||||
|
||||
class Hypha {
|
||||
x: number; y: number; angle: number; gen: number;
|
||||
width: number;
|
||||
points: { x: number; y: number }[];
|
||||
maxPoints: number;
|
||||
growing = true;
|
||||
fade = 1;
|
||||
deathTimer = 0;
|
||||
lifespan: number;
|
||||
wander: number;
|
||||
speed: number;
|
||||
branchProb: number;
|
||||
stepsSinceBranch = 0;
|
||||
|
||||
constructor(x: number, y: number, angle: number, gen: number) {
|
||||
this.x = x; this.y = y; this.angle = angle; this.gen = gen;
|
||||
this.width = Math.max(0.28, 1.05 - gen * 0.22);
|
||||
this.points = [{ x, y }];
|
||||
this.maxPoints = gen === 0 ? 320 + Math.random() * 240
|
||||
: gen === 1 ? 180 + Math.random() * 120
|
||||
: 90 + Math.random() * 80;
|
||||
this.lifespan = 500 + Math.random() * 300;
|
||||
this.wander = 0.12 + Math.random() * 0.14;
|
||||
this.speed = 0.40 + Math.random() * 0.35 + (gen === 0 ? 0.10 : 0);
|
||||
this.branchProb = gen < 2 ? 0.020 : gen < 4 ? 0.010 : 0.003;
|
||||
}
|
||||
|
||||
step(spawned: Hypha[]): boolean {
|
||||
if (this.growing) {
|
||||
this.angle += (Math.random() - 0.5) * this.wander;
|
||||
this.x += Math.cos(this.angle) * this.speed;
|
||||
this.y += Math.sin(this.angle) * this.speed;
|
||||
this.points.push({ x: this.x, y: this.y });
|
||||
this.stepsSinceBranch++;
|
||||
|
||||
if (this.x < -20 || this.x > W + 20 || this.y < -20 || this.y > H + 20)
|
||||
this.growing = false;
|
||||
if (this.points.length >= this.maxPoints)
|
||||
this.growing = false;
|
||||
|
||||
if (this.gen < 5 && this.stepsSinceBranch > 12 && Math.random() < this.branchProb) {
|
||||
const dir = Math.random() < 0.5 ? -1 : 1;
|
||||
spawned.push(new Hypha(this.x, this.y, this.angle + dir * (0.5 + Math.random() * 0.55), this.gen + 1));
|
||||
this.stepsSinceBranch = 0;
|
||||
}
|
||||
} else {
|
||||
this.deathTimer++;
|
||||
this.fade = Math.max(0, 1 - this.deathTimer / this.lifespan);
|
||||
}
|
||||
return this.fade > 0;
|
||||
}
|
||||
|
||||
draw() {
|
||||
if (this.points.length < 2) return;
|
||||
const a = this.fade;
|
||||
ctx.lineCap = 'round';
|
||||
ctx.lineJoin = 'round';
|
||||
|
||||
// Main filament — brighter than original for overlay use
|
||||
ctx.strokeStyle = `rgba(215, 228, 210, ${0.18 * a})`;
|
||||
ctx.lineWidth = this.width;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(this.points[0].x, this.points[0].y);
|
||||
for (let i = 1; i < this.points.length; i++)
|
||||
ctx.lineTo(this.points[i].x, this.points[i].y);
|
||||
ctx.stroke();
|
||||
|
||||
if (this.growing && this.points.length > 4) {
|
||||
const tipLen = Math.min(10, this.points.length - 1);
|
||||
const start = this.points.length - 1 - tipLen;
|
||||
|
||||
// Growing tip — sage-tinted
|
||||
ctx.strokeStyle = `rgba(150, 210, 155, ${0.45 * a})`;
|
||||
ctx.lineWidth = this.width * 1.15;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(this.points[start].x, this.points[start].y);
|
||||
for (let i = start + 1; i < this.points.length; i++)
|
||||
ctx.lineTo(this.points[i].x, this.points[i].y);
|
||||
ctx.stroke();
|
||||
|
||||
// Tip node
|
||||
const tip = this.points[this.points.length - 1];
|
||||
ctx.fillStyle = `rgba(170, 220, 170, ${0.55 * a})`;
|
||||
ctx.beginPath();
|
||||
ctx.arc(tip.x, tip.y, this.width * 1.4, 0, Math.PI * 2);
|
||||
ctx.fill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function spawn() {
|
||||
const fromSide = Math.random() < 0.6;
|
||||
let x: number, y: number, angle: number;
|
||||
if (fromSide) {
|
||||
if (Math.random() < 0.5) { x = -2; angle = (Math.random() - 0.5) * 0.9; }
|
||||
else { x = W + 2; angle = Math.PI + (Math.random() - 0.5) * 0.9; }
|
||||
y = Math.random() * H;
|
||||
} else {
|
||||
x = Math.random() * W;
|
||||
if (Math.random() < 0.5) { y = -2; angle = Math.PI / 2 + (Math.random() - 0.5) * 0.9; }
|
||||
else { y = H + 2; angle = -Math.PI / 2 + (Math.random() - 0.5) * 0.9; }
|
||||
}
|
||||
hyphae.push(new Hypha(x, y, angle, 0));
|
||||
}
|
||||
|
||||
function frame(t: number) {
|
||||
if (!active) return;
|
||||
if (!W || !H) { requestAnimationFrame(frame); return; }
|
||||
ctx.clearRect(0, 0, W, H);
|
||||
|
||||
const target = Math.max(2, Math.floor(W / 150));
|
||||
const liveTrunks = hyphae.reduce((n, h) => n + (h.gen === 0 && h.growing ? 1 : 0), 0);
|
||||
if (liveTrunks < target && t - lastSpawn > 400) { spawn(); lastSpawn = t; }
|
||||
|
||||
const next: Hypha[] = [];
|
||||
for (const h of hyphae) {
|
||||
const alive = h.step(next);
|
||||
h.draw();
|
||||
if (alive) next.push(h);
|
||||
}
|
||||
hyphae = next;
|
||||
requestAnimationFrame(frame);
|
||||
}
|
||||
|
||||
const ro = new ResizeObserver(resize);
|
||||
ro.observe(el);
|
||||
resize();
|
||||
|
||||
if (reduced) {
|
||||
for (let i = 0; i < 10; i++) spawn();
|
||||
for (let s = 0; s < 200; s++) {
|
||||
const next: Hypha[] = [];
|
||||
for (const h of hyphae) { if (h.step(next)) next.push(h); }
|
||||
hyphae = next;
|
||||
}
|
||||
for (const h of hyphae) { h.growing = false; h.draw(); }
|
||||
} else {
|
||||
for (let i = 0; i < 2; i++) spawn();
|
||||
requestAnimationFrame(frame);
|
||||
}
|
||||
|
||||
return () => { active = false; ro.disconnect(); };
|
||||
}
|
||||
</script>
|
||||
|
||||
<canvas bind:this={canvas}></canvas>
|
||||
|
||||
<style>
|
||||
canvas {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
+25
-6
@@ -100,11 +100,23 @@ export type CultivarState = {
|
||||
};
|
||||
chambers: Chamber[];
|
||||
hardware: {
|
||||
fans: Array<{ id: string; speed_pct: number; mode: 'auto' | 'manual' }>;
|
||||
heater: { active: boolean; duty_cycle: number };
|
||||
humidifier: { active: boolean; mode: 'auto' | 'manual' };
|
||||
leds: { mode: string; color_hex: string; brightness: number };
|
||||
cameras: Array<{ id: string; position: string; last_capture_ts: number }>;
|
||||
/** Each compartment has its own FAE fan */
|
||||
fans: Array<{ id: string; chamber_id: string; speed_pct: number; mode: 'auto' | 'manual' }>;
|
||||
/** One ultrasonic humidifier in the base, feeding both compartments */
|
||||
humidifier: { active: boolean; mode: 'auto' | 'manual'; reservoir_pct: number };
|
||||
/** Per-compartment lighting — colonization has a work/photo light,
|
||||
* fruiting has a grow/display light. No grow light in colonization. */
|
||||
lights: Array<{
|
||||
id: string;
|
||||
chamber_id: string;
|
||||
purpose: 'work' | 'grow' | 'photo';
|
||||
on: boolean;
|
||||
color_hex: string;
|
||||
brightness: number;
|
||||
}>;
|
||||
/** Reed-switch door sensors, one per compartment door */
|
||||
doors: Array<{ id: string; chamber_id: string; open: boolean }>;
|
||||
cameras: Array<{ id: string; chamber_id: string; position: string; last_capture_ts: number }>;
|
||||
};
|
||||
recipe: {
|
||||
id: string;
|
||||
@@ -116,6 +128,13 @@ export type CultivarState = {
|
||||
stage_history: Array<{ stage: RecipeStage; started_ts: number; ended_ts: number | null }>;
|
||||
next_actions: Array<{ type: string; due_ts: number; description: string }>;
|
||||
};
|
||||
/** Recurring maintenance tasks the user handles by hand */
|
||||
maintenance: {
|
||||
/** Last time chamber walls + racks were wiped with 70% iso — every 2 weeks */
|
||||
last_wipe_ts: number;
|
||||
/** Last time humidifier reservoir was hand- or dishwasher-washed — every 4 weeks */
|
||||
last_reservoir_clean_ts: number;
|
||||
};
|
||||
ui: {
|
||||
scrubber_ts: number | null;
|
||||
selected_bag_id: string | null;
|
||||
@@ -126,7 +145,7 @@ export type CultivarState = {
|
||||
export type WsDiff = {
|
||||
t: number;
|
||||
e?: { temp?: number; rh?: number; co2?: number; voc?: number; vpd?: number };
|
||||
hw?: { fans?: number[]; heater?: boolean; humidifier?: boolean };
|
||||
hw?: { fans?: number[]; humidifier?: boolean; lights?: boolean[]; doors?: boolean[] };
|
||||
};
|
||||
|
||||
// Friendly stage names for display
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { cultivar } from '../store.svelte';
|
||||
|
||||
const activeAlerts = $derived(
|
||||
cultivar.state.environment.alerts.filter((a: { dismissed: boolean }) => !a.dismissed)
|
||||
);
|
||||
|
||||
const severityIcon: Record<string, string> = {
|
||||
info: '○',
|
||||
warn: '△',
|
||||
critical: '✕',
|
||||
};
|
||||
</script>
|
||||
|
||||
{#if activeAlerts.length > 0}
|
||||
<div class="alert-bar">
|
||||
{#each activeAlerts as alert (alert.id)}
|
||||
<div class="alert alert-{alert.severity}">
|
||||
<span class="alert-icon">{severityIcon[alert.severity]}</span>
|
||||
<span class="alert-type">{alert.type.replace(/_/g, ' ')}</span>
|
||||
<button class="dismiss" onclick={() => cultivar.dismissAlert(alert.id)} aria-label="Dismiss">×</button>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.alert-bar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.alert {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 7px 16px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.alert-info { background: color-mix(in srgb, var(--color-sage) 12%, transparent); color: var(--color-sage); }
|
||||
.alert-warn { background: color-mix(in srgb, var(--color-contam-low) 12%, transparent); color: var(--color-contam-low); }
|
||||
.alert-critical { background: color-mix(in srgb, var(--color-contam-high) 12%, transparent); color: var(--color-contam-high); }
|
||||
|
||||
.alert-icon { font-size: 10px; }
|
||||
.alert-type { flex: 1; text-transform: capitalize; letter-spacing: 0.03em; }
|
||||
|
||||
.dismiss {
|
||||
font-size: 14px;
|
||||
opacity: 0.6;
|
||||
line-height: 1;
|
||||
padding: 2px 4px;
|
||||
border-radius: var(--radius-sm);
|
||||
transition: opacity 0.15s;
|
||||
}
|
||||
.dismiss:hover { opacity: 1; }
|
||||
</style>
|
||||
+390
-106
@@ -1,30 +1,28 @@
|
||||
<script lang="ts">
|
||||
import { cultivar } from '../store.svelte';
|
||||
import LineChart from '../charts/LineChart.svelte';
|
||||
import type { TimeSeriesPoint, EnvironmentReading } from '../types';
|
||||
import InfoHint from './InfoHint.svelte';
|
||||
import type { TimeSeriesPoint, EnvironmentReading, Chamber } from '../types';
|
||||
|
||||
type Win = '1h' | '6h' | '24h';
|
||||
let activeWin = $state<Win>('24h');
|
||||
const winPts: Record<Win, number> = { '1h': 60, '6h': 360, '24h': 1441 };
|
||||
const winStep: Record<Win, number> = { '1h': 1, '6h': 4, '24h': 12 };
|
||||
// Minimum ms between chart redraws per window (1h = every tick, 6h = 30s, 24h = 2min)
|
||||
const winMs: Record<Win, number> = { '1h': 0, '6h': 30_000, '24h': 120_000 };
|
||||
|
||||
const history = $derived(cultivar.state.environment.history);
|
||||
const targets = $derived(cultivar.state.environment.targets);
|
||||
// live values always track the latest point regardless of chart throttle
|
||||
const live = $derived(history[history.length - 1]);
|
||||
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]);
|
||||
|
||||
// Throttled snapshot: chart data only re-renders when window demands it.
|
||||
// The effect subscribes to history (runs every 3s) but commits a new snapshot
|
||||
// only when enough time has elapsed — or immediately when the user switches windows.
|
||||
// Throttled snapshot of the global history
|
||||
const history = $derived(cultivar.state.environment.history);
|
||||
let chartSnap = $state(cultivar.state.environment.history.slice());
|
||||
let snapMs = 0;
|
||||
let snapWin: Win = '24h';
|
||||
|
||||
$effect(() => {
|
||||
const h = cultivar.state.environment.history; // reactive — runs on each tick
|
||||
const win = activeWin; // reactive — runs on window change
|
||||
const h = cultivar.state.environment.history;
|
||||
const win = activeWin;
|
||||
const now = Date.now();
|
||||
if (win !== snapWin || now - snapMs >= winMs[win]) {
|
||||
chartSnap = h.slice();
|
||||
@@ -36,139 +34,425 @@
|
||||
const pts = $derived(winPts[activeWin]);
|
||||
const step = $derived(winStep[activeWin]);
|
||||
|
||||
function scoreReading(r: EnvironmentReading): number {
|
||||
const tP = Math.min(Math.abs(r.temp_c - targets.temp_c) / 3, 1) * 33;
|
||||
const rP = Math.min(Math.abs(r.rh_pct - targets.rh_pct) / 10, 1) * 34;
|
||||
const cP = Math.min(Math.abs((r.co2_ppm ?? r.co2e_ppm ?? 0) - targets.co2_ppm) / 500, 1) * 33;
|
||||
return Math.max(0, Math.round(100 - tP - rP - cP));
|
||||
}
|
||||
// Per-chamber virtual history (single global history offset by the gap
|
||||
// between each chamber's live reading and the history's latest)
|
||||
function sliceCh(ch: Chamber, key: 'temp_c' | 'rh_pct' | 'co2_ppm' | 'co2e_ppm' | 'voc_ppb'): TimeSeriesPoint[] {
|
||||
const last = history[history.length - 1];
|
||||
if (!last) return [];
|
||||
|
||||
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;
|
||||
}
|
||||
})();
|
||||
const baseline = (() => {
|
||||
switch (key) {
|
||||
case 'temp_c': return last.temp_c;
|
||||
case 'rh_pct': return last.rh_pct;
|
||||
case 'co2_ppm': return last.co2_ppm;
|
||||
case 'co2e_ppm': return last.co2e_ppm ?? last.co2_ppm;
|
||||
case 'voc_ppb': return last.voc_ppb;
|
||||
}
|
||||
})();
|
||||
const offset = live - (baseline ?? 0);
|
||||
|
||||
function slice(key: keyof EnvironmentReading): TimeSeriesPoint[] {
|
||||
return chartSnap.slice(-pts)
|
||||
.filter((_, i) => i % step === 0)
|
||||
.map(r => ({ ts: r.ts, value: r[key] as number }));
|
||||
.map(r => {
|
||||
const raw = (r[key] as number | undefined) ?? (r.co2_ppm as number);
|
||||
return { ts: r.ts, value: raw + offset };
|
||||
});
|
||||
}
|
||||
|
||||
const healthSeries = $derived(
|
||||
chartSnap.slice(-pts)
|
||||
.filter((_, i) => i % step === 0)
|
||||
.map(r => ({ ts: r.ts, value: scoreReading(r) }))
|
||||
);
|
||||
// Metric definitions (label, unit, target-ranges per chamber, sparkline color)
|
||||
type Metric = {
|
||||
key: 'temp' | 'humid' | 'co2' | 'voc';
|
||||
label: string;
|
||||
unit: string;
|
||||
color: string;
|
||||
valueFor: (ch: Chamber) => string;
|
||||
seriesFor: (ch: Chamber) => TimeSeriesPoint[];
|
||||
rangeFor: (ch: Chamber) => [number, number];
|
||||
rangeLabel: (ch: Chamber) => string;
|
||||
hint: (ch: Chamber) => { title: string; body: string };
|
||||
};
|
||||
|
||||
const currentScore = $derived(
|
||||
healthSeries.length > 0 ? healthSeries[healthSeries.length - 1].value : 100
|
||||
);
|
||||
// Healthy ranges — calibrated for hobbyist gourmet cultivation
|
||||
const RANGES = {
|
||||
temp: {
|
||||
colonization: [21, 24] as [number, number],
|
||||
fruiting: [16, 20] as [number, number],
|
||||
},
|
||||
humid: {
|
||||
colonization: [85, 92] as [number, number],
|
||||
fruiting: [88, 95] as [number, number],
|
||||
},
|
||||
co2: {
|
||||
colonization: [700, 1600] as [number, number], // high is OK for mycelium
|
||||
fruiting: [400, 900] as [number, number], // fresh air for caps
|
||||
},
|
||||
voc: {
|
||||
colonization: [0, 70] as [number, number],
|
||||
fruiting: [0, 80] as [number, number],
|
||||
},
|
||||
};
|
||||
|
||||
const scoreColor = $derived(
|
||||
currentScore >= 80 ? 'var(--color-sage)'
|
||||
: currentScore >= 50 ? 'var(--color-contam-low)'
|
||||
: 'var(--color-contam-high)'
|
||||
);
|
||||
const metrics: Metric[] = [
|
||||
{
|
||||
key: 'temp',
|
||||
label: 'Temperature',
|
||||
unit: '°C',
|
||||
color: '#2b5a34',
|
||||
valueFor: (ch) => ch.environment.temp_c.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.',
|
||||
}),
|
||||
},
|
||||
{
|
||||
key: 'humid',
|
||||
label: 'Humidity',
|
||||
unit: '%',
|
||||
color: '#4b6a84',
|
||||
valueFor: (ch) => ch.environment.rh_pct.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.',
|
||||
}),
|
||||
},
|
||||
{
|
||||
key: 'co2',
|
||||
label: (() => 'CO₂')(),
|
||||
unit: 'ppm',
|
||||
color: '#8a6a3d',
|
||||
valueFor: (ch) => (ch.type === 'colonization'
|
||||
? (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.',
|
||||
}),
|
||||
},
|
||||
{
|
||||
key: 'voc',
|
||||
label: 'Air quality',
|
||||
unit: 'ppb',
|
||||
color: '#7a6d52',
|
||||
valueFor: (ch) => ch.environment.voc_ppb.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.',
|
||||
}),
|
||||
},
|
||||
];
|
||||
|
||||
const sensors = $derived([
|
||||
{ label: 'Temp', value: live ? `${live.temp_c.toFixed(1)}°` : '—', data: slice('temp_c'), color: 'var(--color-sage)', target: targets.temp_c },
|
||||
{ label: 'Humidity', value: live ? `${live.rh_pct.toFixed(0)}%` : '—', data: slice('rh_pct'), color: 'var(--color-pinning)', target: targets.rh_pct },
|
||||
{ label: 'CO₂e', value: live ? `${(live.co2e_ppm ?? 0).toFixed(0)} ppm` : '—', data: chartSnap.slice(-pts).filter((_, i) => i % step === 0).map(r => ({ ts: r.ts, value: r.co2e_ppm ?? 0 })), color: 'var(--color-fruiting)', target: targets.co2_ppm },
|
||||
{ label: 'CO₂', value: live ? `${live.co2_ppm.toFixed(0)} ppm` : '—', data: slice('co2_ppm'), color: 'var(--color-fruiting)', target: null },
|
||||
{ label: 'VOC', value: live ? `${live.voc_ppb.toFixed(0)} ppb` : '—', data: slice('voc_ppb'), color: 'var(--color-text-muted)', target: null },
|
||||
]);
|
||||
// Is the current value inside the healthy range?
|
||||
function inRange(value: number, [lo, hi]: [number, number]): boolean {
|
||||
return value >= lo && value <= hi;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="panel">
|
||||
<!-- Time window tabs -->
|
||||
<div class="tabs">
|
||||
<section class="panel">
|
||||
<!-- Header -->
|
||||
<header class="panel-head">
|
||||
<div class="head-left">
|
||||
<div class="eyebrow">Climate</div>
|
||||
<h2 class="panel-title font-serif">Environmental Sensors</h2>
|
||||
</div>
|
||||
|
||||
<div class="tabs" role="tablist" aria-label="Time range">
|
||||
{#each (['1h', '6h', '24h'] as Win[]) as w}
|
||||
<button class="tab" class:active={activeWin === w} onclick={() => activeWin = w}>{w}</button>
|
||||
<button
|
||||
class="tab"
|
||||
class:active={activeWin === w}
|
||||
role="tab"
|
||||
aria-selected={activeWin === w}
|
||||
onclick={() => activeWin = w}
|
||||
type="button"
|
||||
>{w}</button>
|
||||
{/each}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Scrollable chart list -->
|
||||
<div class="charts">
|
||||
<!-- Health score trend -->
|
||||
<div class="chart-row health-row">
|
||||
<LineChart
|
||||
data={healthSeries}
|
||||
label="Health"
|
||||
value={String(currentScore)}
|
||||
color={scoreColor}
|
||||
yMin={0}
|
||||
yMax={100}
|
||||
/>
|
||||
<!-- Two-column header for the chambers -->
|
||||
<div class="chamber-heads">
|
||||
<div class="ch-head col-side">
|
||||
<span class="ch-dot" style="background: #1c251d;"></span>
|
||||
<span class="ch-name font-serif">Colonization</span>
|
||||
<span class="ch-desc">dark & still</span>
|
||||
</div>
|
||||
<div class="ch-head fruit-side">
|
||||
<span class="ch-dot" style="background: #d5c48d;"></span>
|
||||
<span class="ch-name font-serif">Fruiting</span>
|
||||
<span class="ch-desc">lit & humid</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Sensor charts -->
|
||||
{#each sensors as s}
|
||||
<div class="chart-row">
|
||||
<LineChart
|
||||
data={s.data}
|
||||
label={s.label}
|
||||
value={s.value}
|
||||
color={s.color}
|
||||
targetValue={s.target}
|
||||
/>
|
||||
<!-- Metric rows -->
|
||||
<div class="rows">
|
||||
{#each metrics as m (m.key)}
|
||||
{@const colRange = m.rangeFor(colonization)}
|
||||
{@const fruitRange = m.rangeFor(fruiting)}
|
||||
{@const colVal = parseFloat(m.valueFor(colonization))}
|
||||
{@const fruitVal = parseFloat(m.valueFor(fruiting))}
|
||||
{@const colOK = inRange(colVal, colRange)}
|
||||
{@const fruitOK = inRange(fruitVal, fruitRange)}
|
||||
|
||||
<div class="row">
|
||||
<!-- 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" />
|
||||
</div>
|
||||
|
||||
<!-- Colonization cell -->
|
||||
<div class="cell">
|
||||
<div class="cell-top">
|
||||
<span class="cell-value font-serif" class:out={!colOK}>
|
||||
{m.valueFor(colonization)}<span class="cell-unit">{m.unit}</span>
|
||||
</span>
|
||||
<span class="cell-chip" class:chip-ok={colOK} class:chip-off={!colOK}>
|
||||
<span class="chip-dot"></span>
|
||||
{colOK ? 'in range' : 'drift'}
|
||||
</span>
|
||||
</div>
|
||||
<div class="cell-chart">
|
||||
<LineChart data={m.seriesFor(colonization)} color={m.color} healthyRange={colRange} />
|
||||
</div>
|
||||
<div class="cell-range">{m.rangeLabel(colonization)}</div>
|
||||
</div>
|
||||
|
||||
<!-- Fruiting cell -->
|
||||
<div class="cell">
|
||||
<div class="cell-top">
|
||||
<span class="cell-value font-serif" class:out={!fruitOK}>
|
||||
{m.valueFor(fruiting)}<span class="cell-unit">{m.unit}</span>
|
||||
</span>
|
||||
<span class="cell-chip" class:chip-ok={fruitOK} class:chip-off={!fruitOK}>
|
||||
<span class="chip-dot"></span>
|
||||
{fruitOK ? 'in range' : 'drift'}
|
||||
</span>
|
||||
</div>
|
||||
<div class="cell-chart">
|
||||
<LineChart data={m.seriesFor(fruiting)} color={m.color} healthyRange={fruitRange} />
|
||||
</div>
|
||||
<div class="cell-range">{m.rangeLabel(fruiting)}</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* ── Tabs ── */
|
||||
.tabs {
|
||||
flex-shrink: 0;
|
||||
.panel-head {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
padding: 8px 12px 6px;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.panel-title {
|
||||
font-size: 26px;
|
||||
letter-spacing: -0.01em;
|
||||
color: var(--ink);
|
||||
margin-top: 4px;
|
||||
line-height: 1.1;
|
||||
font-weight: var(--fw-display);
|
||||
}
|
||||
|
||||
/* Time range tabs */
|
||||
.tabs {
|
||||
display: inline-flex;
|
||||
gap: 2px;
|
||||
padding: 3px;
|
||||
background: var(--paper-2);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 999px;
|
||||
}
|
||||
.tab {
|
||||
padding: 3px 10px;
|
||||
border-radius: var(--radius-sm);
|
||||
padding: 4px 12px;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--color-text-muted);
|
||||
transition: background 0.12s, color 0.12s;
|
||||
letter-spacing: 0.03em;
|
||||
color: var(--ink-muted);
|
||||
transition: background 0.15s, color 0.15s;
|
||||
}
|
||||
.tab:hover { color: var(--color-text); background: var(--color-surface-2); }
|
||||
.tab.active { background: var(--color-surface-2); color: var(--color-sage); }
|
||||
.tab:hover { color: var(--ink); }
|
||||
.tab.active { background: #fbf7ec; color: var(--forest); box-shadow: inset 0 0 0 1px var(--line); }
|
||||
|
||||
/* ── Chart scroll container ── */
|
||||
.charts {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
/* Two-column chamber heads */
|
||||
.chamber-heads {
|
||||
display: grid;
|
||||
grid-template-columns: 130px 1fr 1fr;
|
||||
gap: 12px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid var(--line-soft);
|
||||
}
|
||||
.chamber-heads::before { content: ''; }
|
||||
|
||||
.ch-head {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
}
|
||||
.ch-head:nth-child(1) { grid-column: 2; }
|
||||
.ch-head:nth-child(2) { grid-column: 3; }
|
||||
|
||||
.ch-dot {
|
||||
display: inline-block;
|
||||
width: 8px; height: 8px;
|
||||
border-radius: 50%;
|
||||
align-self: center;
|
||||
}
|
||||
.ch-name {
|
||||
font-size: 14px;
|
||||
color: var(--ink);
|
||||
font-weight: var(--fw-display);
|
||||
letter-spacing: -0.005em;
|
||||
}
|
||||
.ch-desc {
|
||||
font-family: var(--font-serif);
|
||||
font-style: italic;
|
||||
font-size: 12px;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
|
||||
/* Rows */
|
||||
.rows {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: grid;
|
||||
grid-template-columns: 130px 1fr 1fr;
|
||||
gap: 12px;
|
||||
padding: 12px 0;
|
||||
align-items: start;
|
||||
border-bottom: 1px solid var(--line-soft);
|
||||
}
|
||||
.row:last-child { border-bottom: none; }
|
||||
|
||||
.row-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 0 8px 8px;
|
||||
/* Thin scrollbar */
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--color-border) transparent;
|
||||
}
|
||||
.charts::-webkit-scrollbar { width: 4px; }
|
||||
.charts::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }
|
||||
|
||||
/* ── Chart rows — fixed heights ── */
|
||||
.chart-row {
|
||||
flex-shrink: 0;
|
||||
height: calc(100% / 7.5);
|
||||
border-radius: 8px;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
overflow: hidden;
|
||||
padding-top: 2px;
|
||||
font-family: var(--font-sans);
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: var(--ink-2);
|
||||
}
|
||||
|
||||
/* Health row taller */
|
||||
.chart-row.health-row {
|
||||
height: calc(100% / 6);
|
||||
margin-bottom: min(20px, calc(100% / 8));
|
||||
/* Cells */
|
||||
.cell {
|
||||
display: grid;
|
||||
grid-template-rows: auto 28px auto;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.cell-top {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.cell-value {
|
||||
font-size: 22px;
|
||||
line-height: 1;
|
||||
color: var(--ink);
|
||||
letter-spacing: -0.01em;
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-weight: var(--fw-display);
|
||||
}
|
||||
.cell-value.out { color: var(--attention); }
|
||||
|
||||
.cell-unit {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 11.5px;
|
||||
color: var(--ink-muted);
|
||||
margin-left: 3px;
|
||||
letter-spacing: 0.01em;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.cell-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 2px 8px 2px 6px;
|
||||
border-radius: 999px;
|
||||
font-size: 10.5px;
|
||||
letter-spacing: 0.02em;
|
||||
font-weight: 500;
|
||||
}
|
||||
.chip-ok { background: var(--forest-tint); color: var(--forest); }
|
||||
.chip-off { background: #f3e1cb; color: var(--attention); }
|
||||
.chip-dot {
|
||||
width: 5px; height: 5px;
|
||||
border-radius: 50%;
|
||||
background: currentColor;
|
||||
}
|
||||
|
||||
.cell-chart {
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.cell-range {
|
||||
font-size: 11px;
|
||||
font-family: var(--font-serif);
|
||||
font-style: italic;
|
||||
color: var(--ink-muted);
|
||||
letter-spacing: 0.005em;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 900px) {
|
||||
.panel-title { font-size: 22px; }
|
||||
.chamber-heads, .row {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
.chamber-heads .ch-head:nth-child(1) { grid-column: 1; }
|
||||
.chamber-heads .ch-head:nth-child(2) { grid-column: 2; }
|
||||
.row-label {
|
||||
grid-column: 1 / -1;
|
||||
padding-top: 0;
|
||||
padding-bottom: 4px;
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,163 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { cultivar } from '../store.svelte';
|
||||
import Sparkline from '../charts/Sparkline.svelte';
|
||||
import type { TimeSeriesPoint } from '../types';
|
||||
|
||||
// Last 2h of history = 120 points at 1-min resolution
|
||||
const historyWindow = $derived(cultivar.state.environment.history.slice(-120));
|
||||
|
||||
const tempHistory = $derived<TimeSeriesPoint[]>(
|
||||
historyWindow.map(r => ({ ts: r.ts, value: r.temp_c }))
|
||||
);
|
||||
const rhHistory = $derived<TimeSeriesPoint[]>(
|
||||
historyWindow.map(r => ({ ts: r.ts, value: r.rh_pct }))
|
||||
);
|
||||
const co2History = $derived<TimeSeriesPoint[]>(
|
||||
historyWindow.map(r => ({ ts: r.ts, value: r.co2_ppm }))
|
||||
);
|
||||
const vpdHistory = $derived<TimeSeriesPoint[]>(
|
||||
historyWindow.map(r => ({ ts: r.ts, value: r.vpd }))
|
||||
);
|
||||
|
||||
const scrubTs = $derived(cultivar.state.ui.scrubber_ts);
|
||||
|
||||
function fmt(v: number, decimals = 1) {
|
||||
return v.toFixed(decimals);
|
||||
}
|
||||
|
||||
// Show scrubber-time value when in historical mode
|
||||
function scrubValue(history: TimeSeriesPoint[], live: number): number {
|
||||
if (scrubTs === null) return live;
|
||||
const closest = history.reduce((best, pt) =>
|
||||
Math.abs(pt.ts - scrubTs!) < Math.abs(best.ts - scrubTs!) ? pt : best
|
||||
, history[0]);
|
||||
return closest?.value ?? live;
|
||||
}
|
||||
|
||||
const displayTemp = $derived(scrubValue(tempHistory, cultivar.state.environment.live.temp_c));
|
||||
const displayRh = $derived(scrubValue(rhHistory, cultivar.state.environment.live.rh_pct));
|
||||
const displayCo2 = $derived(scrubValue(co2History, cultivar.state.environment.live.co2_ppm));
|
||||
const displayVpd = $derived(scrubValue(vpdHistory, cultivar.state.environment.live.vpd));
|
||||
</script>
|
||||
|
||||
<div class="env-strip">
|
||||
<div class="metric">
|
||||
<div class="metric-value">
|
||||
<span class="num">{fmt(displayTemp)}</span>
|
||||
<span class="unit text-muted">°C</span>
|
||||
</div>
|
||||
<div class="metric-label text-muted">Temp</div>
|
||||
<Sparkline
|
||||
data={tempHistory}
|
||||
width={100}
|
||||
height={28}
|
||||
targetValue={cultivar.state.environment.targets.temp_c}
|
||||
scrubberTs={scrubTs}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="metric">
|
||||
<div class="metric-value">
|
||||
<span class="num">{fmt(displayRh)}</span>
|
||||
<span class="unit text-muted">%</span>
|
||||
</div>
|
||||
<div class="metric-label text-muted">RH</div>
|
||||
<Sparkline
|
||||
data={rhHistory}
|
||||
width={100}
|
||||
height={28}
|
||||
targetValue={cultivar.state.environment.targets.rh_pct}
|
||||
scrubberTs={scrubTs}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="metric">
|
||||
<div class="metric-value">
|
||||
<span class="num">{fmt(displayCo2, 0)}</span>
|
||||
<span class="unit text-muted">ppm</span>
|
||||
</div>
|
||||
<div class="metric-label text-muted">CO₂</div>
|
||||
<Sparkline
|
||||
data={co2History}
|
||||
width={100}
|
||||
height={28}
|
||||
scrubberTs={scrubTs}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="metric">
|
||||
<div class="metric-value">
|
||||
<span class="num">{fmt(displayVpd, 2)}</span>
|
||||
<span class="unit text-muted">kPa</span>
|
||||
</div>
|
||||
<div class="metric-label text-muted">VPD</div>
|
||||
<Sparkline
|
||||
data={vpdHistory}
|
||||
width={100}
|
||||
height={28}
|
||||
scrubberTs={scrubTs}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.env-strip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
padding: 10px 0;
|
||||
background: var(--color-surface);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
flex-shrink: 0;
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
.env-strip::-webkit-scrollbar { display: none; }
|
||||
|
||||
.metric {
|
||||
flex: 1;
|
||||
min-width: 90px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
padding: 0 8px;
|
||||
}
|
||||
|
||||
.metric-value {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 22px;
|
||||
line-height: 1;
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.unit {
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
|
||||
.metric-label {
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.divider {
|
||||
width: 1px;
|
||||
height: 48px;
|
||||
background: var(--color-border);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,152 @@
|
||||
<script lang="ts">
|
||||
interface Props {
|
||||
title: string;
|
||||
body: string;
|
||||
/** Preferred side relative to the anchor */
|
||||
side?: 'top' | 'bottom';
|
||||
/** Icon size in px */
|
||||
size?: number;
|
||||
}
|
||||
|
||||
const { title, body, side = 'top', size = 14 }: Props = $props();
|
||||
|
||||
let open = $state(false);
|
||||
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 });
|
||||
|
||||
function recomputePos() {
|
||||
if (!anchor) return;
|
||||
const r = anchor.getBoundingClientRect();
|
||||
const winW = window.innerWidth;
|
||||
const winH = window.innerHeight;
|
||||
const margin = 8;
|
||||
|
||||
// Try preferred side first, flip if not enough room
|
||||
const roomTop = r.top;
|
||||
const roomBot = winH - r.bottom;
|
||||
const hintEstH = 110;
|
||||
const actualSide = side === 'top'
|
||||
? (roomTop > hintEstH ? 'top' : 'bottom')
|
||||
: (roomBot > hintEstH ? 'bottom' : 'top');
|
||||
|
||||
let left = r.left + r.width / 2 - HINT_W / 2;
|
||||
if (left < margin) left = margin;
|
||||
if (left + HINT_W > winW - margin) left = winW - HINT_W - margin;
|
||||
|
||||
let top = actualSide === 'top'
|
||||
? r.top - 8 // will subtract hintH after mount via bottom anchor
|
||||
: r.bottom + 8;
|
||||
|
||||
pos = { left, top, side: actualSide };
|
||||
}
|
||||
|
||||
function toggle(e: MouseEvent) {
|
||||
e.stopPropagation();
|
||||
if (!open) recomputePos();
|
||||
open = !open;
|
||||
}
|
||||
|
||||
function handleDocClick(e: MouseEvent) {
|
||||
if (!open) return;
|
||||
if (anchor && !anchor.contains(e.target as Node)) open = false;
|
||||
}
|
||||
|
||||
function handleKey(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape') open = false;
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
if (!open) return;
|
||||
document.addEventListener('click', handleDocClick);
|
||||
document.addEventListener('keydown', handleKey);
|
||||
window.addEventListener('resize', recomputePos);
|
||||
window.addEventListener('scroll', recomputePos, true);
|
||||
return () => {
|
||||
document.removeEventListener('click', handleDocClick);
|
||||
document.removeEventListener('keydown', handleKey);
|
||||
window.removeEventListener('resize', recomputePos);
|
||||
window.removeEventListener('scroll', recomputePos, true);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<button
|
||||
bind:this={anchor}
|
||||
class="dot"
|
||||
style="width: {size}px; height: {size}px;"
|
||||
aria-label="What is {title}?"
|
||||
aria-expanded={open}
|
||||
onclick={toggle}
|
||||
type="button"
|
||||
>
|
||||
<svg viewBox="0 0 14 14" width={size - 2} height={size - 2} fill="none" aria-hidden="true">
|
||||
<circle cx="7" cy="7" r="6" stroke="currentColor" stroke-width="1"/>
|
||||
<path d="M7 6v3.5" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
|
||||
<circle cx="7" cy="4.2" r="0.7" fill="currentColor"/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
{#if open}
|
||||
<div
|
||||
class="hint"
|
||||
class:hint-top={pos.side === 'top'}
|
||||
class:hint-bottom={pos.side === 'bottom'}
|
||||
style="left: {pos.left}px; top: {pos.top}px; width: {HINT_W}px;"
|
||||
role="tooltip"
|
||||
>
|
||||
<span class="hint-title font-serif">{title}</span>
|
||||
<span class="hint-body">{body}</span>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.dot {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
color: var(--ink-muted);
|
||||
transition: color 0.15s, background 0.15s;
|
||||
padding: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.dot:hover { color: var(--forest); }
|
||||
.dot[aria-expanded="true"] { color: var(--forest); }
|
||||
|
||||
.hint {
|
||||
position: fixed;
|
||||
z-index: 80;
|
||||
padding: 10px 12px 11px;
|
||||
background: #fbf7ec;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-md);
|
||||
box-shadow: 0 10px 28px rgba(40, 32, 16, 0.14), 0 2px 4px rgba(40, 32, 16, 0.06);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
animation: rise-in 0.14s ease-out;
|
||||
pointer-events: auto;
|
||||
max-width: 260px;
|
||||
}
|
||||
/* For top-side, translate up by the tooltip's own height */
|
||||
.hint-top { transform: translateY(-100%); }
|
||||
.hint-bottom { transform: translateY(0); }
|
||||
|
||||
.hint-title {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--ink);
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.hint-body {
|
||||
font-size: 12px;
|
||||
color: var(--ink-2);
|
||||
line-height: 1.45;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,318 @@
|
||||
<script lang="ts">
|
||||
export type RhythmDetailData = {
|
||||
id: string;
|
||||
urgency: 'urgent' | 'action';
|
||||
title: string;
|
||||
lede: string;
|
||||
why?: string;
|
||||
time_estimate?: string;
|
||||
materials?: string[];
|
||||
steps: string[];
|
||||
tips?: string[];
|
||||
/** Primary action button label (e.g., "Mark wiped down") */
|
||||
primary_cta?: string;
|
||||
/** Callback when the primary CTA is clicked */
|
||||
onPrimary?: () => void;
|
||||
};
|
||||
|
||||
interface Props {
|
||||
detail: RhythmDetailData;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
const { detail, onClose }: Props = $props();
|
||||
|
||||
function handleKey(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape') onClose();
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
window.addEventListener('keydown', handleKey);
|
||||
document.body.style.overflow = 'hidden';
|
||||
return () => {
|
||||
window.removeEventListener('keydown', handleKey);
|
||||
document.body.style.overflow = '';
|
||||
};
|
||||
});
|
||||
|
||||
function handlePrimary() {
|
||||
detail.onPrimary?.();
|
||||
onClose();
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="backdrop"
|
||||
onclick={onClose}
|
||||
onkeydown={(e) => e.key === 'Escape' && onClose()}
|
||||
role="presentation"
|
||||
></div>
|
||||
|
||||
<div class="sheet" role="dialog" aria-labelledby="rd-title" aria-modal="true">
|
||||
<header class="head">
|
||||
<div class="head-copy">
|
||||
<div class="kicker urg-{detail.urgency}">
|
||||
{detail.urgency === 'urgent' ? 'Do today' : 'When you can'}
|
||||
</div>
|
||||
<h2 id="rd-title" class="title font-serif">{detail.title}</h2>
|
||||
<p class="lede">{detail.lede}</p>
|
||||
</div>
|
||||
<button type="button" class="close" onclick={onClose} aria-label="Close">
|
||||
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" aria-hidden="true">
|
||||
<path d="M4 4L14 14M14 4L4 14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<!-- Meta facts: time + materials -->
|
||||
<div class="facts">
|
||||
{#if detail.time_estimate}
|
||||
<div class="fact">
|
||||
<div class="fact-key">Time</div>
|
||||
<div class="fact-val font-serif">{detail.time_estimate}</div>
|
||||
</div>
|
||||
{/if}
|
||||
{#if detail.materials && detail.materials.length > 0}
|
||||
<div class="fact fact-wide">
|
||||
<div class="fact-key">You'll need</div>
|
||||
<div class="fact-val">
|
||||
{#each detail.materials as m, i}
|
||||
<span>{m}</span>{#if i < detail.materials.length - 1}<span class="dot">·</span>{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if detail.why}
|
||||
<div class="why">
|
||||
<div class="why-eyebrow">Why</div>
|
||||
<p>{detail.why}</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<section class="steps">
|
||||
<div class="eyebrow">How</div>
|
||||
<ol>
|
||||
{#each detail.steps as s, i}
|
||||
<li>
|
||||
<span class="step-num font-serif">{i + 1}</span>
|
||||
<span class="step-text">{s}</span>
|
||||
</li>
|
||||
{/each}
|
||||
</ol>
|
||||
</section>
|
||||
|
||||
{#if detail.tips && detail.tips.length > 0}
|
||||
<section class="tips">
|
||||
<div class="eyebrow">Notes</div>
|
||||
<ul>
|
||||
{#each detail.tips as t}
|
||||
<li>{t}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
<div class="actions">
|
||||
<button type="button" class="btn-ghost" onclick={onClose}>Maybe later</button>
|
||||
{#if detail.primary_cta}
|
||||
<button type="button" class="btn-primary" onclick={handlePrimary}>{detail.primary_cta}</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(40, 32, 16, 0.34);
|
||||
backdrop-filter: blur(3px);
|
||||
-webkit-backdrop-filter: blur(3px);
|
||||
z-index: 50;
|
||||
animation: fade-in 0.2s ease-out;
|
||||
}
|
||||
|
||||
.sheet {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: min(520px, 92vw);
|
||||
background: var(--paper);
|
||||
border-left: 1px solid var(--line);
|
||||
padding: 28px 32px 24px;
|
||||
z-index: 51;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 22px;
|
||||
box-shadow: -20px 0 40px rgba(40, 32, 16, 0.18);
|
||||
animation: slide-in-right 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
|
||||
}
|
||||
|
||||
/* ── Header ── */
|
||||
.head {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.head-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
|
||||
|
||||
.kicker {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.16em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.kicker.urg-urgent { color: var(--urgent); }
|
||||
.kicker.urg-action { color: var(--forest); }
|
||||
|
||||
.title {
|
||||
font-size: 28px;
|
||||
line-height: 1.1;
|
||||
letter-spacing: -0.015em;
|
||||
color: var(--ink);
|
||||
font-weight: var(--fw-display);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.lede {
|
||||
font-size: 15px;
|
||||
line-height: 1.55;
|
||||
color: var(--ink-2);
|
||||
max-width: 48ch;
|
||||
}
|
||||
|
||||
.close {
|
||||
width: 34px; height: 34px;
|
||||
border-radius: 50%;
|
||||
color: var(--ink-muted);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background 0.15s, color 0.15s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.close:hover { background: var(--paper-2); color: var(--ink); }
|
||||
|
||||
/* ── Facts strip ── */
|
||||
.facts {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 28px;
|
||||
padding: 14px 0;
|
||||
border-top: 1px solid var(--line-soft);
|
||||
border-bottom: 1px solid var(--line-soft);
|
||||
}
|
||||
.fact { display: flex; flex-direction: column; gap: 3px; }
|
||||
.fact-key {
|
||||
font-size: 10px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
.fact-val {
|
||||
font-size: 14px;
|
||||
color: var(--ink);
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
align-items: baseline;
|
||||
}
|
||||
.fact-val .dot { color: var(--ink-muted); opacity: 0.5; }
|
||||
|
||||
/* ── Why block ── */
|
||||
.why {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 14px 16px;
|
||||
background: var(--forest-tint);
|
||||
border-left: 3px solid var(--forest);
|
||||
border-radius: 4px;
|
||||
}
|
||||
.why-eyebrow {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.16em;
|
||||
text-transform: uppercase;
|
||||
color: var(--forest);
|
||||
}
|
||||
.why p {
|
||||
font-family: var(--font-serif);
|
||||
font-style: italic;
|
||||
font-size: 14.5px;
|
||||
line-height: 1.55;
|
||||
color: var(--ink-2);
|
||||
}
|
||||
|
||||
/* ── Steps ── */
|
||||
.steps ol {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 10px 0 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
}
|
||||
.steps li {
|
||||
display: grid;
|
||||
grid-template-columns: 26px 1fr;
|
||||
gap: 12px;
|
||||
align-items: baseline;
|
||||
}
|
||||
.step-num {
|
||||
font-size: 18px;
|
||||
color: var(--forest);
|
||||
letter-spacing: -0.01em;
|
||||
font-weight: var(--fw-display);
|
||||
line-height: 1.1;
|
||||
text-align: right;
|
||||
padding-right: 4px;
|
||||
border-right: 1px solid var(--line-soft);
|
||||
}
|
||||
.step-text {
|
||||
font-size: 14.5px;
|
||||
line-height: 1.55;
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
/* ── Tips ── */
|
||||
.tips ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 8px 0 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
.tips li {
|
||||
font-family: var(--font-serif);
|
||||
font-style: italic;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.55;
|
||||
color: var(--ink-2);
|
||||
padding-left: 18px;
|
||||
position: relative;
|
||||
}
|
||||
.tips li::before {
|
||||
content: '—';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
color: var(--forest);
|
||||
}
|
||||
|
||||
/* ── Actions ── */
|
||||
.actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 10px;
|
||||
margin-top: auto;
|
||||
padding-top: 14px;
|
||||
border-top: 1px solid var(--line-soft);
|
||||
}
|
||||
</style>
|
||||
@@ -1,220 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { cultivar } from '../store.svelte';
|
||||
|
||||
const history = $derived(cultivar.state.environment.history);
|
||||
const minTs = $derived(history.length > 0 ? history[0].ts : 0);
|
||||
const maxTs = $derived(history.length > 0 ? history[history.length - 1].ts : 0);
|
||||
const isLive = $derived(cultivar.state.ui.scrubber_ts === null);
|
||||
|
||||
let trackEl = $state<HTMLDivElement | null>(null);
|
||||
let isDragging = $state(false);
|
||||
|
||||
const thumbPct = $derived.by(() => {
|
||||
if (isLive || maxTs === minTs) return 100;
|
||||
const ts = cultivar.state.ui.scrubber_ts!;
|
||||
return Math.max(0, Math.min(100, ((ts - minTs) / (maxTs - minTs)) * 100));
|
||||
});
|
||||
|
||||
function tsFromPct(pct: number): number {
|
||||
return minTs + (pct / 100) * (maxTs - minTs);
|
||||
}
|
||||
|
||||
function pctFromEvent(e: MouseEvent | TouchEvent): number {
|
||||
if (!trackEl) return 100;
|
||||
const rect = trackEl.getBoundingClientRect();
|
||||
const clientX = 'touches' in e ? e.touches[0].clientX : e.clientX;
|
||||
return Math.max(0, Math.min(100, ((clientX - rect.left) / rect.width) * 100));
|
||||
}
|
||||
|
||||
function onTrackClick(e: MouseEvent) {
|
||||
const pct = pctFromEvent(e);
|
||||
if (pct >= 99) {
|
||||
cultivar.setScrubberTs(null);
|
||||
} else {
|
||||
cultivar.setScrubberTs(tsFromPct(pct));
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseDown(e: MouseEvent) {
|
||||
isDragging = true;
|
||||
const pct = pctFromEvent(e);
|
||||
cultivar.setScrubberTs(pct >= 99 ? null : tsFromPct(pct));
|
||||
|
||||
const onMove = (ev: MouseEvent) => {
|
||||
const p = pctFromEvent(ev);
|
||||
cultivar.setScrubberTs(p >= 99 ? null : tsFromPct(p));
|
||||
};
|
||||
const onUp = () => {
|
||||
isDragging = false;
|
||||
window.removeEventListener('mousemove', onMove);
|
||||
window.removeEventListener('mouseup', onUp);
|
||||
};
|
||||
window.addEventListener('mousemove', onMove);
|
||||
window.addEventListener('mouseup', onUp);
|
||||
}
|
||||
|
||||
function onTouchStart(e: TouchEvent) {
|
||||
const onMove = (ev: TouchEvent) => {
|
||||
const p = pctFromEvent(ev);
|
||||
cultivar.setScrubberTs(p >= 99 ? null : tsFromPct(p));
|
||||
};
|
||||
const onEnd = () => {
|
||||
window.removeEventListener('touchmove', onMove);
|
||||
window.removeEventListener('touchend', onEnd);
|
||||
};
|
||||
window.addEventListener('touchmove', onMove);
|
||||
window.addEventListener('touchend', onEnd);
|
||||
const p = pctFromEvent(e);
|
||||
cultivar.setScrubberTs(p >= 99 ? null : tsFromPct(p));
|
||||
}
|
||||
|
||||
function formatTs(ts: number): string {
|
||||
const d = new Date(ts * 1000);
|
||||
return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
||||
}
|
||||
|
||||
const displayTime = $derived(
|
||||
isLive
|
||||
? 'Live'
|
||||
: formatTs(cultivar.state.ui.scrubber_ts!)
|
||||
);
|
||||
</script>
|
||||
|
||||
<div class="scrubber">
|
||||
<span class="time-label text-muted">{formatTs(minTs)}</span>
|
||||
|
||||
<div
|
||||
class="track"
|
||||
bind:this={trackEl}
|
||||
onclick={onTrackClick}
|
||||
onmousedown={onMouseDown}
|
||||
ontouchstart={onTouchStart}
|
||||
role="slider"
|
||||
aria-label="Timeline scrubber"
|
||||
aria-valuenow={thumbPct}
|
||||
aria-valuemin={0}
|
||||
aria-valuemax={100}
|
||||
tabindex="0"
|
||||
onkeydown={(e) => {
|
||||
const step = 1;
|
||||
if (e.key === 'ArrowRight') {
|
||||
const next = Math.min(100, thumbPct + step);
|
||||
cultivar.setScrubberTs(next >= 99 ? null : tsFromPct(next));
|
||||
} else if (e.key === 'ArrowLeft') {
|
||||
const next = Math.max(0, thumbPct - step);
|
||||
cultivar.setScrubberTs(tsFromPct(next));
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div class="track-fill" style="width: {thumbPct}%"></div>
|
||||
<div class="thumb" style="left: {thumbPct}%" class:live={isLive}></div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="live-pill"
|
||||
class:active={isLive}
|
||||
onclick={() => cultivar.setScrubberTs(null)}
|
||||
aria-pressed={isLive}
|
||||
>
|
||||
{#if isLive}
|
||||
<span class="live-dot"></span>
|
||||
{/if}
|
||||
{isLive ? 'LIVE' : displayTime}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.scrubber {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 16px;
|
||||
background: var(--color-surface);
|
||||
border-top: 1px solid var(--color-border);
|
||||
flex-shrink: 0;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.time-label {
|
||||
font-size: 10px;
|
||||
white-space: nowrap;
|
||||
letter-spacing: 0.04em;
|
||||
min-width: 36px;
|
||||
}
|
||||
|
||||
.track {
|
||||
flex: 1;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.track::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 8px 0;
|
||||
background: var(--color-border);
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.track-fill {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 8px;
|
||||
bottom: 8px;
|
||||
background: var(--color-sage-dim);
|
||||
border-radius: 2px;
|
||||
pointer-events: none;
|
||||
transition: width 0.1s;
|
||||
}
|
||||
|
||||
.thumb {
|
||||
position: absolute;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-text-muted);
|
||||
border: 2px solid var(--color-surface);
|
||||
transform: translateX(-50%);
|
||||
transition: background 0.2s;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.thumb.live {
|
||||
background: var(--color-sage);
|
||||
box-shadow: 0 0 6px color-mix(in srgb, var(--color-sage) 60%, transparent);
|
||||
}
|
||||
|
||||
.live-pill {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 3px 10px;
|
||||
border-radius: 100px;
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.06em;
|
||||
white-space: nowrap;
|
||||
background: var(--color-surface-2);
|
||||
color: var(--color-text-muted);
|
||||
border: 1px solid var(--color-border);
|
||||
transition: background 0.2s, color 0.2s;
|
||||
}
|
||||
|
||||
.live-pill.active {
|
||||
background: color-mix(in srgb, var(--color-sage) 15%, transparent);
|
||||
color: var(--color-sage);
|
||||
border-color: var(--color-sage-dim);
|
||||
}
|
||||
|
||||
.live-dot {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-sage);
|
||||
animation: dot-live 2s ease-in-out infinite;
|
||||
}
|
||||
</style>
|
||||
@@ -1,180 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { cultivar } from '../store.svelte';
|
||||
|
||||
interface Props {
|
||||
onBagClick: (bagId: string) => void;
|
||||
}
|
||||
|
||||
const { onBagClick }: Props = $props();
|
||||
|
||||
type RecentSnap = {
|
||||
bagId: string;
|
||||
slotId: string;
|
||||
ts: number;
|
||||
image_url: string;
|
||||
colonization_pct: number;
|
||||
contamination_risk: 'none' | 'low' | 'medium' | 'high';
|
||||
};
|
||||
|
||||
const recentSnapshots = $derived.by<RecentSnap[]>(() => {
|
||||
const snaps: RecentSnap[] = [];
|
||||
const chamber = cultivar.state.chambers[0];
|
||||
if (!chamber) return [];
|
||||
for (const slot of chamber.slots) {
|
||||
if (!slot.bag) continue;
|
||||
const { snapshots } = slot.bag.vision;
|
||||
if (snapshots.length === 0) continue;
|
||||
const latest = snapshots[snapshots.length - 1];
|
||||
snaps.push({
|
||||
bagId: slot.bag.bag_id,
|
||||
slotId: slot.slot_id,
|
||||
ts: latest.ts,
|
||||
image_url: latest.image_url,
|
||||
colonization_pct: latest.colonization_pct,
|
||||
contamination_risk: latest.contamination_risk,
|
||||
});
|
||||
}
|
||||
return snaps
|
||||
.sort((a, b) => b.ts - a.ts)
|
||||
.slice(0, 2);
|
||||
});
|
||||
|
||||
function formatAge(ts: number): string {
|
||||
const diff = Math.floor(Date.now() / 1000) - ts;
|
||||
if (diff < 3600) return `${Math.floor(diff / 60)}m ago`;
|
||||
if (diff < 86400) return `${Math.floor(diff / 3600)}h ago`;
|
||||
return `${Math.floor(diff / 86400)}d ago`;
|
||||
}
|
||||
|
||||
const contamColor: Record<string, string> = {
|
||||
none: 'var(--color-text-muted)',
|
||||
low: 'var(--color-contam-low)',
|
||||
medium: 'var(--color-contam-low)',
|
||||
high: 'var(--color-contam-high)',
|
||||
};
|
||||
</script>
|
||||
|
||||
{#if recentSnapshots.length > 0}
|
||||
<div class="snapshot-strip">
|
||||
<div class="strip-label text-muted">Recent</div>
|
||||
<div class="snaps">
|
||||
{#each recentSnapshots as snap (snap.bagId)}
|
||||
<button class="snap-card" onclick={() => onBagClick(snap.bagId)}>
|
||||
<div class="snap-thumb">
|
||||
<div class="thumb-placeholder" style="--slot-color: {contamColor[snap.contamination_risk]}">
|
||||
<span class="slot-label">{snap.slotId}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="snap-meta">
|
||||
<span class="snap-slot">{snap.slotId}</span>
|
||||
<span class="snap-pct">{snap.colonization_pct}%</span>
|
||||
{#if snap.contamination_risk !== 'none'}
|
||||
<span class="snap-contam" style="color: {contamColor[snap.contamination_risk]}">
|
||||
⚠ {snap.contamination_risk}
|
||||
</span>
|
||||
{/if}
|
||||
<span class="snap-age text-muted">{formatAge(snap.ts)}</span>
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.snapshot-strip {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 8px 16px;
|
||||
background: var(--color-surface);
|
||||
border-top: 1px solid var(--color-border);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.strip-label {
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.snaps {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
.snaps::-webkit-scrollbar { display: none; }
|
||||
|
||||
.snap-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 6px 10px;
|
||||
background: var(--color-surface-2);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
text-align: left;
|
||||
transition: border-color 0.2s, background 0.2s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.snap-card:hover {
|
||||
border-color: var(--color-sage-dim);
|
||||
background: color-mix(in srgb, var(--color-sage) 6%, var(--color-surface-2));
|
||||
}
|
||||
|
||||
.snap-thumb {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: var(--radius-sm);
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.thumb-placeholder {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: color-mix(in srgb, var(--slot-color, var(--color-sage)) 10%, var(--color-bg));
|
||||
border: 1px solid color-mix(in srgb, var(--slot-color, var(--color-sage)) 30%, transparent);
|
||||
border-radius: var(--radius-sm);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.slot-label {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 13px;
|
||||
color: color-mix(in srgb, var(--slot-color, var(--color-sage)) 70%, transparent);
|
||||
}
|
||||
|
||||
.snap-meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.snap-slot {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 13px;
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.snap-pct {
|
||||
font-size: 11px;
|
||||
color: var(--color-sage);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.snap-contam {
|
||||
font-size: 10px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
|
||||
.snap-age {
|
||||
font-size: 10px;
|
||||
}
|
||||
</style>
|
||||
+66
-52
@@ -4,89 +4,103 @@
|
||||
const active = $derived(
|
||||
cultivar.state.environment.alerts.filter(a => !a.dismissed)
|
||||
);
|
||||
|
||||
const icons: Record<string, string> = {
|
||||
info: '🍄🟫',
|
||||
warn: '🚩',
|
||||
critical: '⚠️',
|
||||
};
|
||||
</script>
|
||||
|
||||
{#if active.length > 0}
|
||||
<div class="action-list">
|
||||
<div class="notes">
|
||||
{#each active as alert (alert.id)}
|
||||
{@const level = alert.severity}
|
||||
<div class="action-item action-{level}">
|
||||
<span class="action-dot"></span>
|
||||
<span class="action-msg">{alert.message}</span>
|
||||
<div class="note note-{alert.severity}">
|
||||
<span class="note-mark" aria-hidden="true">{icons[alert.severity] ?? '•'}</span>
|
||||
<span class="note-body">{alert.message}</span>
|
||||
<button
|
||||
class="action-dismiss"
|
||||
class="note-close"
|
||||
onclick={() => cultivar.dismissAlert(alert.id)}
|
||||
aria-label="Ignore this action"
|
||||
>Ignore</button>
|
||||
aria-label="Dismiss"
|
||||
>
|
||||
<svg width="11" height="11" viewBox="0 0 12 12" fill="none" aria-hidden="true">
|
||||
<path d="M2 2L10 10M10 2L2 10" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.action-list {
|
||||
.notes {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1px;
|
||||
padding: 0 12px 6px;
|
||||
gap: 6px;
|
||||
padding: 10px 20px 0;
|
||||
}
|
||||
|
||||
.action-item {
|
||||
.note {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
font-size: 12.5px;
|
||||
line-height: 1.35;
|
||||
border: 1px solid transparent;
|
||||
padding: 10px 12px 10px 14px;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
border: 1px solid var(--line);
|
||||
background: #fbf7ec;
|
||||
color: var(--ink);
|
||||
position: relative;
|
||||
animation: rise-in 0.22s ease-out;
|
||||
}
|
||||
|
||||
.action-info {
|
||||
background: color-mix(in srgb, var(--color-sage) 10%, transparent);
|
||||
border-color: color-mix(in srgb, var(--color-sage) 18%, transparent);
|
||||
color: color-mix(in srgb, var(--color-sage) 90%, var(--color-text));
|
||||
/* Vertical accent bar on the left edge */
|
||||
.note::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 10px;
|
||||
bottom: 10px;
|
||||
width: 3px;
|
||||
border-radius: 2px;
|
||||
background: var(--forest);
|
||||
}
|
||||
|
||||
.action-warn {
|
||||
background: color-mix(in srgb, var(--color-contam-low) 10%, transparent);
|
||||
border-color: color-mix(in srgb, var(--color-contam-low) 20%, transparent);
|
||||
color: color-mix(in srgb, var(--color-contam-low) 85%, var(--color-text));
|
||||
}
|
||||
.note-info::before { background: var(--forest); }
|
||||
.note-warn::before { background: var(--attention); }
|
||||
.note-critical::before { background: var(--urgent); }
|
||||
|
||||
.action-critical {
|
||||
background: color-mix(in srgb, var(--color-contam-high) 12%, transparent);
|
||||
border-color: color-mix(in srgb, var(--color-contam-high) 22%, transparent);
|
||||
color: color-mix(in srgb, var(--color-contam-high) 85%, var(--color-text));
|
||||
}
|
||||
.note-info { color: var(--ink); }
|
||||
.note-warn { color: var(--ink); background: #fbf3e7; border-color: #e9d7b9; }
|
||||
.note-critical { color: var(--ink); background: #fbefec; border-color: #e9c7c1; }
|
||||
|
||||
.action-dot {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
background: currentColor;
|
||||
.note-mark {
|
||||
font-size: 14px;
|
||||
line-height: 1.3;
|
||||
flex-shrink: 0;
|
||||
opacity: 0.8;
|
||||
font-family: var(--font-serif);
|
||||
}
|
||||
.note-info .note-mark { color: var(--forest); }
|
||||
.note-warn .note-mark { color: var(--attention); }
|
||||
.note-critical .note-mark { color: var(--urgent); }
|
||||
|
||||
.action-msg {
|
||||
.note-body {
|
||||
flex: 1;
|
||||
font-family: var(--font-sans);
|
||||
}
|
||||
|
||||
.action-dismiss {
|
||||
.note-close {
|
||||
flex-shrink: 0;
|
||||
font-size: 10.5px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
color: currentColor;
|
||||
opacity: 0.5;
|
||||
padding: 2px 6px;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid currentColor;
|
||||
transition: opacity 0.15s;
|
||||
white-space: nowrap;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
color: var(--ink-muted);
|
||||
transition: background 0.15s, color 0.15s;
|
||||
}
|
||||
.action-dismiss:hover { opacity: 0.85; }
|
||||
.note-close:hover { background: var(--paper-3); color: var(--ink); }
|
||||
</style>
|
||||
+105
-45
@@ -1,85 +1,145 @@
|
||||
<script lang="ts">
|
||||
import { cultivar } from '../store.svelte';
|
||||
|
||||
// Format a friendly greeting based on local time of day
|
||||
const hour = new Date().getHours();
|
||||
const greeting =
|
||||
hour < 5 ? 'Good evening'
|
||||
: hour < 12 ? 'Good morning'
|
||||
: hour < 18 ? 'Good afternoon'
|
||||
: 'Good evening';
|
||||
|
||||
// Display cultivar owner name if we had one — for now, friendly generic
|
||||
const date = new Date().toLocaleDateString([], { weekday: 'long', month: 'long', day: 'numeric' });
|
||||
</script>
|
||||
|
||||
<header class="topbar">
|
||||
<!-- Grove5 monogram -->
|
||||
<div class="monogram" aria-label="Grove5">
|
||||
<svg width="28" height="28" viewBox="0 0 32 32" fill="none">
|
||||
<circle cx="16" cy="16" r="16" fill="var(--color-surface-2)"/>
|
||||
<text x="8" y="21" font-family="var(--font-serif)" font-size="13" fill="var(--color-text)" font-weight="400">g</text>
|
||||
<text x="17" y="21" font-family="var(--font-serif)" font-size="13" fill="var(--color-sage)" font-weight="700">5</text>
|
||||
</svg>
|
||||
<!-- Left: brand -->
|
||||
<a class="wordmark" href="/" aria-label="Cultivar home">
|
||||
<img src="/img/g5.svg" alt="" class="mono" aria-hidden="true" />
|
||||
<span class="brand font-serif">Cultivar</span>
|
||||
</a>
|
||||
|
||||
<!-- Center: soft date/greeting (only on wider layouts) -->
|
||||
<div class="meta">
|
||||
<span class="meta-greet font-serif italic">{greeting}</span>
|
||||
<span class="meta-sep">·</span>
|
||||
<span class="meta-date">{date}</span>
|
||||
</div>
|
||||
|
||||
<span class="brand">Cultivar</span>
|
||||
<!-- Right: live status + menu -->
|
||||
<div class="actions">
|
||||
<span class="live" aria-label="Connected">
|
||||
<span class="dot"></span>
|
||||
<span class="live-label">Live</span>
|
||||
</span>
|
||||
|
||||
<div class="spacer"></div>
|
||||
|
||||
<!-- Connection indicator -->
|
||||
<span class="status-dot live" aria-label="Connected"></span>
|
||||
|
||||
<!-- Menu button -->
|
||||
<button class="menu-btn" aria-label="Menu">
|
||||
<svg width="18" height="14" viewBox="0 0 18 14" fill="none">
|
||||
<line x1="0" y1="1" x2="18" y2="1" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
||||
<line x1="0" y1="7" x2="18" y2="7" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
||||
<line x1="0" y1="13" x2="18" y2="13" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
||||
<button class="menu-btn" aria-label="Menu" type="button">
|
||||
<svg width="18" height="14" viewBox="0 0 18 14" fill="none" aria-hidden="true">
|
||||
<line x1="0" y1="1" x2="18" y2="1" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>
|
||||
<line x1="0" y1="7" x2="18" y2="7" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>
|
||||
<line x1="0" y1="13" x2="18" y2="13" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<style>
|
||||
.topbar {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto 1fr;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 14px 24px 12px;
|
||||
flex-shrink: 0;
|
||||
border-bottom: 1px solid var(--line-soft);
|
||||
background: color-mix(in srgb, var(--paper) 86%, transparent);
|
||||
backdrop-filter: blur(8px);
|
||||
-webkit-backdrop-filter: blur(8px);
|
||||
}
|
||||
|
||||
.wordmark {
|
||||
justify-self: start;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 14px;
|
||||
flex-shrink: 0;
|
||||
text-decoration: none;
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.monogram {
|
||||
flex-shrink: 0;
|
||||
line-height: 0;
|
||||
.mono {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.brand {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 17px;
|
||||
letter-spacing: 0.01em;
|
||||
font-size: 22px;
|
||||
font-weight: var(--fw-display);
|
||||
letter-spacing: -0.005em;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
flex: 1;
|
||||
.meta {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
font-size: 12px;
|
||||
color: var(--ink-muted);
|
||||
min-width: 0;
|
||||
}
|
||||
.meta-greet { font-size: 14px; font-weight: var(--fw-body); color: var(--ink-2); }
|
||||
.meta-sep { opacity: 0.4; }
|
||||
.meta-date { letter-spacing: 0.01em; }
|
||||
|
||||
.actions {
|
||||
justify-self: end;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
.live {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 4px 10px 4px 8px;
|
||||
border-radius: 999px;
|
||||
background: var(--forest-tint);
|
||||
color: var(--forest);
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: var(--color-sage);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.status-dot.live {
|
||||
animation: dot-live 2.5s ease-in-out infinite;
|
||||
background: var(--forest);
|
||||
animation: dot-live 2.6s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.menu-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--color-text-muted);
|
||||
transition: background 0.12s, color 0.12s;
|
||||
flex-shrink: 0;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: 50%;
|
||||
color: var(--ink-2);
|
||||
transition: background 0.15s, color 0.15s;
|
||||
}
|
||||
.menu-btn:hover {
|
||||
background: var(--paper-2);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.menu-btn:hover {
|
||||
background: var(--color-surface-2);
|
||||
color: var(--color-text);
|
||||
@media (max-width: 640px) {
|
||||
.meta { display: none; }
|
||||
.live-label { display: none; }
|
||||
.live { padding: 4px 8px; }
|
||||
.topbar { padding: 12px 14px 10px; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,16 @@
|
||||
/** Shape of the rich detail shown when you click a rhythm item */
|
||||
export type RhythmDetailData = {
|
||||
id: string;
|
||||
urgency: 'urgent' | 'action';
|
||||
title: string;
|
||||
lede: string;
|
||||
why?: string;
|
||||
time_estimate?: string;
|
||||
materials?: string[];
|
||||
steps: string[];
|
||||
tips?: string[];
|
||||
/** Primary action button label (e.g., "Mark wiped down") */
|
||||
primary_cta?: string;
|
||||
/** Callback when the primary CTA is clicked */
|
||||
onPrimary?: () => void;
|
||||
};
|
||||
+457
-266
@@ -2,6 +2,7 @@
|
||||
import { cultivar } from '../lib/store.svelte';
|
||||
import ColonizationCurve from '../lib/charts/ColonizationCurve.svelte';
|
||||
import MushroomBag from '../lib/twin/MushroomBag.svelte';
|
||||
import InfoHint from '../lib/ui/InfoHint.svelte';
|
||||
import type { BagSnapshot, BagState } from '../lib/types';
|
||||
import { STAGE_LABELS } from '../lib/types';
|
||||
|
||||
@@ -43,17 +44,17 @@
|
||||
}
|
||||
|
||||
const contamColor: Record<string, string> = {
|
||||
none: 'var(--color-text-muted)',
|
||||
low: 'var(--color-contam-low)',
|
||||
medium: 'var(--color-contam-low)',
|
||||
high: 'var(--color-contam-high)',
|
||||
none: 'var(--forest)',
|
||||
low: 'var(--attention)',
|
||||
medium: 'var(--attention)',
|
||||
high: 'var(--urgent)',
|
||||
};
|
||||
|
||||
const annotColor: Record<string, string> = {
|
||||
mycelium: 'var(--color-mycelium)',
|
||||
contamination: 'var(--color-contam-high)',
|
||||
fruiting: 'var(--color-fruiting)',
|
||||
pinning: 'var(--color-pinning)',
|
||||
const contamLabel: Record<string, string> = {
|
||||
none: 'Healthy',
|
||||
low: 'Monitor',
|
||||
medium: 'Monitor',
|
||||
high: 'Needs attention',
|
||||
};
|
||||
|
||||
// Quick actions
|
||||
@@ -63,44 +64,69 @@
|
||||
actionPending = label;
|
||||
try {
|
||||
await fetch(endpoint, { method: 'POST' });
|
||||
} catch {
|
||||
// mock: ignore errors
|
||||
} finally {
|
||||
actionPending = null;
|
||||
}
|
||||
} catch { /* mock: ignore */ }
|
||||
finally { actionPending = null; }
|
||||
}
|
||||
|
||||
const daysSinceInoc = $derived(
|
||||
bag ? Math.max(0, Math.floor((Date.now() / 1000 - bag.tag.inoculated_ts) / 86400)) : 0
|
||||
);
|
||||
const daysToReady = $derived(
|
||||
bag ? Math.max(0, Math.ceil((bag.vision.projection.estimated_ready_ts - Date.now() / 1000) / 86400)) : 0
|
||||
);
|
||||
</script>
|
||||
|
||||
<div class="bag-detail">
|
||||
<!-- Header -->
|
||||
<div class="detail-header">
|
||||
<button class="back-btn" onclick={onBack} aria-label="Back">
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
|
||||
<path d="M12 4L6 10L12 16" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<header class="head">
|
||||
<button class="back-btn" onclick={onBack} aria-label="Back to overview" type="button">
|
||||
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" aria-hidden="true">
|
||||
<path d="M11 4L6 9L11 14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
<span>Overview</span>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
{#if bag}
|
||||
<div class="header-info">
|
||||
<h1 class="slot-strain">
|
||||
<span class="slot-id">{bag.tag.strain_name}</span>
|
||||
<span class="stage-pill">{STAGE_LABELS[bag.vision.stage]}</span>
|
||||
<div class="page scroll-soft">
|
||||
<!-- ── Strain title section ────────────────────────────── -->
|
||||
<section class="title-card">
|
||||
<div class="title-left">
|
||||
<div class="eyebrow">Slot {bag.slot_id}</div>
|
||||
<h1 class="strain font-serif">
|
||||
{bag.tag.strain_name}
|
||||
</h1>
|
||||
<div class="header-meta text-muted">
|
||||
<span>Started {formatDate(bag.tag.inoculated_ts)}</span>
|
||||
<div class="title-meta">
|
||||
<span class="pill pill-{bag.vision.stage}">{STAGE_LABELS[bag.vision.stage]}</span>
|
||||
<span class="meta-text">{bag.tag.substrate}</span>
|
||||
<span class="sep">·</span>
|
||||
<span>{bag.tag.substrate}</span>
|
||||
<span class="meta-text">Started {formatDate(bag.tag.inoculated_ts)}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if bag}
|
||||
<div class="detail-scroll">
|
||||
<div class="title-stats">
|
||||
<div class="ts-item">
|
||||
<div class="ts-value font-serif">{daysSinceInoc}</div>
|
||||
<div class="ts-key">Day</div>
|
||||
</div>
|
||||
<div class="ts-item">
|
||||
<div class="ts-value font-serif">{bag.vision.colonization_pct}<span class="ts-unit">%</span></div>
|
||||
<div class="ts-key">Colonized</div>
|
||||
</div>
|
||||
<div class="ts-item">
|
||||
<div class="ts-value font-serif">
|
||||
{#if daysToReady > 0}{daysToReady}<span class="ts-unit">d</span>{:else}Soon{/if}
|
||||
</div>
|
||||
<div class="ts-key">Until ready</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Snapshot viewer — mushroom bag digital twin -->
|
||||
<section class="snapshot-viewer">
|
||||
<div class="snapshot-image-wrap">
|
||||
<!-- ── Main grid: bag twin on the left, all info on the right ── -->
|
||||
<div class="main-grid">
|
||||
<!-- LEFT · the bag itself (sticky on wide screens) -->
|
||||
<div class="visual-col">
|
||||
<div class="bag-twin-card">
|
||||
<div class="bag-twin-container">
|
||||
<MushroomBag
|
||||
colonizationPct={activeSnapshot?.colonization_pct ?? bag.vision.colonization_pct}
|
||||
@@ -110,112 +136,163 @@
|
||||
strainCode={bag.tag.strain_code}
|
||||
inoculatedTs={bag.tag.inoculated_ts}
|
||||
/>
|
||||
|
||||
<!-- Overlay: stage + % readout -->
|
||||
<div class="bag-readout">
|
||||
<div class="readout-pct">{activeSnapshot?.colonization_pct ?? bag.vision.colonization_pct}%</div>
|
||||
<div class="readout-label">colonized</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if activeSnapshot && activeSnapshot.contamination_risk !== 'none'}
|
||||
<div class="contam-badge" style="color: {contamColor[activeSnapshot.contamination_risk]}">
|
||||
⚠ {activeSnapshot.contamination_risk} contamination risk
|
||||
<div class="contam-strip" style="color: {contamColor[activeSnapshot.contamination_risk]}">
|
||||
{contamLabel[activeSnapshot.contamination_risk]} · {activeSnapshot.contamination_risk} contamination risk
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- RIGHT · everything else (facts, chart, photos, actions) -->
|
||||
<div class="info-col">
|
||||
<!-- At a glance -->
|
||||
<aside class="facts">
|
||||
<div class="eyebrow">At a glance</div>
|
||||
<dl class="facts-list">
|
||||
<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" />
|
||||
</dt>
|
||||
<dd class="font-serif">{Math.round(bag.vision.colonization_confidence * 100)}%</dd>
|
||||
</div>
|
||||
<div class="fact">
|
||||
<dt>Est. ready</dt>
|
||||
<dd class="font-serif">{formatDate(bag.vision.projection.estimated_ready_ts)}</dd>
|
||||
</div>
|
||||
<div class="fact">
|
||||
<dt>Strain code</dt>
|
||||
<dd class="mono-snippet">{bag.tag.strain_code}</dd>
|
||||
</div>
|
||||
<div class="fact">
|
||||
<dt>Batch</dt>
|
||||
<dd>{bag.tag.batch_id}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</aside>
|
||||
|
||||
<!-- Colonization curve -->
|
||||
<section class="section">
|
||||
<h2 class="section-title">Colonization Progress</h2>
|
||||
<div class="curve-wrap">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="eyebrow">Progress</div>
|
||||
<h2 class="section-title font-serif">Colonization over time</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="curve-card">
|
||||
<ColonizationCurve
|
||||
curve={bag.vision.projection.colonization_curve}
|
||||
inoculatedTs={bag.tag.inoculated_ts}
|
||||
estimatedReadyTs={bag.vision.projection.estimated_ready_ts}
|
||||
/>
|
||||
</div>
|
||||
<div class="curve-meta text-muted">
|
||||
<span>Est. ready: {formatDate(bag.vision.projection.estimated_ready_ts)}</span>
|
||||
<span class="sep">·</span>
|
||||
<span>{bag.vision.colonization_pct}% colonized</span>
|
||||
<span class="sep">·</span>
|
||||
<span>Confidence: {Math.round(bag.vision.colonization_confidence * 100)}%</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Snapshot history -->
|
||||
{#if bag.vision.snapshots.length > 0}
|
||||
<section class="section">
|
||||
<h2 class="section-title">Snapshot History</h2>
|
||||
<div class="history-scroll">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="eyebrow">Photos</div>
|
||||
<h2 class="section-title font-serif">A week at a glance</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="history-scroll scroll-soft">
|
||||
{#each [...bag.vision.snapshots].reverse() as snap, i (snap.ts)}
|
||||
{@const isActive = selectedSnapshotIdx === bag.vision.snapshots.length - 1 - i ||
|
||||
{@const trueIdx = bag.vision.snapshots.length - 1 - i}
|
||||
{@const isActive = selectedSnapshotIdx === trueIdx ||
|
||||
(selectedSnapshotIdx === null && i === 0)}
|
||||
<button
|
||||
class="history-thumb"
|
||||
class:active={isActive}
|
||||
onclick={() => {
|
||||
selectedSnapshotIdx = bag.vision.snapshots.length - 1 - i;
|
||||
}}
|
||||
onclick={() => { selectedSnapshotIdx = trueIdx; }}
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="history-img"
|
||||
style="background: color-mix(in srgb, {snap.contamination_risk !== 'none' ? contamColor[snap.contamination_risk] : 'var(--color-sage)'} 10%, var(--color-bg))"
|
||||
style="background: color-mix(in srgb, {snap.contamination_risk !== 'none' ? contamColor[snap.contamination_risk] : 'var(--forest)'} 14%, #fbf7ec)"
|
||||
>
|
||||
<span class="history-pct">{snap.colonization_pct}%</span>
|
||||
<span class="history-pct font-serif">{snap.colonization_pct}%</span>
|
||||
</div>
|
||||
<div class="history-info">
|
||||
<span class="history-date text-muted">{formatDaysAgo(snap.ts)}</span>
|
||||
<span class="history-date">{formatDaysAgo(snap.ts)}</span>
|
||||
{#if snap.contamination_risk !== 'none'}
|
||||
<span class="history-contam" style="color: {contamColor[snap.contamination_risk]}">⚠</span>
|
||||
<span class="history-contam" style="color: {contamColor[snap.contamination_risk]}" title="Contamination flagged">⚑</span>
|
||||
{/if}
|
||||
</div>
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
{/if}
|
||||
|
||||
<!-- Actions -->
|
||||
<section class="section">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<div class="eyebrow">Actions</div>
|
||||
<h2 class="section-title font-serif">What would you like to do?</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Quick actions -->
|
||||
<section class="section quick-actions">
|
||||
<h2 class="section-title">Actions</h2>
|
||||
<div class="action-row">
|
||||
<button
|
||||
class="action-btn action-flag"
|
||||
disabled={actionPending !== null}
|
||||
onclick={() => postAction(`/api/bags/${bagId}/flag`, 'flag')}
|
||||
>
|
||||
{actionPending === 'flag' ? 'Flagging…' : 'Flag Contamination'}
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="action-btn action-harvest"
|
||||
disabled={actionPending !== null}
|
||||
onclick={() => postAction(`/api/bags/${bagId}/harvest`, 'harvest')}
|
||||
type="button"
|
||||
>
|
||||
{actionPending === 'harvest' ? 'Marking…' : 'Mark Harvested'}
|
||||
<span class="action-icon">✂</span>
|
||||
<span class="action-label">
|
||||
<span class="action-title font-serif">Mark harvested</span>
|
||||
<span class="action-hint">Log today's harvest and free this slot</span>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="action-btn action-flag"
|
||||
disabled={actionPending !== null}
|
||||
onclick={() => postAction(`/api/bags/${bagId}/flag`, 'flag')}
|
||||
type="button"
|
||||
>
|
||||
<span class="action-icon">⚑</span>
|
||||
<span class="action-label">
|
||||
<span class="action-title font-serif">Flag contamination</span>
|
||||
<span class="action-hint">Tell Cultivar something looks off</span>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="action-btn action-retag"
|
||||
disabled={actionPending !== null}
|
||||
onclick={() => {
|
||||
// V1: manual entry fallback
|
||||
const code = prompt('Enter strain code (MSS format):');
|
||||
if (code) {
|
||||
// In production: POST to /api/bags/{id}/retag
|
||||
console.log('Retag:', code);
|
||||
}
|
||||
if (code) console.log('Retag:', code);
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
Retag
|
||||
<span class="action-icon">⟳</span>
|
||||
<span class="action-label">
|
||||
<span class="action-title font-serif">Re-tag bag</span>
|
||||
<span class="action-hint">Scan or enter a different BagTag code</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{:else}
|
||||
<div class="not-found text-muted">Bag not found.</div>
|
||||
<div class="not-found">
|
||||
<p class="italic font-serif">We couldn't find that bag.</p>
|
||||
<button class="btn-ghost" onclick={onBack} type="button">Back to overview</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -224,219 +301,281 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
background: var(--color-bg);
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: var(--paper);
|
||||
animation: slide-in-right var(--transition-view) both;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.detail-header {
|
||||
/* ── Header ── */
|
||||
.head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 16px;
|
||||
background: var(--color-surface);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
padding: 14px 20px;
|
||||
border-bottom: 1px solid var(--line-soft);
|
||||
flex-shrink: 0;
|
||||
background: color-mix(in srgb, var(--paper) 88%, transparent);
|
||||
backdrop-filter: blur(8px);
|
||||
-webkit-backdrop-filter: blur(8px);
|
||||
}
|
||||
|
||||
.back-btn {
|
||||
display: flex;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--color-text-muted);
|
||||
flex-shrink: 0;
|
||||
transition: color 0.2s, background 0.2s;
|
||||
gap: 6px;
|
||||
padding: 6px 12px 6px 8px;
|
||||
border-radius: 999px;
|
||||
color: var(--ink-2);
|
||||
font-size: 13px;
|
||||
transition: background 0.15s, color 0.15s;
|
||||
}
|
||||
.back-btn:hover {
|
||||
color: var(--color-text);
|
||||
background: var(--color-surface-2);
|
||||
background: var(--paper-2);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
.header-info {
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.slot-strain {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 10px;
|
||||
font-family: var(--font-serif);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.slot-id {
|
||||
font-size: 20px;
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.stage-pill {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: var(--color-sage);
|
||||
border: 1px solid color-mix(in srgb, var(--color-sage) 40%, transparent);
|
||||
padding: 2px 7px;
|
||||
border-radius: 20px;
|
||||
white-space: nowrap;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.header-meta {
|
||||
font-size: 11px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.sep { opacity: 0.4; }
|
||||
|
||||
.detail-scroll {
|
||||
/* ── Page ── */
|
||||
.page {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--color-border) transparent;
|
||||
padding: 20px 28px 40px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 26px;
|
||||
}
|
||||
|
||||
/* Snapshot viewer */
|
||||
.snapshot-viewer {
|
||||
padding: 16px;
|
||||
/* ── Title ── */
|
||||
.title-card {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
gap: 24px;
|
||||
align-items: end;
|
||||
padding: 10px 4px 16px;
|
||||
border-bottom: 1px solid var(--line-soft);
|
||||
}
|
||||
|
||||
.snapshot-image-wrap {
|
||||
position: relative;
|
||||
.title-left { display: flex; flex-direction: column; gap: 8px; }
|
||||
|
||||
.strain {
|
||||
font-size: clamp(32px, 4.5vw, 48px);
|
||||
line-height: 1.05;
|
||||
letter-spacing: -0.015em;
|
||||
color: var(--ink);
|
||||
margin-top: 4px;
|
||||
font-weight: var(--fw-display);
|
||||
}
|
||||
|
||||
.title-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
font-size: 13px;
|
||||
color: var(--ink-2);
|
||||
margin-top: 4px;
|
||||
}
|
||||
.meta-text { color: var(--ink-2); }
|
||||
.sep { opacity: 0.4; }
|
||||
|
||||
.title-stats {
|
||||
display: flex;
|
||||
gap: 26px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.ts-item { display: flex; flex-direction: column; gap: 4px; }
|
||||
|
||||
.ts-value {
|
||||
font-size: 28px;
|
||||
line-height: 1;
|
||||
color: var(--ink);
|
||||
letter-spacing: -0.015em;
|
||||
}
|
||||
.ts-unit {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 14px;
|
||||
color: var(--ink-muted);
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
.ts-key {
|
||||
font-size: 10px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--ink-muted);
|
||||
}
|
||||
|
||||
/* ── Main grid (wraps bag visual + info column) ── */
|
||||
.main-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 22px;
|
||||
}
|
||||
|
||||
.visual-col,
|
||||
.info-col {
|
||||
min-width: 0; /* prevent grid blowout from long inner content */
|
||||
}
|
||||
|
||||
.info-col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 26px;
|
||||
}
|
||||
|
||||
.bag-twin-card {
|
||||
background: #fbf7ec;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.bag-twin-container {
|
||||
position: relative;
|
||||
aspect-ratio: 3/4;
|
||||
max-height: 520px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: radial-gradient(ellipse at 50% 45%, var(--color-surface-2) 0%, var(--color-bg) 100%);
|
||||
padding: 12px;
|
||||
background: radial-gradient(ellipse at 50% 40%, #efe8d4 0%, #e8e0ca 100%);
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.bag-readout {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 14px;
|
||||
text-align: right;
|
||||
font-family: var(--font-serif);
|
||||
z-index: 2;
|
||||
padding: 6px 10px;
|
||||
background: color-mix(in srgb, var(--color-bg) 70%, transparent);
|
||||
backdrop-filter: blur(4px);
|
||||
-webkit-backdrop-filter: blur(4px);
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.readout-pct {
|
||||
font-size: 28px;
|
||||
color: var(--color-sage);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.readout-label {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 9px;
|
||||
color: var(--color-text-muted);
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.contam-badge {
|
||||
padding: 6px 12px;
|
||||
font-size: 11px;
|
||||
.contam-strip {
|
||||
padding: 10px 16px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.04em;
|
||||
background: color-mix(in srgb, currentColor 8%, var(--color-surface));
|
||||
letter-spacing: 0.01em;
|
||||
background: color-mix(in srgb, currentColor 10%, #fbf7ec);
|
||||
border-top: 1px solid color-mix(in srgb, currentColor 20%, var(--line));
|
||||
}
|
||||
|
||||
/* Sections */
|
||||
/* ── Facts panel ── */
|
||||
.facts {
|
||||
background: #fbf7ec;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 18px 20px;
|
||||
}
|
||||
|
||||
.facts-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
margin: 10px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.fact {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid var(--line-soft);
|
||||
}
|
||||
.fact:last-child { border-bottom: none; padding-bottom: 0; }
|
||||
|
||||
.fact dt {
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.08em;
|
||||
color: var(--ink-muted);
|
||||
text-transform: uppercase;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.fact dd {
|
||||
font-size: 14px;
|
||||
color: var(--ink);
|
||||
text-align: right;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.mono-snippet {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||
font-size: 11px !important;
|
||||
color: var(--ink-2) !important;
|
||||
}
|
||||
|
||||
/* ── Generic sections ── */
|
||||
.section {
|
||||
padding: 0 16px 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-family: var(--font-sans);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: var(--color-text-muted);
|
||||
margin-bottom: 10px;
|
||||
font-size: 22px;
|
||||
letter-spacing: -0.005em;
|
||||
color: var(--ink);
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.curve-wrap {
|
||||
background: var(--color-surface);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--radius-md);
|
||||
padding: 8px;
|
||||
/* ── Colonization curve card ── */
|
||||
.curve-card {
|
||||
background: #fbf7ec;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 18px 16px 10px;
|
||||
}
|
||||
/* The chart SVG has aspect ratio 360×160 and `height: auto`, which
|
||||
on wide screens lets it grow absurdly tall. Cap it here so the
|
||||
curve always reads as a small, embedded chart — not a hero. */
|
||||
.curve-card :global(.curve-svg) {
|
||||
width: 100%;
|
||||
max-height: 260px;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.curve-meta {
|
||||
font-size: 11px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
/* History strip */
|
||||
/* ── Snapshot history ── */
|
||||
.history-scroll {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
gap: 10px;
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
padding-bottom: 4px;
|
||||
padding: 4px 2px 8px;
|
||||
}
|
||||
.history-scroll::-webkit-scrollbar { display: none; }
|
||||
.history-scroll::-webkit-scrollbar { height: 5px; }
|
||||
|
||||
.history-thumb {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--color-border);
|
||||
padding: 4px;
|
||||
background: var(--color-surface);
|
||||
transition: border-color 0.2s;
|
||||
gap: 6px;
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid var(--line);
|
||||
padding: 6px;
|
||||
background: #fbf7ec;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.history-thumb:hover { border-color: var(--forest-mid); }
|
||||
.history-thumb.active {
|
||||
border-color: var(--color-sage);
|
||||
border-color: var(--forest);
|
||||
box-shadow: 0 0 0 1px var(--forest);
|
||||
}
|
||||
|
||||
.history-img {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 3px;
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
border-radius: var(--radius-sm);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.history-pct {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 14px;
|
||||
color: var(--color-sage);
|
||||
font-size: 16px;
|
||||
color: var(--forest);
|
||||
}
|
||||
|
||||
.history-info {
|
||||
@@ -448,56 +587,108 @@
|
||||
}
|
||||
|
||||
.history-date {
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.history-contam {
|
||||
font-size: 10px;
|
||||
color: var(--ink-muted);
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
/* Quick actions */
|
||||
.history-contam { font-size: 11px; }
|
||||
|
||||
/* ── Actions ── */
|
||||
.action-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
padding: 10px 16px;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
border: 1px solid var(--color-border);
|
||||
background: var(--color-surface-2);
|
||||
color: var(--color-text);
|
||||
transition: background 0.2s, border-color 0.2s;
|
||||
}
|
||||
|
||||
.action-btn:hover:not(:disabled) {
|
||||
background: var(--color-surface);
|
||||
border-color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.action-btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.action-flag {
|
||||
border-color: color-mix(in srgb, var(--color-contam-low) 40%, transparent);
|
||||
color: var(--color-contam-low);
|
||||
}
|
||||
|
||||
.action-harvest {
|
||||
border-color: color-mix(in srgb, var(--color-sage) 40%, transparent);
|
||||
color: var(--color-sage);
|
||||
}
|
||||
|
||||
.not-found {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
padding: 14px 16px;
|
||||
border-radius: var(--radius-md);
|
||||
border: 1px solid var(--line);
|
||||
background: #fbf7ec;
|
||||
color: var(--ink);
|
||||
text-align: left;
|
||||
transition: border-color 0.15s, background 0.15s, transform 0.1s;
|
||||
}
|
||||
.action-btn:hover:not(:disabled) {
|
||||
border-color: var(--forest);
|
||||
background: var(--forest-tint);
|
||||
}
|
||||
.action-btn:active:not(:disabled) { transform: translateY(1px); }
|
||||
.action-btn:disabled { opacity: 0.55; cursor: not-allowed; }
|
||||
|
||||
.action-icon {
|
||||
flex-shrink: 0;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
background: var(--paper-3);
|
||||
color: var(--forest);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
font-family: var(--font-serif);
|
||||
}
|
||||
|
||||
.action-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
|
||||
.action-title { font-size: 14.5px; color: var(--ink); line-height: 1.2; }
|
||||
.action-hint { font-size: 11.5px; color: var(--ink-muted); line-height: 1.3; }
|
||||
|
||||
.action-flag .action-icon { color: var(--attention); background: #f3e1cb; }
|
||||
.action-retag .action-icon { color: var(--ink-2); }
|
||||
|
||||
/* ── Not found ── */
|
||||
.not-found {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 14px;
|
||||
color: var(--ink-muted);
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* ── Responsive ── */
|
||||
@media (max-width: 900px) {
|
||||
.page { padding: 16px 18px 28px; }
|
||||
.title-card {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 18px;
|
||||
}
|
||||
.title-stats { gap: 18px; }
|
||||
.bag-twin-container { max-height: 440px; }
|
||||
}
|
||||
|
||||
/* Desktop: bag visual on the left, everything else stacked on the right.
|
||||
The visual sticks while the info column scrolls past it. */
|
||||
@media (min-width: 1024px) {
|
||||
.main-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
|
||||
gap: 32px;
|
||||
align-items: start;
|
||||
}
|
||||
.visual-col {
|
||||
position: sticky;
|
||||
top: 16px;
|
||||
}
|
||||
.bag-twin-container {
|
||||
max-height: 560px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Extra-wide: give the bag a bit more presence without dwarfing the info. */
|
||||
@media (min-width: 1400px) {
|
||||
.main-grid {
|
||||
grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.1fr);
|
||||
}
|
||||
.info-col {
|
||||
max-width: 760px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -84,14 +84,14 @@
|
||||
{#if step === 'welcome'}
|
||||
<div class="ob-step" style="animation: fade-in 0.4s both">
|
||||
<div class="ob-monogram">
|
||||
<svg width="56" height="56" viewBox="0 0 56 56" fill="none">
|
||||
<circle cx="28" cy="28" r="28" fill="var(--color-charcoal)"/>
|
||||
<text x="14" y="38" font-family="var(--font-serif)" font-size="24" fill="var(--color-charcoal)" font-weight="700">g</text>
|
||||
<text x="31" y="38" font-family="var(--font-serif)" font-size="24" fill="var(--color-sage)" font-weight="700">5</text>
|
||||
<svg width="56" height="56" viewBox="0 0 56 56" fill="none" aria-hidden="true">
|
||||
<circle cx="28" cy="28" r="27" fill="none" stroke="var(--ink)" stroke-width="1.5"/>
|
||||
<text x="14" y="38" font-family="DM Serif Display, Georgia, serif" font-size="26" fill="var(--ink)" font-weight="400">g</text>
|
||||
<text x="31" y="38" font-family="DM Serif Display, Georgia, serif" font-size="26" fill="var(--forest)" font-weight="400">5</text>
|
||||
</svg>
|
||||
</div>
|
||||
<h1 class="ob-headline">Welcome to your Cultivar.</h1>
|
||||
<p class="ob-body text-muted">Let's connect your chamber.</p>
|
||||
<h1 class="ob-headline font-serif">Welcome to your <span class="italic">Cultivar.</span></h1>
|
||||
<p class="ob-body text-muted">Let's connect your chamber to your home.</p>
|
||||
<button class="ob-cta" onclick={() => { step = 'connect'; }}>Begin Setup</button>
|
||||
</div>
|
||||
|
||||
|
||||
+925
-123
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" zoomAndPan="magnify" viewBox="0 0 300 299.999988" height="400" preserveAspectRatio="xMidYMid meet" version="1.0"><defs><g/><clipPath id="37f48aa3d2"><path d="M 150 0 C 67.15625 0 0 67.15625 0 150 C 0 232.84375 67.15625 300 150 300 C 232.84375 300 300 232.84375 300 150 C 300 67.15625 232.84375 0 150 0 Z M 150 0 " clip-rule="nonzero"/></clipPath><clipPath id="565a5711b0"><rect x="0" width="172" y="0" height="288"/></clipPath><clipPath id="495572fdca"><rect x="0" width="81" y="0" height="157"/></clipPath></defs><g clip-path="url(#37f48aa3d2)"><path stroke-linecap="butt" transform="matrix(0.75, 0, 0, 0.75, 0.000006, -0.000000000000063949)" fill="none" stroke-linejoin="miter" d="M 200.000008 0.000000000000085265 C 89.541666 0.000000000000085265 -0.000008 89.541674 -0.000008 200.000016 C -0.000008 310.458359 89.541666 400.000033 200.000008 400.000033 C 310.458351 400.000033 400.000025 310.458359 400.000025 200.000016 C 400.000025 89.541674 310.458351 0.000000000000085265 200.000008 0.000000000000085265 Z M 200.000008 0.000000000000085265 " stroke="#4d4d4d" stroke-width="36" stroke-opacity="1" stroke-miterlimit="4"/></g><g fill="#ffffff" fill-opacity="1"><g transform="translate(147.175779, 156.749987)"><g/></g></g><g transform="matrix(1, 0, 0, 1, 52, 0)"><g clip-path="url(#565a5711b0)"><g fill="#4d4d4d" fill-opacity="1"><g transform="translate(0.196131, 181.120018)"><g><path d="M 75.59375 -141.53125 C 82.882812 -141.53125 90.171875 -140.347656 97.453125 -137.984375 C 104.742188 -135.628906 111.070312 -131.984375 116.4375 -127.046875 C 122.65625 -131.984375 128.285156 -135.46875 133.328125 -137.5 C 138.367188 -139.539062 143.140625 -140.5625 147.640625 -140.5625 C 152.785156 -140.5625 157.234375 -139.328125 160.984375 -136.859375 C 164.742188 -134.398438 166.625 -131.023438 166.625 -126.734375 C 166.625 -123.734375 165.601562 -121.210938 163.5625 -119.171875 C 161.519531 -117.140625 159 -116.125 156 -116.125 C 153.425781 -116.125 151.390625 -116.710938 149.890625 -117.890625 C 148.390625 -119.066406 146.941406 -120.351562 145.546875 -121.75 C 144.148438 -123.144531 142.703125 -124.429688 141.203125 -125.609375 C 139.703125 -126.785156 137.664062 -127.375 135.09375 -127.375 C 132.738281 -127.375 130.378906 -126.726562 128.015625 -125.4375 C 125.660156 -124.15625 123.625 -122.765625 121.90625 -121.265625 C 129.625 -112.472656 133.484375 -101.960938 133.484375 -89.734375 C 133.484375 -79.878906 131.765625 -71.785156 128.328125 -65.453125 C 124.898438 -59.128906 120.128906 -54.035156 114.015625 -50.171875 C 107.910156 -46.316406 100.78125 -43.53125 92.625 -41.8125 C 84.476562 -40.09375 75.796875 -39.128906 66.578125 -38.921875 C 57.578125 -38.492188 50.445312 -37.367188 45.1875 -35.546875 C 39.9375 -33.722656 37.3125 -30.453125 37.3125 -25.734375 C 37.3125 -22.085938 38.921875 -19.566406 42.140625 -18.171875 C 45.359375 -16.773438 49.644531 -15.863281 55 -15.4375 L 82.984375 -14.15625 C 93.921875 -13.726562 103.625 -12.757812 112.09375 -11.25 C 120.5625 -9.75 127.691406 -7.285156 133.484375 -3.859375 C 139.273438 -0.429688 143.671875 4.28125 146.671875 10.28125 C 149.671875 16.289062 151.171875 23.90625 151.171875 33.125 C 151.171875 41.914062 149.398438 49.632812 145.859375 56.28125 C 142.328125 62.9375 137.34375 68.515625 130.90625 73.015625 C 124.476562 77.515625 116.8125 80.941406 107.90625 83.296875 C 99.007812 85.660156 89.3125 86.84375 78.8125 86.84375 C 69.375 86.84375 60.472656 85.929688 52.109375 84.109375 C 43.742188 82.285156 36.503906 79.550781 30.390625 75.90625 C 24.285156 72.257812 19.460938 67.863281 15.921875 62.71875 C 12.378906 57.570312 10.609375 51.566406 10.609375 44.703125 C 10.609375 41.273438 11.195312 37.898438 12.375 34.578125 C 13.5625 31.253906 15.226562 28.304688 17.375 25.734375 C 19.519531 23.160156 22.035156 21.125 24.921875 19.625 C 27.816406 18.125 30.984375 17.375 34.421875 17.375 C 37.203125 17.375 39.664062 17.910156 41.8125 18.984375 C 43.957031 20.054688 45.992188 21.445312 47.921875 23.15625 C 42.773438 24.226562 38.703125 26.960938 35.703125 31.359375 C 32.703125 35.753906 31.203125 40.738281 31.203125 46.3125 C 31.203125 57.25 35.488281 65.503906 44.0625 71.078125 C 52.644531 76.660156 65.296875 79.453125 82.015625 79.453125 C 96.171875 79.453125 107.59375 76.394531 116.28125 70.28125 C 124.96875 64.164062 129.3125 55.320312 129.3125 43.75 C 129.3125 37.738281 128.128906 32.800781 125.765625 28.9375 C 123.410156 25.082031 120.085938 22.03125 115.796875 19.78125 C 111.503906 17.53125 106.351562 15.867188 100.34375 14.796875 C 94.34375 13.722656 87.695312 13.078125 80.40625 12.859375 L 58.21875 11.90625 C 53.71875 11.6875 49.269531 11.203125 44.875 10.453125 C 40.476562 9.703125 36.507812 8.304688 32.96875 6.265625 C 29.425781 4.234375 26.582031 1.453125 24.4375 -2.078125 C 22.300781 -5.617188 21.234375 -10.285156 21.234375 -16.078125 C 21.234375 -23.367188 23.910156 -29.535156 29.26Line truncated
|
||||
|
After Width: | Height: | Size: 8.9 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="695" zoomAndPan="magnify" viewBox="0 0 521.25 140.249994" height="187" preserveAspectRatio="xMidYMid meet" version="1.0"><defs><g/><clipPath id="102357b0b3"><path d="M 1.011719 0 L 444 0 L 444 139.503906 L 1.011719 139.503906 Z M 1.011719 0 " clip-rule="nonzero"/></clipPath><clipPath id="428fdd57e5"><rect x="0" width="443" y="0" height="140"/></clipPath><clipPath id="9ac51ea07f"><path d="M 437 0 L 519.492188 0 L 519.492188 139.503906 L 437 139.503906 Z M 437 0 " clip-rule="nonzero"/></clipPath><clipPath id="50e583f27b"><rect x="0" width="83" y="0" height="140"/></clipPath></defs><g clip-path="url(#102357b0b3)"><g transform="matrix(1, 0, 0, 1, 1, -0.000000000000003526)"><g clip-path="url(#428fdd57e5)"><g fill="#4d4d4d" fill-opacity="1"><g transform="translate(-0.732702, 134.847758)"><g><path d="M 61.21875 3.03125 C 49.78125 3.03125 39.71875 0.648438 31.03125 -4.109375 C 22.34375 -8.878906 15.554688 -15.664062 10.671875 -24.46875 C 5.796875 -33.269531 3.359375 -43.671875 3.359375 -55.671875 C 3.359375 -67.328125 5.769531 -77.53125 10.59375 -86.28125 C 15.414062 -95.03125 22.394531 -101.84375 31.53125 -106.71875 C 40.675781 -111.59375 51.75 -114.03125 64.75 -114.03125 C 70.695312 -114.03125 76.21875 -113.359375 81.3125 -112.015625 C 86.414062 -110.671875 91.265625 -108.707031 95.859375 -106.125 L 96.546875 -82.578125 L 94.859375 -82.578125 L 85.4375 -100.078125 C 83.976562 -102.878906 82.628906 -104.894531 81.390625 -106.125 C 80.160156 -107.351562 78.59375 -108.304688 76.6875 -108.984375 C 74.894531 -109.546875 73.242188 -109.96875 71.734375 -110.25 C 70.222656 -110.53125 68.234375 -110.671875 65.765625 -110.671875 C 58.804688 -110.671875 52.664062 -108.816406 47.34375 -105.109375 C 42.019531 -101.410156 37.898438 -95.523438 34.984375 -87.453125 C 32.066406 -79.378906 30.609375 -68.785156 30.609375 -55.671875 C 30.609375 -42.660156 31.976562 -32.0625 34.71875 -23.875 C 37.46875 -15.695312 41.363281 -9.726562 46.40625 -5.96875 C 51.457031 -2.21875 57.289062 -0.34375 63.90625 -0.34375 C 64.914062 -0.34375 65.894531 -0.425781 66.84375 -0.59375 C 67.800781 -0.757812 68.726562 -0.953125 69.625 -1.171875 C 71.757812 -1.515625 73.160156 -2.414062 73.828125 -3.875 C 74.503906 -5.332031 74.84375 -7.066406 74.84375 -9.078125 L 74.84375 -42.390625 C 74.84375 -46.753906 72.597656 -49.441406 68.109375 -50.453125 L 60.375 -52.46875 L 60.375 -54.15625 L 107.8125 -54.15625 L 107.8125 -52.46875 L 105.453125 -51.796875 C 101.191406 -50.453125 99.0625 -47.648438 99.0625 -43.390625 L 99.0625 -6.890625 C 93.226562 -3.640625 87.3125 -1.175781 81.3125 0.5 C 75.320312 2.1875 68.625 3.03125 61.21875 3.03125 Z M 61.21875 3.03125 "/></g></g></g><g fill="#4d4d4d" fill-opacity="1"><g transform="translate(109.595295, 134.847758)"><g><path d="M 3.359375 0 L 3.359375 -1.6875 L 5.890625 -2.359375 C 8.128906 -3.023438 9.664062 -4.03125 10.5 -5.375 C 11.34375 -6.726562 11.765625 -8.46875 11.765625 -10.59375 L 11.765625 -63.234375 C 11.765625 -65.703125 11.34375 -67.523438 10.5 -68.703125 C 9.664062 -69.878906 8.128906 -70.691406 5.890625 -71.140625 L 3.359375 -71.8125 L 3.359375 -73.5 L 32.296875 -83.25 L 33.96875 -81.578125 L 35.484375 -67.109375 L 35.484375 -65.765625 C 37.054688 -68.898438 39.101562 -71.785156 41.625 -74.421875 C 44.144531 -77.054688 46.945312 -79.210938 50.03125 -80.890625 C 53.113281 -82.578125 56.171875 -83.421875 59.203125 -83.421875 C 63.460938 -83.421875 66.710938 -82.242188 68.953125 -79.890625 C 71.203125 -77.535156 72.328125 -74.5625 72.328125 -70.96875 C 72.328125 -67.15625 71.234375 -64.210938 69.046875 -62.140625 C 66.859375 -60.066406 64.25 -59.03125 61.21875 -59.03125 C 56.507812 -59.03125 52.363281 -61.382812 48.78125 -66.09375 L 48.4375 -66.4375 C 47.3125 -68 46.019531 -68.863281 44.5625 -69.03125 C 43.113281 -69.207031 41.769531 -68.507812 40.53125 -66.9375 C 39.40625 -65.925781 38.476562 -64.71875 37.75 -63.3125 C 37.03125 -61.914062 36.332031 -60.320312 35.65625 -58.53125 L 35.65625 -11.609375 C 35.65625 -7.117188 37.617188 -4.316406 41.546875 -3.203125 L 46.921875 -1.6875 L 46.921875 0 Z M 3.359375 0 "/></g></g></g><g fill="#4d4d4d" fill-opacity="1"><g transform="translate(181.073002, 134.847758)"><g><path d="M 45.921875 2.515625 C 37.398438 2.515625 30 0.75 23.71875 -2.78125 C 17.4375 -6.3125 12.582031 -11.328125 9.15625 -17.828125 C 5.738281 -24.328125 4.03125 -31.953125 4.03125 -40.703125 C 4.03125 -49.441406 5.851562 -57.007812 9.5 -63.40625 C 13.144531 -69.800781 18.132812 -74.734375 24.46875 -78.203125 C 30.800781 -81.679688 37.953125 -83.421875 45.921875 -83.421875 C 53.878906 -83.421875 60.992188 -81.707031 67.265625 -78.28125 C 73.546875 -74.863281 78.507812 -69.957031 82.15625 -63.5625 C 85.800781 -57.175781 87.625 -49.554688 87.625 -40.703125 C 87.625 -31.847656 85.910156 -24.195312 82.484375 -17.75 C 79.066406 -11.300781 74.25 -6.3125 68.03125 -2.78125 C 61.8125 0.75 54.441406 2.515625 45.921875 2.51562Line truncated
|
||||
|
After Width: | Height: | Size: 11 KiB |
@@ -3,6 +3,8 @@ import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [svelte()],
|
||||
// Svelte convention — serve /static/* at the web root (fonts, img, etc.)
|
||||
publicDir: 'static',
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
target: 'es2020',
|
||||
|
||||
Reference in new issue
Block a user