Date: Tue, 30 Sep 2025 06:59:47 +0300
Subject: [PATCH 6/7] =?UTF-8?q?=D0=92=D0=B8=D0=B4=D0=B6=D0=B5=D1=82=20?=
=?UTF-8?q?=D0=B4=D0=B0=D1=82=D1=8B=20=D0=BF=D1=83=D0=B1=D0=BB=D0=B8=D0=BA?=
=?UTF-8?q?=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B8=D0=BB=D0=B8=20=D0=BE=D0=B1?=
=?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/lib/components/DateWidget.svelte | 32 ++++++++++++++++++++++++++++
src/routes/blog/[slug]/+page.svelte | 29 +++++--------------------
2 files changed, 37 insertions(+), 24 deletions(-)
create mode 100644 src/lib/components/DateWidget.svelte
diff --git a/src/lib/components/DateWidget.svelte b/src/lib/components/DateWidget.svelte
new file mode 100644
index 0000000..337868d
--- /dev/null
+++ b/src/lib/components/DateWidget.svelte
@@ -0,0 +1,32 @@
+
+
+
+
+
+ {dateString
+ ? new Date(dateString).toLocaleString(undefined, {
+ month: 'short',
+ day: 'numeric',
+ year: 'numeric'
+ })
+ : 'Не опубликован!'}
+
+
diff --git a/src/routes/blog/[slug]/+page.svelte b/src/routes/blog/[slug]/+page.svelte
index dbd0f2d..0ac6d22 100644
--- a/src/routes/blog/[slug]/+page.svelte
+++ b/src/routes/blog/[slug]/+page.svelte
@@ -1,5 +1,6 @@
@@ -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;