diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -384,6 +384,28 @@ }, "fullAvatar": func(handle string) string { return p.AvatarUrl(handle, "") }, + "placeholderAvatar": func(size string) template.HTML { + sizeClass := "size-6" + iconSize := "size-4" + if size == "tiny" { + sizeClass = "size-6" + iconSize = "size-4" + } else if size == "small" { + sizeClass = "size-8" + iconSize = "size-5" + } else { + sizeClass = "size-12" + iconSize = "size-8" + } + icon, _ := p.icon("user-round", []string{iconSize, "text-gray-400", "dark:text-gray-500"}) + return template.HTML(fmt.Sprintf(`
%s
`, sizeClass, icon)) + }, + "profileAvatarUrl": func(profile *models.Profile, size string) string { + if profile != nil { + return p.AvatarUrl(profile.Did, size) + } + return "" + }, "langColor": enry.GetColor, "reverse": func(s any) any { if s == nil { diff --git a/appview/pages/templates/layouts/profilebase.html b/appview/pages/templates/layouts/profilebase.html --- a/appview/pages/templates/layouts/profilebase.html +++ b/appview/pages/templates/layouts/profilebase.html @@ -2,7 +2,7 @@ {{ define "title" }}{{ resolve .Card.UserDid }}{{ end }} {{ define "extrameta" }} {{ $handle := resolve .Card.UserDid }} - {{ $avatarUrl := fullAvatar $handle }} + {{ $avatarUrl := profileAvatarUrl .Card.Profile "" }} diff --git a/appview/pages/templates/user/fragments/editAvatar.html b/appview/pages/templates/user/fragments/editAvatar.html new file mode 100644 --- /dev/null +++ b/appview/pages/templates/user/fragments/editAvatar.html @@ -0,0 +1,44 @@ +{{ define "user/fragments/editAvatar" }} +
+ +

Select an image (PNG or JPEG, max 1MB)

+ +
+
+ + +
+
+{{ end }} diff --git a/appview/pages/templates/user/fragments/profileCard.html b/appview/pages/templates/user/fragments/profileCard.html --- a/appview/pages/templates/user/fragments/profileCard.html +++ b/appview/pages/templates/user/fragments/profileCard.html @@ -3,9 +3,24 @@ {{ $userIdent := resolve .UserDid }}
- + + {{ if eq .FollowStatus.String "IsSelf" }} + + {{ end }}
+
+ {{ template "user/fragments/editAvatar" . }} +

{{ $userIdent }}

{{ with .Profile }} - {{ if .Pronouns }} -

{{ .Pronouns }}

- {{ end }} + {{ if .Pronouns }} +

{{ .Pronouns }}

+ {{ end }} {{ end }}
@@ -29,7 +44,7 @@ {{ $profile := .Profile }} {{ with .Profile }} {{ if .Description }} -

{{ .Description }}

+

{{ .Description }}

{{ end }} {{ end }} {{ if .IncludeBluesky }}
- {{ template "user/fragments/bluesky" "w-4 h-4 text-black dark:text-white" - }} + {{ template "user/fragments/bluesky" "w-4 h-4 text-black dark:text-white" }} {{ $userIdent }}
{{ end }} {{ range $link := .Links }} - {{ if $link }} -
- {{ i "link" "size-4" }} - {{ $link }} -
- {{ end }} + {{ if $link }} +
+ {{ i "link" "size-4" }} + {{ $link }} +
+ {{ end }} {{ end }} {{ if not $profile.IsStatsEmpty }}
{{ range $stat := .Stats }} - {{ if $stat.Kind }} -
- {{ $stat.Value }} - {{ $stat.Kind.String }} -
- {{ end }} + {{ if $stat.Kind }} +
+ {{ $stat.Value }} + {{ $stat.Kind.String }} +
+ {{ end }} {{ end }}
{{ end }} @@ -75,10 +89,13 @@ {{ end }}
{{ if ne .FollowStatus.String "IsSelf" }} - {{ template "user/fragments/follow" . }} + {{ template "user/fragments/follow" . }} {{ else }} -