mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-01-07 15:10:12 +00:00
redesign profile template
This commit is contained in:
parent
2a44a49979
commit
c200c79bcd
|
@ -16,274 +16,246 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -18,80 +18,110 @@
|
|||
*/ -}}
|
||||
|
||||
{{ template "header.tmpl" .}}
|
||||
<main>
|
||||
<div class="profile">
|
||||
<div class="headerimage">
|
||||
|
||||
<main class="profile">
|
||||
<div class="header">
|
||||
<div class="header-image">
|
||||
{{ if .account.Header }}
|
||||
<img
|
||||
src="{{.account.Header}}"
|
||||
alt="{{if .account.DisplayName}}{{.account.DisplayName}}{{else}}{{.account.Username}}{{end}}'s header"
|
||||
/>
|
||||
<img src="{{.account.Header}}" alt="" />
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="basic">
|
||||
<div id="profile-basic-filler2"></div>
|
||||
<a href="{{.account.Avatar}}" class="avatar"><img src="{{.account.Avatar}}" alt="{{if .account.DisplayName}}{{.account.DisplayName}}{{else}}{{.account.Username}}{{end}}'s avatar"></a>
|
||||
<div class="displayname">{{if .account.DisplayName}}{{emojify .account.Emojis (escape .account.DisplayName)}}{{else}}{{.account.Username}}{{end}}</div>
|
||||
<div class="usernamecontainer">
|
||||
<div class="username">@{{ .account.Username }}@{{ .instance.AccountDomain }}</div>
|
||||
{{- /* 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") }}<div class="role {{ .account.Role.Name }}">{{ .account.Role.Name }}</div>{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="detailed">
|
||||
<div class="bio">
|
||||
{{ if .account.Note }}{{emojify .account.Emojis (noescape .account.Note)}}{{else}}This GoToSocial user hasn't written a bio yet!{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="accountstats">
|
||||
<div class="entry-group">
|
||||
<div class="entry">Joined <b>{{.account.CreatedAt | timestampVague}}</b></div>
|
||||
<div class="entry">Followed by <b>{{.account.FollowersCount}}</b></div>
|
||||
</div>
|
||||
<div class="entry-group">
|
||||
<div class="entry">Following <b>{{.account.FollowingCount}}</b></div>
|
||||
<div class="entry">Posted <b>{{.account.StatusesCount}}</b></div>
|
||||
<div class="basic-info">
|
||||
<a class="avatar" href="{{.account.Avatar}}">
|
||||
<img src="{{.account.Avatar}}" alt="">
|
||||
</a>
|
||||
<span class="displayname text-cutoff">
|
||||
{{if .account.DisplayName}}
|
||||
{{emojify .account.Emojis (escape .account.DisplayName)}}
|
||||
{{else}}
|
||||
{{.account.Username}}
|
||||
{{end}}
|
||||
<span class="sr-only">.</span>
|
||||
</span>
|
||||
<span class="username text-cutoff">@{{.account.Username}}<span class="sr-only">,
|
||||
</span>{{acctInstance .account.Acct}}</span>
|
||||
{{- /* 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") }}
|
||||
<div class="role {{ .account.Role.Name }}">
|
||||
<span class="sr-only">Role: </span>{{ .account.Role.Name }}
|
||||
</div>
|
||||
{{ end }}
|
||||
<!-- <a class="rss-icon-link" href="/@admin/feed.rss" aria-label="RSS feed">
|
||||
<i class="rss-icon fa fa-rss-square" aria-hidden="true"></i>
|
||||
</a> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="about-user">
|
||||
<div class="col-header">
|
||||
<h3>About</h3>
|
||||
</div>
|
||||
|
||||
<div class="fields">
|
||||
{{ range .account.Fields }}
|
||||
<div class="field">
|
||||
<b>{{.Name}}</b>
|
||||
<span>{{.Value}}</span>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="bio">
|
||||
{{ if .account.Note }}
|
||||
{{emojify .account.Emojis (noescape .account.Note)}}
|
||||
{{else}}
|
||||
This GoToSocial user hasn't written a bio yet!
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<div class="accountstats">
|
||||
<b>Joined</b><time datetime="{{.account.CreatedAt}}">{{.account.CreatedAt | timestampVague}}</time>
|
||||
<b>Posts</b><span>{{.account.StatusesCount}}</span>
|
||||
<b>Followed by</b><span>{{.account.FollowersCount}}</span>
|
||||
<b>Following</b><span>{{.account.FollowingCount}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toots">
|
||||
{{ if .pinned_statuses }}
|
||||
<h2 id="pinned">
|
||||
<span>Pinned toots</span>
|
||||
</h2>
|
||||
<div class="thread">
|
||||
<div class="col-header pinned">
|
||||
<h3>Pinned posts</h3>
|
||||
<a href="#recent">jump to recent</a>
|
||||
</div>
|
||||
<section class="thread">
|
||||
{{ range .pinned_statuses }}
|
||||
<div class="toot expanded">
|
||||
<article class="toot expanded" id="{{.ID}}">
|
||||
{{ template "status.tmpl" .}}
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
<div class="col-header" id="recent">
|
||||
<h3>Recent posts</h3>
|
||||
</div>
|
||||
{{ end }}
|
||||
<h2 id="recent">
|
||||
<span>Latest public toots</span>
|
||||
{{ if .rssFeed }}
|
||||
<a href="{{ .rssFeed }}" aria-label="RSS feed">
|
||||
<i class="rss-icon fa fa-rss-square" aria-hidden="true"></i>
|
||||
</a>
|
||||
{{ end }}
|
||||
</h2>
|
||||
{{ if not .statuses }}
|
||||
<div data-nosnippet class="nothinghere">Nothing here!</div>
|
||||
{{ else }}
|
||||
<div class="thread">
|
||||
|
||||
<section class="thread">
|
||||
{{ if not .statuses }}
|
||||
<div data-nosnippet class="nothinghere">Nothing here!</div>
|
||||
{{ else }}
|
||||
{{ range .statuses }}
|
||||
<div class="toot expanded">
|
||||
<article class="toot expanded" id="{{.ID}}">
|
||||
{{ template "status.tmpl" .}}
|
||||
</div>
|
||||
</article>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</section>
|
||||
|
||||
<div class="backnextlinks">
|
||||
{{ if .show_back_to_top }}
|
||||
<a href="/@{{ .account.Username }}">Back to top</a>
|
||||
{{ end }}
|
||||
{{ if .statuses_next }}
|
||||
<a href="{{ .statuses_next }}" class="next">Show older</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="backnextlinks">
|
||||
{{ if .show_back_to_top }}
|
||||
<a href="/@{{ .account.Username }}">Back to top</a>
|
||||
{{ end }}
|
||||
{{ if .statuses_next }}
|
||||
<a href="{{ .statuses_next }}" class="next">Show older</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</main>
|
||||
{{ template "footer.tmpl" .}}
|
||||
|
||||
{{ template "footer.tmpl" .}}
|
Loading…
Reference in a new issue