HifiPlanet-Website/hifi/assets/UpdateSettings-oSfYew6Q.js
Maaxxs c6214637e8 Collapse overlong package card bullets instead of stretching the row
Since all cards in a row share one height, a single card with long
paragraphs in its description (e.g. Limitless) made every card as tall
as that one, leaving a lot of empty space in the others. Collapsed
bullets are now clamped to three lines; normal bullets fit, long
paragraphs end with an ellipsis and the card offers "Mehr anzeigen" to
show the full text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 00:18:09 +02:00

1 line
5.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{r as l,j as e,a as u}from"./index-CZwY_OSZ.js";const D={download:"Herunterladen",extract:"Entpacken",backup:"Sichern",apply:"Installieren"};function w(a){return a?a.slice(0,7):"–"}function L(a){return a?new Date(a).toLocaleString("de-DE"):"–"}function H(){const[a,v]=l.useState(null),[n,_]=l.useState(null),[E,g]=l.useState(!0),[h,j]=l.useState(""),[c,f]=l.useState(!1),[d,i]=l.useState({download:null,extract:null,backup:null,apply:null}),[p,k]=l.useState(""),[x,N]=l.useState(null),m=()=>{g(!0),j(""),Promise.all([u.get("/settings/update-status"),u.get("/settings/update-check")]).then(([t,s])=>{v(t),_(s)}).catch(t=>j(t.message)).finally(()=>g(!1))};l.useEffect(m,[]);const P=async()=>{f(!0),k(""),N(null),i({download:"busy",extract:null,backup:null,apply:null});try{const s=(await u.post("/settings/update-download",{})).run_id;i(r=>({...r,download:"done",extract:"busy"})),await u.post("/settings/update-extract",{run_id:s}),i(r=>({...r,extract:"done",backup:"busy"})),await u.post("/settings/update-backup",{}),i(r=>({...r,backup:"done",apply:"busy"}));const o=await u.post("/settings/update-apply",{run_id:s});i(r=>({...r,apply:"done"})),N(o.log||[]),m()}catch(t){i(s=>{const o=Object.keys(s).find(r=>s[r]==="busy");return o?{...s,[o]:"error"}:s}),k(t.message)}finally{f(!1)}};if(E)return e.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"});const b=(a==null?void 0:a.capabilities)||{},y=b.zip?b.http_client?b.writable?null:"Das Website-Verzeichnis ist für PHP nicht beschreibbar - bitte Dateiberechtigungen prüfen.":"Diese Funktion benötigt ausgehende HTTPS-Verbindungen (curl oder allow_url_fopen), die auf diesem Server aktuell nicht verfügbar sind.":'Diese Funktion benötigt die PHP-Erweiterung "zip", die auf diesem Server aktuell nicht aktiviert ist. Bitte beim Hoster aktivieren lassen.',S=n==null?void 0:n.update_available;return e.jsx("div",{className:"max-w-2xl space-y-6",children:e.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Updates aus Git"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:'Zieht den aktuellen Stand direkt vom Code-Repository und installiert ihn hier - ohne manuellen FTP-Upload. Passiert nur, wenn du unten aktiv auf "Update installieren" klickst, nie automatisch im Hintergrund.'}),h&&e.jsx("p",{className:"mb-3 text-sm text-red-600",children:h}),y?e.jsx("p",{className:"rounded-md bg-amber-50 p-3 text-sm text-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:y}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{className:"rounded-md bg-neutral-50 p-3 dark:bg-neutral-800/50",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-neutral-400",children:"Installiert"}),e.jsx("p",{className:"font-mono text-neutral-800 dark:text-neutral-100",children:w(a==null?void 0:a.deployed_sha)}),e.jsx("p",{className:"text-xs text-neutral-400",children:L(a==null?void 0:a.deployed_at)})]}),e.jsxs("div",{className:"rounded-md bg-neutral-50 p-3 dark:bg-neutral-800/50",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-neutral-400",children:"Neuester Stand"}),e.jsx("p",{className:"font-mono text-neutral-800 dark:text-neutral-100",children:w(n==null?void 0:n.latest_sha)}),(n==null?void 0:n.latest_message)&&e.jsx("p",{className:"truncate text-xs text-neutral-400",title:n.latest_message,children:n.latest_message})]})]}),S?e.jsx("p",{className:"mb-3 text-sm font-medium text-brand-600 dark:text-brand-400",children:"Update verfügbar."}):e.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:"Bereits auf dem neuesten Stand."}),e.jsxs("div",{className:"mb-3 flex gap-2",children:[e.jsx("button",{type:"button",onClick:m,disabled:c,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm font-medium hover:bg-neutral-50 disabled:opacity-50 dark:border-neutral-700 dark:hover:bg-neutral-800",children:"Nach Updates suchen"}),e.jsx("button",{type:"button",onClick:P,disabled:c||!S,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:c?"Installiere…":"Update installieren"})]}),(c||p)&&e.jsx("ul",{className:"mb-3 space-y-1 text-sm",children:Object.entries(D).map(([t,s])=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:d[t]==="done"?"text-green-600 dark:text-green-400":d[t]==="error"?"text-red-600":d[t]==="busy"?"text-brand-600 dark:text-brand-400":"text-neutral-300 dark:text-neutral-600",children:d[t]==="done"?"✓":d[t]==="error"?"✕":d[t]==="busy"?"…":"○"}),s]},t))}),p&&e.jsx("p",{className:"text-sm text-red-600",children:p}),x&&e.jsxs("div",{className:"mt-3 rounded-md bg-green-50 p-3 text-sm text-green-800 dark:bg-green-900/20 dark:text-green-300",children:[e.jsx("p",{className:"mb-1 font-semibold",children:"Update installiert."}),x.length>0&&e.jsxs("details",{children:[e.jsx("summary",{className:"cursor-pointer text-xs",children:"Details anzeigen"}),e.jsx("ul",{className:"mt-2 list-disc pl-5 text-xs",children:x.map((t,s)=>e.jsx("li",{children:t},s))})]})]})]})]})})}export{H as default};