inhaus-plugin-gruppen/resources/js/pages/Post.vue
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

40 lines
2 KiB
Vue
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.

<script setup>
import { onMounted } from 'vue';
import { Link, router } from '@inertiajs/vue3';
import { ChevronLeft, Flag } from '@lucide/vue';
import { AppLayout, Button, 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);
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}`">
<div class="ih:mx-auto ih:grid ih:max-w-2xl ih:gap-4">
<Link :href="group.url" class="ih:inline-flex ih:items-center ih:gap-1 ih:text-sm ih:font-medium ih:text-muted-foreground ih:hover:text-foreground"><ChevronLeft class="ih:size-4" /> {{ group.name }}</Link>
<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>