Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Dgc8etkq7JkjyZgD2DEbv
1 line
4.8 KiB
JavaScript
1 line
4.8 KiB
JavaScript
import{u as g,r as x,g as j,j as e,f as b,c as w,b as f,N as k,e as v,L as u,R as y}from"./index-Cc1wEeIX.js";function P({photos:l,index:s,onClose:t,onNavigate:n}){const{t:i}=g();if(x.useEffect(()=>{if(s==null)return;const r=a=>{a.key==="Escape"&&t(),a.key==="ArrowRight"&&n(1),a.key==="ArrowLeft"&&n(-1)};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[s,t,n]),s==null)return null;const d=l[s],c=r=>r.stopPropagation();return j.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/90 p-4",onClick:t,children:[e.jsx("button",{onClick:r=>{c(r),t()},"aria-label":i("lightbox.close"),className:"absolute right-4 top-4 rounded-full p-2 text-white/80 hover:bg-white/10 hover:text-white",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-7 w-7",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6l12 12M18 6 6 18"})})}),l.length>1&&e.jsx("button",{onClick:r=>{c(r),n(-1)},"aria-label":i("lightbox.previous"),className:"absolute left-2 top-1/2 -translate-y-1/2 rounded-full p-2 text-white/80 hover:bg-white/10 hover:text-white sm:left-4",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-8 w-8",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m15 18-6-6 6-6"})})}),e.jsx("img",{src:d.image_path,alt:d.caption||"",onClick:c,className:"max-h-[85vh] max-w-full rounded-lg object-contain"}),l.length>1&&e.jsx("button",{onClick:r=>{c(r),n(1)},"aria-label":i("lightbox.next"),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-2 text-white/80 hover:bg-white/10 hover:text-white sm:right-4",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-8 w-8",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9 18 6-6-6-6"})})}),d.caption&&e.jsx("p",{onClick:c,className:"absolute bottom-4 left-1/2 -translate-x-1/2 rounded-full bg-black/60 px-4 py-1.5 text-sm text-white",children:d.caption})]}),document.body)}function L(){const{brandSlug:l,projectSlug:s}=b(),[t,n]=x.useState(null),[i,d]=x.useState(null),[c,r]=x.useState(null),{t:a}=g();x.useEffect(()=>{w.get(`/gallery-brands/${l}/${s}/photos`).then(n).catch(o=>d(o))},[l,s]),f({title:t?`${t.project.name} – ${t.project.brand_name}`:a("galleryProjectPage.metaTitleFallback"),description:t?a("galleryProjectPage.metaDescription")(t.project.name):void 0,path:`/galerie/${l}/${s}`});const p=o=>{r(h=>{const m=t.photos.length;return(h+o+m)%m})};return i?i.status===404?e.jsx(k,{}):e.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-red-600 sm:px-6",children:v(i,a)}):t?e.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[e.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[e.jsx(u,{to:"/galerie",className:"hover:text-brand-500",children:a("galleryProjectPage.breadcrumbGallery")})," /"," ",e.jsx(u,{to:`/galerie/${l}`,className:"hover:text-brand-500",children:t.project.brand_name})," / ",t.project.name]}),e.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:t.project.name}),t.photos.length===0&&e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:a("galleryProjectPage.empty")}),e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:t.photos.map((o,h)=>e.jsx(y,{index:h%6,shine:!0,className:"aspect-square overflow-hidden rounded-xl",children:e.jsx("button",{onClick:()=>r(h),className:"block h-full w-full","aria-label":o.caption||a("galleryProjectPage.enlargeImage"),children:e.jsx("img",{src:o.image_path,alt:o.caption||"",loading:"lazy",decoding:"async",className:"h-full w-full object-cover transition duration-300 hover:scale-105"})})},o.id))}),e.jsxs("div",{className:"mt-12 flex flex-col items-start gap-4 rounded-2xl border border-neutral-200 bg-white p-6 shadow-sm dark:border-neutral-800 dark:bg-neutral-900 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-neutral-900 dark:text-white",children:a("galleryProjectPage.ctaTitle")}),e.jsx("p",{className:"mt-1 text-sm text-neutral-600 dark:text-neutral-300",children:a("galleryProjectPage.ctaText")})]}),e.jsx(u,{to:`/kontakt?${new URLSearchParams({topic:a("galleryProjectPage.ctaTopic")(t.project.name)}).toString()}`,className:"shrink-0 rounded-md bg-brand-500 px-5 py-3 text-sm font-semibold text-white shadow-sm hover:bg-brand-600",children:a("galleryProjectPage.ctaButton")})]}),e.jsx(P,{photos:t.photos,index:c,onClose:()=>r(null),onNavigate:p})]}):e.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:a("galleryProjectPage.loading")})}export{L as default};
|