From a6517c61a4fa9927be60e8c0f0ededc5f9dd8986 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A2u=20Cao?=
Date: Fri, 25 Oct 2024 16:25:25 +0200
Subject: [PATCH] Add user addresses to profile page, hide details by default
---
assets/css/layout.css | 5 +++++
html.ts | 19 +++++++++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/assets/css/layout.css b/assets/css/layout.css
index 99d7ca4..0b801f5 100644
--- a/assets/css/layout.css
+++ b/assets/css/layout.css
@@ -113,6 +113,11 @@ main.profile-page img.avatar {
width: 8rem;
}
+main.profile-page details summary {
+ cursor: pointer;
+ margin-bottom: 1.6rem;
+}
+
main .article-list .item h3 {
margin-bottom: 0.5rem;
}
diff --git a/html.ts b/html.ts
index 2f13acd..f4b6f16 100644
--- a/html.ts
+++ b/html.ts
@@ -107,6 +107,19 @@ export function articleListHtml(articles: Article[]): string {
`;
}
+function userAddressHtml(profile: Profile) {
+ let html = "";
+
+ if (profile.nip05) {
+ html += `Nostr address${profile.nip05}\n`;
+ }
+ if (profile.lud16) {
+ html += `Lightning address${profile.lud16}\n`;
+ }
+
+ return html;
+}
+
export function profilePageHtml(profile: Profile, articles: Article[]): string {
const title = `${profile.name} on Nostr`;
@@ -121,12 +134,14 @@ export function profilePageHtml(profile: Profile, articles: Article[]): string {
-
+
+ Details
- Public key
- ${profile.npub}
+ ${userAddressHtml(profile)}
-
+
${articleListHtml(articles)}