Style & brand alignment. Basic version
This commit is contained in:
1 parent
92be365e0c
commit
d074322826
38 files changed
+4442
-3079
No files matched your search
@@ -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>
|
||||
+160
-154
@@ -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>
|
||||
<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>
|
||||
|
||||
<div class="pop-strain">{bag.tag.strain_name}</div>
|
||||
<div class="pop-sub">{bag.tag.substrate}</div>
|
||||
|
||||
<div class="pop-stats">
|
||||
<!-- Stats grid -->
|
||||
<div class="stats">
|
||||
<div class="stat">
|
||||
<div class="stat-label">STAGE</div>
|
||||
<div class="stat-value" style="color: {stageColor[bag.vision.stage]}">
|
||||
{STAGE_LABELS[bag.vision.stage]}
|
||||
</div>
|
||||
<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>
|
||||
<div class="stat">
|
||||
<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>
|
||||
{: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>
|
||||
|
||||
<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,155 +160,153 @@
|
||||
{/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);
|
||||
}
|
||||
|
||||
@keyframes pop-in {
|
||||
from { opacity: 0; transform: translateY(-4px) scale(0.98); }
|
||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
||||
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>
|
||||
Reference in new issue
Block a user