weekly updates

This commit is contained in:
2026-03-19 17:59:15 +00:00
parent 980f66d77d
commit d04ff6b68e
39 changed files with 2401 additions and 17448 deletions

View File

@@ -77,17 +77,17 @@ function buildCommentTree(comments) {
const byId = {};
const roots = [];
comments.forEach(c => {
c.children = [];
byId[c.id] = c;
comments.forEach(comment => {
comment.children = [];
byId[comment.id] = comment;
});
comments.forEach(c => {
if (c.parent_id) {
const parent = byId[c.parent_id];
if (parent) parent.children.push(c);
comments.forEach(comment => {
if (comment.parent_id) {
const parent = byId[comment.parent_id];
if (parent) parent.children.push(comment);
} else {
roots.push(c);
roots.push(comment);
}
});
@@ -112,7 +112,7 @@ function renderComments(comments) {
}
const tree = buildCommentTree(comments);
tree.forEach(c => list.appendChild(createComment(c)));
tree.forEach(comment => list.appendChild(createComment(comment)));
}
@@ -153,8 +153,8 @@ async function postComment(author, content, parentId = null) {
function wireCommentForm() {
const form = document.getElementById("comment-form");
form.addEventListener("submit", async e => {
e.preventDefault();
form.addEventListener("submit", async event => {
event.preventDefault();
const authorInput = form.querySelector("input[name='author']");
const textarea = form.querySelector("textarea[name='content']");
@@ -167,7 +167,7 @@ function wireCommentForm() {
const ok = await postComment(author, content);
if (ok) {
textarea.value = "";
loadComments(); // same pattern as your Kanban board
loadComments();
} else {
alert("Failed to post comment");
}