From 64b2ce3e02d671b877053cdfe0ab5b73cc88171c Mon Sep 17 00:00:00 2001 From: Daniele Tonon Date: Thu, 1 Jun 2023 16:43:47 +0200 Subject: [PATCH] Fix rendering of naddr and other events --- render.go | 3 +++ static/styles.css | 34 +++++++++++++++++----------------- static/styles.scss | 2 +- templates/details.html | 13 ++++++++----- templates/head.html | 2 +- templates/other.html | 2 +- 6 files changed, 31 insertions(+), 25 deletions(-) diff --git a/render.go b/render.go index 00ae99a..5fe2cc4 100644 --- a/render.go +++ b/render.go @@ -111,6 +111,9 @@ func render(w http.ResponseWriter, r *http.Request) { } kindDescription := kindNames[event.Kind] + if kindDescription == "" { + kindDescription = fmt.Sprintf("Kind %d", event.Kind) + } kindNIP := kindNIPS[event.Kind] imageMatch := regexp.MustCompile(`https:\/\/[^ ]*\.(gif|jpe?g|png|webp)`).FindStringSubmatch(event.Content) diff --git a/static/styles.css b/static/styles.css index 5190e33..37ede3a 100644 --- a/static/styles.css +++ b/static/styles.css @@ -686,23 +686,23 @@ body.profile .column_content { } } -body.note .column_content, body.raw .column_content { +body.note .column_content, body.other .column_content { flex-basis: 75%; max-width: 75%; } @media (max-width: 580px) { - body.note .column_content, body.raw .column_content { + body.note .column_content, body.other .column_content { flex-basis: 100%; max-width: 100%; margin-right: 0; } } -body.note .column_content .profile_intro, body.raw .column_content .profile_intro { +body.note .column_content .profile_intro, body.other .column_content .profile_intro { display: flex; max-width: 100%; align-items: center; } -body.note .column_content .profile_intro a, body.raw .column_content .profile_intro a { +body.note .column_content .profile_intro a, body.other .column_content .profile_intro a { display: inherit; width: 100%; align-items: inherit; @@ -711,56 +711,56 @@ body.note .column_content .profile_intro a, body.raw .column_content .profile_in flex-wrap: wrap; } @media (max-width: 580px) { - body.note .column_content .profile_intro a, body.raw .column_content .profile_intro a { + body.note .column_content .profile_intro a, body.other .column_content .profile_intro a { margin-top: 0rem; margin-bottom: -0.5rem; } } -body.note .column_content .profile_intro .info-wrapper, body.raw .column_content .profile_intro .info-wrapper { +body.note .column_content .profile_intro .info-wrapper, body.other .column_content .profile_intro .info-wrapper { flex-grow: 1; margin-bottom: 1rem; } @media (max-width: 580px) { - body.note .column_content .profile_intro .info-wrapper, body.raw .column_content .profile_intro .info-wrapper { + body.note .column_content .profile_intro .info-wrapper, body.other .column_content .profile_intro .info-wrapper { display: block; } } @media (max-width: 580px) { body.note .column_content .profile_intro .info-wrapper .name, - body.note .column_content .profile_intro .info-wrapper .npub, body.raw .column_content .profile_intro .info-wrapper .name, - body.raw .column_content .profile_intro .info-wrapper .npub { + body.note .column_content .profile_intro .info-wrapper .npub, body.other .column_content .profile_intro .info-wrapper .name, + body.other .column_content .profile_intro .info-wrapper .npub { display: block-inline; font-size: 0.9rem; } } -body.note .column_content .profile_intro .pic-wrapper, body.raw .column_content .profile_intro .pic-wrapper { +body.note .column_content .profile_intro .pic-wrapper, body.other .column_content .profile_intro .pic-wrapper { flex-basis: 16%; margin-right: 1rem; } @media (max-width: 580px) { - body.note .column_content .profile_intro .pic-wrapper, body.raw .column_content .profile_intro .pic-wrapper { + body.note .column_content .profile_intro .pic-wrapper, body.other .column_content .profile_intro .pic-wrapper { margin-right: 0.5rem; } } -body.note .column_content .published_at, body.note .column_content .reply_of, body.raw .column_content .published_at, body.raw .column_content .reply_of { +body.note .column_content .published_at, body.note .column_content .reply_of, body.other .column_content .published_at, body.other .column_content .reply_of { width: 100%; text-align: right; align-self: end; font-size: 0.8rem; } -.theme--default body.note .column_content .published_at, .theme--default body.note .column_content .reply_of, .theme--default body.raw .column_content .published_at, .theme--default body.raw .column_content .reply_of { +.theme--default body.note .column_content .published_at, .theme--default body.note .column_content .reply_of, .theme--default body.other .column_content .published_at, .theme--default body.other .column_content .reply_of { color: #9a9a9a; } -.theme--dark body.note .column_content .published_at, .theme--dark body.note .column_content .reply_of, .theme--dark body.raw .column_content .published_at, .theme--dark body.raw .column_content .reply_of { +.theme--dark body.note .column_content .published_at, .theme--dark body.note .column_content .reply_of, .theme--dark body.other .column_content .published_at, .theme--dark body.other .column_content .reply_of { color: #f3f3f3; } -.theme--default body.note .column_content .published_at a, .theme--default body.note .column_content .reply_of a, .theme--default body.raw .column_content .published_at a, .theme--default body.raw .column_content .reply_of a { +.theme--default body.note .column_content .published_at a, .theme--default body.note .column_content .reply_of a, .theme--default body.other .column_content .published_at a, .theme--default body.other .column_content .reply_of a { color: #e32a6d; } -.theme--dark body.note .column_content .published_at a, .theme--dark body.note .column_content .reply_of a, .theme--dark body.raw .column_content .published_at a, .theme--dark body.raw .column_content .reply_of a { +.theme--dark body.note .column_content .published_at a, .theme--dark body.note .column_content .reply_of a, .theme--dark body.other .column_content .published_at a, .theme--dark body.other .column_content .reply_of a { color: #e32a6d; } -body.note .column_content .reply_of, body.raw .column_content .reply_of { +body.note .column_content .reply_of, body.other .column_content .reply_of { margin-top: 0.2rem; } diff --git a/static/styles.scss b/static/styles.scss index f8385a7..46402e3 100644 --- a/static/styles.scss +++ b/static/styles.scss @@ -653,7 +653,7 @@ body.profile { } } -body.note, body.raw { +body.note, body.other { .column_content { flex-basis: 75%; max-width: 75%; diff --git a/templates/details.html b/templates/details.html index 9037a20..ad23ec3 100644 --- a/templates/details.html +++ b/templates/details.html @@ -1,19 +1,22 @@ -
+
Published at
{{.createdAt | sanitizeString}}
-
+
Kind type
- {{.kindID}} - {{.kindDescription | sanitizeString}} + {{.kindID}} + {{ if not (eq .kindNIP "")}} + - {{.kindDescription | sanitizeString}} + {{ end }}
-
+
Nevent
{{.nevent | sanitizeString}}
-
+
Event JSON
{{.eventJSON}}
\ No newline at end of file diff --git a/templates/head.html b/templates/head.html index bf2d0a3..d67cd62 100644 --- a/templates/head.html +++ b/templates/head.html @@ -63,5 +63,5 @@ {{end}} - + diff --git a/templates/other.html b/templates/other.html index dd47b5f..8a44c95 100644 --- a/templates/other.html +++ b/templates/other.html @@ -3,7 +3,7 @@ {{template "head.html" .}} - + {{template "top.html" .}}