[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 80490c183e.

* settings interface wrapping

* fix reported toot styling

* add role to profile sr-only text

* comment fallback rule

* remove currently unused image description lacking indicator
This commit is contained in:
f0x52 2023-05-11 17:46:32 +02:00 committed by GitHub
commit 9cc9ffc5a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 1754 additions and 1382 deletions

View file

@ -16,274 +16,252 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
header {
a img {
height: 5rem;
}
}
main {
background: transparent;
padding-top: 0;
.page {
grid-template-columns: 1fr minmax(auto, 60rem) 1fr; /* fallback for lack of min() support */
grid-template-columns: 1fr min(92%, 65rem) 1fr;
}
.profile {
background: $bg-accent;
display: grid;
grid-template-columns: 100%;
gap: 0.5rem;
margin-bottom: 0.2rem;
overflow-x: hidden;
position: relative;
padding: 0.5rem;
border-radius: $br;
box-shadow: $boxshadow;
border: $boxshadow-border;
.headerimage {
width: 100%;
aspect-ratio: 3 / 1;
max-height: 16rem;
overflow: hidden;
box-shadow: $boxshadow;
.column-split {
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
}
.profile .header {
background: $profile-bg;
border-radius: $br;
overflow: hidden;
margin-bottom: 1rem;
.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
*/
$avatar-size: 8.5rem;
$name-size: 3rem;
$username-size: 2rem;
$overlap: calc($avatar-size - $name-size - $username-size);
.basic-info {
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;
line-height: $name-size;
font-size: 1.5rem;
font-weight: bold;
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;
}
.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 {
background: $bg;
color: $fg;
border: 0.13rem solid $bg;
grid-area: role;
align-self: center;
justify-self: start;
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;
&.admin {
color: $role-admin;
border-color: $role-admin;
}
.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 {
background: $gray1;
color: $orange2;
border-color: $orange2;
}
.role.moderator {
background: $gray1;
color: $blue2;
border-color: $blue1;
&.moderator {
color: $role-mod;
border-color: $role-mod;
}
}
}
}
@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;
}
@media screen and (max-width: 750px) {
.profile .header {
.basic-info {
grid-template-columns: auto 1fr;
grid-template-rows: $avatar-size $name-size auto;
grid-template-areas:
"avatar avatar"
"displayname displayname"
"username role";
.displayname {
padding-left: 1rem;
font-size: 1.5rem;
line-height: 2rem;
margin-top: 0.5rem;
align-self: stretch;
font-size: 1.4rem;
}
}
}
}
.usernamecontainer {
padding-left: 1rem;
.profile .col-header {
display: flex;
justify-content: start;
gap: 2rem;
align-items: center;
.username {
margin-left: 0;
}
margin: 0;
background: $profile-bg;
border-top-left-radius: $br;
border-top-right-radius: $br;
padding: 0.75rem;
h3 {
font-size: 1.2rem;
line-height: 1.3rem;
margin: 0;
}
}
.profile .toots {
flex: 65 25rem;
display: flex;
flex-direction: column;
gap: 0.4rem;
.col-header {
display: grid;
grid-template-columns: auto 1fr;
gap: 1rem;
a {
justify-self: end;
}
.rss-icon {
display: block;
margin: -0.25rem 0;
.fa {
font-size: 2rem;
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;
}
}
}
.detailed {
.toot {
border-radius: 0;
.info {
padding: 0.3rem 0.75rem;
}
&:last-child {
border-bottom-left-radius: $br;
border-bottom-right-radius: $br;
}
}
}
.profile .about-user {
flex: 35 14rem;
border-radius: $br;
overflow: hidden;
.col-header {
margin-bottom: -0.25rem;
}
.fields {
background: $profile-bg;
display: flex;
flex-direction: column;
flex: 1 1 25em;
padding: 0 0.5rem;
padding-top: 0.25rem;
h2 {
margin-top: 0;
}
.field {
padding: 0.25rem;
display: flex;
flex-direction: column;
border-bottom: 0.1rem solid $gray2;
word-break: break-all;
.bio {
margin-top: 0;
margin-bottom: 0.5rem;
margin-left: 1rem;
margin-right: 1rem;
word-break: break-word;
a {
color: $acc1;
text-decoration: underline;
&:first-child {
border-top: 0.1rem solid $gray2;
}
}
}
}
.accountstats {
display: flex;
flex-wrap: wrap;
border-radius: 0 0 $br $br;
border-top: 0.1rem solid $bg;
.entry-group {
flex: 1 1 auto;
min-width: 50%;
display: flex;
.bio {
background: $profile-bg;
padding: 1rem 0.75rem;
padding-bottom: 1.25rem;
}
.entry {
white-space: nowrap;
width: 50%;
margin: 1.2rem 0.5rem;
text-align: center;
.accountstats {
background: $bg-accent;
padding: 0.75rem;
display: grid;
grid-template-columns: auto 1fr;
gap: 0.25rem 1rem;
}
}
.nothinghere {
margin-left: 1rem;
}
.backnextlinks {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
a {
padding: 1rem;
}
.next {
margin-left: auto;
}
}
.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;
}
}
}