track create and edit separately
This commit is contained in:
@@ -409,7 +409,7 @@ function noteList(notes) {
|
|||||||
const isCommon = n.username === state.commonSpace;
|
const isCommon = n.username === state.commonSpace;
|
||||||
const meta = el("div", { class: "note-meta" });
|
const meta = el("div", { class: "note-meta" });
|
||||||
if (isCommon) meta.appendChild(el("span", { class: "common-badge", text: "common" }));
|
if (isCommon) meta.appendChild(el("span", { class: "common-badge", text: "common" }));
|
||||||
meta.appendChild(document.createTextNode(`${n.username} · ${relTime(n.updated_at)}`));
|
meta.appendChild(document.createTextNode(`${n.username} · edited ${relTime(n.updated_at)} · created ${fmtDate(n.created_at)}`));
|
||||||
if (n.attachments) meta.appendChild(el("span", { class: "attach-count", text: n.attachments + " attachment" + (n.attachments === 1 ? "" : "s") }));
|
if (n.attachments) meta.appendChild(el("span", { class: "attach-count", text: n.attachments + " attachment" + (n.attachments === 1 ? "" : "s") }));
|
||||||
const bodyEl = el("div", { class: "note-body" }, [
|
const bodyEl = el("div", { class: "note-body" }, [
|
||||||
el("div", { class: "note-title", text: n.title || "Untitled" }),
|
el("div", { class: "note-title", text: n.title || "Untitled" }),
|
||||||
@@ -443,6 +443,13 @@ async function searchFor(q) {
|
|||||||
box.appendChild(noteList(results));
|
box.appendChild(noteList(results));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fmtDate(iso) {
|
||||||
|
if (!iso) return "";
|
||||||
|
const d = new Date(iso.replace(" ", "T") + "Z");
|
||||||
|
if (isNaN(d)) return iso;
|
||||||
|
return d.toLocaleDateString();
|
||||||
|
}
|
||||||
|
|
||||||
function relTime(iso) {
|
function relTime(iso) {
|
||||||
if (!iso) return "";
|
if (!iso) return "";
|
||||||
const d = new Date(iso.replace(" ", "T") + "Z");
|
const d = new Date(iso.replace(" ", "T") + "Z");
|
||||||
|
|||||||
Reference in New Issue
Block a user