1import{r as c,j as t}from"./vendor-react-BTaBH3I0.js";import{b as m}from"./navigation-Dh0zVaO9.js";import{S as i,o as f,k as x,n as y,L as j,c as k,d as v}from"./LumaCards-BipzN3-u.js";import{u as w,c as S,L as b}from"./index-pVy5dhMT.js";import{B as P}from"./Breadcrumbs-DZm62UFR.js";import{d as N,a as L,u as C}from"./vendor-router-DaUSQCqh.js";import"./OwnerInlineControls-B2VlUHpd.js";import"./vendor-helmet-BVAFyVM5.js";import"./vendor-misc-DOep9v2o.js";const A=()=>{const{t:r,locale:p}=w(),{slug:n}=N(),o=L(),l=C(),[s,g]=c.useState(null),[h,a]=c.useState(!0),[u,d]=c.useState(!1);return c.useEffect(()=>{n&&(a(!0),d(!1),S(`/api/sector/${encodeURIComponent(n)}`).then(e=>{if(e.status===404)return d(!0),a(!1),null;if(!e.ok)throw new Error(`Sector responded ${e.status}`);return e.json()}).then(e=>{e&&g(e),a(!1)}).catch(e=>{console.error("[SectorBrowsePage]",e),a(!1)}))},[n,p]),h?t.jsx("div",{className:"flex items-center justify-center min-h-[60vh]",children:t.jsx(b,{className:"animate-spin",style:{color:"var(--wystem-accent-primary-ink)",width:24,height:24}})}):u||!s?t.jsx("div",{className:"max-w-6xl mx-auto px-6 py-24 text-center",children:t.jsx("p",{style:{fontFamily:"var(--wystem-font-serif)",fontStyle:"italic",color:"var(--wystem-ink-muted)",fontSize:"1.125rem"},children:"No work has been filed under this sector yet."})}):t.jsxs("div",{children:[t.jsx(P,{items:[{label:r("breadcrumbs.commons","Commons"),href:"/"},{label:r("breadcrumbs.sectors","Sectors")},{label:(s==null?void 0:s.label)??r("sectorPage.fallback","Sector")}]}),t.jsxs("header",{className:"max-w-6xl mx-auto px-6",style:{paddingTop:"clamp(3rem, 6vw, 5rem)",paddingBottom:"clamp(2rem, 4vw, 3rem)"},children:[t.jsx("p",{className:"text-[10px] font-bold uppercase mb-3",style:{letterSpacing:"var(--wystem-badge-tracking)",color:"var(--wystem-accent-primary-ink)"},children:r("sectorPage.kicker","Sector")}),t.jsx("h1",{style:{fontFamily:"var(--wystem-font-display)",fontWeight:800,fontSize:"clamp(2.5rem, 5vw, 3.5rem)",color:"var(--wystem-ink-primary)",letterSpacing:"-0.03em",lineHeight:1.05},children:s.label}),t.jsxs("p",{className:"mt-3",style:{fontFamily:"var(--wystem-font-serif)",fontStyle:"italic",color:"var(--wystem-ink-secondary)",fontSize:"1rem",maxWidth:"60ch",lineHeight:1.55},children:[s.orgs.length," ",s.orgs.length===1?r("sectorPage.orgWorksSingular","organisation works"):r("sectorPage.orgWorksPlural","organisations work")," ",r("sectorPage.leadBody","in this area of the commons. Below: recent articles, recipes, reports, and projects filed here.")]})]}),s.orgs.length>0&&t.jsx(i,{id:"sector-orgs",kicker:r("sectorPage.orgKicker","Organisations"),title:r("sectorPage.orgTitle","Working in this sector"),tone:"page",children:t.jsx("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))"},children:s.orgs.map(e=>t.jsxs("button",{type:"button",onClick:()=>o(`/org/${e.slug}`),className:"text-left p-4 transition-colors flex items-center gap-3",style:{background:"transparent",cursor:"pointer",borderRadius:4},onMouseEnter:x,onMouseLeave:f,children:[t.jsx("div",{className:"flex items-center justify-center shrink-0 overflow-hidden",style:{width:44,height:44,background:e.logo_path?"var(--wystem-surface-canvas)":"var(--wystem-accent-primary-soft)",border:"1px solid color-mix(in oklch, var(--wystem-ink-primary) 8%, transparent)",borderRadius:3},children:e.logo_path?t.jsx("img",{src:e.logo_path,alt:"",className:"w-full h-full object-contain"}):t.jsx("span",{style:{fontFamily:"var(--wystem-font-serif)",fontStyle:"italic",fontWeight:600,fontSize:18,color:"var(--wystem-accent-primary-ink)"},children:(e.name.charAt(0)||"?").toUpperCase()})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate",style:{fontFamily:"var(--wystem-font-display)",fontWeight:600,fontSize:"0.9rem",color:"var(--wystem-ink-primary)"},children:e.name}),t.jsxs("p",{className:"truncate text-[11px]",style:{color:"var(--wystem-ink-muted)"},children:[e.document_count," doc",e.document_count===1?"":"s"]})]})]},e.slug))})}),s.projects.length>0&&t.jsx(i,{id:"sector-projects",kicker:r("sectorPage.projectsKicker","Projects"),title:r("sectorPage.projectsTitle","In this sector"),tone:"tinted",children:t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:s.projects.map(e=>t.jsx(y,{project:e},e.slug))})}),s.articles.length>0&&t.jsx(i,{id:"sector-articles",kicker:r("sectorPage.articlesKicker","Articles"),title:r("sectorPage.articlesTitle","Articles in this sector"),tone:"page",children:t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:s.articles.slice(0,8).map(e=>t.jsx(j,{article:e,onClick:()=>o(`/immersive/${e.id}?from=${m(l)}`)}
1,e.id))})}),s.recipes.length>0&&t.jsx(i,{id:"sector-recipes",kicker:r("sectorPage.recipesKicker","Recipes"),title:r("sectorPage.recipesTitle","Recipes from this sector"),tone:"tinted",children:t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:s.recipes.slice(0,8).map(e=>t.jsx(k,{recipe:e,onClick:()=>o(`/recipe/${encodeURIComponent(e.id)}?from=${m(l)}`)},e.id))})}),s.reports.length>0&&t.jsx(i,{id:"sector-reports",kicker:r("sectorPage.dataStoriesKicker","Data Stories"),title:r("sectorPage.dataStoriesTitle","Data Stories filed under this sector"),tone:"page",children:t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:s.reports.slice(0,8).map(e=>t.jsx(v,{report:e,onClick:()=>o(`/story/${encodeURIComponent(e.drive_file_id)}?from=${m(l)}`)},e.drive_file_id))})})]})};export{A as SectorBrowsePage};
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.