fix: news frontend

This commit is contained in:
DecDuck
2025-03-10 12:05:10 +11:00
parent b6f52f660a
commit 1eede0f035
7 changed files with 53 additions and 62 deletions

View File

@@ -37,10 +37,10 @@
</div>
<div>
<label for="excerpt" class="block text-sm font-medium text-zinc-400">Excerpt</label>
<label for="excerpt" class="block text-sm font-medium text-zinc-400">Exercept</label>
<input
id="excerpt"
v-model="newArticle.excerpt"
v-model="newArticle.description"
type="text"
class="mt-1 block w-full rounded-md bg-zinc-900 border-zinc-700 text-zinc-100 shadow-sm focus:border-primary-500 focus:ring-primary-500"
required
@@ -171,7 +171,7 @@ const newTagInput = ref('');
const newArticle = ref({
title: '',
excerpt: '',
description: '',
content: '',
image: '',
tags: [] as string[]
@@ -290,7 +290,7 @@ const createArticle = async () => {
// Reset form
newArticle.value = {
title: '',
excerpt: '',
description: '',
content: '',
image: '',
tags: []

View File

@@ -87,7 +87,7 @@
</div>
<h3 class="relative text-sm font-medium text-zinc-100">{{ article.title }}</h3>
<p class="relative mt-1 text-xs text-zinc-400 line-clamp-2" v-html="formatExcerpt(article.excerpt)"></p>
<p class="relative mt-1 text-xs text-zinc-400 line-clamp-2" v-html="formatExcerpt(article.description)"></p>
<div class="relative mt-2 flex items-center gap-x-2 text-xs text-zinc-500">
<time :datetime="article.publishedAt">{{ formatDate(article.publishedAt) }}</time>
</div>
@@ -115,7 +115,7 @@ const availableTags = computed(() => {
if (!articles.value) return [];
const tags = new Set<string>();
articles.value.forEach(article => {
article.tags.forEach(tag => tags.add(tag));
article.tags.forEach(tag => tags.add(tag.name));
});
return Array.from(tags);
});
@@ -151,7 +151,7 @@ const filteredArticles = computed(() => {
return articles.value.filter((article) => {
const matchesSearch =
article.title.toLowerCase().includes(searchQuery.value.toLowerCase()) ||
article.excerpt.toLowerCase().includes(searchQuery.value.toLowerCase());
article.description.toLowerCase().includes(searchQuery.value.toLowerCase());
const articleDate = new Date(article.publishedAt);
const now = new Date();
@@ -175,7 +175,7 @@ const filteredArticles = computed(() => {
}
const matchesTags = selectedTags.value.length === 0 ||
selectedTags.value.every(tag => article.tags.includes(tag));
selectedTags.value.every(tag => article.tags.find((e) => e.name == tag));
return matchesSearch && matchesDate && matchesTags;
});