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
This commit is contained in:
Carter McBride 2024-06-19 12:13:20 -06:00 committed by GitHub
parent 3984c01a45
commit fd57b35c9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 51 additions and 22 deletions

View file

@ -5,12 +5,12 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>🦉 Bubo Reader</title> <title>📰 Carter's RSS Feeds</title>
<link rel="stylesheet" href="/style.css" /> <link rel="stylesheet" href="/style.css" />
</head> </head>
<body> <body>
<h1>🦉 Bubo Reader</h1> <h1>📰 Carter's RSS Feeds</h1>
{% for group, feeds in data %} {% for group, feeds in data %}
<h2>{{ group }}</h2> <h2>{{ group }}</h2>
@ -22,9 +22,10 @@
</summary> </summary>
<ul> <ul>
{% for item in feed.items %} {% for item in feed.items %}
<li> <li class="{% if item.isRecent %}has-recent{% endif %}">
{{ item.timestamp | formatDate }} @ {{ item.timestamp | formatTime }}— <div><a class="article-title" href="{{ item.link }}" target="_blank" rel="noopener norefferer nofollow">{{
<a href="{{ item.link }}" target="_blank" rel="noopener norefferer nofollow">{{ item.title }}</a> item.title }}</a>
<div class="article-timestamp">{{ item.timestamp | formatDate }}, {{ item.timestamp | formatTime }}</div>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -46,7 +47,6 @@
Powered by Powered by
<a href="https://github.com/georgemandis/bubo-rss">Bubo Reader (v{{ info.version }})</a>, a project by <a <a href="https://github.com/georgemandis/bubo-rss">Bubo Reader (v{{ info.version }})</a>, a project by <a
href="https://george.mand.is">George Mandis</a>. ❤️ href="https://george.mand.is">George Mandis</a>. ❤️
<a href="{{ info.funding.url }}">Sponsor on GitHub</a>
</p> </p>
</body> </body>

View file

@ -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 { body {
font-family: system-ui; font-family: system-ui;
font-size: 18px; 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 { summary {
cursor: pointer; cursor: pointer;
} }
summary:hover { summary,
opacity: .75; 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 { .feed-url {
color: #aaa; color: #aaa;
} }
.article-timestamp {
font-size: 0.75em;
}
details ul {
list-style-type: none;
margin: 0;
}

View file

@ -2,7 +2,7 @@ export interface Feeds {
[key: string]: object[]; [key: string]: object[];
} }
export interface FeedItem { export interface FeedItem {
[key: string]: string | number | Date | FeedItem[]; [key: string]: string | number | Date | boolean | FeedItem[];
items: FeedItem[]; items: FeedItem[];
} }

View file

@ -124,8 +124,14 @@ const processFeed =
item.timestamp = getTimestamp(item); item.timestamp = getTimestamp(item);
item.title = getTitle(item); item.title = getTitle(item);
item.link = getLink(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); contentFromAllFeeds[group].push(contents as object);
process.stdout.write( process.stdout.write(
`${success("Successfully fetched:")} ${feed} - ${benchmark(startTime)}\n`, `${success("Successfully fetched:")} ${feed} - ${benchmark(startTime)}\n`,