Files
mission-control-v2/frontend/dist/assets/ChronikView-CVJajeyU.js
T
HitonabiandClaude Opus 5 33032f8fb0
Ampel / ampel (push) Failing after 25s
feat(chronik): P6 — Dichteleiste zeigt, WANN die Box aktiv war (§4.5)
Der Zugewinn gegenueber einer reinen Liste: Ein stiller Tag und eine durchgearbeitete
Nacht sehen in einer Liste gleich aus — man muss scrollen, um es zu merken. Die
Dichteleiste macht das Muster sichtbar, bevor man den ersten Eintrag liest.

48 Stufen ueber den gezeigten Zeitraum, Achsenbeschriftung an beiden Enden, und beim
Filtern zeigt sie nur die Treffer (dann in kraeftigerem Ton).

Bewusst eigenes SVG-freies Markup statt einer Diagramm-Bibliothek: Es sind Rechtecke
ueber einer Zeitachse. Recharts dafuer zu laden waere 95 kB fuer etwas, das in 30
Zeilen passt — genau der Reflex, der in P0 das Startbuendel aufgeblaeht hatte.

Eine Kleinigkeit mit Absicht: Ein einzelner Eintrag bekommt 12 % Mindesthoehe. Ohne
sie saehe ein ruhiger Tag aus wie gar keine Aktivitaet — genau die Verwechslung, die
die Leiste verhindern soll. Dafuer gibt es einen eigenen Test.

Verifiziert gegen die echte Box:
  150 Eintraege vom 02.08. bis 28.08., 25 von 48 Stufen belegt, Hoehen gestaffelt
  Filter "update" -> 30 von 150, Leiste zeigt nur noch die Treffer und wird
    hervorgehoben, Adresse /chronik?q=update

59 Tests gruen (5 neue) · ESLint 0 Fehler · Einstieg 133 400 B gzip / Budget 140 000.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-28 10:02:07 +02:00

32 lines
12 KiB
JavaScript

