inhaus-plugin-gruppen/resources/js/pages/Post.vue
2026-09-29 05:37:33 +00:00

40 lines
1.9 KiB
Vue
Raw Permalink 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.

<script setup>
import { onMounted } from 'vue';
import { router } from '@inertiajs/vue3';
import { Flag } from '@lucide/vue';
import { AppLayout, Button, PageHeader, http, toast } from '@inhaus/ui';
import PostCard from '../components/PostCard.vue';
const props = defineProps({
group: { type: Object, required: true },
post: { type: Object, required: true },
comments: { type: Array, required: true },
reactions: { type: Array, required: true },
reports: { type: Array, default: () => [] },
});
onMounted(() => {
const target = location.hash ? document.querySelector(location.hash) : null;
target?.scrollIntoView({ block: 'center' });
});
async function resolve() {
await http.post(`/gruppen/beitraege/${props.post.id}/meldungen-erledigt`);
toast.success('Meldungen erledigt');
router.reload();
}
</script>
<template>
<AppLayout :title="`Beitrag in ${group.name}`" width="medium">
<PageHeader title="Beitrag" :breadcrumbs="[{ label: 'Gruppen', href: '/gruppen' }, { label: group.name, href: group.url }]" />
<div class="ih:mx-auto ih:grid ih:max-w-4xl ih:gap-4">
<div v-if="reports.length" class="ih:rounded-md ih:border ih:border-destructive/30 ih:bg-destructive/5 ih:p-3 ih:text-sm">
<p class="ih:flex ih:items-center ih:gap-2 ih:font-medium"><Flag class="ih:size-4 ih:text-destructive" /> {{ reports.length }} {{ reports.length === 1 ? 'Meldung' : 'Meldungen' }}</p>
<ul class="ih:mt-1 ih:list-disc ih:pl-6 ih:text-muted-foreground"><li v-for="r in reports" :key="r.id">{{ r.comment_id ? 'Kommentar: ' : '' }}{{ r.reason }}</li></ul>
<Button size="sm" variant="outline" class="ih:mt-2" @click="resolve">In Ordnung – erledigt</Button>
</div>
<PostCard :post="post" :reactions="reactions" :full-comments="comments" @deleted="router.visit(group.url)" />
</div>
</AppLayout>
</template>