Herzen und Kommentare schon in der Vorschau (0.44.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m4s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 7m25s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 8m3s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m26s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 9m49s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 9m1s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m41s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 45s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m6s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m4s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 7m25s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 8m3s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m26s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 9m49s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 9m1s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 8m41s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 45s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m6s
- NewsPost::withStats: Herzen (Anzahl, eigenes) und Kommentare (Anzahl) für alle Vorschau-Abfragen: Übersicht, Widgets, Slider, Block, Profil, „Weitere Beiträge“, API - NewsPostResource: „comments“ (null bei ausgeschalteten Kommentaren) - NewsStats.vue in Karte, Listeneintrag, Block-Layouts, Slider und Seitenleiste Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
60dd200300
commit
21307fc953
145 changed files with 471 additions and 358 deletions
|
|
@ -6,6 +6,7 @@ import CategoryLabel from '../components/CategoryLabel.vue';
|
|||
import NewsCard from '../components/NewsCard.vue';
|
||||
import NewsImage from '../components/NewsImage.vue';
|
||||
import NewsListItem from '../components/NewsListItem.vue';
|
||||
import NewsStats from '../components/NewsStats.vue';
|
||||
import { formatShortDate } from '@/lib/format';
|
||||
|
||||
/**
|
||||
|
|
@ -38,7 +39,10 @@ const moreLabel = computed(() => props.block.data.more_label ?? 'Alle anzeigen')
|
|||
<CategoryLabel :category="post.category" />
|
||||
<h4 class="mt-1 line-clamp-2 text-base leading-snug font-semibold group-hover:underline">{{ post.title }}</h4>
|
||||
<p v-if="post.teaser" class="mt-1 line-clamp-2 text-[13px] text-muted-foreground">{{ post.teaser }}</p>
|
||||
<p class="mt-1.5 text-xs text-muted-foreground">{{ formatShortDate(post.published_at) }}</p>
|
||||
<p class="mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground">
|
||||
{{ formatShortDate(post.published_at) }}
|
||||
<NewsStats :post="post" />
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
|
|
@ -51,6 +55,10 @@ const moreLabel = computed(() => props.block.data.more_label ?? 'Alle anzeigen')
|
|||
<CategoryLabel :category="posts[0].category" />
|
||||
<h4 class="mt-1 line-clamp-2 text-lg leading-snug font-semibold group-hover:underline">{{ posts[0].title }}</h4>
|
||||
<p v-if="posts[0].teaser" class="mt-1 line-clamp-3 text-sm text-muted-foreground">{{ posts[0].teaser }}</p>
|
||||
<p class="mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground">
|
||||
{{ formatShortDate(posts[0].published_at) }}
|
||||
<NewsStats :post="posts[0]" />
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
<div v-if="posts.length > 1" class="divide-y border-t">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import NewsStats from './NewsStats.vue';
|
||||
import { ArrowRight, ChevronLeft, ChevronRight, Pause, Play } from '@lucide/vue';
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -66,6 +67,7 @@ onBeforeUnmount(stop);
|
|||
</span>
|
||||
<h2 class="text-2xl leading-tight font-semibold tracking-tight sm:text-[32px]">{{ current.title }}</h2>
|
||||
<p v-if="current.teaser" class="mt-3 line-clamp-3 hidden text-[15px] text-white/85 sm:block">{{ current.teaser }}</p>
|
||||
<NewsStats v-if="current.likes || current.comments" :post="current" light class="mt-3" />
|
||||
<Link
|
||||
:href="`/neuigkeiten/${current.slug}`"
|
||||
class="mt-5 inline-flex w-fit items-center gap-2 rounded-md bg-brand px-4 py-2.5 text-sm font-medium text-brand-foreground transition-colors hover:bg-brand-700"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<script setup>
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { Heart } from '@lucide/vue';
|
||||
import CategoryLabel from './CategoryLabel.vue';
|
||||
import NewsImage from './NewsImage.vue';
|
||||
import NewsStats from './NewsStats.vue';
|
||||
import { formatShortDate } from '@/lib/format';
|
||||
|
||||
defineProps({
|
||||
|
|
@ -19,7 +19,7 @@ defineProps({
|
|||
<p v-if="post.teaser" class="mt-1.5 line-clamp-2 text-[13px] text-muted-foreground">{{ post.teaser }}</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>
|
||||
<NewsStats :post="post" class="ml-auto" />
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
import { Link } from '@inertiajs/vue3';
|
||||
import CategoryLabel from './CategoryLabel.vue';
|
||||
import NewsImage from './NewsImage.vue';
|
||||
import NewsStats from './NewsStats.vue';
|
||||
import { formatRelative } from '@/lib/format';
|
||||
|
||||
defineProps({
|
||||
|
|
@ -12,10 +13,13 @@ defineProps({
|
|||
<template>
|
||||
<Link :href="`/neuigkeiten/${post.slug}`" class="group flex gap-4 py-3">
|
||||
<NewsImage :src="post.thumb_url" :alt="post.title" class="w-28 shrink-0 rounded-md sm:w-32" />
|
||||
<div class="min-w-0">
|
||||
<div class="min-w-0 flex-1">
|
||||
<CategoryLabel :category="post.category" />
|
||||
<h3 class="mt-0.5 line-clamp-2 text-sm leading-snug font-semibold group-hover:underline">{{ post.title }}</h3>
|
||||
<p class="mt-1 text-xs text-muted-foreground">{{ formatRelative(post.published_at) }}</p>
|
||||
<p class="mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground">
|
||||
{{ formatRelative(post.published_at) }}
|
||||
<NewsStats :post="post" />
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</template>
|
||||
|
|
|
|||
42
plugins-core/news/resources/js/components/NewsStats.vue
Normal file
42
plugins-core/news/resources/js/components/NewsStats.vue
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<script setup>
|
||||
import { Heart, MessageCircle } from '@lucide/vue';
|
||||
import { computed } from 'vue';
|
||||
|
||||
/**
|
||||
* Herzen und Kommentare eines Beitrags – schon in der Vorschau sichtbar.
|
||||
* Kommentare fehlen, wenn sie für den Beitrag ausgeschaltet sind (comments = null).
|
||||
*/
|
||||
const props = defineProps({
|
||||
post: { type: Object, required: true },
|
||||
light: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const hasLikes = computed(() => typeof props.post.likes === 'number');
|
||||
const hasComments = computed(() => typeof props.post.comments === 'number');
|
||||
const label = computed(() =>
|
||||
[
|
||||
hasLikes.value ? `${props.post.likes} ${props.post.likes === 1 ? 'Herz' : 'Herzen'}` : null,
|
||||
hasComments.value ? `${props.post.comments} ${props.post.comments === 1 ? 'Kommentar' : 'Kommentare'}` : null,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(', '),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span
|
||||
v-if="hasLikes || hasComments"
|
||||
class="inline-flex items-center gap-3 text-xs tabular-nums"
|
||||
:class="light ? 'text-white/85' : 'text-muted-foreground'"
|
||||
role="img"
|
||||
:aria-label="label"
|
||||
:title="label"
|
||||
>
|
||||
<span v-if="hasLikes" class="inline-flex items-center gap-1">
|
||||
<Heart class="size-3.5" :class="post.liked ? (light ? 'fill-current' : 'fill-current text-brand-text') : ''" aria-hidden="true" />{{ post.likes }}
|
||||
</span>
|
||||
<span v-if="hasComments" class="inline-flex items-center gap-1">
|
||||
<MessageCircle class="size-3.5" aria-hidden="true" />{{ post.comments }}
|
||||
</span>
|
||||
</span>
|
||||
</template>
|
||||
|
|
@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button';
|
|||
import EasyLanguageBar from '@/components/EasyLanguageBar.vue';
|
||||
import PersonAvatar from '@/components/PersonAvatar.vue';
|
||||
import NewsComments from '../components/NewsComments.vue';
|
||||
import NewsStats from '../components/NewsStats.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
import PageContent from '@/pagebuilder/PageContent.vue';
|
||||
import { formatDate, formatShortDate } from '@/lib/format';
|
||||
|
|
@ -220,7 +221,7 @@ const mailLink = () => `mailto:?subject=${encodeURIComponent(props.post.title)}&
|
|||
<span class="min-w-0">
|
||||
<span v-if="item.category" class="block text-[10px] font-semibold tracking-wider text-accent2-text uppercase">{{ item.category.name }}</span>
|
||||
<span class="line-clamp-2 text-sm leading-snug font-medium group-hover:underline">{{ item.title }}</span>
|
||||
<span class="block text-xs text-muted-foreground">{{ formatShortDate(item.published_at) }}</span>
|
||||
<span class="flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground">{{ formatShortDate(item.published_at) }} <NewsStats :post="item" /></span>
|
||||
</span>
|
||||
</Link>
|
||||
</li>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue