Fix rendering of naddr and other events

This commit is contained in:
Daniele Tonon
2023-06-01 16:43:47 +02:00
parent 3b6b347337
commit 64b2ce3e02
6 changed files with 31 additions and 25 deletions

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -653,7 +653,7 @@ body.profile {
}
}
body.note, body.raw {
body.note, body.other {
.column_content {
flex-basis: 75%;
max-width: 75%;

View File

@@ -1,19 +1,22 @@
<div class="field {{if not (eq .type "other")}}advanced{{end}}">
<div class="field {{if not ( or (eq .type "other") (eq .type "address"))}}advanced{{end}}">
<div class="label">Published at</div>
{{.createdAt | sanitizeString}}
</div>
<div class="field {{if not (eq .type "other")}}advanced{{end}}">
<div class="field {{if not ( or (eq .type "other") (eq .type "address"))}}advanced{{end}}">
<div class="label">Kind type</div>
{{.kindID}} - <a href="https://github.com/nostr-protocol/nips/blob/master/{{.kindNIP | sanitizeString}}.md">{{.kindDescription | sanitizeString}}</a>
{{.kindID}}
{{ if not (eq .kindNIP "")}}
- <a href="https://github.com/nostr-protocol/nips/blob/master/{{.kindNIP | sanitizeString}}.md">{{.kindDescription | sanitizeString}}</a>
{{ end }}
</div>
<div class="field {{if not (eq .type "other")}}advanced{{end}}">
<div class="field {{if not ( or (eq .type "other") (eq .type "address"))}}advanced{{end}}">
<div class="label">Nevent</div>
<div>{{.nevent | sanitizeString}}</div>
</div>
<div class="field {{if not (eq .type "other")}}advanced{{end}} boxed">
<div class="field {{if not ( or (eq .type "other") (eq .type "address"))}}advanced{{end}} boxed">
<div class="label">Event JSON</div>
<div class="json">{{.eventJSON}}</div>
</div>

View File

@@ -63,5 +63,5 @@
{{end}}
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/njump/static/styles.css?v=20230601" />
<link rel="stylesheet" href="/njump/static/styles.css?v=20230601b" />
</head>

View File

@@ -3,7 +3,7 @@
<meta charset="UTF-8" />
{{template "head.html" .}}
<body class="raw">
<body class="other">
{{template "top.html" .}}
<div class="container_wrapper">