1 line
No EOL
2 KiB
JavaScript
1 line
No EOL
2 KiB
JavaScript
import{i as e,t}from"../chunks/PostCard-ClNPcHNo.js";import{Fragment as n,createBlock as r,createCommentVNode as i,createElementBlock as a,createElementVNode as o,createTextVNode as s,createVNode as c,onMounted as l,openBlock as u,renderList as d,toDisplayString as f,unref as p,withCtx as m}from"vue";import{router as h}from"@inertiajs/vue3";import{AppLayout as g,Button as _,PageHeader as v,http as y,toast as b}from"@inhaus/ui";var x={class:`ih:mx-auto ih:grid ih:max-w-4xl ih:gap-4`},S={key:0,class:`ih:rounded-md ih:border ih:border-destructive/30 ih:bg-destructive/5 ih:p-3 ih:text-sm`},C={class:`ih:flex ih:items-center ih:gap-2 ih:font-medium`},w={class:`ih:mt-1 ih:list-disc ih:pl-6 ih:text-muted-foreground`},T={__name:`Post`,props:{group:{type:Object,required:!0},post:{type:Object,required:!0},comments:{type:Array,required:!0},reactions:{type:Array,required:!0},reports:{type:Array,default:()=>[]}},setup(T){let E=T;l(()=>{(location.hash&&document.querySelector(location.hash))?.scrollIntoView({block:`center`})});async function D(){await y.post(`/gruppen/beitraege/${E.post.id}/meldungen-erledigt`),b.success(`Meldungen erledigt`),h.reload()}return(l,y)=>(u(),r(p(g),{title:`Beitrag in ${T.group.name}`},{default:m(()=>[c(p(v),{title:`Beitrag`,breadcrumbs:[{label:`Gruppen`,href:`/gruppen`},{label:T.group.name,href:T.group.url}]},null,8,[`breadcrumbs`]),o(`div`,x,[T.reports.length?(u(),a(`div`,S,[o(`p`,C,[c(p(e),{class:`ih:size-4 ih:text-destructive`}),s(` `+f(T.reports.length)+` `+f(T.reports.length===1?`Meldung`:`Meldungen`),1)]),o(`ul`,w,[(u(!0),a(n,null,d(T.reports,e=>(u(),a(`li`,{key:e.id},f(e.comment_id?`Kommentar: `:``)+f(e.reason),1))),128))]),c(p(_),{size:`sm`,variant:`outline`,class:`ih:mt-2`,onClick:D},{default:m(()=>[...y[1]||=[s(`In Ordnung – erledigt`,-1)]]),_:1})])):i(``,!0),c(t,{post:T.post,reactions:T.reactions,"full-comments":T.comments,onDeleted:y[0]||=e=>p(h).visit(T.group.url)},null,8,[`post`,`reactions`,`full-comments`])])]),_:1},8,[`title`]))}};export{T as default}; |