lbry-desktop/ui/scss/component/_comments.scss
infinite-persistence 5742e1c2ca
Handle representation of blocked replies
## Issue
- `Comment.replies` currently represent all replies, while `comment.List` returns a filtered version, so the actual replies could be less.
- The actual replies is represented by `total_filtered_items`, but we only get that after making a fetch. So, users could click "Show more" but get nothing.

## Fix
- Stop showing "Show more" based on `total_filtered_items`.
- If there is a balance, display 1 dummy comment to represent all blocked replies. This handles the case of "Show more" being displayed but ended up with 0 replies if all replies were blocked.

## Future
Note that `Comment.replies` might be changed to represented filtered comments in the near future (refer to Beamer), so the GUI is made such that the dummy just won't appear when that change happens.
2021-07-14 15:11:44 +08:00

447 lines
7.8 KiB
SCSS

$thumbnailWidth: 1.5rem;
$thumbnailWidthSmall: 1rem;
.comments {
list-style-type: none;
font-size: var(--font-small);
margin-top: var(--spacing-l);
}
.comments--replies {
list-style-type: none;
margin-left: var(--spacing-s);
flex: 1;
}
.comment__sort {
margin: var(--spacing-s) 0;
margin-right: var(--spacing-s);
display: block;
@media (min-width: $breakpoint-small) {
margin-top: 0;
display: inline;
}
}
.comment__create {
font-size: var(--font-small);
}
.comment__create--reply {
margin-top: var(--spacing-m);
position: relative;
}
.comment__create--bottom {
padding-bottom: 0;
}
.comment {
width: 100%;
display: flex;
flex-direction: column;
font-size: var(--font-small);
margin: 0;
position: relative;
&:not(:first-child) {
margin-top: var(--spacing-l);
}
.comment__author-thumbnail {
@include handleChannelGif($thumbnailWidthSmall);
margin-right: 0;
@media (min-width: $breakpoint-small) {
@include handleChannelGif($thumbnailWidth);
}
.channel-staked__wrapper {
padding: 0;
left: calc(#{$thumbnailWidthSmall} / 4);
bottom: -1rem;
padding: -1rem;
margin-left: 0;
}
.channel-staked__indicator {
@media (max-width: $breakpoint-small) {
margin-left: 0.1rem;
}
}
}
}
.comment__thumbnail-wrapper {
flex: 0;
margin-top: var(--spacing-xxs);
}
.comment__content {
display: flex;
flex-direction: row;
}
.comment__replies-container {
margin: 0;
}
.comment__replies {
display: flex;
margin-top: var(--spacing-m);
margin-left: calc(#{$thumbnailWidthSmall} + var(--spacing-xs));
@media (min-width: $breakpoint-small) {
margin-left: calc(#{$thumbnailWidth} + var(--spacing-m));
}
}
.comment--reply {
margin: 0;
&:not(:first-child) {
margin-top: var(--spacing-m);
}
}
.comment--top-level {
&:not(:first-child) {
margin-top: var(--spacing-l);
}
}
.comment--slimed {
opacity: 0.6;
}
.comment__sc-preview {
display: flex;
align-items: center;
border: 1px solid var(--color-border);
border-radius: var(--border-radius);
padding: var(--spacing-s);
margin: var(--spacing-s) 0;
}
.comment__edit-input {
margin-top: var(--spacing-xxs);
}
.comment__scpreview-amount {
margin-right: var(--spacing-m);
font-size: var(--font-large);
}
.comment__threadline {
@extend .button--alt;
height: auto;
align-self: stretch;
padding: 1px;
border-radius: 3px;
background-color: var(--color-comment-threadline);
&:hover {
box-shadow: 0 0 0 1px var(--color-comment-threadline-hover);
background-color: var(--color-comment-threadline-hover);
border-color: var(--color-comment-threadline-hover);
}
@media (min-width: $breakpoint-small) {
padding: 2px;
}
}
.comment-new__label-wrapper {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: baseline;
flex-wrap: wrap;
width: 100%;
@media (min-width: $breakpoint-small) {
fieldset-section {
max-width: 10rem;
}
}
}
.comment-new__label {
white-space: nowrap;
margin-right: var(--spacing-xs);
}
.comment--highlighted {
background: var(--color-comment-highlighted);
box-shadow: 0 0 0 5px var(--color-comment-highlighted);
border-radius: 4px;
}
.comment__body-container {
flex: 1;
margin-left: var(--spacing-xs);
@media (min-width: $breakpoint-small) {
margin-left: var(--spacing-s);
}
}
.comment__dead {
display: flex;
align-items: center;
.icon {
margin-left: var(--spacing-s);
}
}
.comment__meta {
display: flex;
justify-content: space-between;
}
.comment__meta-information {
display: flex;
justify-content: flex-start;
align-items: center;
height: 100%;
}
.comment__pin {
margin-left: var(--spacing-s);
.icon {
padding-top: 1px;
}
}
.comment__message {
word-break: break-word;
max-width: 35rem;
ul li,
ol li {
list-style-position: inside;
}
p {
& + p {
margin-top: var(--spacing-xxs);
}
}
}
.comment__author {
max-width: 10rem;
text-overflow: ellipsis;
margin-right: var(--spacing-xs);
height: 100%;
}
.comment__author--creator {
padding: 0 3px;
background-color: var(--color-primary-alt);
border-radius: var(--border-radius);
&.button--uri-indicator {
color: var(--color-link);
}
}
.comment__time {
@extend .button--uri-indicator;
opacity: 0.5;
white-space: nowrap;
height: 100%;
margin-right: var(--spacing-xs);
&:focus {
@include linkFocus;
}
}
.comment__menu {
align-self: flex-end;
line-height: 1;
button {
border-radius: var(--border-radius);
&:focus {
@include linkFocus;
}
}
}
.comment__char-count {
font-size: var(--font-xsmall);
}
.comment__char-count-mde {
align-self: flex-end;
font-size: var(--font-xsmall);
padding-right: var(--spacing-xs); // Align with SimpleMDE's status bar
padding-bottom: 0;
}
.comment__menu-option {
display: flex;
align-items: center;
padding: var(--spacing-s);
font-size: var(--font-xsmall);
.menu__link {
padding: 0;
}
}
.comment__menu-icon--hovering {
stroke: var(--color-comment-menu-hovering);
}
.comment__menu-icon {
stroke: var(--color-comment-menu);
}
.comment__menu-list {
box-shadow: var(--card-box-shadow);
border-radius: var(--card-radius);
padding: var(--spacing-s);
}
.comment__menu-title {
@extend .help;
margin-top: 0;
padding-left: var(--spacing-xs);
padding-right: var(--spacing-xl);
padding-bottom: var(--spacing-xs);
font-size: var(--font-small);
border-bottom: 1px solid var(--color-border);
&:not(:first-child) {
margin-top: var(--spacing-xs);
padding-top: var(--spacing-xs);
border-top: 1px solid var(--color-border);
}
&:not(:last-child) {
margin-bottom: var(--spacing-xs);
}
}
.comment__menu-help {
@extend .help;
margin-top: var(--spacing-xs);
padding-left: calc(18px + var(--spacing-s));
max-width: 15rem;
white-space: pre-line;
}
.comment__actions {
display: flex;
margin-top: var(--spacing-s);
> *:not(:last-of-type) {
margin-right: var(--spacing-m);
}
.button__label {
margin-left: var(--spacing-xs);
}
}
.comment__actions--nested {
@extend .comment__actions;
margin-left: calc((#{$thumbnailWidthSmall} + var(--spacing-xs)));
margin-top: var(--spacing-m);
@media (min-width: $breakpoint-small) {
margin-left: calc((#{$thumbnailWidth} + var(--spacing-m)));
}
}
.comment__action {
@extend .button--uri-indicator;
height: auto;
font-size: var(--font-xsmall);
}
.comment__action--creator-like {
&:disabled {
opacity: 1;
}
}
.comment__action,
.comment__author {
&:focus {
@include linkFocus;
}
}
.comment__action--active {
.icon {
fill: var(--color-primary-alt);
stroke: var(--color-primary);
}
}
.comment__action--nested {
@extend .comment__action;
}
.comment__action--nested,
.comment__create--nested-reply {
margin-top: var(--spacing-s);
margin-left: calc((#{$thumbnailWidthSmall} + var(--spacing-xs)) * 2 + var(--spacing-m) + 4px);
@media (min-width: $breakpoint-small) {
margin-left: calc((#{$thumbnailWidth} + var(--spacing-m)) * 2 + var(--spacing-m) + 4px);
}
}
.comment__more-below {
margin-top: var(--spacing-l);
}
.comment__creator-like {
height: 0.8rem;
width: 0.8rem;
margin-left: 3px;
z-index: 3;
position: absolute;
top: 0.4rem;
left: 0.4rem;
}
.comment__menu-active {
padding: var(--spacing-xs);
padding-bottom: 0;
border-top: 1px solid var(--color-border);
margin-top: var(--spacing-s);
display: flex;
align-items: center;
.channel-thumbnail {
margin-right: var(--spacing-xs);
height: 1.8rem;
width: 1.8rem;
}
}
.comment__menu-channel {
@extend .help;
font-size: var(--font-xsmall);
margin-top: 0;
max-width: 10rem;
white-space: pre-line;
margin-right: var(--spacing-s);
}
.comment__tip-input {
margin: var(--spacing-s) 0;
}
.comment--blocked {
opacity: 0.5;
}