From 9cc9ffc5a7edd5bcd4e51bd6b32dfdba5082dd24 Mon Sep 17 00:00:00 2001 From: f0x52 Date: Thu, 11 May 2023 17:46:32 +0200 Subject: [frontend] Profiles with fields & more (#1764) * redesign status template * separate index page styling * redesign profile template * fix header styling/wrapping * remove old spoiler js * fix status cw button wrapping * fix status info variables * profile responsiveness, accessibility tweaks * fix variable use, mobile * remove duplicate id's * rss icon, fix indent * fix toot border-radius * fix toot spacing * emojify and html profile fields * refactor (sensitive) media rendering * plaintext profile fields * bundle plyr icon svg * only pause video when switching photoswipe slides * yarn upgrade * profile fields formatting * replace uglifyify with @browserify updated fork * fix profile field templating (yet again) * fix React classes * testrig: add testing profile field for admin user * fix sensitive media interactions * Revert "testrig: add testing profile field for admin user" This reverts commit 80490c183e6639ce5b57fcfca6772d8f96df8706. * settings interface wrapping * fix reported toot styling * add role to profile sr-only text * comment fallback rule * remove currently unused image description lacking indicator --- web/template/header.tmpl | 55 ++++++++----- web/template/profile.tmpl | 202 +++++++++++++++++++++++++++++----------------- web/template/status.tmpl | 149 +++++++++++++++++++++------------- web/template/thread.tmpl | 16 ++-- 4 files changed, 263 insertions(+), 159 deletions(-) (limited to 'web/template') diff --git a/web/template/header.tmpl b/web/template/header.tmpl index addd0953e..05e47991a 100644 --- a/web/template/header.tmpl +++ b/web/template/header.tmpl @@ -21,46 +21,61 @@ + - {{ if .ogMeta }}{{ if .ogMeta.Locale }} - {{ end }} + {{ if .ogMeta }}{{ if .ogMeta.Locale }} + + {{ end }} + - {{ if .ogMeta.ArticlePublisher }} + {{ if .ogMeta.ArticlePublisher }} + - {{ end }}{{ if .ogMeta.ProfileUsername }} - {{ end }} - {{ if .ogMeta.ImageAlt }} - {{ end }}{{ if .ogMeta.ImageWidth }} + {{ end }}{{ if .ogMeta.ProfileUsername }} + + {{ end }} + + {{ if .ogMeta.ImageAlt }} + + {{ end }}{{ if .ogMeta.ImageWidth }} + - {{ end }}{{ end }} - {{ if .rssFeed }}{{ end }} + {{ end }}{{ end }} + + {{ if .rssFeed }} + {{ end }} - {{range .stylesheets}} - {{end}} + {{range .stylesheets}} + + {{end}} + - {{range .stylesheets}} + {{range .stylesheets}} + {{end}}{{ if .ogMeta }}{{ .ogMeta.Title }}{{ else }}{{.instance.Title}} - GoToSocial{{ end }} +
- - {{ if .instance.ThumbnailDescription }}{{ .instance.ThumbnailDescription }}{{ else }}Instance Logo{{ end }} -
-

- {{.instance.Title}} -

-
+
+ {{ if .instance.ThumbnailDescription }}{{ .instance.ThumbnailDescription }}{{ else }}Instance Logo{{ end }} +

+ {{.instance.Title}} +

-
+
\ No newline at end of file diff --git a/web/template/profile.tmpl b/web/template/profile.tmpl index c7665c69e..a9842b44c 100644 --- a/web/template/profile.tmpl +++ b/web/template/profile.tmpl @@ -18,80 +18,130 @@ */ -}} {{ template "header.tmpl" .}} -
-
-
- {{ if .account.Header }} - {{if .account.DisplayName}}{{.account.DisplayName}}{{else}}{{.account.Username}}{{end}}'s header - {{ end }} -
-
-
- {{if .account.DisplayName}}{{.account.DisplayName}}{{else}}{{.account.Username}}{{end}}'s avatar -
{{if .account.DisplayName}}{{emojify .account.Emojis (escape .account.DisplayName)}}{{else}}{{.account.Username}}{{end}}
-
-
@{{ .account.Username }}@{{ .instance.AccountDomain }}
- {{- /* Only render account role if 1. it's present and 2. it's not equal to the standard 'user' role */ -}} - {{ if and (.account.Role) (ne .account.Role.Name "user") }}
{{ .account.Role.Name }}
{{ end }} -
-
-
-
- {{ if .account.Note }}{{emojify .account.Emojis (noescape .account.Note)}}{{else}}This GoToSocial user hasn't written a bio yet!{{end}} -
-
-
-
-
Joined {{.account.CreatedAt | timestampVague}}
-
Followed by {{.account.FollowersCount}}
-
-
-
Following {{.account.FollowingCount}}
-
Posted {{.account.StatusesCount}}
-
-
-
- {{ if .pinned_statuses }} -

