From fd57b35c9b33041146de40364e578992452de2ae Mon Sep 17 00:00:00 2001 From: Carter McBride <18412686+carterworks@users.noreply.github.com> Date: Wed, 19 Jun 2024 12:13:20 -0600 Subject: [PATCH] Make it sepia and highlight stories from the past 24 hours (#4) * Make it sepia * Change page title and remove sponsor link * Revert styling for error messages * Hightlight new content --- config/template.html | 12 +++++----- public/style.css | 53 +++++++++++++++++++++++++++++++------------- src/@types/bubo.d.ts | 2 +- src/index.ts | 6 +++++ 4 files changed, 51 insertions(+), 22 deletions(-) diff --git a/config/template.html b/config/template.html index a168f12..6e86983 100644 --- a/config/template.html +++ b/config/template.html @@ -5,12 +5,12 @@ - 🦉 Bubo Reader + 📰 Carter's RSS Feeds -

🦉 Bubo Reader

+

📰 Carter's RSS Feeds

{% for group, feeds in data %}

{{ group }}

@@ -22,9 +22,10 @@ @@ -46,7 +47,6 @@ Powered by Bubo Reader (v{{ info.version }}), a project by George Mandis. ❤️ - Sponsor on GitHub

diff --git a/public/style.css b/public/style.css index c6db2e2..9ea2d7e 100644 --- a/public/style.css +++ b/public/style.css @@ -1,28 +1,51 @@ +:root { + --color-bg: oklch(97.1% 0.024 88.23); + --color-hover: oklch(94.48% 0.024 88.23); + --color-text: oklch(24.74% 0.024 88.23); + --color-new: oklch(94.48% 0.024 38.23); +} + body { font-family: system-ui; font-size: 18px; + background: var(--color-bg); + color: var(--color-text); } - - -details:focus, -details:focus-within, -details:hover { - /* background:#ffeb3b; */ - /* outline:2px #000 solid; */ -} - - -details ul li {} - summary { cursor: pointer; } -summary:hover { - opacity: .75; +summary, +details li { + padding: 0.5em; + border-radius: 12px; + margin-block-start: 4px; + transition: background cubic-bezier(0.39, 0.575, 0.565, 1) 0.2s; +} + +summary:hover, +details li:hover { + background: var(--color-hover) +} + +details:has(li.has-recent) { + + summary, + li.has-recent { + background: var(--color-new); + } } .feed-url { color: #aaa; -} \ No newline at end of file +} + +.article-timestamp { + font-size: 0.75em; +} + +details ul { + list-style-type: none; + margin: 0; +} diff --git a/src/@types/bubo.d.ts b/src/@types/bubo.d.ts index 1d53a24..85dc9a5 100644 --- a/src/@types/bubo.d.ts +++ b/src/@types/bubo.d.ts @@ -2,7 +2,7 @@ export interface Feeds { [key: string]: object[]; } export interface FeedItem { - [key: string]: string | number | Date | FeedItem[]; + [key: string]: string | number | Date | boolean | FeedItem[]; items: FeedItem[]; } diff --git a/src/index.ts b/src/index.ts index 4bf6f82..1aa3e3b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -124,8 +124,14 @@ const processFeed = item.timestamp = getTimestamp(item); item.title = getTitle(item); item.link = getLink(item); + const timestamp = new Date(Number.parseInt(item.timestamp)); + const yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); + item.isRecent = timestamp > yesterday; } + contents.hasRecent = contents.items.some((item) => item.isRecent); + contentFromAllFeeds[group].push(contents as object); process.stdout.write( `${success("Successfully fetched:")} ${feed} - ${benchmark(startTime)}\n`,