PageSourceSearch

https://circassianweb.com/assets/StoryDetailPage-DJsISTBt.js

js circassianweb.com collected 2026-10-02 17:53:59 UTC 3,728 bytes, 1 lines download raw bytes

1import{r,j as e}from"./vendor-ui-Dew8CZxq.js";import P from"./purify.es-B9ZVCkUG.js";import{d as q,a as z,L as A}from"./vendor-router-DljXtjbj.js";import{e as B,d as C,b8 as D,s as o,B as u,bn as T,aU as x,ai as k,an as p}from"./index-DFuwCptV.js";import{S as c}from"./SidebarLayout-D8Rdd3Io.js";import{u as E}from"./storyTranslations-BuJfS_2U.js";import{A as U}from"./arrow-left-DcrUMmwE.js";import"./vendor-supabase-BOCL3uOH.js";import"./vendor-charts-Da-j9H4-.js";import"./vendor-editor-Ct-iNwJc.js";import"./vendor-query-Cjd1QUxP.js";const V=()=>{const{id:i}=q(),{user:f}=B(),{isRTL:g,language:h}=C(),t=E(h),j=z(),[s,b]=r.useState(null),[m,y]=r.useState([]),[N,v]=r.useState(""),[w,l]=r.useState(!0);D({title:s?`${s.title} — ${t.title}`:t.title,description:s?.body.replace(/<[^>]+>/g," ").slice(0,160)||t.subtitle}),r.useEffect(()=>{i&&(async()=>{l(!0);const{data:a}=await o.from("stories").select("*").eq("id",i).maybeSingle();if(!a){l(!1);return}b(a);const{data:n}=await o.from("story_photos").select("storage_path, caption").eq("story_id",i).order("position");y((n||[]).map(d=>({url:o.storage.from("stories").getPublicUrl(d.storage_path).data.publicUrl,caption:d.caption})));const{data:L}=await o.from("profiles").select("full_name").eq("user_id",a.author_id).maybeSingle();v(L?.full_name||t.anonymous),l(!1)})()},[i]);const _=async()=>{if(!s||!confirm(t.deleteConfirm))return;const{error:a}=await o.from("stories").delete().eq("id",s.id);if(a){p.error(a.message);return}p.success(t.deleted),j("/stories")};if(w)return e.jsx(c,{children:e.jsx("div",{className:"max-w-3xl mx-auto px-4 py-16 text-center text-muted-foreground",children:t.loading})});if(!s)return e.jsx(c,{children:e.jsx("div",{className:"max-w-3xl mx-auto px-4 py-16 text-center",children:t.notFound})});const S=f?.id===s.author_id;return e.jsx(c,{children:e.jsxs("article",{className:"max-w-3xl mx-auto px-4 sm:px-8 py-8",dir:g?"rtl":"ltr",children:[e.jsx(u,{variant:"ghost",size:"sm",asChild:!0,className:"mb-4",children:e.jsxs(A,{to:"/stories",children:[e.jsx(U,{className:"w-4 h-4 me-1"})," ",t.allStories]})}),s.cover_image_url&&e.jsx("div",{className:"rounded-lg overflow-hidden mb-6 bg-muted",children:e.jsx("img",{src:s.cover_image_url,alt:s.title,className:"w-full max-h-[480px] object-cover"})}),e.jsx("h1",{className:"text-3xl sm:text-4xl font-serif font-bold mb-3",children:s.title}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground mb-2",children:[e.jsxs("span",{children:[t.by," ",N]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(T,{className:"w-3 h-3"})," ",new Date(s.created_at).toLocaleDateString()]}),s.member_name&&e.jsxs("span",{children:[t.about," ",e.jsx("strong",{className:"text-foreground",children:s.member_name})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[s.tribe&&e.jsx(x,{variant:"secondary",children:s.tribe}),s.era&&e.jsx(x,{variant:"outline",children:s.era})]}),e.jsx("div",{className:"prose prose-neutral dark:prose-invert max-w-none text-foreground/90 leading-relaxed",dangerouslySetInnerHTML:{__html:P.sanitize(s.body)}}),m.length>1&&e.jsx("div",{className:"mt-8 grid grid-cols-2 sm:grid-cols-3 gap-3",children:m.slice(1).map((a,n)=>e.jsxs("figure",{className:"rounded-md overflow-hidden bg-muted",children:[e.jsx("img",{src:a.url,alt:a.caption||"",loading:"lazy",className:"w-full h-40 object-cover"}),a.caption&&e.jsx("figcaption",{className:"text-xs p-2 text-muted-foreground",children:a.caption})]},n))}),S&&e.jsx("div",{className:"mt-10 pt-6 border-t flex justify-end",children:e.jsxs(u,{variant:"destructive",size:"sm",onClick:_,children:[e.jsx(k,{className:"w-4 h-4 me-1"})," ",t.deleteBtn]})})]})})};export{V 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.