Herzen, Reichweite und App-Anbindung (0.30.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 6m10s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 6m3s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 7m33s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 7m25s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m28s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 7m27s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m26s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m27s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 44s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m12s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 6m10s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 6m3s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 7m33s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 7m25s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m28s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 7m27s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m26s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m27s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 44s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m12s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d9fcc7a9b4
commit
b3e2b525e1
161 changed files with 1249 additions and 342 deletions
|
|
@ -1,5 +1,6 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { Heart } from '@lucide/vue';
|
||||
import CategoryLabel from './CategoryLabel.vue';
|
||||
import NewsImage from './NewsImage.vue';
|
||||
import { formatShortDate } from '@/lib/format';
|
||||
|
|
@ -16,7 +17,10 @@ defineProps({
|
|||
<CategoryLabel :category="post.category" />
|
||||
<h3 class="mt-1 line-clamp-2 text-[15px] leading-snug font-semibold group-hover:underline">{{ post.title }}</h3>
|
||||
<p v-if="post.teaser" class="mt-1.5 line-clamp-2 text-[13px] text-muted-foreground">{{ post.teaser }}</p>
|
||||
<p class="mt-auto pt-3 text-xs text-muted-foreground">{{ formatShortDate(post.published_at) }} · {{ post.reading_minutes }} Min.</p>
|
||||
<p class="mt-auto flex items-center gap-1 pt-3 text-xs text-muted-foreground">
|
||||
{{ formatShortDate(post.published_at) }} · {{ post.reading_minutes }} Min.
|
||||
<span v-if="post.likes" class="ml-auto inline-flex items-center gap-1 tabular-nums" :title="`${post.likes} ${post.likes === 1 ? 'Herz' : 'Herzen'}`"><Heart class="size-3.5" :class="post.liked ? 'fill-current text-brand-text' : ''" /> {{ post.likes }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { MessageSquareWarning, Plus } from '@lucide/vue';
|
||||
import { Eye, Heart, MessageSquareWarning, Plus } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import Panel from '@/components/Panel.vue';
|
||||
import { formatRelative } from '@/lib/format';
|
||||
|
|
@ -46,6 +46,10 @@ const badge = (post) => ({
|
|||
<template v-if="post.date"> · {{ formatRelative(post.date) }}</template>
|
||||
</p>
|
||||
</div>
|
||||
<span v-if="post.readers !== undefined" class="flex shrink-0 items-center gap-2.5 text-xs text-muted-foreground tabular-nums">
|
||||
<span class="inline-flex items-center gap-1" title="Gelesen (anonym gezählt)"><Eye class="size-3.5" /> {{ post.readers }}</span>
|
||||
<span class="inline-flex items-center gap-1" title="Herzen"><Heart class="size-3.5" /> {{ post.likes }}</span>
|
||||
</span>
|
||||
<MessageSquareWarning v-if="post.review_note" class="size-4 shrink-0 text-amber-600" title="Mit Anmerkung zurückgegeben" />
|
||||
<span class="shrink-0 rounded px-1.5 py-0.5 text-[11px] font-medium" :class="badge(post)">{{ post.status_label }}</span>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Link, router } from '@inertiajs/vue3';
|
||||
import { useWindowScroll } from '@vueuse/core';
|
||||
import { ArrowLeft, CalendarDays, Check, Clock, Link2, Mail, MessageCircle, PenLine } from '@lucide/vue';
|
||||
import { ArrowLeft, CalendarDays, ChartNoAxesColumn, Check, Clock, Heart, Link2, Mail, MessageCircle, PenLine } from '@lucide/vue';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import NewsComments from '../components/NewsComments.vue';
|
||||
|
|
@ -17,8 +17,34 @@ const props = defineProps({
|
|||
form: { type: Object, default: null },
|
||||
content: { type: Object, default: null },
|
||||
comments: { type: Object, default: null },
|
||||
reach: { type: Object, default: null },
|
||||
});
|
||||
|
||||
// Herz: sofort umschalten, der Server bestätigt im Hintergrund
|
||||
const liked = ref(!!props.post.liked);
|
||||
const likes = ref(props.post.likes ?? 0);
|
||||
watch(() => [props.post.liked, props.post.likes], ([l, n]) => {
|
||||
liked.value = !!l;
|
||||
likes.value = n ?? 0;
|
||||
});
|
||||
function toggleLike() {
|
||||
const next = !liked.value;
|
||||
liked.value = next;
|
||||
likes.value += next ? 1 : -1;
|
||||
router.visit(`/neuigkeiten/${props.post.slug}/herz`, {
|
||||
method: next ? 'post' : 'delete',
|
||||
preserveScroll: true,
|
||||
preserveState: true,
|
||||
onError: () => {
|
||||
liked.value = !next;
|
||||
likes.value += next ? -1 : 1;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const maxDay = computed(() => Math.max(1, ...(props.reach?.days ?? []).map((d) => d.readers)));
|
||||
const showLikers = ref(false);
|
||||
|
||||
// Lesefortschritt: Anteil des Artikels, der schon oben aus dem Bild gescrollt ist
|
||||
const article = ref(null);
|
||||
const progress = ref(0);
|
||||
|
|
@ -80,6 +106,7 @@ const mailLink = () => `mailto:?subject=${encodeURIComponent(props.post.title)}&
|
|||
<div class="mt-2 flex flex-wrap items-center gap-x-5 gap-y-2 text-sm text-white/80">
|
||||
<span class="inline-flex items-center gap-1.5"><CalendarDays class="size-4" /> {{ formatDate(post.published_at) }}</span>
|
||||
<span class="inline-flex items-center gap-1.5"><Clock class="size-4" /> {{ post.reading_minutes }} Min. Lesezeit</span>
|
||||
<span v-if="likes" class="inline-flex items-center gap-1.5"><Heart class="size-4" /> {{ likes }}</span>
|
||||
<a v-if="comments?.count" href="#kommentare" class="inline-flex items-center gap-1.5 hover:text-white"><MessageCircle class="size-4" /> {{ comments.count }} {{ comments.count === 1 ? 'Kommentar' : 'Kommentare' }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -110,7 +137,17 @@ const mailLink = () => `mailto:?subject=${encodeURIComponent(props.post.title)}&
|
|||
<PageContent v-if="form" :content="form" class="mt-10" />
|
||||
|
||||
<footer class="mt-10 flex flex-wrap items-center gap-2 border-t pt-6">
|
||||
<span class="mr-2 text-sm text-muted-foreground">Beitrag teilen:</span>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
:aria-pressed="liked"
|
||||
:class="liked ? 'border-brand/40 bg-brand-soft text-brand-text hover:bg-brand-soft hover:text-brand-text' : ''"
|
||||
@click="toggleLike"
|
||||
>
|
||||
<Heart :class="liked ? 'fill-current' : ''" />
|
||||
{{ liked ? 'Gefällt mir' : 'Herz geben' }}<span v-if="likes" class="tabular-nums"> · {{ likes }}</span>
|
||||
</Button>
|
||||
<span class="mr-2 ml-auto text-sm text-muted-foreground max-sm:ml-0">Beitrag teilen:</span>
|
||||
<Button variant="outline" size="sm" @click="copyLink">
|
||||
<component :is="copied ? Check : Link2" /> {{ copied ? 'Link kopiert' : 'Link kopieren' }}
|
||||
</Button>
|
||||
|
|
@ -133,6 +170,35 @@ const mailLink = () => `mailto:?subject=${encodeURIComponent(props.post.title)}&
|
|||
</Link>
|
||||
</section>
|
||||
|
||||
<!-- Reichweite: nur für die Redaktion der Kategorie -->
|
||||
<section v-if="reach" class="rounded-xl border bg-card p-5 shadow-xs">
|
||||
<h2 class="mb-3 flex items-center gap-1.5 text-xs font-semibold tracking-wider text-muted-foreground uppercase"><ChartNoAxesColumn class="size-3.5" /> Reichweite</h2>
|
||||
<dl class="grid grid-cols-3 gap-3 text-center">
|
||||
<div><dt class="text-[11px] text-muted-foreground">Gelesen</dt><dd class="text-xl font-semibold tabular-nums">{{ reach.readers }}</dd></div>
|
||||
<div><dt class="text-[11px] text-muted-foreground">der Belegschaft</dt><dd class="text-xl font-semibold tabular-nums">{{ reach.share }} %</dd></div>
|
||||
<div><dt class="text-[11px] text-muted-foreground">Herzen</dt><dd class="text-xl font-semibold tabular-nums">{{ reach.likes }}</dd></div>
|
||||
</dl>
|
||||
<div v-if="reach.days.length > 1" class="mt-4">
|
||||
<div class="flex h-16 items-end gap-0.5" role="img" :aria-label="`Lesende je Tag in den ersten ${reach.days.length} Tagen`">
|
||||
<div
|
||||
v-for="day in reach.days"
|
||||
:key="day.date"
|
||||
class="flex-1 rounded-t-sm bg-brand/70"
|
||||
:style="{ height: `${Math.max(4, (day.readers / maxDay) * 100)}%` }"
|
||||
:title="`${formatShortDate(day.date)}: ${day.readers}`"
|
||||
/>
|
||||
</div>
|
||||
<p class="mt-1 text-[11px] text-muted-foreground">Lesende je Tag seit Veröffentlichung</p>
|
||||
</div>
|
||||
<div v-if="reach.likers.length" class="mt-4 border-t pt-3">
|
||||
<button type="button" class="text-[13px] font-medium text-brand-text hover:underline" @click="showLikers = !showLikers">
|
||||
{{ showLikers ? 'Ausblenden' : 'Wer hat ein Herz gegeben?' }}
|
||||
</button>
|
||||
<p v-if="showLikers" class="mt-2 text-[13px] leading-relaxed text-muted-foreground">{{ reach.likers.join(', ') }}</p>
|
||||
</div>
|
||||
<p class="mt-3 text-[11px] leading-snug text-muted-foreground">Gezählt wird anonym: jede Person einmal, ohne festzuhalten, wer gelesen hat.</p>
|
||||
</section>
|
||||
|
||||
<section v-if="related.data.length" class="rounded-xl border bg-card p-5 shadow-xs lg:sticky lg:top-20">
|
||||
<h2 class="mb-3 text-xs font-semibold tracking-wider text-muted-foreground uppercase">Weitere Beiträge</h2>
|
||||
<ul class="grid gap-1">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue