PageSourceSearch

https://clickholdings.com.hk/assets/news-status-CMG3B8W3.js

js clickholdings.com.hk collected 2026-10-04 13:31:06 UTC 5,370 bytes, 1 lines download raw bytes

1import{c as g,u as v,a as b,r as c,j as e,P as j}from"./main-tVJvHoBe.js";import{C as w}from"./circle-check-CNcLVAR9.js";import{R as N}from"./refresh-cw-lxDqXVnC.js";const y=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],h=g("triangle-alert",y);function x(l){if(!l)return"—";const t=Date.now()-new Date(l).getTime();if(!Number.isFinite(t)||t<0)return"just now";const n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;const r=Math.floor(n/60);if(r<60)return`${r}m ago`;const i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function F(){const l=v(b),[t,n]=c.useState(null),[r,i]=c.useState(null),[d,p]=c.useState(!1),[,f]=c.useState(0),m=async()=>{p(!0);const s=performance.now();try{const a={...await l(),clientFetchedAt:new Date().toISOString(),durationMs:Math.round(performance.now()-s)};n(a),!a.error&&a.items.length>0&&i(a.fetchedAt||a.clientFetchedAt)}catch(o){n({items:[],fetchedAt:"",error:o instanceof Error?o.message:"Request failed",clientFetchedAt:new Date().toISOString(),durationMs:Math.round(performance.now()-s)})}finally{p(!1)}};c.useEffect(()=>{m();const s=setInterval(m,6e4),o=setInterval(()=>f(a=>a+1),1e3);return()=>{clearInterval(s),clearInterval(o)}},[]);const u=t&&!t.error&&t.items.length>0;return e.jsxs("div",{children:[e.jsx(j,{eyebrow:"System Health",title:"News Feed Status",desc:"Real-time verification of the live GlobeNewswire press release sync powering the Newsroom."}),e.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-12",children:[e.jsxs("div",{className:["flex flex-wrap items-center justify-between gap-4 border p-5",u?"border-primary/40 bg-primary/5":"border-destructive/40 bg-destructive/5"].join(" "),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[u?e.jsx(w,{className:"h-6 w-6 text-primary"}):e.jsx(h,{className:"h-6 w-6 text-destructive"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.25em] text-muted-foreground",children:"Source · GlobeNewswire (Click Holdings Limited)"}),e.jsx("div",{className:"text-lg font-bold",children:u?"Feed healthy — live sync OK":"Feed degraded — using local fallback"})]})]}),e.jsxs("button",{onClick:m,disabled:d,className:"inline-flex items-center gap-2 border border-border bg-surface px-4 py-2 font-mono text-[11px] uppercase tracking-wider hover:border-primary hover:text-primary disabled:opacity-50",children:[e.jsx(N,{className:["h-3.5 w-3.5",d?"animate-spin":""].join(" ")}),d?"Syncing…":"Sync now"]})]}),e.jsx("div",{className:"mt-6 grid grid-cols-2 gap-px bg-border md:grid-cols-4",children:[{label:"Last successful sync",value:r?x(r):"—",sub:r??"Never"},{label:"Last attempt",value:t?x(t.clientFetchedAt):"—",sub:t?.clientFetchedAt??"—"},{label:"Items returned",value:t?String(t.items.length):"—",sub:"from live feed"},{label:"Response time",value:t?`${t.durationMs} ms`:"—",sub:"round-trip"}].map(s=>e.jsxs("div",{className:"bg-surface p-5",children:[e.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.2em] text-muted-foreground",children:s.label}),e.jsx("div",{className:"mt-2 font-mono text-xl font-bold tabular-nums",children:s.value}),e.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground",children:s.sub})]},s.label))}),t?.error&&e.jsxs("div",{className:"mt-6 border border-destructive/40 bg-destructive/5 p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.2em] text-destructive",children:[e.jsx(h,{className:"h-4 w-4"})," Fetch error"]}),e.jsx("pre",{className:"mt-3 whitespace-pre-wrap break-words font-mono text-sm text-destructive",children:t.error}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"The Newsroom will continue serving the most recent cached + local press release list while the upstream source is unavailable. Auto-retries every 60 seconds."})]}),t&&t.items.length>0&&e.jsxs("div",{className:"mt-10",children:[e.jsxs("div",{className:"mb-4 flex items-baseline justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-primary",children:"Latest from feed"}),e.jsx("h2",{className:"mt-1 text-xl font-bold",children:"5 most recent press releases"})]}),e.jsxs("div",{className:"font-mono text-[10px] uppercase tracking-wider text-muted-foreground",children:["Server fetched · ",x(t.fetchedAt)]})]}),e.jsx("ol",{className:"grid gap-px bg-border",children:t.items.slice(0,5).map(s=>e.jsxs("li",{className:"bg-surface p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[e.jsxs("div",{className:"font-mono text-[10px] uppercase tracking-wider text-primary",children:[s.date," · ",s.category]}),e.jsx("a",{href:s.articleUrl,target:"_blank",rel:"noopener noreferrer",className:"font-mono text-[10px] uppercase tracking-wider text-muted-foreground hover:text-primary",children:"Open ↗"})]}),e.jsx("div",{className:"mt-1 text-sm font-semibold leading-snug",children:s.title})]},s.id))})]}),e.jsx("p",{className:"mt-8 font-mono text-[10px] uppercase tracking-wider text-muted-foreground",children:"Auto-refreshes every 60s · Cache TTL 30 min on server"})]})]})}export{F as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.