diff options
| author | 2022-11-15 10:19:32 +0100 | |
|---|---|---|
| committer | 2022-11-15 10:19:32 +0100 | |
| commit | a39a664525f55846dd5eea52fcc7009867835989 (patch) | |
| tree | 33ba8c86bff8ea31853c1f52a92260d2909edcd4 /web | |
| parent | [feature] Allow newly uploaded emojis to be placed in categories (#939) (diff) | |
| download | gotosocial-a39a664525f55846dd5eea52fcc7009867835989.tar.xz | |
[feature] Serialize local account role via API, and show it via web view (#1045)
* [feature] Add 'role' field to api serialization of local accounts
* [chore] Add a bit of license text while I'm here
* [frogend] render account role on same line as username in web view of profile
* style tweaking on role badges, general profile header layout
* profile stats wrapping
* don't render standard 'user' role on web view
Co-authored-by: f0x <f0x@cthu.lu>
Diffstat (limited to 'web')
| -rw-r--r-- | web/source/css/_colors.css | 3 | ||||
| -rw-r--r-- | web/source/css/base.css | 1 | ||||
| -rw-r--r-- | web/source/css/profile.css | 104 | ||||
| -rw-r--r-- | web/template/profile.tmpl | 18 | 
4 files changed, 94 insertions, 32 deletions
| diff --git a/web/source/css/_colors.css b/web/source/css/_colors.css index 940ded336..82028dce6 100644 --- a/web/source/css/_colors.css +++ b/web/source/css/_colors.css @@ -62,6 +62,9 @@ $border-accent: $orange2;  $link-fg: $fg-accent; +$role-moderator: $orange1; +$role-admin: $blue2; +  $button-bg: $blue2;  $button-fg: $gray1;  $button-hover-bg: $blue3; diff --git a/web/source/css/base.css b/web/source/css/base.css index ed8d55d05..1818d532b 100644 --- a/web/source/css/base.css +++ b/web/source/css/base.css @@ -60,6 +60,7 @@ body {  	display: grid;  	min-height: 100%;  	min-width: 100%; +	width: 100vw;  	grid-template-columns: auto minmax(auto, 90ch) auto;  	grid-template-columns: auto min(92%, 90ch) auto; diff --git a/web/source/css/profile.css b/web/source/css/profile.css index 1f76d5d03..42be7da63 100644 --- a/web/source/css/profile.css +++ b/web/source/css/profile.css @@ -31,10 +31,11 @@ main {  	background: $bg-accent;  	display: grid;  	grid-template-rows: auto auto auto; -	grid-template-columns: auto; +	grid-template-columns: 100%;  	gap: 0.5rem;  	margin-bottom: 0.2rem;  	overflow-x: hidden; +	position: relative;  	border-radius: $br;  	box-shadow: $boxshadow; @@ -56,12 +57,12 @@ main {  	}  	.basic { -		max-height: 10rem; -		margin-top: -7rem; +		height: 8.5rem; +		margin-top: -6.5rem;  		display: grid; -		grid-template-columns: 1rem auto 1fr; -		grid-template-rows: auto auto auto; +		grid-template-columns: 1rem 8.5rem 1fr; +		grid-template-rows: 3rem 3rem 2.5rem;  		grid-template-areas:  			".       avatar ." @@ -97,44 +98,80 @@ main {  		a, div {  			color: inherit;  			text-decoration: none; -			padding: 0.5rem;  		}  		.displayname {  			grid-area: displayname; -			padding-right: 1rem;  			font-weight: bold;  			font-size: 2rem; -			line-height: 2.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;  		} -		.username { -			display: flex; -			flex-wrap: wrap; - +		.usernamecontainer { +			height: 2.5rem; +			display: grid; +			grid-template-columns: auto 1fr;  			grid-area: username; -			padding-top: 0; -			margin-top: 0.25rem; -			padding-bottom: 0.25rem; +			/* justify-content: space-between; */ +			padding: 0; +			gap: 0.5rem; +			position: relative; +			  			color: $fg-accent;  			font-weight: bold; -			word-break: break-all; -			text-overflow: ellipsis; -			overflow: hidden; -			user-select: all; + +			.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; +				padding-top: 0.1rem; +				border: 0.1rem solid $gray1; +				border-radius: $br; +				font-variant: small-caps; +			} + +			.role.admin { +				background: $gray1; +				color: $orange2; +				border-color: $orange2; +			} + +			.role.moderator { +				background: $gray1; +				color: $blue2; +				border-color: $blue1; +			}  		}  	}  	@media screen and (max-width: 600px) { -		.basic { -			max-height: initial; -			margin-top: -7.5vh; +		& { +			gap: 0.1rem; +		} +		.basic { +			height: initial;  			display: flex;  			flex-direction: column; @@ -151,12 +188,18 @@ main {  			.displayname {  				padding-left: 1rem; -				font-size: 5vw; +				font-size: 1.5rem; +				line-height: 2rem; +				margin-top: 0.5rem;  				align-self: stretch;  			} -			.username { +			.usernamecontainer {  				padding-left: 1rem; + +				.username { +					margin-left: 0; +				}  			}  		}  	} @@ -171,7 +214,7 @@ main {  		}  		.bio { -			margin-top: 0.5rem; +			margin-top: 0;  			margin-bottom: 0.5rem;  			margin-left: 1rem;  			margin-right: 1rem; @@ -188,12 +231,19 @@ main {  .accountstats {  	display: flex;  	flex-wrap: wrap; -	justify-content: space-around;  	border-radius: 0 0 $br $br;  	border-top: 0.1rem solid $bg; +	.entry-group { +		flex: 1 1 auto; +		min-width: 50%; +		display: flex; +	} +  	.entry { -		padding: 1rem 1.2rem; +		white-space: nowrap; +		width: 50%; +		margin: 1.2rem 0.5rem;  		text-align: center;  	}  } diff --git a/web/template/profile.tmpl b/web/template/profile.tmpl index 136496cdb..6cb1daf08 100644 --- a/web/template/profile.tmpl +++ b/web/template/profile.tmpl @@ -13,7 +13,11 @@              <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="username">@{{.account.Username}}@{{.instance.AccountDomain}}</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 "user") }}<div class="role {{ .account.Role }}">{{ .account.Role }}</div>{{ end }} +            </div>          </div>          <div class="detailed">              <div class="bio"> @@ -21,10 +25,14 @@              </div>          </div>          <div class="accountstats"> -            <div class="entry">Joined <b>{{.account.CreatedAt | timestampVague}}</b></div> -            <div class="entry">Followed by <b>{{.account.FollowersCount}}</b></div> -            <div class="entry">Following <b>{{.account.FollowingCount}}</b></div> -            <div class="entry">Posted <b>{{.account.StatusesCount}}</b></div> +            <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>          </div>      </div>      <h2 id="recent"> | 
