1import{k as T,u as A,a as I,l as O,r,m as J,Z as R,j as e,n as y,H as N,L as v,B as H,d as a,$ as U}from"./index-BC6Ih8e-.js";import{H as E}from"./Header-7ILEk9kD.js";import{u as z}from"./useAnonymousStats-Cx6MPHPS.js";import{u as B}from"./useAnalytics-DT9Yplez.js";import{S as n,D,a as M,t as V}from"./seoConstants-C_Ikpdnw.js";import{h as F,a as Z,g as q,f as K,d as Q}from"./seoTemplates-DNplLAi7.js";import{u as W}from"./useUrlLanguageSync-DVJentyq.js";import{u as X}from"./useLocalizedRouteGuards-CSfuj-l5.js";import{S as Y}from"./SeoRedirectHead-C_hQb4pa.js";import{A as ee}from"./arrow-left-Bhfd2Cux.js";import"./index-DQkh2j8L.js";import"./gamepad-2-BrhzSYrr.js";function ge(){const{uiLang:c}=T(),{t:d}=A(),{setLanguage:g,availableLanguages:x,isLoadingLanguages:k}=I(),{userRoles:S,loading:h}=O(),_=S.includes("admin");z("guide"),B("guide");const{nonCanonicalRedirectPath:f,isInactiveLanguage:w}=X({uiLang:c,segmentType:"articles"}),t=(c||"fi").toUpperCase(),m=r.useMemo(()=>x.map(s=>s.code.toUpperCase()),[x]).includes(t);r.useEffect(()=>{m&&(g(t),J.changeLanguage(t.toLowerCase()))},[t,m,g]),W({uiLang:c,isLanguageSupported:m,resolveTargetPath:s=>a("articles",s)});const[i,j]=r.useState([]),[$,L]=r.useState(!0);if(r.useEffect(()=>{let s=!1;return L(!0),R(t,{limit:60}).then(p=>{s||j(p)}).catch(p=>{console.error("Error loading guides:",p),s||j([])}).finally(()=>{s||L(!1)}),()=>{s=!0}},[t]),f)return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(Y,{targetPath:f}),e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(y,{className:"h-8 w-8 animate-spin text-primary"})})]});if(w&&!h&&!_)return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(N,{children:e.jsx("meta",{name:"robots",content:"noindex, follow"})}),e.jsx(E,{}),e.jsxs("main",{className:"container mx-auto px-4 py-8 text-center",children:[e.jsx("h1",{className:"text-2xl font-bold mb-4",children:d("errors.languageNotSupported")}),e.jsx(v,{to:"/",children:e.jsxs(H,{variant:"outline",children:[e.jsx(ee,{className:"h-4 w-4 mr-2"}),d("nav.home",{defaultValue:"Etusivu"})]})})]})]});const b=F(t),u=Z({type:"guideList",title:"",lang:t}),o=`${n}${a("articles",t)}`,l=q(t),C=K([{name:l.home,url:`${n}/${t.toLowerCase()}`},{name:l.guides,url:o}]),G=Q({name:l.guides,url:o,items:i.map(s=>({name:s.title_text||s.url_slug||"",url:`${n}${a("article",t,s.url_slug||"")}`}))}),P=Object.keys(U).map(s=>({hrefLang:s.toLowerCase(),href:`${n}${a("articles",s)}`}));return e.jsxs(e.Fragment,{children:[e.jsxs(N,{children:[e.jsx("title",{children:b}),e.jsx("meta",{name:"description",content:u}),e.jsx("meta",{property:"og:type",content:"website"}),e.jsx("meta",{property:"og:url",content:o}),e.jsx("meta",{property:"og:title",content:b}),e.jsx("meta",{property:"og:description",content:u}),e.jsx("meta",{property:"og:image",content:D}),e.jsx("meta",{property:"og:site_name",content:M}),e.jsx("meta",{property:"og:locale",content:V(t)}),e.jsx("link",{rel:"canonical",href:o}),P.map(s=>e.jsx("link",{rel:"alternate",hrefLang:s.hrefLang,href:s.href},`hreflang-${s.hrefLang}`)),e.jsx("link",{rel:"alternate",hrefLang:"x-default",href:`${n}${a("articles","EN")}`}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify(C)}),i.length>0&&e.jsx("script",{type:"application/ld+json",children:JSON.stringify(G)})]}),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(E,{}),e.jsxs("main",{className:"container mx-auto px-4 py-8 max-w-4xl",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-2",children:l.guides}),e.jsx("p",{className:"text-muted-foreground mb-8",children:u}),$||k||h?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(y,{className:"h-8 w-8 animate-spin text-primary"})}):i.length===0?e.jsx("div",{className:"text-center text-muted-foreground py-16",children:d("guide.empty",{defaultValue:"Ei vielä julkaistuja artikkeleita."})}):e.jsx("ul",{className:"grid gap-4 md:grid-cols-2",children:i.map(s=>e.jsx("li",{children:e.jsxs(v,{to:a("article",t,s.url_slug||""),className:"block border rounded-lg p-4 hover:bg-muted transition",children:[s.hero_url&&e.jsx("img",{src:s.hero_url,alt:"",className:"w-full aspect-video object-cover rounded-md mb-3",loading:"lazy"}),e.jsx("h2",{className:"text-lg font-semibold mb-1",children:s.title_text}),s.description_text&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-3",children:s.description_text})]})},s.id))})]})]})]})}export{ge 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.