Add router for navigation state management and enhance lighting effects in CultivarTwin
Introduce centralized router module to manage navigation state between overview, bag detail, reference, and onboarding pages. Replace local state variables in App.svelte with router-driven navigation. Update Onboarding completion to navigate to overview page. Enhance CultivarTwin lighting with work light spotlight for colonization chamber and headlight-style grow light with lens flare, beam, and halo effects for
No files matched your search
@@ -1,24 +1,28 @@
|
||||
<script lang="ts">
|
||||
import { cultivar } from './lib/store.svelte';
|
||||
import { router } from './lib/router.svelte';
|
||||
import Overview from './routes/Overview.svelte';
|
||||
import BagDetail from './routes/BagDetail.svelte';
|
||||
import Onboarding from './routes/Onboarding.svelte';
|
||||
import Reference from './routes/Reference.svelte';
|
||||
import './app.css';
|
||||
|
||||
let selectedBagId = $state<string | null>(null);
|
||||
let showDetail = $state(false);
|
||||
let showReference = $state(false);
|
||||
|
||||
function handleBagSelect(bagId: string) {
|
||||
selectedBagId = bagId;
|
||||
cultivar.selectBag(bagId);
|
||||
showDetail = true;
|
||||
router.navigate({ page: 'bag', bagId });
|
||||
}
|
||||
|
||||
function handleBack() {
|
||||
showDetail = false;
|
||||
cultivar.selectBag(null);
|
||||
router.navigate({ page: 'overview' });
|
||||
}
|
||||
|
||||
function handleOpenReference() {
|
||||
router.navigate({ page: 'reference' });
|
||||
}
|
||||
|
||||
function handleCloseReference() {
|
||||
router.navigate({ page: 'overview' });
|
||||
}
|
||||
|
||||
// Start mock WebSocket on mount
|
||||
@@ -27,25 +31,30 @@
|
||||
return () => cultivar.stopMockWs();
|
||||
});
|
||||
|
||||
const showOnboarding = $derived(!cultivar.state.ui.onboarding_complete);
|
||||
const showOnboarding = $derived(!cultivar.state.ui.onboarding_complete || router.current.page === 'onboarding');
|
||||
const showDetail = $derived(router.current.page === 'bag');
|
||||
const showReference = $derived(router.current.page === 'reference');
|
||||
const selectedBagId = $derived(showDetail ? (router.current as Extract<typeof router.current, { page: 'bag' }>).bagId : null);
|
||||
</script>
|
||||
|
||||
<div id="app-root">
|
||||
{#if router.current.page === 'overview' || showDetail || showReference}
|
||||
<Overview
|
||||
onBagSelect={handleBagSelect}
|
||||
onOpenReference={() => (showReference = true)}
|
||||
onOpenReference={handleOpenReference}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
{#if showDetail && selectedBagId}
|
||||
<BagDetail bagId={selectedBagId} onBack={handleBack} />
|
||||
{/if}
|
||||
|
||||
{#if showReference}
|
||||
<Reference onBack={() => (showReference = false)} />
|
||||
<Reference onBack={handleCloseReference} />
|
||||
{/if}
|
||||
|
||||
{#if showOnboarding}
|
||||
<Onboarding onComplete={() => {}} />
|
||||
<Onboarding onComplete={() => router.navigate({ page: 'overview' })} />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -374,8 +374,8 @@ const fullMockState: CultivarState = {
|
||||
],
|
||||
humidifier: { active: true, mode: 'auto', reservoir_pct: 72 },
|
||||
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-col-work', chamber_id: 'main', purpose: 'work', on: true, color_hex: '#f4ecd8', brightness: 0 },
|
||||
{ id: 'light-col-photo', chamber_id: 'main', purpose: 'photo', on: true, color_hex: '#f4ecd8', brightness: 0 },
|
||||
{ id: 'light-fruit-grow', chamber_id: 'second', purpose: 'grow', on: true, color_hex: '#f7f0dc', brightness: 0.55 },
|
||||
],
|
||||
doors: [
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
export type Route =
|
||||
| { page: 'overview' }
|
||||
| { page: 'reference' }
|
||||
| { page: 'bag'; bagId: string }
|
||||
| { page: 'onboarding' };
|
||||
|
||||
function parseHash(hash: string): Route {
|
||||
const clean = hash.replace(/^#\/?/, '');
|
||||
if (!clean || clean === '') return { page: 'overview' };
|
||||
|
||||
const [page, ...rest] = clean.split('/');
|
||||
|
||||
switch (page) {
|
||||
case 'reference':
|
||||
return { page: 'reference' };
|
||||
case 'bag':
|
||||
return rest[0] ? { page: 'bag', bagId: rest[0] } : { page: 'overview' };
|
||||
case 'onboarding':
|
||||
return { page: 'onboarding' };
|
||||
default:
|
||||
return { page: 'overview' };
|
||||
}
|
||||
}
|
||||
|
||||
function routeToHash(route: Route): string {
|
||||
switch (route.page) {
|
||||
case 'overview':
|
||||
return '';
|
||||
case 'reference':
|
||||
return '#reference';
|
||||
case 'bag':
|
||||
return `#bag/${route.bagId}`;
|
||||
case 'onboarding':
|
||||
return '#onboarding';
|
||||
}
|
||||
}
|
||||
|
||||
function createRouter() {
|
||||
let route = $state<Route>(parseHash(window.location.hash));
|
||||
|
||||
// Sync from URL to state
|
||||
const handleHashChange = () => {
|
||||
route = parseHash(window.location.hash);
|
||||
};
|
||||
|
||||
// Sync from state to URL
|
||||
const navigate = (newRoute: Route) => {
|
||||
const newHash = routeToHash(newRoute);
|
||||
const currentHash = window.location.hash;
|
||||
|
||||
if (newHash !== currentHash) {
|
||||
window.history.pushState(null, '', newHash || window.location.pathname);
|
||||
}
|
||||
route = newRoute;
|
||||
};
|
||||
|
||||
// Initialize and listen
|
||||
if (typeof window !== 'undefined') {
|
||||
window.addEventListener('hashchange', handleHashChange);
|
||||
window.addEventListener('popstate', handleHashChange);
|
||||
|
||||
// Ensure initial URL is clean if empty
|
||||
if (!window.location.hash && route.page !== 'overview') {
|
||||
navigate(route);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
get current() { return route; },
|
||||
navigate,
|
||||
back: () => window.history.back(),
|
||||
};
|
||||
}
|
||||
|
||||
export const router = createRouter();
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { fade } from 'svelte/transition';
|
||||
import { cultivar } from '../store.svelte';
|
||||
import type { Chamber, BagState } from '../types';
|
||||
import FruitCluster from './FruitCluster.svelte';
|
||||
@@ -9,9 +10,11 @@
|
||||
onBagClick?: (bagId: string, el: HTMLElement) => void;
|
||||
/** Fires when a user activates an empty slot's "Scan bag" CTA. */
|
||||
onAddBag?: (chamberType: 'colonization' | 'fruiting', slotId: string) => void;
|
||||
/** Controls visibility of the wall gallery. */
|
||||
showGallery?: boolean;
|
||||
}
|
||||
|
||||
const { onBagClick, onAddBag }: Props = $props();
|
||||
const { onBagClick, onAddBag, showGallery = true }: Props = $props();
|
||||
|
||||
function handleSlotAdd(chamberType: 'colonization' | 'fruiting', slotId: string, e: Event) {
|
||||
e.stopPropagation();
|
||||
@@ -99,8 +102,22 @@
|
||||
title: { text: s.strain, y: 28.8, size: 4.2 },
|
||||
subtitle: { text: placard(s), y: 32.8, size: 2.9 },
|
||||
}),
|
||||
// (frame 3 is hand-authored — the "Welcome home" tapestry — see template)
|
||||
null,
|
||||
// 3 · "Welcome home" tapestry — unique cream frame with Live Laugh Lignify
|
||||
() => ({
|
||||
tx: 492, ty: 252, rotate: 3.4,
|
||||
frame: { x: -22, y: -30, w: 44, h: 50, fill: '#cbb592', stroke: '#85714b' },
|
||||
mat: { fill: '#fff8e7' },
|
||||
image: { href: '/img/illustration_mycelium.webp', x: -19, y: -27, w: 38, h: 44, opacity: 0.85 },
|
||||
lines: [
|
||||
{ text: 'Live', y: -14, size: 6.5, fill: '#fff' },
|
||||
{ text: 'Laugh', y: -6, size: 6.5, fill: '#fff' },
|
||||
{ text: 'Lignify', y: 3, size: 6.5, fill: '#fff' },
|
||||
],
|
||||
divider: { y: 12, width: 14, stroke: '#b09870', strokeWidth: 0.4, opacity: 0.7 },
|
||||
placard: { x: -19, y: 22, w: 40, h: 12, fill: '#ece2c3', stroke: '#a89466' },
|
||||
title: { text: 'Welcome home', y: 27.5, size: 4.5 },
|
||||
subtitle: { text: 'hand-stitched, probably', y: 32, size: 3.4 },
|
||||
}),
|
||||
// 4 · left wall, upper — mid-brown
|
||||
(s) => ({
|
||||
tx: -8, ty: 68, rotate: 0,
|
||||
@@ -139,7 +156,10 @@
|
||||
const galleryFrames = $derived(
|
||||
frameFactories.map((make, i) => {
|
||||
const entry = gallerySpecies[i];
|
||||
return make && entry ? make(entry) : null;
|
||||
// Some factories (like the tapestry) don't need an entry — they take 0 args
|
||||
if (!make) return null;
|
||||
if (make.length === 0) return (make as () => FrameSpec)();
|
||||
return entry ? make(entry) : null;
|
||||
})
|
||||
);
|
||||
|
||||
@@ -293,20 +313,16 @@
|
||||
<div class="lc-kicker">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'} colonizing</span>
|
||||
<span class="lc-desc">{occupiedCol === 1 ? 'bag' : 'bags'}</span>
|
||||
</div>
|
||||
<div class="lc-poem font-serif italic">An underground forest floor.</div>
|
||||
</div>
|
||||
|
||||
<div class="label-card right">
|
||||
<div class="lc-kicker">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>
|
||||
<span class="lc-desc">{occupiedFruit === 1 ? 'bag' : 'bags'}</span>
|
||||
</div>
|
||||
<div class="lc-poem font-serif italic">A shaded grove after rain.</div>
|
||||
</div>
|
||||
</div>
|
||||
<svg
|
||||
@@ -329,10 +345,10 @@
|
||||
<stop offset="100%" stop-color="#fff" stop-opacity="0"/>
|
||||
</linearGradient>
|
||||
|
||||
<linearGradient id="body-grad" x1="0" y1="0" x2="1" y2="0.3">
|
||||
<linearGradient id="body-grad" x1="0" y1="0" x2="1" y2="0.2">
|
||||
<stop offset="0%" stop-color="#cac9d1"/>
|
||||
<stop offset="45%" stop-color="#efefef"/>
|
||||
<stop offset="65%" stop-color="#fff"/>
|
||||
<stop offset="100%" stop-color="#f0f4f7"/>
|
||||
</linearGradient>
|
||||
|
||||
<linearGradient id="col-inner" x1="0.5" y1="0" x2="0.5" y2="1">
|
||||
@@ -344,9 +360,11 @@
|
||||
<image href="/img/illustration_mycelium.webp" x="-10" y="45" width="250" height="500" opacity="0.25"/>
|
||||
</pattern>
|
||||
|
||||
<!-- Fruiting chamber base - slightly warm for light contrast -->
|
||||
<linearGradient id="fruit-inner" x1="0.5" y1="0" x2="0.5" y2="1">
|
||||
<stop offset="0%" stop-color="#fff"/>
|
||||
<stop offset="100%" stop-color="#fff"/>
|
||||
<stop offset="0%" stop-color="#eee"/>
|
||||
<stop offset="20%" stop-color="#fafafa"/>
|
||||
<stop offset="100%" stop-color="#efefef"/>
|
||||
</linearGradient>
|
||||
|
||||
<radialGradient id="col-led" cx="50%" cy="0%" r="120%" fy="0%">
|
||||
@@ -355,6 +373,15 @@
|
||||
<stop offset="100%" stop-color={colLedColor} stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
|
||||
<!-- Work light spotlight - bright white for photo capture -->
|
||||
<radialGradient id="work-spot" cx="50%" cy="0%" r="45%" fx="50%" fy="0%">
|
||||
<stop offset="0%" stop-color="#ffffff" stop-opacity="0.95"/>
|
||||
<stop offset="10%" stop-color="#fffefb" stop-opacity="0.85"/>
|
||||
<stop offset="30%" stop-color="#f5f3ed" stop-opacity="0.55"/>
|
||||
<stop offset="60%" stop-color="#e8e6e0" stop-opacity="0.2"/>
|
||||
<stop offset="100%" stop-color="#e8e6e0" 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}/>
|
||||
@@ -430,17 +457,35 @@
|
||||
<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%">
|
||||
<stop offset="0%" stop-color="#e8f4fc" stop-opacity="1"/>
|
||||
<stop offset="30%" stop-color="#d4e9f7" stop-opacity="0.5"/>
|
||||
<stop offset="100%" stop-color="#d4e9f7" stop-opacity="0"/>
|
||||
<!-- Headlight main beam - intense with long throw -->
|
||||
<radialGradient id="grow-bloom" cx="50%" cy="0%" r="65%" fx="50%" fy="0%">
|
||||
<stop offset="0%" stop-color="#ffffff" stop-opacity="1"/>
|
||||
<stop offset="5%" stop-color="#f8faff" stop-opacity="0.98"/>
|
||||
<stop offset="15%" stop-color="#e0ecff" stop-opacity="0.9"/>
|
||||
<stop offset="35%" stop-color="#c4d8f5" stop-opacity="0.6"/>
|
||||
<stop offset="60%" stop-color="#a8c4eb" stop-opacity="0.3"/>
|
||||
<stop offset="85%" stop-color="#d0d8e0" stop-opacity="0.08"/>
|
||||
<stop offset="100%" stop-color="#e8e4dc" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
<!-- Intense lens flare core -->
|
||||
<radialGradient id="headlight-flare" cx="50%" cy="0%" r="15%">
|
||||
<stop offset="10%" stop-color="#ffffff" stop-opacity="0.95"/>
|
||||
<stop offset="30%" stop-color="#e8f4ff" stop-opacity="0.7"/>
|
||||
<stop offset="70%" stop-color="#c8e0ff" stop-opacity="0.2"/>
|
||||
<stop offset="100%" stop-color="#ffffff" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
<!-- Beam halo glow -->
|
||||
<radialGradient id="beam-halo" cx="50%" cy="10%" r="80%">
|
||||
<stop offset="0%" stop-color="#e0ecff" stop-opacity="0"/>
|
||||
<stop offset="20%" stop-color="#e0ecff" stop-opacity="0.4"/>
|
||||
<stop offset="40%" stop-color="#c8d8f0" stop-opacity="0.15"/>
|
||||
<stop offset="100%" stop-color="#f0ece4" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
|
||||
<!-- Ultrasonic mist bloom -->
|
||||
<radialGradient id="mist-bloom" cx="50%" cy="50%" r="60%">
|
||||
<stop offset="0%" stop-color="#8edffa" stop-opacity="0.95"/>
|
||||
<stop offset="60%" stop-color="#8edffa" stop-opacity="0.12"/>
|
||||
<stop offset="60%" stop-color="#8edffa" stop-opacity="0.2"/>
|
||||
<stop offset="100%" stop-color="#8edffa" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
|
||||
@@ -450,12 +495,23 @@
|
||||
<feGaussianBlur in="SourceGraphic" stdDeviation="1.5"/>
|
||||
</filter>
|
||||
|
||||
<!-- Ground shadow gradients -->
|
||||
<radialGradient id="shadow-falloff" cx="50%" cy="50%" r="50%">
|
||||
<stop offset="0%" stop-color="#000" stop-opacity="0.35"/>
|
||||
<stop offset="60%" stop-color="#000" stop-opacity="0.12"/>
|
||||
<stop offset="100%" stop-color="#000" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="shadow-core" cx="50%" cy="50%" r="50%">
|
||||
<stop offset="0%" stop-color="#000" stop-opacity="0.25"/>
|
||||
<stop offset="100%" stop-color="#000" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
|
||||
<!-- 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="70%" r="70%">
|
||||
<stop offset="0%" stop-color="#8edffa" stop-opacity="0.6"/>
|
||||
<stop offset="40%" stop-color="#8edffa" stop-opacity="0.4"/>
|
||||
<stop offset="100%" stop-color="#8edffa" stop-opacity="0"/>
|
||||
<stop offset="0%" stop-color="#e6eefa" stop-opacity="1"/>
|
||||
<stop offset="40%" stop-color="#cddefa" stop-opacity="0.8"/>
|
||||
<stop offset="100%" stop-color="#cddefa" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
|
||||
<!-- Clip the mist so it never spills outside the fruiting interior -->
|
||||
@@ -486,7 +542,8 @@
|
||||
Sits behind the appliance so the frames feel hung on the
|
||||
room's back wall. All decorative, aria-hidden.
|
||||
Displays up to 3 unique species currently growing. -->
|
||||
<g class="wall-gallery" aria-hidden="true" pointer-events="none">
|
||||
{#if showGallery}
|
||||
<g class="wall-gallery" aria-hidden="true" pointer-events="none" transition:fade={{ duration: 200 }}>
|
||||
|
||||
<!-- Species-portrait frames (geometry in frameFactories above) -->
|
||||
{#each galleryFrames as frame, i (i)}
|
||||
@@ -495,38 +552,15 @@
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
<!-- Frame 3 · "Welcome home" tapestry — unique layout, stays inline -->
|
||||
<g transform="translate(492, 252) rotate(3.4)">
|
||||
<rect x="-22" y="-30" width="44" height="50" rx="0.8"
|
||||
fill="#000" opacity="0.22" transform="translate(1.8, 2.4)"/>
|
||||
<rect x="-22" y="-30" width="44" height="50" rx="1"
|
||||
fill="#cbb592" stroke="#85714b" stroke-width="0.4"/>
|
||||
<rect x="-19" y="-27" width="38" height="44" fill="#fff8e7"/>
|
||||
<image href="/img/illustration_mycelium.webp"
|
||||
x="-19" y="-27" width="38" height="44"
|
||||
preserveAspectRatio="xMidYMid slice" opacity="0.85"/>
|
||||
<text x="0" y="-14" text-anchor="middle" fill="#fff"
|
||||
style="font-size: 6.5px; font-family: 'DM Serif Display', Georgia, serif;">Live</text>
|
||||
<text x="0" y="-6" text-anchor="middle" fill="#fff"
|
||||
style="font-size: 6.5px; font-family: 'DM Serif Display', Georgia, serif;">Laugh</text>
|
||||
<text x="0" y="3" text-anchor="middle" fill="#fff"
|
||||
style="font-size: 6.5px; font-family: 'DM Serif Display', Georgia, serif;">Lignify</text>
|
||||
<line x1="-7" y1="12" x2="7" y2="12" stroke="#b09870" stroke-width="0.4" opacity="0.7"/>
|
||||
<rect x="-19" y="22" width="40" height="12" rx="0.6"
|
||||
fill="#ece2c3" stroke="#a89466" stroke-width="0.25"/>
|
||||
<text x="1" y="27.5" text-anchor="middle" fill="#2f2615"
|
||||
style="font-size: 4.5px; font-family: 'DM Serif Display', Georgia, serif;">Welcome home</text>
|
||||
<text x="1" y="32" text-anchor="middle" fill="#8a7650"
|
||||
style="font-size: 3.4px; font-style: italic; font-family: 'DM Sans', sans-serif;">hand-stitched, probably</text>
|
||||
</g>
|
||||
</g>
|
||||
{/if}
|
||||
|
||||
<!-- Floor reflection band beneath the appliance -->
|
||||
<rect x="20" y="398" width="440" height="30" rx="2" fill="url(#floor-reflection)" opacity="0.6"/>
|
||||
|
||||
<!-- Ground shadow -->
|
||||
<ellipse cx="240" cy="403" rx="240" ry="10" fill="#a89d80" opacity="0.3"/>
|
||||
<ellipse cx="240" cy="403" rx="200" ry="5" fill="#8a7f64" opacity="0.22"/>
|
||||
<!-- Ground shadow with radial falloff -->
|
||||
<ellipse cx="200" cy="403" rx="500" ry="30" fill="url(#shadow-falloff)"/>
|
||||
<ellipse cx="200" cy="403" rx="300" ry="12" fill="url(#shadow-core)"/>
|
||||
|
||||
<!-- Appliance body -->
|
||||
<g filter="url(#cab-shadow)">
|
||||
@@ -561,12 +595,14 @@
|
||||
width={LEFT.w} height={LEFT.h} rx="4"
|
||||
fill="url(#col-pattern)" pointer-events="none"/>
|
||||
|
||||
<!-- 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"/>
|
||||
<!-- Work light bloom when on -->
|
||||
{#if colWorkLight?.on}
|
||||
<ellipse cx={LEFT.x + LEFT.w / 2} cy={LEFT.y + 39} rx={LEFT.w / 2 - 20} ry="40"
|
||||
fill="url(#work-spot)" pointer-events="none" />
|
||||
<!-- Hot core -->
|
||||
<ellipse cx={LEFT.x + LEFT.w / 2} cy={LEFT.y + 0} rx="20" ry="1"
|
||||
fill="#ffffff" opacity="0.85" pointer-events="none" />
|
||||
{/if}
|
||||
|
||||
<rect x={LEFT.x} y={LEFT.y} width={LEFT.w} height={LEFT.h} rx="4"
|
||||
fill="url(#col-led)" pointer-events="none"/>
|
||||
@@ -705,22 +741,21 @@
|
||||
width={RIGHT.w} height={RIGHT.h} rx="4"
|
||||
fill="url(#fruit-pattern)" pointer-events="none"/>
|
||||
|
||||
<!-- 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 ? '#5bd4fc' : '#cfd9c0'}
|
||||
stroke-width={fruitGrowLight?.on ? 1.2 : 0.9}
|
||||
stroke-opacity={fruitGrowLight?.on ? 1 : 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 -->
|
||||
<!-- Headlight bloom 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={100}
|
||||
<!-- Outer halo -->
|
||||
<ellipse cx={RIGHT.x + RIGHT.w / 2} cy={RIGHT.y + 95} rx={RIGHT.w / 2 + 10} ry="95"
|
||||
fill="url(#beam-halo)" pointer-events="none" />
|
||||
<!-- Main beam -->
|
||||
<ellipse cx={RIGHT.x + RIGHT.w / 2} cy={RIGHT.y + 65} rx={RIGHT.w / 2 - 4} ry="65"
|
||||
fill="url(#grow-bloom)" pointer-events="none" />
|
||||
<!-- Lens flare core -->
|
||||
<ellipse cx={RIGHT.x + RIGHT.w / 2} cy={RIGHT.y + 20} rx="50" ry="18"
|
||||
fill="url(#headlight-flare)" pointer-events="none" />
|
||||
{/if}
|
||||
|
||||
|
||||
{#each SHELF_YS_RIGHT 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"/>
|
||||
@@ -1007,25 +1042,26 @@
|
||||
min-width: 0;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
/* Skip painting the whole twin while it's scrolled offscreen */
|
||||
content-visibility: auto;
|
||||
contain-intrinsic-size: 680px 500px;
|
||||
}
|
||||
|
||||
.twin-wrap::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 1;
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
var(--paper-1) 0%,
|
||||
var(--paper) 0%,
|
||||
var(--paper-2) 40%,
|
||||
var(--paper-3) 78%,
|
||||
var(--paper) 78%,
|
||||
var(--paper-3) 82%,
|
||||
var(--paper) 82%,
|
||||
var(--ink-muted) 82%,
|
||||
var(--ink-muted) 94%
|
||||
var(--paper-3) 85%,
|
||||
#555 85%,
|
||||
#888 95%,
|
||||
var(--paper-1) 100%
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1255,14 +1291,6 @@
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.lc-poem {
|
||||
font-size: 11.5px;
|
||||
color: var(--ink-muted);
|
||||
opacity: 0.45;
|
||||
letter-spacing: 0.005em;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.lc-count {
|
||||
font-family: var(--font-serif);
|
||||
font-size: 15px;
|
||||
@@ -1273,9 +1301,9 @@
|
||||
}
|
||||
.lc-total {
|
||||
font-family: var(--font-serif);
|
||||
color: var(--ink);
|
||||
color: var(--ink-muted);
|
||||
opacity: 1;
|
||||
font-size: 15px;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
.lc-sep { opacity: 0.3; color: var(--ink); }
|
||||
.lc-desc {
|
||||
|
||||
@@ -16,7 +16,11 @@
|
||||
/** Mat inset inside the frame (usually 3 on all sides) */
|
||||
mat: { fill: string; inset?: number };
|
||||
/** Painting image */
|
||||
image: { href: string; x: number; y: number; w: number; h: number };
|
||||
image: { href: string; x: number; y: number; w: number; h: number; opacity?: number };
|
||||
/** Optional tapestry text lines overlaid on the image (e.g. "Live Laugh Lignify") */
|
||||
lines?: { text: string; y: number; size: number; fill?: string }[];
|
||||
/** Optional divider line below the tapestry lines */
|
||||
divider?: { y: number; width: number; stroke?: string; strokeWidth?: number; opacity?: number };
|
||||
/** Placard that hangs below the frame */
|
||||
placard: { x: number; y: number; w: number; h: number; fill?: string; stroke?: string };
|
||||
/** Title + subtitle text baselines (y relative to group origin) */
|
||||
@@ -64,10 +68,26 @@
|
||||
<!-- Image -->
|
||||
<image href={spec.image.href}
|
||||
x={spec.image.x} y={spec.image.y} width={spec.image.w} height={spec.image.h}
|
||||
preserveAspectRatio="xMidYMid slice"/>
|
||||
preserveAspectRatio="xMidYMid slice" opacity={spec.image.opacity ?? 1}/>
|
||||
<rect x={spec.image.x} y={spec.image.y} width={spec.image.w} height={spec.image.h}
|
||||
fill="none" stroke={frameStroke} stroke-width="0.3" opacity="0.3"/>
|
||||
|
||||
<!-- Optional tapestry text lines -->
|
||||
{#if spec.lines}
|
||||
{#each spec.lines as line}
|
||||
<text x="0" y={line.y} text-anchor="middle" fill={line.fill ?? '#fff'}
|
||||
style="font-size: {line.size}px; font-family: 'DM Serif Display', Georgia, serif;"
|
||||
>{line.text}</text>
|
||||
{/each}
|
||||
{/if}
|
||||
|
||||
<!-- Optional divider line -->
|
||||
{#if spec.divider}
|
||||
<line x1={-spec.divider.width/2} y1={spec.divider.y} x2={spec.divider.width/2} y2={spec.divider.y}
|
||||
stroke={spec.divider.stroke ?? '#b09870'} stroke-width={spec.divider.strokeWidth ?? 0.4}
|
||||
opacity={spec.divider.opacity ?? 0.7}/>
|
||||
{/if}
|
||||
|
||||
<!-- Placard -->
|
||||
<rect x={spec.placard.x} y={spec.placard.y} width={spec.placard.w} height={spec.placard.h}
|
||||
rx="0.5" fill={placardFill} stroke={placardStroke} stroke-width="0.2"/>
|
||||
|
||||
@@ -169,8 +169,8 @@
|
||||
<!-- Header -->
|
||||
<header class="panel-head">
|
||||
<div class="head-left">
|
||||
<div class="eyebrow">Climate</div>
|
||||
<h2 class="panel-title font-serif">Environmental Sensors</h2>
|
||||
<div class="eyebrow">Sensors</div>
|
||||
<h2 class="panel-title font-serif">Environment</h2>
|
||||
</div>
|
||||
|
||||
<div class="tabs" role="tablist" aria-label="Time range">
|
||||
@@ -296,7 +296,7 @@
|
||||
border-radius: 999px;
|
||||
}
|
||||
.tab {
|
||||
padding: 4px 12px;
|
||||
padding: 8px 20px;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
|
||||
// ── Popover plumbing ─────────────────────────────────────────────
|
||||
let popoverBagId = $state<string | null>(null);
|
||||
|
||||
// ── Gallery toggle state (passed to CultivarTwin) ────────────────
|
||||
let showGallery = $state(false);
|
||||
let popoverAnchor = $state<{ x: number; y: number } | null>(null);
|
||||
|
||||
function handleBagClick(bagId: string, el: HTMLElement) {
|
||||
@@ -516,13 +519,6 @@
|
||||
</span>
|
||||
</div>
|
||||
</aside>
|
||||
<!-- Decorative illustration for wide screens (fills whitespace) -->
|
||||
<img
|
||||
src="/img/illustration.webp"
|
||||
alt=""
|
||||
class="hero-illustration"
|
||||
loading="lazy"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -533,14 +529,38 @@
|
||||
|
||||
<!-- ═══ SECTION 2 · Cultivar ═══ -->
|
||||
<section class="section section-appliance">
|
||||
<button
|
||||
class="gallery-toggle"
|
||||
onclick={() => showGallery = !showGallery}
|
||||
aria-label={showGallery ? 'Hide gallery' : 'Show gallery'}
|
||||
aria-pressed={showGallery}
|
||||
title={showGallery ? 'Hide gallery' : 'Show gallery'}
|
||||
>
|
||||
<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">
|
||||
{#if showGallery}
|
||||
<!-- Crossed picture icon (gallery off) -->
|
||||
<rect x="1" y="3" width="14" height="10" rx="1" fill="none" stroke="currentColor" stroke-width="1.2"/>
|
||||
<line x1="2" y1="2" x2="14" y2="14" stroke="currentColor" stroke-width="1.2"/>
|
||||
{:else}
|
||||
<!-- Picture icon (gallery on) -->
|
||||
<rect x="1" y="3" width="14" height="10" rx="1" fill="none" stroke="currentColor" stroke-width="1.2"/>
|
||||
<circle cx="5" cy="7" r="1.5" fill="currentColor"/>
|
||||
<path d="M1 11l4-3 3 2 4-4 3 3v3H1z" fill="currentColor"/>
|
||||
{/if}
|
||||
</svg>
|
||||
</button>
|
||||
<header class="sec-head">
|
||||
<div class="head-row">
|
||||
<div>
|
||||
<div class="eyebrow">Your Cultivar</div>
|
||||
<h2 class="sec-title font-serif">Current Status</h2>
|
||||
<p class="sec-sub font-serif italic">Tap any bag to check on it.</p>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="appliance-wrap">
|
||||
<CultivarTwin onBagClick={handleBagClick} onAddBag={handleAddBag} />
|
||||
<CultivarTwin onBagClick={handleBagClick} onAddBag={handleAddBag} {showGallery} />
|
||||
{#if popoverBagId && popoverAnchor}
|
||||
<BagPopover
|
||||
bagId={popoverBagId}
|
||||
@@ -603,6 +623,8 @@
|
||||
opacity: 0.04;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.section-climate { border-top: none;}
|
||||
@media (max-width: 900px) {
|
||||
.section-hero::before {
|
||||
margin-left: -18px;
|
||||
@@ -633,13 +655,43 @@
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.head-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.gallery-toggle {
|
||||
margin-left: auto;
|
||||
top: 0;
|
||||
display: flex;
|
||||
z-index: 1;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--line);
|
||||
background: var(--paper-2);
|
||||
color: var(--ink-muted);
|
||||
cursor: pointer;
|
||||
transition: background 0.15s, border-color 0.15s, color 0.15s;
|
||||
}
|
||||
.gallery-toggle:hover {
|
||||
background: var(--paper-3);
|
||||
border-color: var(--paper-2);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
/* ── Hero grid ────────────────────────────────────────── */
|
||||
.hero {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
|
||||
grid-template-columns: minmax(0, 1fr) minmax(300px, 520px);
|
||||
gap: 20px;
|
||||
align-items: start;
|
||||
max-width: 1000px;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.hero-copy {
|
||||
@@ -649,18 +701,7 @@
|
||||
position: relative; /* for absolute positioning of illustration */
|
||||
}
|
||||
|
||||
.hero-illustration {
|
||||
display: none; /* hidden on smaller screens */
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
left: calc(max(920px, 66vw)); /* to the right of briefing max-width */
|
||||
width: auto;
|
||||
height: 55%;
|
||||
object-fit: contain;
|
||||
opacity: 0.95;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
.hero-head {
|
||||
font-size: clamp(44px, 6.2vw, 68px);
|
||||
@@ -686,7 +727,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
max-width: 54ch;
|
||||
max-width: 65ch;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.brief-par {
|
||||
@@ -737,7 +778,7 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
z-index: 1;
|
||||
z-index: 0;
|
||||
min-width: 0;
|
||||
align-self: stretch;
|
||||
justify-content: space-between;
|
||||
@@ -873,7 +914,7 @@
|
||||
z-index: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: -80px;
|
||||
margin-top: -70px;
|
||||
margin-left: -28px;
|
||||
margin-right: -28px;
|
||||
margin-bottom: -40px;
|
||||
@@ -917,13 +958,6 @@
|
||||
}
|
||||
.foot-mark { font-size: 13px; color: var(--ink-2); }
|
||||
|
||||
/* ── Responsive ── */
|
||||
@media (min-width: 660px) {
|
||||
.hero-illustration {
|
||||
display: block; /* show on very wide screens with whitespace */
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 970px) {
|
||||
.hero {
|
||||
grid-template-columns: 1fr;
|
||||
@@ -932,11 +966,6 @@
|
||||
}
|
||||
.hero-stats { margin-top: 6px; }
|
||||
.rhythm { margin-top: 0; }
|
||||
.hero-illustration {
|
||||
left: calc(54ch + 20px);
|
||||
width: 40vw;
|
||||
top: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 970px) {
|
||||
|
||||
@@ -260,7 +260,11 @@
|
||||
<div class="detail-split">
|
||||
<figure class="detail-figure">
|
||||
<div class="detail-art">
|
||||
{#if s.image}
|
||||
<img src={s.image} alt={s.commonName} class="detail-image" />
|
||||
{:else}
|
||||
<SpecimenJar tone={CATEGORY_TONE[s.category]} name={s.commonName} caption={s.id} uid={`d-${s.id}`} />
|
||||
{/if}
|
||||
</div>
|
||||
<figcaption class="detail-caption">
|
||||
{s.commonName} — {s.scientific}
|
||||
@@ -501,10 +505,9 @@
|
||||
<span class="italic">growing indoors.</span>
|
||||
</h1>
|
||||
<p class="hero-lede">
|
||||
A curated shortlist of species that fruit reliably in Cultivar's
|
||||
bag-based growing system. Gourmet workhorses, functional polypores, and a couple of
|
||||
specimens kept only for their looks — with the climate envelopes
|
||||
and yields you can expect from each.
|
||||
A curated shortlist of species that colonize and fruit reliably in Cultivar. Gourmet workhorses,
|
||||
functional polypores, and a couple of specimens kept only for their looks, with ideal
|
||||
climate envelopes and yields you can expect from each.
|
||||
</p>
|
||||
|
||||
<div class="hero-stats">
|
||||
@@ -599,7 +602,11 @@
|
||||
{#each speciesFiltered as s (s.id)}
|
||||
<button class="card" onclick={() => openSpecies(s.id)} type="button">
|
||||
<div class="card-art">
|
||||
{#if s.image}
|
||||
<img src={s.image} alt={s.commonName} class="card-image" loading="lazy" />
|
||||
{:else}
|
||||
<SpecimenJar tone={CATEGORY_TONE[s.category]} name={s.commonName} caption={s.id} uid={`g-${s.id}`} />
|
||||
{/if}
|
||||
|
||||
<span class="diff-badge" style="--c: {DIFFICULTY_COLOR[s.difficulty]}">
|
||||
{DIFFICULTY_LABEL[s.difficulty]}
|
||||
@@ -1041,6 +1048,14 @@
|
||||
max-width: 75%;
|
||||
filter: drop-shadow(0 3px 8px rgba(40, 30, 10, 0.1));
|
||||
}
|
||||
.card-image {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
object-position: center;
|
||||
}
|
||||
|
||||
.sev-badge, .diff-badge {
|
||||
position: absolute;
|
||||
@@ -1289,6 +1304,13 @@
|
||||
max-width: 80%;
|
||||
filter: drop-shadow(0 6px 22px rgba(40, 30, 10, 0.12));
|
||||
}
|
||||
.detail-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
object-position: center;
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
.detail-caption {
|
||||
font-size: 12px;
|
||||
color: var(--ink-muted);
|
||||
|
||||
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 19 KiB |