Allow any type for sub entries; add creation timestamp to rows
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -44,6 +44,22 @@ function fill_markdown(el, text) {
|
||||
render_markdown(text).then(html => { el.innerHTML = html; });
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Formatting
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function format_time(ms) {
|
||||
const diff = Date.now() - ms;
|
||||
const m = Math.floor(diff / 60000);
|
||||
const h = Math.floor(diff / 3600000);
|
||||
const d = Math.floor(diff / 86400000);
|
||||
if (m < 1) { return 'just now'; }
|
||||
if (m < 60) { return `${m}m ago`; }
|
||||
if (h < 24) { return `${h}h ago`; }
|
||||
if (d < 7) { return `${d}d ago`; }
|
||||
return new Date(ms).toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: d > 365 ? 'numeric' : undefined });
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Tree helpers
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -397,7 +413,11 @@ function make_entry_row(entry, children_map) {
|
||||
tags_el.appendChild(span);
|
||||
}
|
||||
|
||||
row.querySelector('.btn-sub').addEventListener('click', () => open_add_dialog(entry.id, entry.type));
|
||||
const time_el = row.querySelector('.task-time');
|
||||
time_el.textContent = format_time(entry.created_at);
|
||||
time_el.title = new Date(entry.created_at).toLocaleString();
|
||||
|
||||
row.querySelector('.btn-sub').addEventListener('click', () => open_add_dialog(entry.id, null));
|
||||
row.querySelector('.btn-edit').addEventListener('click', () => open_edit_dialog(entry));
|
||||
row.querySelector('.btn-delete').addEventListener('click', () => confirm_delete(entry));
|
||||
|
||||
|
||||
@@ -141,6 +141,12 @@ main { padding: 1.25rem; }
|
||||
margin-top: 0.1rem;
|
||||
}
|
||||
|
||||
.task-time {
|
||||
font-size: 11px;
|
||||
color: #555;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.task-row[data-priority='high'] { border-left-color: #e05555; }
|
||||
.task-row[data-priority='normal'] { border-left-color: #5588e0; }
|
||||
.task-row[data-priority='low'] { border-left-color: #555; }
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<div class="task-title markup"></div>
|
||||
<div class="task-footer">
|
||||
<span class="task-tags"></span>
|
||||
<span class="task-time"></span>
|
||||
<div class="task-actions">
|
||||
<button class="btn-sub">+ Sub</button>
|
||||
<button class="btn-edit">Edit</button>
|
||||
|
||||
Reference in New Issue
Block a user