enhance with charts and home layout, and make more mobile friendly

This commit is contained in:
JCEEE
2026-08-31 18:03:44 +01:00
parent 3bf78d777c
commit 11a09d65ff
10 changed files with 724 additions and 156 deletions
@@ -147,4 +147,25 @@
.nav-label {
overflow: hidden;
}
@media (max-width: 1023px) {
.sidebar {
width: 56px;
}
.sidebar-header {
justify-content: center;
padding: 1rem 0;
}
.app-name {
display: none;
}
.nav-item {
justify-content: center;
padding: 0.6rem 0;
margin: 0;
}
.nav-label {
display: none;
}
}
</style>
@@ -49,6 +49,11 @@
transition: left 0.2s;
gap: 0.75rem;
}
@media (max-width: 1023px) {
.topnav {
left: 56px;
}
}
.topnav-left { display: flex; align-items: center; gap: 0.5rem; }
.topnav-announcement { flex: 1; text-align: center; }
.announcement-text { font-size: 0.85rem; color: #6b7280; }
+138 -35
View File
@@ -1,20 +1,40 @@
<script lang="ts">
let { title, subtitle, hero = false, tabs, weeknav, sort }: {
import type { Snippet } from 'svelte';
let {
title,
subtitle,
hero = false,
tabs,
weeknav,
sort,
children
}: {
title: string;
subtitle?: string;
hero?: boolean;
tabs?: { items: { label: string; value: string }[]; active: string; onchange: (v: string) => void };
tabs?: {
items: { label: string; value: string }[];
active: string;
onchange: (v: string) => void;
};
weeknav?: { current: string; onPrev: () => void; onNext: () => void };
sort?: { options: { label: string; value: string }[]; active: string; onchange: (v: string) => void };
sort?: {
options: { label: string; value: string }[];
active: string;
onchange: (v: string) => void;
};
children?: Snippet;
} = $props();
</script>
<div class="view-header" class:hero>
<div class="view-header flex justify-between" class:hero>
<div class="view-title-group">
<h1 class="view-title">{title}</h1>
<h1 class="view-title text-3xl">{title}</h1>
{#if subtitle}<p class="view-subtitle">{subtitle}</p>{/if}
</div>
{@render children?.()}
<div class="view-tools">
{#if tabs}
<div class="tab-bar">
@@ -22,8 +42,8 @@
<button
class="tab-btn"
class:active={tab.value === tabs.active}
onclick={() => tabs.onchange(tab.value)}
>{tab.label}</button>
onclick={() => tabs.onchange(tab.value)}>{tab.label}</button
>
{/each}
</div>
{/if}
@@ -37,7 +57,11 @@
{/if}
{#if sort}
<select class="sort-select" value={sort.active} onchange={(e) => sort.onchange(e.currentTarget.value)}>
<select
class="sort-select"
value={sort.active}
onchange={(e) => sort.onchange(e.currentTarget.value)}
>
{#each sort.options as opt}
<option value={opt.value}>{opt.label}</option>
{/each}
@@ -47,27 +71,80 @@
</div>
<style>
.view-header { margin-bottom: 1.5rem; }
.view-title-group { margin-bottom: 0.5rem; }
.view-title { font-size: 1.4rem; font-weight: 700; color: #111827; margin: 0; }
.view-subtitle { font-size: 0.9rem; color: #6b7280; margin: 0.25rem 0 0 0; }
.view-tools { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.tab-bar { display: flex; gap: 2px; background: #f3f4f6; border-radius: 6px; padding: 2px; }
.view-header {
margin-bottom: 1.5rem;
}
.view-title-group {
margin-bottom: 0.5rem;
}
.view-title {
font-weight: 700;
color: #111827;
margin: 0;
}
.view-subtitle {
font-size: 0.9rem;
color: #6b7280;
margin: 0.25rem 0 0 0;
}
.view-tools {
display: flex;
align-items: center;
gap: 1rem;
flex-wrap: wrap;
}
.tab-bar {
display: flex;
gap: 2px;
background: #f3f4f6;
border-radius: 6px;
padding: 2px;
}
.tab-btn {
padding: 0.35rem 0.85rem; border: none; background: transparent; border-radius: 5px;
font-size: 0.85rem; color: #6b7280; cursor: pointer;
padding: 0.35rem 0.85rem;
border: none;
background: transparent;
border-radius: 5px;
font-size: 0.85rem;
color: #6b7280;
cursor: pointer;
}
.tab-btn.active {
background: #fff;
color: #4338ca;
font-weight: 600;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.week-nav {
display: flex;
align-items: center;
gap: 0.5rem;
}
.tab-btn.active { background: #fff; color: #4338ca; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.week-nav { display: flex; align-items: center; gap: 0.5rem; }
.nav-btn {
padding: 0.2rem 0.5rem; border: 1px solid #d1d5db; background: #fff; border-radius: 4px;
cursor: pointer; font-size: 1rem; line-height: 1;
padding: 0.2rem 0.5rem;
border: 1px solid #d1d5db;
background: #fff;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
line-height: 1;
}
.nav-btn:hover {
background: #f3f4f6;
}
.nav-label {
font-size: 0.85rem;
color: #374151;
font-weight: 500;
min-width: 140px;
text-align: center;
}
.nav-btn:hover { background: #f3f4f6; }
.nav-label { font-size: 0.85rem; color: #374151; font-weight: 500; min-width: 140px; text-align: center; }
.sort-select {
padding: 0.3rem 0.6rem; border: 1px solid #d1d5db; border-radius: 5px;
font-size: 0.85rem; background: #fff;
padding: 0.3rem 0.6rem;
border: 1px solid #d1d5db;
border-radius: 5px;
font-size: 0.85rem;
background: #fff;
}
/* ── Hero lead (child-dashboard style) ── */
@@ -78,15 +155,41 @@
color: #fff;
box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35);
}
.view-header.hero .view-title-group { margin-bottom: 0.25rem; }
.view-header.hero .view-title { color: #fff; }
.view-header.hero .view-subtitle { color: rgba(255, 255, 255, 0.85); }
.view-header.hero .view-tools { margin-top: 0.75rem; }
.view-header.hero .tab-bar { background: rgba(255, 255, 255, 0.16); }
.view-header.hero .tab-btn { color: rgba(255, 255, 255, 0.9); }
.view-header.hero .tab-btn:hover { color: #fff; }
.view-header.hero .tab-btn.active { background: #fff; color: #4338ca; }
.view-header.hero .nav-btn { background: rgba(255, 255, 255, 0.92); border-color: transparent; color: #4338ca; }
.view-header.hero .nav-label { color: #fff; }
.view-header.hero .sort-select { background: rgba(255, 255, 255, 0.92); color: #1e1b4b; }
.view-header.hero .view-title-group {
margin-bottom: 0.25rem;
}
.view-header.hero .view-title {
color: #fff;
}
.view-header.hero .view-subtitle {
color: rgba(255, 255, 255, 0.85);
}
.view-header.hero .view-tools {
margin-top: 0.75rem;
}
.view-header.hero .tab-bar {
background: rgba(255, 255, 255, 0.16);
}
.view-header.hero .tab-btn {
color: rgba(255, 255, 255, 0.9);
}
.view-header.hero .tab-btn:hover {
color: #fff;
}
.view-header.hero .tab-btn.active {
background: #fff;
color: #4338ca;
}
.view-header.hero .nav-btn {
background: rgba(255, 255, 255, 0.92);
border-color: transparent;
color: #4338ca;
}
.view-header.hero .nav-label {
color: #fff;
}
.view-header.hero .sort-select {
background: rgba(255, 255, 255, 0.92);
color: #1e1b4b;
}
</style>