Compare commits

..

4 Commits

Author SHA1 Message Date
Harwinder Sekhon 89d0dcc67c Add BBC News RSS feed (source bbc, BBC red accent) 2026-10-16 15:57:43 -04:00
Harwinder Sekhon 3c2d90fb7e Stream the page shell first so a loader shows while feeds fetch
Opening the page used to block on refreshStale() before a single byte went
out, so the browser sat on a blank tab for the whole fetch. index.php now
renders templates/shell.php (head, header, filters, skeleton loader) and
flushes it, then refreshes and appends templates/content.php, which removes
the loader as the feed HTML arrives.

- templates/layout.php is split into shell.php + content.php
- refresh chip moved to a right-aligned row above the feed: the toolbar
  paints before the refresh report exists
- header story count shows the cached total, then corrects to the real one
- skeleton styles match the card grid and keep the sources' chroma; a
  noscript style hides the loader for clients without JS
- README: file map and page-load lifecycle updated
2026-10-08 15:28:51 -04:00
Harwinder Sekhon 20f4fd7095 Redesign UI color system: neutral ink chrome, sources own the chroma
The light lavender theme carried its color in decoration -- four colored
background blobs, a conic-gradient brand mark, gradient-clipped wordmark,
a four-color animated button, a spinning conic empty mark, and a five-color
spectrum rail. All of that competed with the only color on screen that
carries meaning: which source a story came from.

- One indigo-slate ink ramp (bg / surface / line / ink) carries every neutral
  surface; the only saturated hues are the three sources, used strictly as
  signals -- filter pill, card spine, source chip, timestamp, feed health.
- Rule for every filled state: bright fill, deep ink type. Source tokens kept
  in sync between :root and View::sourceColor().
- Signature "signal bars": a CSS brand mark of three ascending bars in the
  source hues, and the header rail re-cut into three wire segments that double
  as the palette legend. The empty state reuses the mark, unlit and static.
- Bootstrap switched to data-bs-theme="dark" with matching form controls,
  alerts, and focus rings; --ink-faint recalibrated so small text clears
  WCAG 4.5:1 on every surface. Reduced-motion behavior unchanged.
