clone

a self-hosted multitenant nostr relay with sites, file storage, git hosting, and inbox and outbox delivery

feat/ui-updates
tinyrelay / tinyclient / social_profile.html
social_profile.html 2.3K
1{{define "social-profile"}}<section id="social-profile">2{{if .Error}}<p role="alert">{{.Error}}</p>3{{else if not .View}}<header><h1>Social profile</h1><p>See someone’s profile and their posts in one place.</p></header>4<form method="get" action="/social/profile"><label for="profile-author">Public key</label><input id="profile-author" name="author" placeholder="64 hex characters or npub" required><button>View profile</button></form>5{{if not .Actor}}<p><a href="{{signinURL .Base .Path .Query}}">Sign in</a> to open your own profile.</p>{{end}}6{{else}}{{$profile := asMap (index (asMap .Event) "profile")}}<header id="social-profile-head">7{{with socialMediaURL (str (index $profile "banner"))}}<img id="social-profile-banner" src="{{.}}" alt="" loading="lazy" referrerpolicy="no-referrer">{{end}}8<img id="social-profile-picture" src="{{with socialMediaURL (str (index $profile "picture"))}}{{.}}{{else}}{{avatarURL .View}}{{end}}" alt="" width="80" height="80" loading="lazy" referrerpolicy="no-referrer">9<h1>{{or (str (index $profile "display_name")) (str (index $profile "name")) (shortID .View)}}</h1><p>{{template "nostrKey" .View}}</p>10{{with str (index $profile "about")}}<p id="social-profile-about">{{.}}</p>{{end}}11{{with socialMediaURL (str (index $profile "website"))}}<p><a href="{{.}}" rel="noopener noreferrer">{{.}}</a></p>{{end}}12{{with str (index $profile "nip05")}}<p><small>NIP-05 {{.}}</small></p>{{end}}13{{if eq .Actor .View}}<p>{{if eq (socialView .Query).Key "podcasts"}}<a href="/social?kind=podcasts&amp;author={{.Actor}}">Manage podcast</a>{{else}}<a href="/profile">Edit profile</a>{{end}}</p>{{end}}14</header>15<nav id="social-profile-views" aria-label="Profile posts">{{range socialViews}}{{$kind := .Key}}<a href="/social/profile?author={{urlquery $.View}}{{if ne $kind "feed"}}&amp;kind={{urlquery $kind}}{{end}}"{{if eq (socialView $.Query).Key $kind}} aria-current="page"{{end}}>{{if eq $kind "feed"}}All posts{{else}}{{.Label}}{{end}}</a>{{end}}</nav>16{{if eq (socialView .Query).Key "podcasts"}}<p id="social-profile-subscribe"><a href="{{podcastFeedURL .Query}}">Subscribe with RSS</a></p>{{end}}17{{template "socialFeed" .}}18<form method="get" action="/social/profile"><label for="profile-author-again">View another profile</label><input id="profile-author-again" name="author" value="{{.View}}"><button>View</button></form>19{{end}}</section>{{end}}