From 8ec369a7044a701bf2e2fb2aa4e96fc8e7f9529b Mon Sep 17 00:00:00 2001
From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com>
Date: Tue, 23 Jun 2026 22:37:23 +0200
Subject: [PATCH] feat(ui): source-type icons next to entry titles
---
crates/archivr-server/static/app.js | 35 +++++++++++++++++++++++--
crates/archivr-server/static/styles.css | 15 +++++++++++
2 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/crates/archivr-server/static/app.js b/crates/archivr-server/static/app.js
index 1934341..afd02a9 100644
--- a/crates/archivr-server/static/app.js
+++ b/crates/archivr-server/static/app.js
@@ -44,6 +44,36 @@ function valueText(value) {
return value ?? "";
}
+const SOURCE_ICONS = {
+ youtube: ``,
+ x: ``,
+ instagram: ``,
+ facebook: ``,
+ tiktok: ``,
+ reddit: ``,
+ snapchat: ``,
+ local: ``,
+ web: ``,
+ other: ``,
+};
+
+function sourceIcon(kind) {
+ const svg = SOURCE_ICONS[kind] || SOURCE_ICONS.other;
+ const el = document.createElement("span");
+ el.className = "source-icon";
+ el.innerHTML = svg;
+ return el;
+}
+
+function formatTimestamp(value) {
+ if (!value) return "";
+ // value is an ISO-8601 string from SQLite; display as "YYYY-MM-DD HH:MM"
+ const d = new Date(value.endsWith("Z") ? value : value + "Z");
+ if (isNaN(d)) return value;
+ const pad = (n) => String(n).padStart(2, "0");
+ return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`;
+}
+
async function getJson(url) {
const response = await fetch(url);
if (!response.ok) {
@@ -111,9 +141,10 @@ function renderEntries() {
row.classList.add("is-selected");
}
- appendCell(row, valueText(entry.archived_at));
+ appendCell(row, formatTimestamp(entry.archived_at));
const titleCell = appendCell(row, "");
+ titleCell.append(sourceIcon(entry.source_kind));
const title = document.createElement("span");
title.className = "entry-title";
title.textContent = valueText(entry.title) || valueText(entry.entry_uid);
@@ -167,7 +198,7 @@ function renderContextDetail(detail) {
}
const metaFields = [
- ["Added", detail.summary.archived_at],
+ ["Added", formatTimestamp(detail.summary.archived_at)],
["Source", detail.summary.source_kind],
["Type", detail.summary.entity_kind],
["Visibility", detail.summary.visibility],
diff --git a/crates/archivr-server/static/styles.css b/crates/archivr-server/static/styles.css
index 46f246f..0ae3ce5 100644
--- a/crates/archivr-server/static/styles.css
+++ b/crates/archivr-server/static/styles.css
@@ -203,6 +203,21 @@ select {
font-weight: 750;
}
+.source-icon {
+ display: inline-flex;
+ align-items: center;
+ width: 1em;
+ height: 1em;
+ margin-right: 0.35em;
+ vertical-align: middle;
+ flex-shrink: 0;
+}
+
+.source-icon svg {
+ width: 100%;
+ height: 100%;
+}
+
.url-cell {
color: #555b55;
word-break: break-all;