1import{K as g,i as m,r,M as i,u as f,j as e,L as w,O as N}from"./index-CMjJqRFh.js";import{g as S,a as z}from"./email-cockpit.functions-Bbo3T7xh.js";import{e as A}from"./admin.functions-D6Zcv2U7.js";function E({children:t,email:a}){const o=g(),c=m(S),l=m(z),[p,n]=r.useState(!1);r.useEffect(()=>{let s=!0;i.auth.getSession().then(({data:b})=>{s&&n(!!b.session?.access_token)});const{data:u}=i.auth.onAuthStateChange((b,y)=>{n(!!y?.access_token)});return()=>{s=!1,u.subscription.unsubscribe()}},[]);const d=f({queryKey:["unread-counts"],enabled:p,queryFn:async()=>{try{return await c({data:void 0})}catch(s){return console.warn("[AdminShell] unread count fetch failed",s),{inbox:0,leads:0,notifs:0}}},refetchInterval:3e4,retry:!1,throwOnError:!1});async function h(){await i.auth.signOut(),o.navigate({to:"/app/auth",replace:!0})}const j=(d.data?.inbox??0)+(d.data?.leads??0),x=f({queryKey:["email-active-alerts"],enabled:p,queryFn:async()=>{try{return await l()}catch{return{warn:0,crit:0}}},refetchInterval:6e4,retry:!1,throwOnError:!1}),v=(x.data?.crit??0)>0?"crit":(x.data?.warn??0)>0?"warn":void 0,k=[{id:"overview",title:"Ãversikt",items:[{to:"/app/cockpit",label:"Cockpit"},{to:"/app/resources",label:"Resurser & kostnad"},{to:"/app/ops",label:"Drift & fel"},{to:"/app/ekonomi",label:"Ekonomi"}]},{id:"mail",title:"Mejl",items:[{to:"/app/email",label:"Ãversikt",dot:v},{to:"/app/inkorg",label:"Inkorg",badge:j},{to:"/app/warmup",label:"Streams & warm-up"},{to:"/app/mail",label:"Veckomail"}]},{id:"pipeline",title:"Pipeline",items:[{to:"/app/discovery",label:"Discovery",step:1},{to:"/app/targets",label:"Targets",step:2},{to:"/app/runs",label:"Körningar",step:3},{to:"/app/quality",label:"Kvalitet",step:4},{to:"/app/curation",label:"Companies",step:5},{to:"/app/backfill",label:"Backfill (rejected)",step:6}]},{id:"katalog",title:"Katalog & sälj",items:[{to:"/app/foretag",label:"Publika jobb"},{to:"/app/strategy-leaderboard",label:"Strategi-leaderboard"},{to:"/app/dashboard",label:"Dashboard"}]},{id:"social",title:"Sociala kanaler",items:[{to:"/app/social",label:"Inlägg & idéer"}]},{id:"system",title:"System",items:[{to:"/app/ats",label:"ATS-leverantörer"},{to:"/app/timkorningar",label:"Timkörningar (loggar)"},{to:"/app/brand",label:"Grafisk profil"},{to:"/app/legal",label:"Juridik"},{to:"/app/legal-requests",label:"Borttagningar"}]}];return e.jsxs("div",{className:"min-h-screen bg-zinc-50 text-zinc-900",children:[e.jsx("header",{className:"border-b border-zinc-200 bg-white",children:e.jsxs("div",{className:"mx-auto flex max-w-[1600px] items-center justify-between px-6 py-3",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsx("span",{className:"font-mono text-xs uppercase tracking-widest text-zinc-500",children:"jobscanner / cockpit"})}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[a?e.jsx("span",{className:"font-mono text-xs text-zinc-500",children:a}):null,e.jsx("button",{onClick:h,className:"rounded-md border border-zinc-200 px-3 py-1 text-xs font-medium hover:bg-zinc-100",children:"Logga ut"})]})]})}),e.jsxs("div",{className:"mx-auto flex max-w-[1600px] gap-6 px-6 py-6",children:[e.jsx("aside",{className:"w-60 shrink-0",children:e.jsx("nav",{className:"flex flex-col gap-5 text-sm",children:k.map(s=>e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 px-3 text-[10px] font-bold uppercase tracking-wider text-zinc-400",children:s.title}),e.jsx("div",{className:"flex flex-col gap-0.5",children:s.items.map(u=>e.jsx(C,{item:u},u.to))})]},s.id))})}),e.jsx("main",{className:"min-w-0 flex-1",children:t})]})]})}function C({item:t}){return e.jsxs(w,{to:t.to,activeProps:{className:"bg-zinc-900 text-white"},className:"flex items-center justify-between rounded-md px-3 py-2 font-medium text-zinc-700 hover:bg-zinc-100",children:[e.jsxs("span",{className:"flex items-center gap-2",children:[t.step?e.jsx("span",{className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-zinc-200 font-mono text-[10px] text-zinc-700",children:t.step}):null,t.label,t.dot?e.jsx("span",{"aria-label":t.dot==="crit"?"Kritiska larm":"Varningar",className:`inline-block h-2 w-2 rounded-full ${t.dot==="crit"?"bg-red-500 animate-pulse":"bg-amber-500"}`}):null]}),t.badge&&t.badge>0?e.jsx("span",{className:"rounded-full bg-red-600 px-2 py-0.5 text-[10px] font-bold text-white",children:t.badge}):null]})}function I(){const t=g(),[a,o]=r.useState("loading"),c=m(A);return r.useEffect(()=>{let l=!1;i.auth.getSession().then(({data:n})=>{l||(o(n.session??null),n.session&&c({data:void 0}).catch(()=>{}))});const{data:p}=i.auth.onAuthStateChange((n,d)=>{l||o(d??null)});return()=>{l=!0,p.subscription.unsubscribe()}},[c]),r.useEffect(()=>{a===null&&t.navigate({to:"/app/auth",replace:!0})},[a,t]),a==="loading"?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-zinc-50",children:e.jsx("p",{className:"font-mono text-xs uppercase tracking-widest text-zinc-500",children:"Laddarâ¦"})}):a===null?null:e.jsx(E,{email:a.user.email??null,children:e.jsx(N,{})})}
1export{I 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.