Deployment Script, Postgres migration, UX improvements

This commit is contained in:
2026-05-08 23:07:01 +12:00
parent 9afc3170ff
commit cfc193b713
37 changed files with 4390 additions and 2715 deletions
+25 -222
View File
@@ -1,6 +1,8 @@
<script lang="ts">
import { invalidateAll } from '$app/navigation';
import { api } from '$lib/api';
import AppSecondaryRail from '$lib/components/navigation/AppSecondaryRail.svelte';
import AppSecondaryRailLayout from '$lib/components/navigation/AppSecondaryRailLayout.svelte';
import { clientSession } from '$lib/session';
import { toast } from '$lib/toast';
import { BarChart3, CirclePlus, Wheat } from 'lucide-svelte';
@@ -47,7 +49,10 @@
}
];
const railGroups = [...new Set(railItems.map((item) => item.group))];
const railGroups = [...new Set(railItems.map((item) => item.group))].map((group) => ({
label: group,
items: railItems.filter((item) => item.group === group)
}));
let activeView = $state<RawMaterialsView>('overview');
const pageSize = 20;
let overviewMixesPage = $state(1);
@@ -229,38 +234,18 @@
<p class="feedback error">{errorMessage}</p>
{/if}
<div class="workspace-layout">
<nav class="workspace-nav" aria-label="Raw materials navigation">
<p class="nav-section-label">Raw Materials</p>
<div class="nav-identity">
<div class="nav-avatar" aria-hidden="true">
<Wheat size={16} strokeWidth={1.75} />
</div>
<div class="nav-identity-text">
<p class="identity-name">{activeMaterials.length} active inputs</p>
<p class="identity-role">{data.rawMaterials.length} tracked materials</p>
</div>
</div>
{#each railGroups as group}
<div class="nav-group">
<p class="nav-group-label">{group}</p>
{#each railItems.filter((item) => item.group === group) as item}
{@const Icon = item.icon}
<button
type="button"
class="nav-item"
class:active={activeView === item.id}
onclick={() => (activeView = item.id)}
>
<span class="nav-icon"><Icon size={18} strokeWidth={1.75} /></span>
<span>{item.label}</span>
</button>
{/each}
</div>
{/each}
</nav>
<AppSecondaryRailLayout>
{#snippet rail()}
<AppSecondaryRail
sectionLabel="Raw Materials"
identityTitle={`${activeMaterials.length} active inputs`}
identitySubtitle={`${data.rawMaterials.length} tracked materials`}
identityIcon={Wheat}
groups={railGroups}
activeId={activeView}
onSelect={(id) => (activeView = id as RawMaterialsView)}
/>
{/snippet}
<div class="workspace-panel">
{#if activeRailItem}
@@ -620,7 +605,7 @@
{/if}
</div>
</div>
</div>
</AppSecondaryRailLayout>
{/if}
<style>
@@ -651,7 +636,7 @@
.locked-card,
.feedback,
.workspace-layout {
:global(.secondary-rail-layout) {
margin-bottom: 1.25rem;
}
@@ -688,82 +673,6 @@
font-weight: 600;
}
.workspace-layout {
display: grid;
grid-template-columns: 15rem minmax(0, 1fr);
align-items: stretch;
min-height: calc(100vh - 8.5rem);
max-height: calc(100vh - 8.5rem);
background: var(--panel);
border: 1px solid var(--line);
border-radius: 1.15rem;
box-shadow: var(--shadow);
overflow: hidden;
}
.workspace-nav {
position: sticky;
top: 0;
display: flex;
flex-direction: column;
gap: 0.4rem;
height: 100%;
min-height: calc(100vh - 8.5rem);
padding: 1.1rem 0.85rem 0.85rem;
background: var(--panel);
border-right: 1px solid var(--line);
overflow-y: auto;
}
.nav-section-label {
margin: 0 0.55rem 0.3rem;
color: var(--muted);
font-size: 0.7rem;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.nav-identity {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0 0.25rem 0.9rem;
border-bottom: 1px solid var(--line);
}
.nav-avatar {
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 2.5rem;
height: 2.5rem;
border-radius: 50%;
background: var(--green-deep);
color: #fff;
}
.nav-identity-text {
min-width: 0;
}
.identity-name {
margin: 0;
font-size: 0.85rem;
font-weight: 700;
color: var(--text);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.identity-role {
margin: 0;
font-size: 0.74rem;
color: var(--muted);
}
.feedback {
padding: 0.95rem 1rem;
font-weight: 600;
@@ -784,96 +693,22 @@
.metric-row,
.top-grid,
.material-grid,
.impact-grid,
.nav-group {
.impact-grid {
display: grid;
gap: 1rem;
}
.nav-group {
gap: 0.12rem;
padding-top: 0.15rem;
}
.nav-group-label {
margin: 0.15rem 0.55rem 0.3rem;
color: var(--muted);
font-size: 0.7rem;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
}
.nav-item {
position: relative;
display: flex;
align-items: center;
gap: 0.7rem;
width: 100%;
padding: 0.6rem 0.6rem;
border: none;
border-radius: 0.7rem;
background: transparent;
color: #3a4a41;
font-size: 0.93rem;
text-align: left;
cursor: pointer;
transition: background-color 140ms ease, color 140ms ease;
}
.nav-icon {
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 1.6rem;
height: 1.6rem;
color: #6d7d74;
border-radius: 0.55rem;
transition: color 140ms ease;
}
.nav-item:hover {
background: var(--panel-soft);
color: #304038;
}
.nav-item.active {
background: var(--color-brand);
color: #fff;
font-weight: 600;
}
.nav-item:hover .nav-icon {
color: #304038;
}
.nav-item.active .nav-icon {
color: #fff;
}
.nav-item.active::before {
content: '';
position: absolute;
left: -0.85rem;
top: 0.45rem;
bottom: 0.45rem;
width: 3px;
border-radius: 999px;
background: var(--color-brand);
}
.workspace-panel {
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
background: var(--panel);
height: 100%;
overflow: hidden;
}
.panel-header {
position: sticky;
top: 0;
z-index: 2;
display: flex;
align-items: flex-start;
gap: 1rem;
@@ -913,10 +748,7 @@
}
.panel-body {
flex: 1;
min-height: 0;
padding: 1.5rem;
overflow-y: auto;
}
.metric-row {
@@ -1194,7 +1026,7 @@
}
@media (max-width: 1180px) {
.workspace-layout,
:global(.secondary-rail-layout),
.metric-row,
.top-grid,
.material-grid,
@@ -1202,19 +1034,6 @@
.stats-grid {
grid-template-columns: 1fr;
}
.workspace-nav {
position: static;
min-height: auto;
height: auto;
overflow: visible;
border-right: none;
border-bottom: 1px solid var(--line);
}
.workspace-layout {
min-height: auto;
max-height: none;
}
}
@media (max-width: 820px) {
@@ -1239,21 +1058,5 @@
align-items: flex-start;
}
.nav-group {
display: flex;
flex-wrap: wrap;
gap: 0.3rem;
padding-top: 0;
}
.nav-group-label {
width: 100%;
margin-left: 0;
margin-right: 0;
}
.nav-item {
width: auto;
}
}
</style>