1import{c as f,h as j,r as b,j as e,b as u,U as N,as as v}from"./index-BkYHdQDn.js";import{f as y}from"./fetchAllAnalyticsEvents-OuprNa8o.js";/** 2 * @license lucide-react v0.475.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const k=[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],z=f("SearchX",k);function _(){const{data:d=[],isLoading:c}=j({queryKey:["analytics-events"],queryFn:()=>y(),staleTime:6e4}),s=b.useMemo(()=>{const t=d.filter(r=>r.event_type==="search_performed"),o=new Set(t.map(r=>r.anonymous_user_id).filter(Boolean));let i=0;const x={};for(const r of t){const a=r.context||{};a.zero_results&&(i+=1);const n=String(a.query||"").toLowerCase().trim();n&&(x[n]=(x[n]||0)+1)}const p=Object.entries(x).sort((r,a)=>a[1]-r[1]).slice(0,12),m={};for(const r of t){const a=new Date(r.created_date);if(!a)continue;const n=a.toISOString().slice(0,10);m[n]=(m[n]||0)+1}const g=Object.entries(m).sort((r,a)=>r[0].localeCompare(a[0])).slice(-14);return{total:t.length,users:o.size,zero:i,zeroRate:t.length?Math.round(i/t.length*100):0,top:p,dailySorted:g}},[d]),h=Math.max(...s.dailySorted.map(t=>t[1]),1);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-black text-foreground",children:"Zoekgedrag"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Hoeveel zoekopdrachten, unieke zoekers, zero-result-rate en de populairste zoektermen."})]}),c?e.jsx("div",{className:"flex items-center justify-center py-16 text-muted-foreground text-sm",children:"Gegevens ladenâ¦"}):s.total===0?e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-10 text-center",children:[e.jsx(u,{className:"w-8 h-8 text-muted-foreground/40 mx-auto mb-3"}),e.jsx("p",{className:"text-sm font-bold text-foreground",children:"Onvoldoende data"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Nog geen search_performed-events."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[e.jsx(l,{icon:u,label:"Zoekopdrachten",value:s.total}),e.jsx(l,{icon:N,label:"Unieke zoekers",value:s.users}),e.jsx(l,{icon:z,label:"Zero-result rate",value:`${s.zeroRate}%`}),e.jsx(l,{icon:v,label:"Unieke termen",value:s.top.length})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-4",children:[e.jsx("h3",{className:"text-xs font-bold uppercase tracking-wide text-muted-foreground mb-3",children:"Zoekopdrachten per dag (laatste 14)"}),e.jsx("div",{className:"flex items-end gap-1.5 h-32",children:s.dailySorted.map(([t,o])=>e.jsxs("div",{className:"flex-1 flex flex-col items-center gap-1",children:[e.jsx("div",{className:"w-full bg-primary/70 rounded-t",style:{height:`${o/h*100}%`},title:`${t}: ${o}`}),e.jsx("span",{className:"text-[9px] text-muted-foreground/60",children:t.slice(5)})]},t))})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-4",children:[e.jsx("h3",{className:"text-xs font-bold uppercase tracking-wide text-muted-foreground mb-3",children:"Populairste zoektermen"}),s.top.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"Geen query-data beschikbaar."}):e.jsx("ul",{className:"space-y-2",children:s.top.map(([t,o])=>e.jsxs("li",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-foreground truncate flex-1",children:['"',t,'"']}),e.jsx("div",{className:"w-24 h-2 rounded-full bg-secondary overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary",style:{width:`${o/s.top[0][1]*100}%`}})}),e.jsx("span",{className:"text-xs font-bold text-foreground w-8 text-right",children:o})]},t))})]})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-4 text-xs text-muted-foreground",children:[e.jsx("strong",{className:"text-foreground",children:"Tip:"})," een hoge zero-result-rate wijst op een gat in de catalogus of een zoekfunctie die te streng matcht. Bekijk de populairste termen zonder resultaat om content-aanvulling of synoniemen toe te voegen."]})]})]})}function l({icon:d,label:c,value:s}){return e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-4",children:[e.jsx(d,{className:"w-4 h-4 text-primary mb-2"}),e.jsx("p",{className:"text-2xl font-black text-foreground leading-none",children:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-1.5",children:c})]})}export{_ as default};
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.