2025-01-14 13:05:45 -03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "github.com/nbd-wtf/go-nostr"
|
|
|
|
|
|
|
|
templ reportsPage(reports chan *nostr.Event, loggedUser string) {
|
|
|
|
@layout(loggedUser) {
|
|
|
|
<div>
|
|
|
|
<h1 class="text-xl p-4">reports received</h1>
|
|
|
|
<div>
|
|
|
|
for report := range reports {
|
|
|
|
<div>
|
2025-04-05 09:56:41 -03:00
|
|
|
if e := report.Tags.Find("e"); e != nil {
|
2025-01-14 13:05:45 -03:00
|
|
|
@eventReportComponent(e, report)
|
2025-04-05 09:56:41 -03:00
|
|
|
} else if p := report.Tags.Find("p"); p != nil {
|
2025-01-14 13:05:45 -03:00
|
|
|
@profileReportComponent(p, report)
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-04-05 09:56:41 -03:00
|
|
|
templ eventReportComponent(e nostr.Tag, report *nostr.Event) {
|
|
|
|
if res, _ := sys.StoreRelay.QuerySync(ctx, nostr.Filter{IDs: []string{e[1]}}); len(res) > 0 {
|
2025-01-14 13:05:45 -03:00
|
|
|
<div>
|
|
|
|
<div class="font-lg">
|
|
|
|
<span class="font-semibold">
|
2025-04-05 09:56:41 -03:00
|
|
|
if len(e) >= 3 {
|
|
|
|
{ e[2] }
|
2025-01-14 13:05:45 -03:00
|
|
|
}
|
|
|
|
</span>
|
|
|
|
{ " report" }
|
|
|
|
</div>
|
|
|
|
<div>by @userNameComponent(sys.FetchProfileMetadata(ctx, report.PubKey))</div>
|
|
|
|
<div class="p-3">{ report.Content }</div>
|
|
|
|
<div>
|
|
|
|
event reported:
|
|
|
|
<div class="text-mono">{ res[0].String() }</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-04-05 09:56:41 -03:00
|
|
|
templ profileReportComponent(p nostr.Tag, report *nostr.Event) {
|
|
|
|
if isPublicKeyInWhitelist(p[1]) {
|
2025-01-14 13:05:45 -03:00
|
|
|
<div>
|
|
|
|
<div class="font-lg">
|
|
|
|
<span class="font-semibold">
|
2025-04-05 09:56:41 -03:00
|
|
|
if len(p) >= 3 {
|
|
|
|
{ p[2] }
|
2025-01-14 13:05:45 -03:00
|
|
|
}
|
|
|
|
</span>
|
|
|
|
{ " report" }
|
|
|
|
</div>
|
|
|
|
<div>by @userNameComponent(sys.FetchProfileMetadata(ctx, report.PubKey))</div>
|
|
|
|
<div class="p-3">{ report.Content }</div>
|
|
|
|
<div>
|
|
|
|
profile reported:
|
2025-04-05 09:56:41 -03:00
|
|
|
<a href={ templ.URL("https://njump.me/p/" + report.PubKey) } target="_blank" class="font-mono py-1">
|
|
|
|
<nostr-name pubkey={ report.PubKey }>{ report.PubKey }</nostr-name>
|
|
|
|
</a>
|
2025-01-14 13:05:45 -03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
}
|