diff --git a/web/source/css/profile.css b/web/source/css/profile.css index 0065f6015..44cf754d1 100644 --- a/web/source/css/profile.css +++ b/web/source/css/profile.css @@ -16,274 +16,246 @@ along with this program. If not, see . */ -header { - a img { - height: 5rem; - } +.page { + grid-template-columns: 1fr minmax(auto, 60rem) 1fr; + grid-template-columns: 1fr min(92%, 65rem) 1fr; } -main { +main.profile { + background: $gray2; background: transparent; - padding-top: 0; + padding: 0.5rem; + border-radius: $br; + + display: grid; + grid-template-rows: auto auto; + grid-template-columns: 35fr 65fr; + grid-template-areas: + "header header" + "about toots"; + + gap: 1rem; } -.profile { +main.profile .header { + grid-area: header; + background: $bg-accent; - display: grid; - grid-template-columns: 100%; - gap: 0.5rem; - margin-bottom: 0.2rem; - overflow-x: hidden; - position: relative; - border-radius: $br; - box-shadow: $boxshadow; - border: $boxshadow-border; + overflow: hidden; - .headerimage { - width: 100%; - aspect-ratio: 3 / 1; - max-height: 16rem; - overflow: hidden; - box-shadow: $boxshadow; + .header-image { + position: relative; + padding-top: 33.33%; /* aspect-ratio 1/3 */ img { + position: absolute; + top: 0; + left: 0; + right: 0; width: 100%; height: 100%; object-fit: cover; - border-radius: $br-inner $br-inner 0 0; } } - .basic { - height: 8.5rem; - margin-top: -6.5rem; + /* + Basic info container has the user's avatar, display- and username, and role + It's partially overlapped over the header image, by a negative margin-top + */ + .basic-info { + $avatar-size: 8.5rem; + $name-size: 3rem; + $username-size: 2rem; + $overlap: calc($avatar-size - $name-size - $username-size); + + position: relative; display: grid; - grid-template-columns: 1rem 8.5rem 1fr; - grid-template-rows: 3rem 3rem 2.5rem; - + box-sizing: border-box; + grid-template-columns: $avatar-size auto 1fr; + grid-template-rows: $overlap $name-size auto; grid-template-areas: - ". avatar ." - "filler2 avatar displayname" - ". avatar username"; + "avatar . ." + "avatar displayname displayname" + "avatar username role"; - #profile-basic-filler2 { - grid-area: filler2; - background: $bg-trans; - } + margin: 1rem; + margin-top: calc(-1 * $overlap); + gap: 0 1rem; .avatar { - align-self: end; - box-sizing: border-box; - height: 8.5rem; - width: 8.5rem; grid-area: avatar; - background: $bg; + height: $avatar-size; + width: $avatar-size; border: 0.2rem solid $avatar-border; - padding: 0; border-radius: $br; - position: relative; + overflow: hidden; /* prevents image extending beyond rounded borders */ - box-shadow: $boxshadow; img { - object-fit: cover; - border-radius: $br-inner; - width: 100%; height: 100%; + width: 100%; + object-fit: cover; } } - a, div { - color: inherit; - text-decoration: none; - } - .displayname { grid-area: displayname; - font-weight: bold; + line-height: $name-size; font-size: 2rem; - line-height: 3rem; - background: $bg-trans; - word-break: break-all; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - max-height: 6rem; - padding: 0 0.5rem; + font-weight: bold; } - .usernamecontainer { - height: 2.5rem; - display: grid; - grid-template-columns: auto 1fr; + .username { + min-width: 0; grid-area: username; - /* justify-content: space-between; */ - padding: 0; - gap: 0.5rem; - position: relative; - + line-height: $username-size; + + font-size: 1rem; + font-weight: bold; color: $fg-accent; + user-select: all; + } + + .role { + grid-area: role; + align-self: center; + justify-self: start; + border: 0.13rem solid $gray1; + border-radius: $br; + padding: 0.3rem; + + line-height: 1.1rem; + font-size: 0.9rem; + font-variant: small-caps; font-weight: bold; - .username { - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - user-select: all; - - line-height: 2.5rem; - padding-left: 0; - margin-left: 0.5rem; - } - - .role { - justify-self: start; - align-self: center; - line-height: 1.1rem; - font-size: 0.9rem; - margin-right: 0.2rem; - padding: 0.2rem; - margin-top: 0.1rem; - padding-top: 0.1rem; - border: 0.1rem solid $gray1; - border-radius: $br; - font-variant: small-caps; - } - - .role.admin { + &.admin { background: $gray1; color: $orange2; border-color: $orange2; } - .role.moderator { + &.moderator { background: $gray1; color: $blue2; border-color: $blue1; } } } +} - @media screen and (max-width: 600px) { - & { - gap: 0.1rem; - } - - .basic { - margin-top: calc(-22vw + 1rem); - height: initial; - display: flex; - flex-direction: column; - - #profile-basic-filler2 { - display: none; - } - - .avatar { - align-self: flex-start; - margin-left: 1rem; - height: 22vw; - width: 22vw; - } - - .displayname { - padding-left: 1rem; - font-size: 1.5rem; - line-height: 2rem; - margin-top: 0.5rem; - align-self: stretch; - } - - .usernamecontainer { - padding-left: 1rem; - - .username { - margin-left: 0; - } - } - } - } - - .detailed { +main.profile { + .col-header { display: flex; - flex-direction: column; - flex: 1 1 25em; + justify-content: start; + gap: 2rem; + align-items: center; - h2 { - margin-top: 0; + margin: 0; + background: $gray4; + border-top-left-radius: $br; + border-top-right-radius: $br; + padding: 0.75rem; + + h3 { + font-size: 1.2rem; + line-height: 1.3rem; + margin: 0; } - .bio { - margin-top: 0; - margin-bottom: 0.5rem; - margin-left: 1rem; - margin-right: 1rem; - word-break: break-word; + &.pinned { + margin: 0 1rem; + display: grid; + grid-template-columns: auto 1fr; + gap: 1rem; a { - color: $acc1; - text-decoration: underline; + justify-self: end; } } } } -.accountstats { - display: flex; - flex-wrap: wrap; - border-radius: 0 0 $br $br; - border-top: 0.1rem solid $bg; +main.profile .toots { + grid-area: toots; - .entry-group { - flex: 1 1 auto; - min-width: 50%; + display: flex; + flex-direction: column; + gap: 0.4rem; + + .col-header { + margin: 0; + background: $gray4; + border-top-left-radius: $br; + border-top-right-radius: $br; + padding: 0.75rem; + } + + .toot { + padding-top: 0.75rem; + box-shadow: none; + border: none; + + .contentgrid { + padding: 0 0.75rem; + } + + .info { + padding: 0.3rem 0.75rem; + } + + &:first-child { + border-radius: 0; + } + } +} + +main.profile .about-user { + grid-area: about; + border-radius: $br; + overflow: hidden; + + .col-header { + margin-bottom: -0.25rem; + } + + .fields { + background: $gray4; display: flex; + flex-direction: column; + padding: 0.5rem; + padding-top: 0.25rem; + + .field { + padding: 0.25rem; + display: flex; + flex-direction: column; + border-bottom: 0.1rem solid $gray2; + word-break: break-all; + + &:first-child { + border-top: 0.1rem solid $gray2; + } + + b { + color: $fg-accent; + } + } } - .entry { - white-space: nowrap; - width: 50%; - margin: 1.2rem 0.5rem; - text-align: center; - } -} - -.nothinghere { - margin-left: 1rem; -} - -.backnextlinks { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - - a { - padding: 1rem; + .bio { + background: $gray4; + padding: 0 0.75rem; + padding-bottom: 0.75rem; } - .next { - margin-left: auto; + .accountstats { + background: $bg-accent; + padding: 0.75rem; + + display: grid; + grid-template-columns: auto 1fr; + gap: 0.25rem 1rem; } -} - -.toot, .toot:last-child { - box-shadow: $boxshadow; -} - -#recent, #pinned { - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - margin: 1rem; - .rss-icon { - font-size: 1.45em; - object-fit: contain; - vertical-align: middle; - color: $orange2; - /* can't size a single-color background, so we use a linear-gradient that's effectively white */ - background: linear-gradient(to right, $white1 100%, transparent 0) no-repeat center center; - background-size: 1.2rem 1.4rem; - } -} +} \ No newline at end of file diff --git a/web/source/frontend/index.js b/web/source/frontend/index.js index 2a9577201..e5d447ae5 100644 --- a/web/source/frontend/index.js +++ b/web/source/frontend/index.js @@ -60,3 +60,20 @@ Array.from(document.getElementsByClassName("spoiler-label")).forEach((label) => label.addEventListener("click", () => { setTimeout(update, 1); }); } }); + +Array.from(document.getElementsByClassName("spoiler-details")).forEach((spoiler) => { + const button = spoiler.getElementsByClassName("button")[0]; + + if (button != undefined) { + function update() { + if (spoiler.open) { + button.textContent = "Show less"; + } else { + button.textContent = "Show more"; + } + } + update(); + + spoiler.addEventListener("toggle", update); + } +}); diff --git a/web/template/profile.tmpl b/web/template/profile.tmpl index c7665c69e..49ef3c054 100644 --- a/web/template/profile.tmpl +++ b/web/template/profile.tmpl @@ -18,80 +18,110 @@ */ -}} {{ 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 .account.DisplayName}} + {{emojify .account.Emojis (escape .account.DisplayName)}} + {{else}} + {{.account.Username}} + {{end}} + . + + @{{.account.Username}}, + {{acctInstance .account.Acct}} + {{- /* 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") }} +
+ Role: {{ .account.Role.Name }}
+ {{ end }} +
+ +
+
+

About

+
+ +
+ {{ range .account.Fields }} +
+ {{.Name}} + {{.Value}} +
+ {{ end }} +
+ +
+ {{ if .account.Note }} + {{emojify .account.Emojis (noescape .account.Note)}} + {{else}} + This GoToSocial user hasn't written a bio yet! + {{end}} +
+ +
+ Joined + Posts{{.account.StatusesCount}} + Followed by{{.account.FollowersCount}} + Following{{.account.FollowingCount}} +
+
+ +
{{ if .pinned_statuses }} -

- Pinned toots -

-
+
+

Pinned posts

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

Recent posts

- {{ end }} -

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

- {{ if not .statuses }} -
Nothing here!
- {{ else }} -
+ +
+ {{ if not .statuses }} +
Nothing here!
+ {{ else }} {{ range .statuses }} -
+
{{ template "status.tmpl" .}} -
+ + {{ end }} + {{ end }} +
+ + - {{ end }} -
-{{ template "footer.tmpl" .}} + +{{ template "footer.tmpl" .}} \ No newline at end of file