import{c as f,r as p,j as e,b as w,ai as z,z as C,A as D,aj as A,L as y,a1 as E,R as N,a5 as B,ak as L,al as Z,am as q,u as $,k as R,n as j,q as T}from"./index-l6kyKCL9.js";import{S as U}from"./search-C1Zs6OOf.js";/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const V=f("AlarmClock",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M12 9v4l2 2",key:"1c63tq"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const v=f("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const H=f("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const O=f("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const P=f("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
* @license lucide-react v0.460.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const W=f("Radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]),F=3600,k=48;function J({items:t,aktiv:m}){const{balken:d,von:x,bis:g,max:c}=p.useMemo(()=>{if(!t.length)return{balken:[],von:0,bis:0,max:0};const a=t.map(l=>l.ts),h=Math.min(...a),r=Math.max(...a),o=Math.max(r-h,F),n=new Array(k).fill(0);for(const l of a){const b=Math.min(k-1,Math.floor((l-h)/o*k));n[b]++}return{balken:n,von:h,bis:r,max:Math.max(...n,1)}},[t]);if(d.length===0)return null;const u=a=>new Date(a*1e3).toLocaleDateString("de-DE",{day:"2-digit",month:"2-digit",...g-x<2*86400?{hour:"2-digit",minute:"2-digit"}:{}});return e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"flex h-8 items-end gap-px",role:"img","aria-label":`Aktivitätsdichte: ${t.length} Einträge zwischen ${u(x)} und ${u(g)}`,children:d.map((a,h)=>e.jsx("div",{title:a===1?"1 Eintrag":`${a} Einträge`,className:w("min-w-px flex-1 rounded-t-sm transition-colors",a===0?"bg-border/25":m?"bg-primary/70":"bg-primary/40"),style:{height:a===0?"2px":`${Math.max(12,a/c*100)}%`}},h))}),e.jsxs("div",{className:"flex justify-between font-mono text-[9px] text-muted-foreground/60",children:[e.jsx("span",{children:u(x)}),e.jsxs("span",{className:"tabular-nums",children:[t.length," Einträge"]}),e.jsx("span",{children:u(g)})]})]})}const _={sentry:{icon:Z,label:"Health-Wächter",cls:"text-red-300 bg-red-500/10 border-red-500/25"},alarm:{icon:L,label:"Alarm",cls:"text-red-200 bg-red-500/15 border-red-500/40"},notify:{icon:H,label:"Meldung",cls:"text-sky-300 bg-sky-500/10 border-sky-500/25"},"chef-gutachter":{icon:P,label:"Morgenlage",cls:"text-violet-300 bg-violet-500/10 border-violet-500/25"},radar:{icon:W,label:"Radar",cls:"text-teal-300 bg-teal-500/10 border-teal-500/25"},auftragsbuch:{icon:B,label:"Auftragsbuch",cls:"text-primary bg-primary/10 border-primary/25"},zeitmaschine:{icon:N,label:"Zeitmaschine",cls:"text-amber-300 bg-amber-500/10 border-amber-500/25"},reminder:{icon:V,label:"Erinnerung",cls:"text-amber-300 bg-amber-500/10 border-amber-500/25"},traum:{icon:E,label:"Traum",cls:"text-violet-300 bg-violet-500/10 border-violet-500/25"}},G={icon:O,label:"Box",cls:"text-muted-foreground bg-background/40 border-border/50"};function I(t){return new Date(t*1e3).toLocaleDateString("de-DE",{weekday:"long",day:"2-digit",month:"long"})}function Y(){const{data:t=[],isLoading:m}=z(),[d,x]=p.useState(!0),g=C(),{q:c=""}=D({from:"/chronik"}),u=r=>g({to:"/chronik",search:r?{q:r}:{},replace:!0}),a=p.useMemo(()=>{const r=c.trim().toLowerCase();return r?t.filter(o=>o.subject.toLowerCase().includes(r)||o.text.toLowerCase().includes(r)||o.source.toLowerCase().includes(r)):t},[t,c]),h=p.useMemo(()=>{const r=[];for(const o of a){const n=I(o.ts),l=r[r.length-1];l&&l.day===n?l.items.push(o):r.push({day:n,items:[o]})}return r},[a]);return e.jsxs("div",{className:"space-y-7",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Chronik"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Was deine Box von allein getan und gemeldet hat — und die Zeitmaschine, falls du zu einem früheren Stand zurück willst."})]}),e.jsx(K,{}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:[e.jsx(A,{className:"h-3.5 w-3.5"})," Verlauf",c&&e.jsxs("span",{className:"normal-case text-primary",children:["· ",a.length," von ",t.length]})]}),e.jsxs("div",{className:"relative ml-auto w-full sm:w-64",children:[e.jsx(U,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground","aria-hidden":"true"}),e.jsx("input",{type:"search",value:c,onChange:r=>u(r.target.value),placeholder:"Verlauf durchsuchen …","aria-label":"Chronik durchsuchen",className:"h-8 w-full rounded-lg border border-border/60 bg-background/40 pl-8 pr-3 text-xs text-foreground outline-none transition-colors focus:border-primary"})]})]}),!m&&a.length>0&&e.jsx(J,{items:a,aktiv:!!c}),m&&e.jsxs("div",{className:"flex items-center gap-2 rounded-2xl border border-border/60 bg-card/30 p-6 text-xs text-muted-foreground",children:[e.jsx(y,{className:"h-4 w-4 animate-spin"})," Chronik wird geladen …"]}),!m&&a.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 text-center text-xs text-muted-foreground",children:c?e.jsxs(e.Fragment,{children:["Nichts zu „",c,'" im Verlauf. ',e.jsx("button",{onClick:()=>u(""),className:"cursor-pointer text-primary underline underline-offset-2",children:"Filter aufheben"})]}):"Noch keine Einträge. Sobald die Box etwas von allein tut oder meldet (Updates, Wächter, Träume), steht es hier."}),h.map(({day:r,items:o})=>e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-xs font-bold text-foreground/70",children:r}),e.jsxs("div",{className:"space-y-2 border-l-2 border-border/40 pl-4",children:[(d?o.slice(0,8):o).map(n=>{const l=_[n.source]??G,b=l.icon;return e.jsxs("div",{className:"relative rounded-xl border border-border/50 bg-card/40 p-3 backdrop-blur-sm",children:[e.jsx("span",{className:"absolute -left-[23px] top-4 h-2.5 w-2.5 rounded-full bg-border ring-4 ring-background/60"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:w("flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-bold",l.cls),children:[e.jsx(b,{className:"h-3 w-3"})," ",l.label]}),n.subject&&e.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:n.subject}),e.jsx("span",{className:"ml-auto font-mono text-[10px] text-muted-foreground/60",children:new Date(n.ts*1e3).toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})})]}),e.jsx("p",{className:"mt-1.5 whitespace-pre-wrap text-xs leading-relaxed text-foreground/85",children:n.text})]},n.id)}),d&&o.length>8&&e.jsxs("button",{onClick:()=>x(!1),className:"text-[11px] text-muted-foreground underline hover:text-foreground",children:[o.length-8," weitere anzeigen"]})]})]},r))]})]})}function K(){const{data:t}=q(),m=$(),{showAlert:d,showConfirm:x,dialogElement:g}=R(),[c,u]=p.useState(null),[a,h]=p.useState(!1),[r,o]=p.useState(!1),n=(t==null?void 0:t.backups)??[],l=r?n:n.slice(0,4);function b(s){const i=s.snapshot.match(/^(\d{4})-?(\d{2})-?(\d{2})[T_-](\d{2})[-:]?(\d{2})/);return i?`${i[3]}.${i[2]}.${i[1]}, ${i[4]}:${i[5]} Uhr`:s.snapshot}async function M(s){u(s.file);try{await j("/api/zeitmaschine/restore",{method:"POST",body:JSON.stringify({file:s.file})}),d("Zeitmaschine läuft","Die Wiederherstellung wurde gestartet. Die Dienste starten gleich neu — die Zentrale ist kurz weg und meldet sich von selbst zurück. Vorher wurde automatisch ein Sicherheits-Backup des jetzigen Zustands gemacht.")}catch(i){d("Start fehlgeschlagen",String((i==null?void 0:i.message)||i))}finally{u(null)}}async function S(){h(!0);try{const s=await j("/api/system/backup",{method:"POST"});s.ok?d("Gesichert",`Snapshot ${s.snapshot} wurde angelegt.`):d("Backup fehlgeschlagen",s.error||"Unbekannter Fehler"),m.invalidateQueries({queryKey:T.zeitmaschine})}catch(s){d("Backup fehlgeschlagen",String((s==null?void 0:s.message)||s))}finally{h(!1)}}return e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:[e.jsx(v,{className:"h-3.5 w-3.5"})," Zeitmaschine — gesicherte Stände"]}),e.jsxs("button",{onClick:S,disabled:a||!(t!=null&&t.available),className:"flex h-8 items-center gap-1.5 rounded-lg border border-border/60 bg-card/45 px-2.5 text-[11px] font-semibold text-muted-foreground hover:text-foreground hover:border-primary/40 transition-all cursor-pointer disabled:opacity-50",children:[a?e.jsx(y,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(v,{className:"h-3.5 w-3.5"})," Jetzt sichern"]})]}),t&&!t.available&&e.jsx("div",{className:"rounded-2xl border border-amber-500/30 bg-amber-500/5 p-4 text-xs text-amber-300",children:"Die Snapshots liegen auf der Box — im lokalen Dev-Modus nicht verfügbar."}),(t==null?void 0:t.available)&&n.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-5 text-center text-xs text-muted-foreground",children:'Noch keine Snapshots. Das nächtliche Backup (03:30) legt sie automatisch an — oder „Jetzt sichern".'}),l.length>0&&e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:l.map((s,i)=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-xl border border-border/50 bg-card/40 p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-xs font-semibold text-foreground",children:[b(s)," ",i===0&&e.jsx("span",{className:"ml-1 rounded bg-emerald-500/10 px-1.5 py-0.5 text-[9px] font-bold text-emerald-300",children:"neuester"})]}),e.jsxs("p",{className:"font-mono text-[10px] text-muted-foreground/70 truncate",title:s.file,children:[s.size_mb.toLocaleString("de-DE")," MB · ",s.file]})]}),e.jsxs("button",{disabled:c!==null,onClick:()=>x("Wirklich zu diesem Stand zurück?",`Die Box wird auf den Snapshot vom ${b(s)} zurückgesetzt (Gedächtnis, Hermes-Config, Modell-Router). Der JETZIGE Zustand wird vorher automatisch gesichert — der Schritt ist also umkehrbar. Die Dienste starten neu, die Zentrale ist kurz weg.`,()=>M(s)),className:"flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-amber-500/40 bg-amber-500/10 px-2.5 text-[10px] font-bold uppercase tracking-wide text-amber-300 transition-all hover:bg-amber-500/20 cursor-pointer disabled:opacity-50",children:[c===s.file?e.jsx(y,{className:"h-3 w-3 animate-spin"}):e.jsx(N,{className:"h-3 w-3"})," Zurück"]})]},s.file))}),n.length>4&&!r&&e.jsxs("button",{onClick:()=>o(!0),className:"text-[11px] text-muted-foreground underline hover:text-foreground",children:["Alle ",n.length," Snapshots anzeigen"]}),g]})}export{Y as ChronikView};