inhaus-plugin-gruppen/dist/pages/Index.js
Friederich Loheide 5bdfb8a082 Gruppen-Plugin 1.0.0
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 17:17:10 +00:00

1 line
No EOL
4.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{n as e,t}from"../chunks/loader-circle-CxzeMpQS.js";import{n,t as r}from"../chunks/GroupCard-5fLVVVGb.js";import{t as i}from"../chunks/PostCard-hYMtqskw.js";import{r as a,t as o}from"../chunks/GroupDialog-DkTJQL7Q.js";import{Fragment as s,createBlock as c,createCommentVNode as l,createElementBlock as u,createElementVNode as d,createTextVNode as f,createVNode as p,normalizeStyle as m,openBlock as h,ref as g,renderList as _,toDisplayString as v,unref as y,watch as b,withCtx as x}from"vue";import{Link as S,usePage as C}from"@inertiajs/vue3";import{AppLayout as w,Button as T,EmptyState as E,PageHeader as D,http as O,toast as k}from"@inhaus/ui";var A=e({name:`users-round`,size:24,node:[[`path`,{d:`M18 21a8 8 0 0 0-16 0`,key:`3ypg7q`}],[`circle`,{cx:`10`,cy:`8`,r:`5`,key:`o932ke`}],[`path`,{d:`M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3`,key:`10s06x`}]],aliases:[`users-2`]}),j={class:`ih:grid ih:gap-6 ih:lg:grid-cols-[minmax(0,1fr)_20rem]`},M={class:`ih:mx-auto ih:grid ih:w-full ih:max-w-2xl ih:content-start ih:gap-4`,"aria-label":`Neue Beiträge aus Ihren Gruppen`},N={key:1,class:`ih:rounded-xl ih:border ih:bg-card`},P={class:`ih:grid ih:content-start ih:gap-5`},F={key:0,class:`ih:rounded-xl ih:border ih:border-brand/40 ih:bg-brand-soft/40 ih:p-4`},I={class:`ih:grid ih:gap-3`},L={class:`ih:rounded-xl ih:border ih:bg-card ih:p-4`},R={key:0,class:`ih:-mx-2 ih:grid`},z={class:`ih:min-w-0`},B={class:`ih:block ih:truncate ih:text-sm ih:font-medium`},V={class:`ih:text-xs ih:text-muted-foreground`},H={key:1,class:`ih:text-sm ih:text-muted-foreground`},U={key:1,class:`ih:grid ih:gap-3`},W={__name:`Index`,props:{posts:{type:Array,required:!0},more:{type:Boolean,default:!1},groups:{type:Array,required:!0},invitations:{type:Array,default:()=>[]},suggested:{type:Array,default:()=>[]},privacy:{type:Object,required:!0},privacyHints:{type:Object,required:!0}},setup(e){let W=e,G=C();b(()=>G.props.flash?.status,e=>e&&k.success(e),{immediate:!0});let K=g(W.posts),q=g(W.more),J=g(!1),Y=g(!1),X=[`👍`,`❤️`,`😂`,`😮`,`😢`,`👏`];async function Z(){J.value=!0;let e=await O.get(`/gruppen?vor=${K.value.at(-1).id}`);K.value.push(...e.posts),q.value=e.more,J.value=!1}return(g,b)=>(h(),c(y(w),{title:`Gruppen`},{default:x(()=>[p(y(D),{title:`Gruppen`,description:`Austausch zu Themen, Hobbys und Projekten – offen, geschlossen oder privat.`},{actions:x(()=>[p(y(T),{variant:`outline`,"as-child":``},{default:x(()=>[p(y(S),{href:`/gruppen/entdecken`},{default:x(()=>[p(y(n)),b[2]||=f(` Gruppen entdecken`,-1)]),_:1})]),_:1}),p(y(T),{onClick:b[0]||=e=>Y.value=!0},{default:x(()=>[p(y(a)),b[3]||=f(` Gruppe gründen`,-1)]),_:1})]),_:1}),d(`div`,j,[d(`section`,M,[(h(!0),u(s,null,_(K.value,e=>(h(),c(i,{key:e.id,post:e,reactions:X,"show-group":``,onDeleted:t=>K.value=K.value.filter(t=>t.id!==e.id)},null,8,[`post`,`onDeleted`]))),128)),q.value?(h(),c(y(T),{key:0,variant:`outline`,disabled:J.value,onClick:Z},{default:x(()=>[J.value?(h(),c(y(t),{key:0,class:`ih:animate-spin`})):l(``,!0),b[4]||=f(` Ältere Beiträge laden`,-1)]),_:1},8,[`disabled`])):l(``,!0),K.value.length?l(``,!0):(h(),u(`div`,N,[p(y(E),{icon:y(A),title:e.groups.length?`Noch keine Beiträge`:`Sie sind noch in keiner Gruppe`,text:e.groups.length?`Schreiben Sie den ersten Beitrag in einer Ihrer Gruppen.`:`Entdecken Sie Gruppen zu Ihren Themen – oder gründen Sie selbst eine.`},null,8,[`icon`,`title`,`text`])]))]),d(`aside`,P,[e.invitations.length?(h(),u(`section`,F,[b[5]||=d(`h2`,{class:`ih:mb-2 ih:text-sm ih:font-semibold`},`Einladungen`,-1),d(`div`,I,[(h(!0),u(s,null,_(e.invitations,e=>(h(),c(r,{key:e.id,group:e},null,8,[`group`]))),128))])])):l(``,!0),d(`section`,L,[b[6]||=d(`h2`,{class:`ih:mb-2 ih:text-sm ih:font-semibold`},`Ihre Gruppen`,-1),e.groups.length?(h(),u(`ul`,R,[(h(!0),u(s,null,_(e.groups,e=>(h(),u(`li`,{key:e.id},[p(y(S),{href:e.url,class:`ih:flex ih:items-center ih:gap-3 ih:rounded-md ih:p-2 ih:hover:bg-accent/60`},{default:x(()=>[d(`span`,{class:`ih:size-10 ih:shrink-0 ih:rounded-md ih:bg-brand ih:bg-cover ih:bg-center`,style:m(e.cover_url?{backgroundImage:`url(${e.cover_url})`}:{})},null,4),d(`span`,z,[d(`span`,B,v(e.name),1),d(`span`,V,v(e.members_count)+` `+v(e.members_count===1?`Mitglied`:`Mitglieder`),1)])]),_:2},1032,[`href`])]))),128))])):(h(),u(`p`,H,`Noch keine.`))]),e.suggested.length?(h(),u(`section`,U,[b[7]||=d(`h2`,{class:`ih:text-sm ih:font-semibold`},`Vorschläge`,-1),(h(!0),u(s,null,_(e.suggested,e=>(h(),c(r,{key:e.id,group:e},null,8,[`group`]))),128))])):l(``,!0)])]),p(o,{open:Y.value,"onUpdate:open":b[1]||=e=>Y.value=e,privacy:e.privacy,"privacy-hints":e.privacyHints},null,8,[`open`,`privacy`,`privacy-hints`])]),_:1}))}};export{W as default};