- Pinned toots -

-
- {{ range .pinned_statuses }} -
- {{ template "status.tmpl" .}} -
- {{ end }} -
- {{ end }} -

- Latest public toots - {{ if .rssFeed }} - - - - {{ end }} -

- {{ if not .statuses }} -
Nothing here!
- {{ else }} -
- {{ range .statuses }} -
- {{ template "status.tmpl" .}} -
- {{ end }} -
- {{ end }} - + +
+
+
+ {{ if .account.Header }} + + {{ end }} +
+ +
+ Profile for + {{if .account.DisplayName}}{{.account.DisplayName}}{{else}}{{.account.Username}}{{end}}. + Username @{{.account.Username}}, {{acctInstance .account.Acct}}. + {{ if and (.account.Role) (ne .account.Role.Name "user") }} + Role: {{ .account.Role.Name }} + {{ end }} +
+
+ +
+ +
+
+

About

+
+ +
+ {{ range .account.Fields }} +
+ {{emojify $.account.Emojis (noescape .Name)}} + {{emojify $.account.Emojis (noescape .Value)}} +
+ {{ end }} +
+ +
+ {{ if .account.Note }} + {{emojify .account.Emojis (noescape .account.Note)}} + {{else}} + This GoToSocial user hasn't written a bio yet! + {{end}} +
+ +
+ Joined on {{.account.CreatedAt | timestampVague}}. + {{.account.StatusesCount}} post{{if .account.StatusesCount | eq 1 | not}}s{{end}}. + Followed by {{.account.FollowersCount}}. + Following {{.account.FollowingCount}}. +
+ + +
+ +
+ {{ if .pinned_statuses }} +
+

Pinned posts

+ jump to recent +
+
+ {{ range .pinned_statuses }} +
+ {{ template "status.tmpl" .}} +
+ {{ end }} +
+ {{ end }} + +
+

Recent posts

+ {{ if .rssFeed }} + + + + {{ end }} +
+ +
+ {{ if not .statuses }} +
Nothing here!
+ {{ else }} + {{ range .statuses }} +
+ {{ template "status.tmpl" .}} +
+ {{ end }} + {{ end }} +
+ + +
+
-{{ template "footer.tmpl" .}} + +{{ template "footer.tmpl" .}} \ No newline at end of file diff --git a/web/template/status.tmpl b/web/template/status.tmpl index f31219a9e..a8c9792ab 100644 --- a/web/template/status.tmpl +++ b/web/template/status.tmpl @@ -17,71 +17,110 @@ // along with this program. If not, see . */ -}} -
- - {{if .Account.DisplayName}}{{emojify .Account.Emojis (escape .Account.DisplayName)}}{{else}}{{.Account.Username}}{{end}} - @{{.Account.Acct}} -
- {{.CreatedAt | timestamp}} -
+
+ + + + {{if .Account.DisplayName}} + {{emojify .Account.Emojis (escape .Account.DisplayName)}} + {{else}} + {{.Account.Username}} + {{end}} + . + + @{{.Account.Username}}, {{acctInstance .Account.Acct}} + +
+
{{if .SpoilerText}} - -
- {{emojify .Emojis (escape .SpoilerText)}} - -
- {{end}} +
+ + {{emojify .Emojis (escape .SpoilerText)}} + Toggle visibility + +
+ {{emojify .Emojis (noescape .Content)}} +
+
+ {{else}}
{{emojify .Emojis (noescape .Content)}}
+ {{end}}
{{with .MediaAttachments}} - -
-
{{.CreatedAt | timestampPrecise}}
-
-
{{.RepliesCount}}
-
{{.ReblogsCount}}
-
{{.FavouritesCount}}
+
+
-View toot + +Open + thread \ No newline at end of file diff --git a/web/template/thread.tmpl b/web/template/thread.tmpl index 5e4e3f7d4..f2b61019d 100644 --- a/web/template/thread.tmpl +++ b/web/template/thread.tmpl @@ -19,20 +19,20 @@ {{ template "header.tmpl" .}}
-
+
{{range .context.Ancestors}} -
+
{{ template "status.tmpl" .}} -
+ {{end}} -
+
{{ template "status.tmpl" .status}} -
+ {{range .context.Descendants}} -
+
{{ template "status.tmpl" .}} -
+ {{end}} -
+
{{ template "footer.tmpl" .}} \ No newline at end of file -- cgit v1.3