[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
parent 6392e00653
commit 9cc9ffc5a7
21 changed files with 1754 additions and 1382 deletions

View File

@@ -69,8 +69,10 @@ $border-accent: $orange2;
$link-fg: $fg-accent;
$role-moderator: $orange1;
$role-admin: $blue2;
$role-admin: $orange2;
$role-mod: $blue2;
$profile-bg: $gray4;
$button-bg: $blue2;
$button-fg: $gray1;
@@ -80,10 +82,11 @@ $button-danger-bg: $error3;
$button-danger-fg: $white1;
$button-danger-hover-bg: $error2;
$toot-focus-bg: $gray5;
$toot-unfocus-bg: $gray2;
$toot-bg: $gray3;
$toot-info-bg: $gray2;
$toot-info-bg: $gray4;
$toot-focus-bg: $gray5;
$toot-focus-info-bg: $gray4;
$no-img-desc-bg: $orange1;
$no-img-desc-fg: $gray1;
@@ -116,4 +119,13 @@ $error-bg: $error2;
$list-entry-bg: $gray2;
$list-entry-alternate-bg: $gray3;
$list-entry-hover-bg: $gray4;
$list-entry-hover-bg: $gray4;
/* Plyr video player */
$plyr-color-main: $orange2;
$plyr-video-background: $bg-accent;
$plyr-badge-background: $bg-accent;
$plyr-video-controls-background: $bg-accent;
$plyr-badge-text-color: $fg;
$plyr-badge-border-radius: $br;
$plyr-video-progress-buffered-background: $gray8;

View File

@@ -44,6 +44,11 @@ $br: 0.4rem;
inside something with $br, eg avatar, header img */
$br-inner: 0.2rem;
/* Fork-Awesome 'fa-fw' fixed icon width
keep in sync with https://github.com/ForkAwesome/Fork-Awesome/blob/a99579ae3e735ee70e51ed62dfcee3172b5b2db7/css/fork-awesome.css#L50
*/
$fa-fw: 1.28571429em;
html, body {
padding: 0;
margin: 0;
@@ -95,26 +100,25 @@ header {
}
header a {
margin: 2rem;
display: flex;
flex-wrap: wrap;
gap: 2rem;
margin: 1.5rem;
gap: 1rem;
justify-content: center;
img {
align-self: center;
height: 6rem;
height: 3rem;
}
div {
h1 {
flex-grow: 1;
align-self: center;
display: flex;
text-align: center;
h1 {
word-wrap: anywhere;
align-self: center;
color: $fg;
}
font-size: 1.5rem;
word-wrap: anywhere;
color: $fg;
}
}
@@ -132,15 +136,6 @@ header a {
}
main {
section {
background: $bg-accent;
box-shadow: $boxshadow;
border: $boxshadow-border;
border-radius: $br;
padding: 2rem;
margin-bottom: 2rem;
}
p:first-child {
margin-top: 0;
}

41
web/source/css/index.css Normal file
View File

@@ -0,0 +1,41 @@
/*
GoToSocial
Copyright (C) 2021-2023 GoToSocial Authors admin@gotosocial.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
header a {
margin: 2rem;
gap: 2rem;
img {
height: 6rem;
}
h1 {
font-size: 2rem;
}
}
main {
section {
background: $bg-accent;
box-shadow: $boxshadow;
border: $boxshadow-border;
border-radius: $br;
padding: 2rem;
margin-bottom: 2rem;
}
}

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;
}
}
}

View File

@@ -18,6 +18,7 @@
@import "photoswipe/dist/photoswipe.css";
@import "photoswipe-dynamic-caption-plugin/photoswipe-dynamic-caption-plugin.css";
@import "plyr/dist/plyr.css";
main {
background: transparent;
@@ -31,13 +32,13 @@ main {
}
.toot {
background: $toot-unfocus-bg;
background: $toot-bg;
box-shadow: $boxshadow;
border: $boxshadow-border;
border-radius: $br;
position: relative;
margin-bottom: $br;
padding-top: 1.5rem;
padding-bottom: 0.7rem;
padding-top: 0.75rem;
a {
position: relative;
@@ -46,87 +47,88 @@ main {
text-decoration: none;
}
.contentgrid {
padding: 0 1.5rem;
.author > a {
padding: 0 0.75rem;
display: grid;
grid-template-columns: 4rem 1fr auto;
grid-template-rows: 1.5rem auto auto auto;
column-gap: 0.5rem;
}
grid-template-columns: 3.5rem 1fr auto;
grid-template-rows: auto auto;
grid-template-areas:
"avatar display date"
"avatar user .";
gap: 0 0.5rem;
.not-expanded {
color: $fg-reduced;
grid-column: 3;
grid-row: 1;
}
.avatar {
grid-row: span 3;
aspect-ratio: 1/1;
display: flex;
border: 0.2rem solid $avatar-border;
border-radius: 0.4rem;
overflow: hidden; /* hides corners from img overflowing */
img {
height: 100%;
width: 100%;
.avatar {
grid-area: avatar;
height: 3.5rem;
width: 3.5rem;
object-fit: cover;
background: $bg;
}
}
.displayname, .username {
justify-self: start;
align-self: start;
border: 0.15rem solid $avatar-border;
border-radius: $br;
overflow: hidden; /* hides corners from img overflowing */
img {
height: 100%;
width: 100%;
object-fit: cover;
background: $bg;
}
}
.displayname, .username {
justify-self: start;
align-self: start;
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.displayname {
font-weight: bold;
font-size: 1.5rem;
line-height: 2rem;
margin-top: -0.5rem;
}
.username {
color: $link-fg;
font-size: 1rem;
line-height: 1.3rem;
}
input.spoiler:checked ~ .content {
display: none;
}
.spoiler {
padding-bottom: 0.5rem;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.4rem;
.spoiler-text {
word-break: break-word;
}
label {
padding: 0.2rem 0.3rem;
cursor: pointer;
.displayname {
grid-area: display;
font-weight: bold;
font-size: 1rem;
line-height: 1.3rem;
/* margin-top: -0.5rem; */
}
label:hover {
.username {
grid-area: user;
color: $link-fg;
font-size: 1rem;
line-height: 1.3rem;
}
.timestamp {
grid-area: date;
color: $fg-reduced;
}
}
.body {
padding: 0.5rem 0.75rem;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
details > summary {
display: inline-block;
list-style: none;
&::-webkit-details-marker {
display: none; /* Safari */
}
.button {
white-space: nowrap;
cursor: pointer;
}
}
.text {
margin: 0;
padding-top: 0.5rem;
grid-row: span 1;
grid-column: 1 / span 3;
@@ -135,14 +137,21 @@ main {
width: 100%;
details > summary {
padding-bottom: 0.5rem;
.button {
padding: 0.2rem 0.3rem;
font-size: 1rem;
}
}
a {
color: $link-fg;
text-decoration: underline;
}
.content {
padding-bottom: 0.5rem;
word-break: break-word;
blockquote {
@@ -202,17 +211,104 @@ main {
}
.media {
margin-top: 0.5rem;
border-radius: $br;
grid-column: span 3;
display: grid;
grid-template-columns: 50% 50%;
grid-auto-rows: 10rem;
overflow: hidden;
gap: 0.3rem;
.media-wrapper {
height: 100%;
width: 100%;
box-sizing: border-box;
border: 0.15rem solid $gray1;
border-radius: $br;
position: relative;
overflow: hidden;
z-index: 2;
details {
position: absolute;
height: 100%;
width: 100%;
&[open] summary {
height: auto;
width: auto;
margin: 1rem;
padding: 0;
.show, video, img {
display: none;
}
.eye.button .hide {
display: inline-block;
grid-column: 1 / span 3;
grid-row: 1 / span 2;
}
}
summary {
position: absolute;
height: 100%;
width: 100%;
z-index: 3;
overflow: hidden;
display: grid;
padding: 1rem;
grid-template-columns: 1fr auto 1fr;
grid-template-rows: 1fr 1fr;
grid-template-areas:
"eye sensitive ."
". sensitive .";
.eye.button {
grid-area: eye;
align-self: start;
justify-self: start;
margin: 0;
padding: 0.4rem;
.fa-fw {
line-height: $fa-fw;
}
.hide {
display: none;
}
}
.show.sensitive {
grid-area: sensitive;
align-self: center;
.button {
cursor: pointer;
align-self: center;
}
}
video, img {
z-index: -1;
position: absolute;
height: calc(100% + 1.2rem);
width: calc(100% + 1.2rem);
top: -0.6rem;
left: -0.6rem;
filter: blur(1.2rem);
}
}
video.plyr-video, .plyr {
position: absolute;
height: 100%;
width: 100%;
object-fit: contain;
background: $gray1;
}
}
}
&.single .media-wrapper {
@@ -223,133 +319,6 @@ main {
grid-row: span 2;
}
.open, .open .button {
display: none;
}
.closed {
z-index: 2;
}
input.sensitive-checkbox:checked { /* Media is shown */
& ~ .video-play {
display: flex;
}
& ~ .sensitive {
.closed {
transition: 0.8s;
pointer-events: none;
opacity: 0;
& > * {
display: none;
}
}
.open {
display: flex;
justify-content: flex-start;
.button {
align-self: flex-start;
display: initial;
z-index: 4;
}
}
}
}
.video-play {
.icon-span {
align-self: center;
display: initial;
z-index: 4;
.icon {
color: $white1;
}
.icon-bg {
color: $gray1;
font-size: 1.1em;
}
}
display: none;
position: absolute;
height: 100%;
width: 100%;
justify-content: center;
align-items: center;
font-size: 7em;
pointer-events: none;
}
.sensitive {
position: absolute;
height: 100%;
width: 100%;
.open, .closed {
display: flex;
position: absolute;
height: 100%;
width: 100%;
justify-content: center;
padding: 1rem;
label {
z-index: 3;
}
}
.closed {
transition: 0.3s;
background: $bg-sensitive;
@supports (backdrop-filter: blur(2rem)) {
background: transparent;
backdrop-filter: blur(2rem);
}
.button {
align-self: center;
justify-self: center;
}
}
}
.no-image-desc {
color: $no-img-desc-fg;
background: $no-img-desc-bg;
display: flex;
position: absolute;
bottom: 0.1rem;
right: 0.4rem;
margin-bottom: 0.4rem;
margin-right: 0.4rem;
padding: 0.1rem 0.45rem;
border-radius: 100%;
border: 0.2rem solid $button-fg;
z-index: 3;
i.fa {
display: block;
line-height: 1.6rem;
}
span {
margin-left: 0.3rem;
display: none;
}
&:hover {
span {
display: block;
}
border-radius: 0.2rem;
}
}
img {
width: 100%;
height: 100%;
@@ -358,14 +327,14 @@ main {
}
.info {
display: flex;
background: $toot-info-bg;
color: $fg-reduced;
display: none;
border-top: 0.15rem solid $toot-info-border;
padding: 0.5rem 1.5rem;
padding: 0.5rem 0.75rem;
div {
padding-right: 1.3rem;
div, time {
padding-right: 1rem;
}
.stats {
@@ -406,39 +375,39 @@ main {
background: $toot-focus-bg;
padding-bottom: 0;
.contentgrid {
.displayname {
grid-column: span 2;
}
.not-expanded {
display: none;
}
}
.info {
display: flex;
}
.media {
margin-bottom: 0.5rem;
background: $toot-focus-info-bg;
}
}
}
footer + div { /* something weird from the devstack.. */
display: none;
}
.plyr--video {
flex-direction: column-reverse;
@media screen and (max-width: 89ch) {
.toot {
.contentgrid {
grid-template-rows: 1.5rem 1.3rem 1.3rem auto;
}
.plyr__video-wrapper {
position: relative;
}
.username, .not-expanded {
grid-column: 2;
grid-row: auto;
}
.plyr__controls {
align-self: stretch;
position: initial;
padding: 0.1rem;
padding-top: 0.2rem;
}
.plyr__control {
box-shadow: none;
}
.plyr__control--overlaid {
top: calc(50% - 18px);
}
}
.pswp__content {
padding: 2rem;
.plyr {
max-height: 100%;
}
}

View File

@@ -22,7 +22,7 @@
const Photoswipe = require("photoswipe/dist/umd/photoswipe.umd.min.js");
const PhotoswipeLightbox = require("photoswipe/dist/umd/photoswipe-lightbox.umd.min.js");
const PhotoswipeCaptionPlugin = require("photoswipe-dynamic-caption-plugin").default;
const PhotoswipeVideoPlugin = require("photoswipe-video-plugin").default;
const Plyr = require("plyr");
let [_, _user, type, id] = window.location.pathname.split("/");
if (type == "statuses") {
@@ -34,29 +34,128 @@ if (type == "statuses") {
const lightbox = new PhotoswipeLightbox({
gallery: '.photoswipe-gallery',
children: 'a',
children: '.photoswipe-slide',
pswpModule: Photoswipe,
});
new PhotoswipeCaptionPlugin(lightbox, {
type: 'auto',
captionContent(slide) {
return slide.data.alt;
}
});
lightbox.addFilter('itemData', (item) => {
const el = item.element;
if (el && el.classList.contains("plyr-video")) {
const parentNode = el._plyrContainer.parentNode;
return {
alt: el.getAttribute("alt"),
_video: {
open(c) {
c.appendChild(el._plyrContainer);
},
close() {
parentNode.appendChild(el._plyrContainer);
},
pause() {
el._player.pause();
}
},
width: parseInt(el.dataset.pswpWidth),
height: parseInt(el.dataset.pswpHeight)
};
}
return item;
});
lightbox.on("contentActivate", (e) => {
const { content } = e;
if (content.data._video != undefined) {
content.data._video.open(content.element);
}
});
lightbox.on("contentDeactivate", (e) => {
const { content } = e;
if (content.data._video != undefined) {
content.data._video.pause();
content.data._video.close();
}
});
lightbox.on("close", function () {
if (lightbox.pswp.currSlide.data._video != undefined) {
lightbox.pswp.currSlide.data._video.close();
}
});
new PhotoswipeVideoPlugin(lightbox, {});
lightbox.init();
Array.from(document.getElementsByClassName("spoiler-label")).forEach((label) => {
let checkbox = document.getElementById(label.htmlFor);
if (checkbox != undefined) {
function update() {
if (checkbox.checked) {
label.innerHTML = "Show more";
} else {
label.innerHTML = "Show less";
}
function dynamicSpoiler(className, updateFunc) {
Array.from(document.getElementsByClassName(className)).forEach((spoiler) => {
const update = updateFunc(spoiler);
if (update) {
update();
spoiler.addEventListener("toggle", update);
}
update();
});
}
label.addEventListener("click", () => { setTimeout(update, 1); });
dynamicSpoiler("text-spoiler", (spoiler) => {
const button = spoiler.querySelector("button");
if (button != undefined) {
return () => {
button.textContent = spoiler.open
? "Show less"
: "Show more";
};
}
});
dynamicSpoiler("video-spoiler", (spoiler) => {
const video = spoiler.querySelector(".plyr-video");
const eye = spoiler.querySelector(".eye.button");
if (video != undefined) {
return () => {
if (spoiler.open) {
eye.setAttribute("aria-label", "Hide media");
} else {
eye.setAttribute("aria-label", "Show media");
video.pause();
}
};
}
});
Array.from(document.getElementsByClassName("plyr-video")).forEach((video) => {
let player = new Plyr(video, {
title: video.title,
settings: ["loop"],
disableContextMenu: false,
hideControls: false,
tooltips: { contrors: true, seek: true },
iconUrl: "/assets/plyr.svg",
listeners: {
fullscreen: () => {
if (player.playing) {
setTimeout(() => {
player.play();
}, 1);
}
lightbox.loadAndOpen(parseInt(video.dataset.pswpIndex), {
gallery: video.closest(".photoswipe-gallery")
});
return false;
}
}
});
player.elements.container.title = video.title;
video._player = player;
video._plyrContainer = player.elements.container;
});

View File

@@ -29,7 +29,7 @@ let cssEntryFiles = fs.readdirSync(path.join(__dirname, "./css")).map((file) =>
const prodCfg = {
transform: [
["uglifyify", {
["@browserify/uglifyify", {
global: true,
exts: ".js"
}],

View File

@@ -24,7 +24,7 @@
"papaparse": "^5.3.2",
"photoswipe": "^5.3.3",
"photoswipe-dynamic-caption-plugin": "^1.2.7",
"photoswipe-video-plugin": "^1.0.2",
"plyr": "^3.7.8",
"psl": "^1.9.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
@@ -42,6 +42,7 @@
"@babel/preset-env": "^7.19.4",
"@babel/preset-react": "^7.18.6",
"@browserify/envify": "^6.0.0",
"@browserify/uglifyify": "^6.0.0",
"@joepie91/eslint-config": "^1.1.1",
"autoprefixer": "^10.4.13",
"babelify": "^10.0.0",
@@ -55,7 +56,6 @@
"postcss": "^8.4.18",
"postcss-custom-prop-vars": "^0.0.5",
"postcss-import": "^15.0.0",
"postcss-nested": "^6.0.0",
"uglifyify": "^5.0.2"
"postcss-nested": "^6.0.0"
}
}

View File

@@ -140,13 +140,18 @@ function ReportedToot({ toot }) {
const account = toot.account;
return (
<div className="toot expanded">
<div className="contentgrid">
<span className="avatar">
<img src={account.avatar} alt="" />
</span>
<span className="displayname">{account.display_name.trim().length > 0 ? account.display_name : account.username}</span>
<span className="username">@{account.username}</span>
<article className="toot expanded">
<section className="author">
<a>
<img className="avatar" src={account.avatar} alt="" />
<span className="displayname">
{account.display_name.trim().length > 0 ? account.display_name : account.username}
<span className="sr-only">.</span>
</span>
<span className="username">@{account.username}</span>
</a>
</section>
<section className="body">
<div className="text">
<div className="content">
{toot.spoiler_text?.length > 0
@@ -158,15 +163,11 @@ function ReportedToot({ toot }) {
{toot.media_attachments?.length > 0 &&
<TootMedia media={toot.media_attachments} sensitive={toot.sensitive} />
}
</div>
<div className="toot-info">
<a
href={toot.url}
target="_blank"
rel="noreferrer"
>{new Date(toot.created_at).toLocaleString()}</a>
</div>
</div>
</section>
<aside className="info">
<time datetime={toot.created_at}>{new Date(toot.created_at).toLocaleString()}</time>
</aside>
</article>
);
}

View File

@@ -24,17 +24,23 @@ const React = require("react");
module.exports = function FakeProfile({ avatar, header, display_name, username, role }) {
return ( // Keep in sync with web/template/profile.tmpl
<div className="profile">
<div className="headerimage">
<img className="headerpreview" src={header} alt={header ? `header image for ${username}` : "None set"} />
</div>
<div className="basic">
<div id="profile-basic-filler2"></div>
<span className="avatar"><img className="avatarpreview" src={avatar} alt={avatar ? `avatar image for ${username}` : "None set"} /></span>
<div className="displayname">{display_name.trim().length > 0 ? display_name : username}</div>
<div className="usernamecontainer">
<div className="username"><span>@{username}</span></div>
<div className="header">
<div className="header-image">
<img src={header} alt={header ? `header image for ${username}` : "None set"} />
</div>
<div className="basic-info" aria-hidden="true">
<a className="avatar" href="{{.account.Avatar}}">
<img src={avatar} alt={avatar ? `avatar image for ${username}` : "None set"} />
</a>
<span className="displayname text-cutoff">
{display_name.trim().length > 0 ? display_name : username}
<span className="sr-only">.</span>
</span>
<span className="username text-cutoff">@{username}</span>
{(role && role != "user") &&
<div className={`role ${role}`}>{role}</div>
<div className={`role ${role}`}>
<span className="sr-only">Role: </span>{role}
</div>
}
</div>
</div>

View File

@@ -31,19 +31,22 @@ module.exports = function FakeToot({ children }) {
} } = query.useVerifyCredentialsQuery();
return (
<div className="toot expanded">
<div className="contentgrid">
<span className="avatar">
<img src={account.avatar} alt="" />
</span>
<span className="displayname">{account.display_name.trim().length > 0 ? account.display_name : account.username}</span>
<span className="username">@{account.username}</span>
<article className="toot expanded">
<section className="author">
<a>
<img className="avatar" src={account.avatar} alt="" />
<span className="displayname">
{account.display_name.trim().length > 0 ? account.display_name : account.username}
<span className="sr-only">.</span>
</span>
<span className="username">@{account.username}</span>
</a>
</section>
<section className="body">
<div className="text">
<div className="content">
{children}
</div>
{children}
</div>
</div>
</div>
</section>
</article>
);
};

View File

@@ -16,11 +16,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* Fork-Awesome 'fa-fw' fixed icon width
keep in sync with https://github.com/ForkAwesome/Fork-Awesome/blob/a99579ae3e735ee70e51ed62dfcee3172b5b2db7/css/fork-awesome.css#L50
*/
$fa-fw: 1.28571429em;
body {
grid-template-rows: auto 1fr;
}
@@ -30,10 +25,6 @@ body {
width: 100%;
}
section {
grid-column: 2;
}
header {
justify-content: start;
@@ -51,19 +42,26 @@ header {
}
}
main section {
box-shadow: none;
border-radius: none;
border: none;
}
#root {
display: grid;
grid-template-columns: 1fr minmax(auto, 60rem) 1fr;
grid-template-columns: 1fr min(92%, 60rem) 1fr;
box-sizing: border-box;
display: flex;
justify-content: center;
flex-wrap: wrap;
margin: 0 1rem;
gap: 1rem;
section.oauth {
max-width: 92%;
width: 60rem;
}
section.with-sidebar {
flex-grow: 100;
flex-basis: 40rem;
background: $bg-accent;
padding: 2rem;
border-radius: $br;
& > div, & > form {
border-left: 0.2rem solid $border-accent;
padding-left: 0.4rem;
@@ -97,13 +95,13 @@ main section {
}
.sidebar {
margin: 0 1rem;
flex-grow: 1;
flex-basis: 20rem;
align-self: start;
justify-self: end;
background: $bg;
display: flex;
flex-direction: column;
min-width: 12rem;
.account-card {
grid-template-columns: auto 1fr auto;
@@ -240,10 +238,6 @@ nav.menu-tree {
text-transform: capitalize;
}
section {
margin-bottom: 1rem;
}
input, select, textarea {
box-sizing: border-box;
}
@@ -406,9 +400,10 @@ section.with-sidebar > div, section.with-sidebar > form {
gap: 1rem;
.profile {
.basic {
margin-bottom: 0.5rem;
/* margin-top: 0; */
padding: 0;
.header {
border: 0.1rem solid $gray1;
}
}

File diff suppressed because it is too large Load Diff