From fd55a7e7e2445d8b79a537ec35f40648c72ea8fa Mon Sep 17 00:00:00 2001
From: randymcmillan
Date: Fri, 12 Dec 2025 14:03:17 -0500
Subject: [PATCH] src/js/ui/render.js:render-patch-content
---
src/js/ui/render.js | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------
src/js/ui/state.js | 1 +
src/template.html | 11 +++++++----
3 files changed, 83 insertions(+), 23 deletions(-)
diff --git a/src/js/ui/render.js b/src/js/ui/render.js
index c7a4161..732268f 100644
--- a/src/js/ui/render.js
+++ b/src/js/ui/render.js
@@ -239,6 +239,12 @@ function render_reactions(model, ev) {
function render_repo_event_summary(ev) {
console.log("Rendering NIP-34 event summary for:", JSON.stringify(ev, null, 2));
+ let a = "";
+ let d = "";
+ let r = "";
+ let alt = "";
+ let e = "";
+ let p = "";
let summary = "";
let repo_id = "";
let repo_url = "";
@@ -251,12 +257,19 @@ function render_repo_event_summary(ev) {
let issue_title = "";
let patch_id = "";
let pull_req_id = "";
-
+ let json_body = "";
for (const tag of ev.tags) {
- if (tag[0] === "a" && tag[1].includes("30617:")) { // Repository Announcement Address
+ console.log("______________________tag=", tag);
+ if (tag[0] === "d" && tag[1].includes("30617:")) { // Repository Announcement Address
+ repo_id = tag[1];
+ repo_name = tag[1];
+ d = tag[1];
+ } else if (tag[0] === "d" && tag[1].includes("30618:")) { // Repository Announcement Address
repo_id = tag[1];
- } else if (tag[0] === "name") {
repo_name = tag[1];
+ d = tag[1];
+ } else if (tag[0] === "name") {
+ //repo_name = tag[1];
} else if (tag[0] === "url" || tag[0] === "web") {
repo_url = tag[1];
} else if (tag[0] === "description") {
@@ -275,12 +288,25 @@ function render_repo_event_summary(ev) {
patch_id = tag[1];
} else if (tag[0] === "e" && tag[3] === "pull_request") { // Pull Request ID
pull_req_id = tag[1];
+ } else if (tag[0] === "a") {
+ a = tag[1];
+ } else if (tag[0] === "r") {
+ r = tag[1];
+ } else if (tag[0] === "alt") {
+ alt = tag[1];
+ } else if (tag[0] === "e") {
+ e = tag[1];
+ } else if (tag[0] === "p") {
+ p = tag[1];
+ } else {
+ // capture full event
+ json_body = JSON.stringify(ev, null, 2);
}
}
switch (ev.kind) {
case KIND_REPO_ANNOUNCE:
- summary = `Repository Announcement: ${repo_name || "Untitled Repository"}`;
+ summary = `Repository Announcement: ${repo_name || "309:Untitled Repository"}`;
if (description) {
summary += `
${description}`;
}
@@ -298,52 +324,82 @@ function render_repo_event_summary(ev) {
}
break;
case KIND_REPO_STATE_ANNOUNCE:
- summary = `Repository State: ${repo_name || "Untitled Repository"}`;
- const refs_tags = ev.tags.filter(tag => tag[0] === "r");
- if (refs_tags.length > 0) {
- summary += `
Branches/Tags: ${refs_tags.map(tag => tag[1]).join(", ")}`;
+ let d = ev.tags.filter(tag => tag[0] === "d");
+ if (d.length > 0) {
+ summary = `Repository State: ${d.map(tag => tag[1]).join(", ")}`;
} else {
- summary += `
Tracking stopped.`;
+ summary = `Repository State: ${ev.d || ev.id}`;
+ }
+
+ if (description) {
+ summary += `
${description}`;
+ }
+ if (repo_url) {
+ summary += `
Web: ${repo_url}`;
+ }
+ if (clone_url) {
+ summary += `
Clone: ${clone_url}`;
+ }
+ if (maintainers.length > 0) {
+ summary += `
Maintainers: ${maintainers.map(pk => fmt_name({pubkey: pk})).join(", ")}`;
+ }
+ if (relays.length > 0) {
+ summary += `
Relays: ${relays.join(", ")}`;
+ } else {
+ summary += json_body;
}
break;
case KIND_REPO_PATCH:
- summary = `Patch for repository ${repo_name || repo_id || "Unknown"}`;
+ //let patch_d = ev.tags.filter(tag => tag[0] === "d");
+ let patch_content = ev.content;
+ //if (patch_d.length > 0) {
+ // summary = `355:Repository Patch: ${patch_d.map(tag => tag[1]).join(", ")}`;
+ //} else {
+ // summary = `357:Repository Patch: ${ev.d || ev.id}`;
+ //}
+ summary += `${patch_content}`; //TODO git commit formatting
if (issue_title) {
summary += `
Title: ${issue_title}`;
}
if (patch_id) {
summary += `
Patch ID: ${fmt_note_id(patch_id)}`;
- }
+ } else {
+
+ //summary += json_body; //`
Tracking stopped.`;
break;
+ }
case KIND_REPO_PULL_REQ:
case KIND_REPO_PULL_REQ_UPDATE:
- summary = `Pull Request for repository ${repo_name || repo_id || "Unknown"}`;
+ summary = `Pull Request for repository ${ev.repo_name || ev.repo_id || "Unknown"}`;
if (issue_title) {
summary += `
Title: ${issue_title}`;
}
if (pull_req_id) {
summary += `
PR ID: ${fmt_note_id(pull_req_id)}`;
}
+ summary += json_body; //`
Tracking stopped.`;
break;
case KIND_REPO_ISSUE:
- summary = `Issue for repository ${repo_name || repo_id || "Unknown"}`;
- if (issue_title) {
- summary += `
Title: ${issue_title}`;
+ summary = `Issue for repository ${ev.repo_name || ev.repo_id || "Unknown"}`;
+ if (ev.issue_title) {
+ summary += `
Title: ${ev.issue_title}`;
}
+ summary += json_body; //`
Tracking stopped.`;
break;
case KIND_REPO_STATUS_OPEN:
case KIND_REPO_STATUS_APPLIED:
case KIND_REPO_STATUS_CLOSED:
case KIND_REPO_STATUS_DRAFT:
- summary = `Repository Status: ${status_tag || "Unknown"}`;
+ summary = `Repository Status: ${ev.status_tag || "401:Unknown"}`;
if (repo_name) {
- summary += `
Repository: ${repo_name}`;
+ summary += `
Repository: ${ev.repo_name}`;
}
if (issue_title) {
- summary += `
Related: ${issue_title}`;
+ summary += `
Related: ${ev.issue_title}`;
} else if (patch_id) {
- summary += `
Related Patch: ${fmt_note_id(patch_id)}`;
+ summary += `
Related Patch: ${ev.fmt_note_id(patch_id)}`;
}
+ summary += json_body; //`
Tracking stopped.`;
break;
}
diff --git a/src/js/ui/state.js b/src/js/ui/state.js
index bcf7bae..da5eb3f 100644
--- a/src/js/ui/state.js
+++ b/src/js/ui/state.js
@@ -130,6 +130,7 @@ function view_timeline_apply_mode(model, mode, opts={}, push_state=true) {
switch(mode) {
case VM_FRIENDS:
el.dataset.hideReplys = opts.hide_replys;
+ name = "Home";
break;
case VM_THREAD:
el.dataset.threadId = thread_id;
diff --git a/src/template.html b/src/template.html
index cf2aea9..230e45b 100644
--- a/src/template.html
+++ b/src/template.html
@@ -58,8 +58,9 @@
title="gnostr.org">
+ gnostr
+
-
@@ -70,7 +71,7 @@