- README documents the two rules next to View::sourceColor().
2026-10-08 11:59:01 -04:00
Harwinder Sekhon aa31507ff5 Fix manage page Dashboard link pointing back to itself
"<- Dashboard" used href="?", which resolves to the current path with an
empty query -- manage.php -- so it reloaded the manage page instead of
returning to the feed. Point it at index.php.
2026-10-08 11:57:09 -04:00
8 changed files with 445 additions and 209 deletions
+29 -5
View File
@@ -19,6 +19,9 @@ No framework, no build step. PHP + SQLite for caching, Bootstrap 5 for the UI.
selection** from the browser (`manage.php`, password protected): add
channels by `@handle`, disable or remove feeds — no config editing needed.
- Paginates with a **"Load more stories"** button (AJAX, 20 per page).
- Streams the page shell (header, filters and a skeleton loader) to the browser
**before** the feeds are fetched, so something paints within milliseconds on
every open.
- Caches everything in **SQLite** so page loads never wait on the network; feeds
are refreshed on demand when stale (default TTL 30 min).
@@ -217,13 +220,16 @@ index.php api/items.php
FeedService::page(source, page, pageSize, since) ← read path
└─ FeedRepository::getItems()/countItems() SQL over the SQLite cache
│
└─ View::render('layout' | 'cards') server-rendered HTML
└─ View::render('cards') server-rendered HTML
(api/items.php returns that HTML inside a JSON envelope)
```
**Request lifecycle (page load):** bootstrap → refresh stale feeds → validate
`source`/`range` → query one page → render `templates/layout.php` which includes
`templates/cards.php`.
**Request lifecycle (page load):** bootstrap → sync configured feeds → render
`templates/shell.php` (head, header, filters, skeleton loader) and **flush it**
→ refresh stale feeds → query one page → append the rendered
`templates/content.php` (which includes `templates/cards.php`) and drop the
loader. The shell paints while the refresh is still running; the loader never
outlives the fetch — the content chunk removes it as soon as it arrives.
**Request lifecycle (load more):** `assets/app.js` calls `api/items.php` with the
next `page` (plus current `source` and `range`), receives
@@ -283,7 +289,8 @@ button when `has_more` is false.
│ ├── ManageAuth.php manage.php gate: password, CSRF, flash messages
│ └── View.php Escaping + render() + labels/colors/time formatting
├── templates/
│ ├── layout.php Full page shell, filters, grid, empty state, Load more
│ ├── shell.php Streamed first: head, header, filters, feed loader
│ ├── content.php Streamed after the refresh: grid, empty state, Load more
│ ├── manage.php Feed management page (login, add forms, feed list)
│ └── cards.php One feed card partial (used by page + API)
├── assets/
@@ -461,6 +468,23 @@ sourceColor('hackernews') // hex used for the card spine, chip and active pill
The source tab and filter pill are generated automatically from `sources()`.
### Colour system (`assets/style.css`)
The dashboard has **no house colour**. One ink ramp (`--bg` → `--ink`) carries
every neutral surface, line, and label, and the only saturated colour on screen
belongs to the sources — used strictly as a signal: filter pill, card spine,
source chip, timestamp, feed health. Two rules hold it together:
- **Bright fill, deep ink type.** Every filled state (active pill, source chip,
primary action) is a bright fill with `--ink-deep` type — no white text on
saturated fills, no gradient fills.
- **One hue per source, mirrored in two places.** `:root` defines the token
(`--youtube`, `--reddit`, `--rt`) and `View::sourceColor()` returns the same
hex for the inline `--src`/`--pill` values the templates emit. Change both.
The header rail (`.wire-rail`) is the colour legend: one segment per source, in
order.
---
## Deployment notes (Apache + php-fpm on SELinux, e.g. Fedora)
+249 -123
View File
@@ -1,21 +1,47 @@
:root {
--ink: #160b2e;
--ink-soft: #5b5178;
--bg: #f4f1ff;
--surface: #ffffff;
--line: #e6dffb;
/* ==========================================================================
RSS Feed Dashboard — "Nightwire" palette
--------------------------------------------------------------------------
Thesis: the dashboard has no house colour. One calm ink family carries the
whole interface; the only saturated colour belongs to the sources
(YouTube / Reddit / RT) and is used strictly as a signal — filter pills,
card spines, chips, timestamps, feed health.
--accent: #6a3dff;
--youtube: #ff1f4b;
--reddit: #ff6a00;
--rt: #00c389;
--sun: #ffc24b;
Rule for every filled state: bright fill, deep ink type.
========================================================================== */
:root {
color-scheme: dark;
/* Ink ramp — cool indigo-slate, not black */
--bg: #0f1319;
--surface: #161b24;
--surface-2: #1e242f;
--line: #262d3a;
--line-2: #3a4351;
--ink: #f1f3f7;
--ink-soft: #a3adbd;
--ink-faint: #828da1;
--ink-deep: #0c1015; /* type that sits on a bright fill */
/* Source signals — the only chroma in the UI */
--youtube: #ff3b5c;
--reddit: #ff7a2f;
--rt: #1fcb93;
/* Neutral interactive: the "All" tab, neutral pills, primary action */
--accent: var(--ink);
--display: "Space Grotesk", system-ui, sans-serif;
--body: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
--mono: "JetBrains Mono", ui-monospace, monospace;
}
::selection {
background: var(--ink);
color: var(--ink-deep);
}
/* ---------- Shell ---------- */
.app-body {
@@ -27,17 +53,15 @@
-webkit-font-smoothing: antialiased;
}
/* One soft wash of panel light from the top edge. No coloured blobs, so the
source hues stay the only chroma on screen. */
.app-body::before {
content: "";
position: fixed;
inset: 0;
z-index: 0;
pointer-events: none;
background:
radial-gradient(42rem 30rem at 6% -8%, rgba(106, 61, 255, 0.18), transparent 62%),
radial-gradient(36rem 26rem at 98% -4%, rgba(255, 31, 75, 0.14), transparent 60%),
radial-gradient(34rem 26rem at 52% 112%, rgba(0, 195, 137, 0.16), transparent 62%),
radial-gradient(30rem 22rem at 82% 78%, rgba(255, 106, 0, 0.12), transparent 60%);
background: radial-gradient(58rem 30rem at 50% -14%, rgba(241, 243, 247, 0.055), transparent 72%);
}
.site-header,
@@ -52,10 +76,10 @@ main {
position: sticky;
top: 0;
z-index: 20;
background: rgba(255, 255, 255, 0.78);
background: rgba(15, 19, 25, 0.82);
border-bottom: 1px solid var(--line);
backdrop-filter: saturate(180%) blur(16px);
-webkit-backdrop-filter: saturate(180%) blur(16px);
backdrop-filter: saturate(160%) blur(16px);
-webkit-backdrop-filter: saturate(160%) blur(16px);
}
.brand {
@@ -65,12 +89,18 @@ main {
text-decoration: none;
}
/* Signal bars: three feeds, ascending strength, one per source hue. */
.brand-mark {
width: 26px;
width: 30px;
height: 26px;
border-radius: 9px;
background: conic-gradient(from 220deg, var(--accent), var(--youtube), var(--reddit), var(--rt), var(--accent));
box-shadow: 0 6px 16px rgba(106, 61, 255, 0.4);
border: 1px solid var(--line);
background:
linear-gradient(var(--youtube), var(--youtube)) 6px bottom / 3px 8px no-repeat,
linear-gradient(var(--reddit), var(--reddit)) 12px bottom / 3px 13px no-repeat,
linear-gradient(var(--rt), var(--rt)) 18px bottom / 3px 18px no-repeat,
var(--surface-2);
box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.65);
}
.brand-text {
@@ -83,10 +113,7 @@ main {
.brand-text em {
font-style: normal;
background: linear-gradient(90deg, var(--accent), var(--youtube) 55%, var(--reddit));
-webkit-background-clip: text;
background-clip: text;
color: transparent;
color: var(--ink-faint);
}
.header-meta {
@@ -99,30 +126,38 @@ main {
opacity: 0.4;
}
/* Desk is live — neutral pulse, so it is never confused with a source. */
.pulse {
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--rt);
background: var(--ink);
animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
0% { box-shadow: 0 0 0 0 rgba(0, 195, 137, 0.55); }
70% { box-shadow: 0 0 0 9px rgba(0, 195, 137, 0); }
100% { box-shadow: 0 0 0 0 rgba(0, 195, 137, 0); }
0% { box-shadow: 0 0 0 0 rgba(241, 243, 247, 0.32); }
70% { box-shadow: 0 0 0 9px rgba(241, 243, 247, 0); }
100% { box-shadow: 0 0 0 0 rgba(241, 243, 247, 0); }
}
.spectrum-rail {
height: 5px;
/* Three wires — one segment per source, page-coloured gaps between them. */
.wire-rail {
height: 3px;
background: linear-gradient(90deg,
var(--accent), var(--youtube) 32%, var(--reddit) 60%, var(--sun) 78%, var(--rt));
var(--youtube) 0, var(--youtube) calc(33.333% - 1px),
var(--bg) calc(33.333% - 1px), var(--bg) calc(33.333% + 1px),
var(--reddit) calc(33.333% + 1px), var(--reddit) calc(66.666% - 1px),
var(--bg) calc(66.666% - 1px), var(--bg) calc(66.666% + 1px),
var(--rt) calc(66.666% + 1px));
}
/* ---------- Filter pills ---------- */
.filter-pills {
gap: 0.5rem;
scrollbar-width: thin;
scrollbar-color: var(--line-2) transparent;
}
.filter-pill {
@@ -133,13 +168,13 @@ main {
padding: 0.42rem 0.95rem;
border-radius: 999px;
border: 1px solid var(--line);
background: rgba(255, 255, 255, 0.7);
background: rgba(255, 255, 255, 0.04);
color: var(--ink);
font-weight: 600;
font-size: 0.86rem;
text-decoration: none;
white-space: nowrap;
transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.filter-pill .pill-dot {
@@ -152,19 +187,21 @@ main {
.filter-pill:hover {
transform: translateY(-1px);
box-shadow: 0 8px 18px -10px var(--pill);
background: rgba(255, 255, 255, 0.07);
border-color: var(--line-2);
color: var(--ink);
}
.filter-pill.active {
background: var(--pill);
border-color: transparent;
color: #fff;
box-shadow: 0 10px 22px -10px var(--pill);
color: var(--ink-deep);
box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--pill) 75%, transparent);
}
.filter-pill.active .pill-dot {
background: rgba(255, 255, 255, 0.9);
background: currentColor;
opacity: 0.8;
}
.refresh-chip {
@@ -173,8 +210,9 @@ main {
gap: 0.4rem;
padding: 0.32rem 0.7rem;
border-radius: 999px;
background: rgba(106, 61, 255, 0.1);
color: var(--accent);
border: 1px solid var(--line);
background: var(--surface-2);
color: var(--ink-soft);
font-size: 0.72rem;
font-weight: 500;
}
@@ -185,12 +223,14 @@ main {
font-size: 0.66rem;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--ink-soft);
color: var(--ink-faint);
padding-right: 0.15rem;
}
.range-pills {
gap: 0.35rem;
scrollbar-width: thin;
scrollbar-color: var(--line-2) transparent;
}
.range-pill {
@@ -199,26 +239,27 @@ main {
padding: 0.32rem 0.75rem;
border-radius: 999px;
border: 1px solid var(--line);
background: rgba(255, 255, 255, 0.7);
background: rgba(255, 255, 255, 0.04);
color: var(--ink-soft);
font-size: 0.78rem;
font-weight: 600;
text-decoration: none;
white-space: nowrap;
transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.range-pill:hover {
color: var(--ink);
border-color: var(--accent);
border-color: var(--line-2);
background: rgba(255, 255, 255, 0.07);
transform: translateY(-1px);
}
.range-pill.active {
background: var(--accent);
background: var(--ink);
border-color: transparent;
color: #fff;
box-shadow: 0 10px 22px -10px var(--accent);
color: var(--ink-deep);
box-shadow: 0 8px 20px -10px rgba(241, 243, 247, 0.45);
}
/* ---------- Cards ---------- */
@@ -229,23 +270,25 @@ main {
border: 1px solid var(--line);
border-top: 4px solid var(--src);
border-radius: 18px;
background: var(--surface);
background:
linear-gradient(180deg, color-mix(in srgb, var(--src) 8%, transparent), transparent 34%),
var(--surface);
overflow: hidden;
box-shadow: 0 1px 2px rgba(22, 11, 46, 0.04), 0 14px 34px -26px rgba(22, 11, 46, 0.5);
transition: transform 0.18s ease, box-shadow 0.18s ease;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 18px 34px -28px rgba(0, 0, 0, 0.9);
transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.feed-card:hover {
transform: translateY(-4px);
box-shadow: 0 20px 44px -20px rgba(22, 11, 46, 0.4);
box-shadow: 0 20px 44px -20px color-mix(in srgb, var(--src) 55%, transparent);
border-color: color-mix(in srgb, var(--src) 32%, var(--line));
box-shadow: 0 22px 44px -24px color-mix(in srgb, var(--src) 45%, transparent), 0 18px 34px -28px rgba(0, 0, 0, 0.9);
}
.feed-thumb-link {
position: relative;
display: block;
overflow: hidden;
background: #efeaff;
background: color-mix(in srgb, var(--src) 16%, var(--surface));
}
.feed-thumb-link::after {
@@ -253,7 +296,7 @@ main {
position: absolute;
inset: 0;
pointer-events: none;
background: linear-gradient(to top, rgba(22, 11, 46, 0.5), transparent 52%);
background: linear-gradient(to top, rgba(9, 11, 15, 0.55), transparent 52%);
}
.feed-thumb {
@@ -275,7 +318,7 @@ main {
font-weight: 600;
letter-spacing: 0.09em;
text-transform: uppercase;
color: #fff;
color: var(--ink-deep);
background: var(--src);
}
@@ -286,7 +329,7 @@ main {
z-index: 1;
padding: 0.24rem 0.6rem;
border-radius: 999px;
box-shadow: 0 6px 16px -6px rgba(22, 11, 46, 0.6);
box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.7);
}
.source-chip {
@@ -303,7 +346,7 @@ main {
.feed-name {
font-size: 0.68rem;
letter-spacing: 0.02em;
color: var(--ink-soft);
color: var(--ink-faint);
}
.feed-card .card-title {
@@ -338,7 +381,7 @@ main {
}
.card-footer-meta {
border-top: 1px dashed var(--line);
border-top: 1px solid var(--line);
}
.author {
@@ -349,32 +392,89 @@ main {
.timestamp {
font-size: 0.72rem;
font-weight: 500;
color: var(--src);
color: color-mix(in srgb, var(--src) 78%, var(--ink));
}
.mono {
font-family: var(--mono);
}
/* ---------- Feed loader ---------- */
/* Skeleton cards hold the feed's place while the first page is fetched. The
spine stays neutral: no source colour is known yet, so the sources keep
their chroma to themselves. */
.skeleton-card {
--src: var(--line-2);
pointer-events: none;
}
.skeleton-thumb,
.skeleton-chip,
.skeleton-line {
display: block;
background: linear-gradient(90deg, var(--surface-2) 25%, var(--line-2) 37%, var(--surface-2) 63%);
background-size: 400% 100%;
border-radius: 6px;
animation: skeleton-sweep 1.5s ease-in-out infinite;
}
.skeleton-thumb {
width: 100%;
aspect-ratio: 16 / 9;
border-radius: 0;
}
.skeleton-chip {
width: 46px;
height: 18px;
border-radius: 999px;
flex-shrink: 0;
}
.skeleton-line {
height: 0.62rem;
margin-bottom: 0.5rem;
}
.skeleton-title {
height: 1.02rem;
margin-bottom: 0.75rem;
}
.skeleton-timestamp {
width: 3.25rem;
height: 0.72rem;
margin-bottom: 0;
}
@keyframes skeleton-sweep {
from {
background-position: 100% 50%;
}
to {
background-position: 0 50%;
}
}
/* ---------- Empty state ---------- */
.empty-state {
padding: 4.5rem 1rem;
color: var(--ink-soft);
color: var(--ink-faint);
}
/* Same signal-bars mark as the header, unlit — a quiet, static glyph. */
.empty-mark {
width: 58px;
height: 58px;
width: 44px;
height: 30px;
margin: 0 auto 1rem;
border-radius: 20px;
background: conic-gradient(from 220deg, var(--accent), var(--youtube), var(--reddit), var(--rt), var(--accent));
filter: saturate(1.1);
animation: spin 12s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
background:
linear-gradient(var(--youtube), var(--youtube)) 12px bottom / 4px 10px no-repeat,
linear-gradient(var(--reddit), var(--reddit)) 19px bottom / 4px 16px no-repeat,
linear-gradient(var(--rt), var(--rt)) 26px bottom / 4px 22px no-repeat;
opacity: 0.5;
}
.empty-title {
@@ -383,47 +483,48 @@ main {
color: var(--ink);
}
/* ---------- Button ---------- */
/* ---------- Primary action ---------- */
.btn-energy {
/* The tally light: the brightest thing on the page, so there is never a
question about what the primary action is. */
.btn-tally {
border: 0;
border-radius: 999px;
padding: 0.7rem 1.7rem;
font-family: var(--display);
font-weight: 600;
color: #fff;
background: linear-gradient(100deg, var(--accent), var(--youtube) 48%, var(--reddit) 78%, var(--rt));
background-size: 160% 100%;
box-shadow: 0 14px 30px -14px rgba(106, 61, 255, 0.8);
transition: transform 0.15s ease, background-position 0.4s ease, box-shadow 0.15s ease;
color: var(--ink-deep);
background: var(--ink);
box-shadow: 0 12px 28px -14px rgba(241, 243, 247, 0.4);
transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn-energy:hover,
.btn-energy:focus {
color: #fff;
.btn-tally:hover,
.btn-tally:focus {
color: var(--ink-deep);
transform: translateY(-2px);
background-position: 100% 0;
box-shadow: 0 18px 36px -14px rgba(255, 31, 75, 0.7);
background: #ffffff;
box-shadow: 0 18px 34px -14px rgba(241, 243, 247, 0.5);
}
.btn-energy:disabled {
opacity: 0.65;
.btn-tally:disabled {
opacity: 0.55;
transform: none;
color: #fff;
color: var(--ink-deep);
}
.alert-soft {
border: 1px solid #ffe1a8;
border: 1px solid color-mix(in srgb, var(--youtube) 40%, transparent);
border-radius: 14px;
background: #fff8ea;
color: #7a5a12;
background: color-mix(in srgb, var(--youtube) 12%, var(--surface));
color: #ffc2ce;
}
.alert-ok-soft {
border: 1px solid #b7ecd2;
border: 1px solid color-mix(in srgb, var(--rt) 40%, transparent);
border-radius: 14px;
background: #ecfbf3;
color: #14624a;
background: color-mix(in srgb, var(--rt) 12%, var(--surface));
color: #9beed2;
}
/* ---------- Manage page ---------- */
@@ -434,27 +535,27 @@ main {
padding: 0.38rem 0.85rem;
border-radius: 999px;
border: 1px solid var(--line);
background: rgba(255, 255, 255, 0.7);
background: rgba(255, 255, 255, 0.04);
color: var(--ink-soft);
font-size: 0.78rem;
font-weight: 600;
text-decoration: none;
white-space: nowrap;
transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.manage-link:hover {
color: var(--accent);
border-color: var(--accent);
color: var(--ink);
border-color: var(--line-2);
background: rgba(255, 255, 255, 0.07);
transform: translateY(-1px);
box-shadow: 0 8px 18px -12px var(--accent);
}
.manage-title {
font-size: 0.68rem;
letter-spacing: 0.14em;
text-transform: uppercase;
color: var(--ink-soft);
color: var(--ink-faint);
}
.manage-main {
@@ -466,7 +567,7 @@ main {
border: 1px solid var(--line);
border-radius: 18px;
padding: 1.25rem 1.4rem;
box-shadow: 0 1px 2px rgba(22, 11, 46, 0.04), 0 14px 34px -26px rgba(22, 11, 46, 0.5);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 18px 34px -28px rgba(0, 0, 0, 0.9);
}
.manage-notice {
@@ -523,7 +624,7 @@ main {
font-size: 0.68rem;
font-weight: 600;
color: var(--ink-soft);
background: rgba(22, 11, 46, 0.06);
background: rgba(255, 255, 255, 0.07);
padding: 0.12rem 0.5rem;
border-radius: 999px;
}
@@ -549,7 +650,7 @@ main {
}
.feed-row:hover {
box-shadow: 0 12px 26px -18px rgba(22, 11, 46, 0.55);
box-shadow: 0 12px 26px -18px rgba(0, 0, 0, 0.85);
}
.feed-row.is-off {
@@ -576,22 +677,21 @@ main {
letter-spacing: 0.09em;
text-transform: uppercase;
color: var(--ink-soft);
background: rgba(22, 11, 46, 0.06);
background: rgba(255, 255, 255, 0.07);
padding: 0.16rem 0.5rem;
border-radius: 999px;
}
.feed-row-url {
font-size: 0.66rem;
color: var(--ink-soft);
color: var(--ink-faint);
text-decoration: none;
max-width: 36ch;
opacity: 0.85;
}
.feed-row-url:hover {
color: var(--accent);
opacity: 1;
color: var(--ink);
text-decoration: underline;
}
.health {
@@ -619,8 +719,7 @@ main {
}
.health-idle {
color: var(--ink-soft);
opacity: 0.75;
color: var(--ink-faint);
}
.feed-row-actions {
@@ -631,49 +730,76 @@ main {
}
.btn-mini {
border: 1px solid var(--line);
border: 1px solid var(--line-2);
border-radius: 999px;
background: rgba(255, 255, 255, 0.75);
background: rgba(255, 255, 255, 0.04);
color: var(--ink-soft);
font-size: 0.72rem;
font-weight: 600;
padding: 0.3rem 0.85rem;
transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn-mini:hover,
.btn-mini:focus {
color: var(--ink);
border-color: var(--ink-soft);
border-color: var(--ink-faint);
background: rgba(255, 255, 255, 0.08);
}
.btn-mini-on {
color: var(--accent);
border-color: rgba(106, 61, 255, 0.45);
background: rgba(106, 61, 255, 0.08);
color: var(--ink);
border-color: var(--ink-faint);
background: rgba(255, 255, 255, 0.1);
}
.btn-mini-on:hover,
.btn-mini-on:focus {
color: var(--accent);
border-color: var(--accent);
background: rgba(106, 61, 255, 0.14);
color: var(--ink);
border-color: var(--ink-soft);
background: rgba(255, 255, 255, 0.14);
}
.btn-mini-danger:hover,
.btn-mini-danger:focus {
color: var(--youtube);
border-color: rgba(255, 31, 75, 0.5);
background: rgba(255, 31, 75, 0.07);
border-color: color-mix(in srgb, var(--youtube) 55%, transparent);
background: color-mix(in srgb, var(--youtube) 12%, transparent);
}
/* ---------- Form controls ---------- */
.form-control {
background: var(--surface-2);
border: 1px solid var(--line-2);
color: var(--ink);
}
.form-control::placeholder {
color: var(--ink-faint);
}
.form-control:focus {
background: var(--surface-2);
border-color: var(--ink-soft);
color: var(--ink);
box-shadow: 0 0 0 3px rgba(241, 243, 247, 0.12);
}
code {
color: var(--ink);
background: rgba(255, 255, 255, 0.06);
padding: 0.1rem 0.35rem;
border-radius: 6px;
}
/* ---------- Focus & motion ---------- */
a:focus-visible,
button:focus-visible {
outline: 3px solid rgba(106, 61, 255, 0.55);
button:focus-visible,
input:focus-visible {
outline: 2px solid var(--ink);
outline-offset: 2px;
border-radius: 8px;
}
@media (prefers-reduced-motion: reduce) {
+7
View File
@@ -61,4 +61,11 @@ return [
'label' => 'RT News',
'url' => 'https://www.rt.com/rss/',
],
// BBC News (top stories).
[
'source' => 'bbc',
'label' => 'BBC News',
'url' => 'https://feeds.bbci.co.uk/news/rss.xml',
],
];
+32 -6
View File
@@ -6,13 +6,11 @@ declare(strict_types=1);
$app = require __DIR__ . '/src/bootstrap.php';
$config = $app['config'];
$repository = $app['repository'];
$service = $app['service'];
$refresh = $service->refreshStale();
$sources = $service->sources();
$activeSource = $_GET['source'] ?? null;
if (!is_string($activeSource) || !in_array($activeSource, $sources, true)) {
if (!is_string($activeSource) || $activeSource === '') {
$activeSource = null;
}
@@ -21,13 +19,41 @@ $activeRange = $_GET['range'] ?? '';
if (!is_string($activeRange) || !array_key_exists($activeRange, $ranges)) {
$activeRange = '';
}
$since = $activeRange !== '' ? gmdate('c', time() - (int) $ranges[$activeRange]) : null;
$pageSize = (int) $config['page_size'];
$page = $service->page($activeSource, 1, (int) $config['page_size'], $since);
// Register the configured feeds before anything renders so the filter tabs are
// complete on a fresh database; refreshStale() repeats the same sync cheaply.
$repository->syncFeeds($app['feeds']);
echo App\View::render('layout', [
$sources = $service->sources();
if ($activeSource !== null && !in_array($activeSource, $sources, true)) {
$activeSource = null;
}
// Send the shell (header, filters and the feed loader) before refreshing, so
// the loader is on screen while the feeds are being fetched. Nothing may hold
// those bytes back.
ini_set('zlib.output_compression', '0');
while (ob_get_level() > 0 && ob_end_flush()) {
// Drop any active output buffers so the shell reaches the browser now.
}
echo App\View::render('shell', [
'config' => $config,
'sources' => $sources,
'activeSource' => $activeSource,
'activeRange' => $activeRange,
'cachedTotal' => $repository->countItems($activeSource, $since),
]);
flush();
$refresh = $service->refreshStale();
$page = $service->page($activeSource, 1, $pageSize, $since);
echo App\View::render('content', [
'activeSource' => $activeSource,
'activeRange' => $activeRange,
'page' => $page,
+7 -4
View File
@@ -17,6 +17,7 @@ final class View
'youtube' => 'YouTube',
'reddit' => 'Reddit',
'rt' => 'RT',
'bbc' => 'BBC',
default => ucfirst($source),
};
}
@@ -27,6 +28,7 @@ final class View
'youtube' => 'text-bg-danger',
'reddit' => 'text-bg-warning',
'rt' => 'text-bg-dark',
'bbc' => 'text-bg-danger',
default => 'text-bg-secondary',
};
}
@@ -34,10 +36,11 @@ final class View
public static function sourceColor(string $source): string
{
return match ($source) {
'youtube' => '#ff1f4b',
'reddit' => '#ff6a00',
'rt' => '#00c389',
default => '#6a3dff',
'youtube' => '#ff3b5c',
'reddit' => '#ff7a2f',
'rt' => '#1fcb93',
'bbc' => '#bb1919',
default => '#f1f3f7',
};
}
+88
View File
@@ -0,0 +1,88 @@
<?php
declare(strict_types=1);
use App\View;
/** @var string|null $activeSource */
/** @var string|null $activeRange */
/** @var array<string, mixed> $page */
/** @var array<string, mixed> $refresh */
$activeRange = $activeRange ?? '';
$errors = $refresh['errors'] ?? [];
$total = (int) $page['total'];
?>
<?php if (($refresh['attempted'] ?? 0) > 0): ?>
<div class="d-flex justify-content-end mb-3">
<span class="refresh-chip mono">
<span aria-hidden="true">↻</span>
<?= (int) $refresh['succeeded'] ?>/<?= (int) $refresh['attempted'] ?> feeds
· <?= (int) $refresh['new_items'] ?> new
</span>
</div>
<?php endif; ?>
<?php if ($errors !== []): ?>
<div class="alert alert-warning alert-dismissible fade show small alert-soft" role="alert">
<strong>Some feeds could not be refreshed:</strong>
<ul class="mb-0 ps-3">
<?php foreach ($errors as $error): ?>
<li><?= View::e((string) $error) ?></li>
<?php endforeach; ?>
</ul>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php endif; ?>
<div id="feed"
class="row g-4"
data-api="api/items.php"
data-source="<?= View::e((string) ($activeSource ?? '')) ?>"
data-range="<?= View::e($activeRange) ?>"
data-page="1"
data-page-size="<?= (int) $page['page_size'] ?>"
data-has-more="<?= $page['has_more'] ? '1' : '0' ?>"
data-total="<?= $total ?>">
<?= View::render('cards', ['items' => $page['items']]) ?>
</div>
<div id="feed-empty" class="empty-state text-center <?= $total > 0 ? 'd-none' : '' ?>">
<div class="empty-mark" aria-hidden="true"></div>
<?php if ($activeRange !== ''): ?>
<p class="empty-title mb-1">Nothing in the past <?= View::e(View::rangeLabel($activeRange)) ?></p>
<p class="small mb-0">Try a wider time range to see more.</p>
<?php else: ?>
<p class="empty-title mb-1">Nothing in the feed yet</p>
<p class="small mb-0">Feeds may be rate limited right now — reload in a moment.</p>
<?php endif; ?>
</div>
<div class="text-center mt-5">
<button id="load-more"
type="button"
class="btn btn-tally <?= $page['has_more'] ? '' : 'd-none' ?>">
<span class="spinner-border spinner-border-sm me-2 d-none" role="status" aria-hidden="true"></span>
Load more stories
</button>
</div>
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<script src="assets/app.js" defer></script>
<script>
(function () {
var loader = document.getElementById('feed-loader');
if (loader !== null) {
loader.remove();
}
var count = document.getElementById('story-count');
if (count !== null) {
count.textContent = '<?= $total ?> stories';
}
})();
</script>
</body>
</html>
+6 -6
View File
@@ -19,7 +19,7 @@ foreach ($feeds as $feed) {
$actionUrl = 'manage.php';
?>
<!doctype html>
<html lang="en" data-bs-theme="light">
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
@@ -41,10 +41,10 @@ $actionUrl = 'manage.php';
</a>
<div class="d-flex align-items-center gap-3">
<span class="mono manage-title">Manage feeds</span>
<a class="manage-link" href="?">&larr; Dashboard</a>
<a class="manage-link" href="index.php">&larr; Dashboard</a>
</div>
</div>
<div class="spectrum-rail" aria-hidden="true"></div>
<div class="wire-rail" aria-hidden="true"></div>
</header>
<main class="container-xxl py-4 manage-main">
@@ -70,7 +70,7 @@ $actionUrl = 'manage.php';
<input type="hidden" name="csrf" value="<?= $csrf ?>">
<input type="hidden" name="action" value="login">
<input type="password" name="input" class="form-control mono" placeholder="Password" required autofocus autocomplete="current-password">
<button type="submit" class="btn btn-energy btn-compact">Sign in</button>
<button type="submit" class="btn btn-tally btn-compact">Sign in</button>
</form>
</div>
<?php else: ?>
@@ -91,7 +91,7 @@ $actionUrl = 'manage.php';
<input type="text" name="input" class="form-control mono" inputmode="url"
placeholder="r/homelab · homelab · reddit.com/r/homelab"
required maxlength="300" autocomplete="off">
<button type="submit" class="btn btn-energy btn-compact">Add</button>
<button type="submit" class="btn btn-tally btn-compact">Add</button>
</form>
</div>
</div>
@@ -104,7 +104,7 @@ $actionUrl = 'manage.php';
<input type="text" name="input" class="form-control mono" inputmode="url"
placeholder="@handle · UC… channel ID · channel URL"
required maxlength="300" autocomplete="off">
<button type="submit" class="btn btn-energy btn-compact">Add</button>
<button type="submit" class="btn btn-tally btn-compact">Add</button>
</form>
</div>
</div>
+27 -65
View File
@@ -8,8 +8,7 @@ use App\View;
/** @var array<int, string> $sources */
/** @var string|null $activeSource */
/** @var string|null $activeRange */
/** @var array<string, mixed> $page */
/** @var array<string, mixed> $refresh */
/** @var int $cachedTotal */
$tabs = ['' => 'All'];
foreach ($sources as $source) {
@@ -34,16 +33,14 @@ $linkFor = static function (string $source, string $range): string {
return $params === [] ? '?' : '?' . http_build_query($params);
};
$errors = $refresh['errors'] ?? [];
$total = (int) $page['total'];
?>
<!doctype html>
<html lang="en" data-bs-theme="light">
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>RSS Feed Dashboard</title>
<noscript><style>#feed-loader{display:none}</style></noscript>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap"
@@ -62,14 +59,14 @@ $total = (int) $page['total'];
<div class="d-flex align-items-center gap-3">
<div class="header-meta d-none d-md-flex align-items-center">
<span class="pulse" aria-hidden="true"></span>
<span class="mono"><?= $total ?> stories</span>
<span class="mono" id="story-count"><?= $cachedTotal ?> stories</span>
<span class="sep">/</span>
<span class="mono">YouTube · Reddit · RT</span>
</div>
<a class="manage-link" href="manage.php">Manage</a>
</div>
</div>
<div class="spectrum-rail" aria-hidden="true"></div>
<div class="wire-rail" aria-hidden="true"></div>
</header>
<main class="container-xxl py-4">
@@ -90,14 +87,6 @@ $total = (int) $page['total'];
</li>
<?php endforeach; ?>
</ul>
<?php if (($refresh['attempted'] ?? 0) > 0): ?>
<span class="refresh-chip mono">
<span aria-hidden="true">↻</span>
<?= (int) $refresh['succeeded'] ?>/<?= (int) $refresh['attempted'] ?> feeds
· <?= (int) $refresh['new_items'] ?> new
</span>
<?php endif; ?>
</div>
<div class="d-flex flex-wrap align-items-center gap-2 mt-3">
@@ -113,53 +102,26 @@ $total = (int) $page['total'];
</div>
</div>
<?php if ($errors !== []): ?>
<div class="alert alert-warning alert-dismissible fade show small alert-soft" role="alert">
<strong>Some feeds could not be refreshed:</strong>
<ul class="mb-0 ps-3">
<?php foreach ($errors as $error): ?>
<li><?= View::e((string) $error) ?></li>
<?php endforeach; ?>
</ul>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<?php endif; ?>
<div id="feed"
class="row g-4"
data-api="api/items.php"
data-source="<?= View::e((string) ($activeSource ?? '')) ?>"
data-range="<?= View::e($activeRange) ?>"
data-page="1"
data-page-size="<?= (int) $page['page_size'] ?>"
data-has-more="<?= $page['has_more'] ? '1' : '0' ?>"
data-total="<?= $total ?>">
<?= View::render('cards', ['items' => $page['items']]) ?>
<div id="feed-loader" class="row g-4" role="status">
<span class="visually-hidden">Loading feeds…</span>
<?php for ($placeholder = 0; $placeholder < 3; $placeholder++): ?>
<div class="col-12 col-md-6 col-xl-4">
<div class="card h-100 feed-card skeleton-card" aria-hidden="true">
<div class="skeleton-thumb"></div>
<div class="card-body d-flex flex-column">
<div class="d-flex align-items-center gap-2 mb-2">
<span class="skeleton-chip"></span>
<span class="skeleton-line w-50 mb-0"></span>
</div>
<span class="skeleton-line skeleton-title w-100"></span>
<span class="skeleton-line w-100"></span>
<span class="skeleton-line w-75"></span>
<div class="card-footer-meta mt-auto d-flex justify-content-between align-items-center pt-3">
<span class="skeleton-line w-25 mb-0"></span>
<span class="skeleton-line skeleton-timestamp"></span>
</div>
</div>
</div>
</div>
<?php endfor; ?>
</div>
<div id="feed-empty" class="empty-state text-center <?= $total > 0 ? 'd-none' : '' ?>">
<div class="empty-mark" aria-hidden="true"></div>
<?php if ($activeRange !== ''): ?>
<p class="empty-title mb-1">Nothing in the past <?= View::e(View::rangeLabel($activeRange)) ?></p>
<p class="small mb-0">Try a wider time range to see more.</p>
<?php else: ?>
<p class="empty-title mb-1">Nothing in the feed yet</p>
<p class="small mb-0">Feeds may be rate limited right now — reload in a moment.</p>
<?php endif; ?>
</div>
<div class="text-center mt-5">
<button id="load-more"
type="button"
class="btn btn-energy <?= $page['has_more'] ? '' : 'd-none' ?>">
<span class="spinner-border spinner-border-sm me-2 d-none" role="status" aria-hidden="true"></span>
Load more stories
</button>
</div>
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<script src="assets/app.js" defer></script>
</body>
</html>