From 2e99b04261f3d64edf2558b8d8e450a99a2fd68b Mon Sep 17 00:00:00 2001 From: Ivan Kuzmenko <6745157+rndtrash@users.noreply.github.com> Date: Tue, 30 Sep 2025 07:11:32 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D1=81=D0=B2=D0=B5=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D1=81=D0=B2=D0=B5=D0=B6=D0=B8=D1=85=20=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=20=D0=BD=D0=B5=D0=B4=D0=B0=D0=B2=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D1=91=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D1=85=20=D0=BF=D0=BE=D1=81=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/components/BlogCard.svelte | 73 ++++++++++++++++++++++++------ src/lib/util/Blogs.ts | 1 + 2 files changed, 59 insertions(+), 15 deletions(-) diff --git a/src/lib/components/BlogCard.svelte b/src/lib/components/BlogCard.svelte index 161d579..1d31599 100644 --- a/src/lib/components/BlogCard.svelte +++ b/src/lib/components/BlogCard.svelte @@ -7,13 +7,21 @@ @@ -58,19 +69,31 @@ alt={post.thumbnailAlt ?? 'Миниатюра поста'} /> {/if} + {#if isPostFresh} +
+ {#if isPostUpdated} + ОБНОВЛЕНО + {:else} + НОВОЕ + {/if} +
+ {/if}
-
-
- -

- {new Date(post.date!).toLocaleString('default', { - month: 'short', - day: 'numeric', - year: 'numeric' - })} -

-
+
+ + {#if post.dateChanged} + + {/if}

{post.title}

@@ -87,6 +110,26 @@ .blog-card { @apply flex w-full max-w-5xl overflow-hidden rounded-lg bg-slate-100 text-slate-950 drop-shadow-xl transition-all hover:drop-shadow-2xl; + .toast { + @apply absolute top-0 right-0 rounded-bl-lg p-2 font-bold text-slate-50; + } + + &.updated { + box-shadow: 0 0 0 4px var(--color-purple-600); + + .toast { + @apply bg-purple-600; + } + } + + &.new { + box-shadow: 0 0 0 4px var(--color-amber-600); + + .toast { + @apply bg-amber-600; + } + } + img.thumbnail { @apply absolute h-full w-full object-cover transition-transform; diff --git a/src/lib/util/Blogs.ts b/src/lib/util/Blogs.ts index a45ceaa..47939b5 100644 --- a/src/lib/util/Blogs.ts +++ b/src/lib/util/Blogs.ts @@ -1,6 +1,7 @@ import path from 'path'; export const THUMBNAIL_DEFAULT = "https://teasanctuary.ru/common/background-day.webp"; +export const BLOG_POST_FRESHNESS_MILLIS = 3 * 24 * 60 * 60 * 1000; // 3 дня export type PostComparer = (a: App.BlogPost, b: App.BlogPost) => number;