mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-19 05:59:26 +08:00
This change improves the loading experience when fetching user list on slow connections by adding a skeleton shimmer effect. It also makes the initial load less jumpy due to opening panel with the correct number of reactions preloading. ### How it looks <img width="287" height="350" alt="reaction-loading-state" src="https://github.com/user-attachments/assets/21cde76b-9e43-480c-b7a9-4bc832ea9e3c" /> --------- Co-authored-by: discourse-patch-triage[bot] <272280883+discourse-patch-triage[bot]@users.noreply.github.com>
265 lines
4.9 KiB
SCSS
Vendored
265 lines
4.9 KiB
SCSS
Vendored
@use "lib/viewport";
|
|
|
|
// specific d-modal overrules
|
|
.fk-d-menu-modal.discourse-reactions-users-menu-content,
|
|
.fk-d-menu-modal.post-liked-users-menu-content {
|
|
.d-modal {
|
|
&__container {
|
|
height: clamp(50dvh, 50dvh, 60dvh);
|
|
}
|
|
|
|
&__body {
|
|
padding-top: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
.post-users-popup {
|
|
--skeleton-shimmer-rgb: #{hexToRGB($primary-50)};
|
|
width: 250px;
|
|
background: var(--secondary);
|
|
color: var(--primary);
|
|
line-height: normal;
|
|
|
|
@include viewport.until(sm) {
|
|
width: 100%;
|
|
}
|
|
|
|
&__title {
|
|
padding: 0 var(--space-4) var(--space-4);
|
|
text-align: center;
|
|
font-weight: 700;
|
|
border-bottom: 1px solid var(--primary-low);
|
|
|
|
@include viewport.until(sm) {
|
|
padding-top: var(--space-3);
|
|
padding-bottom: var(--space-3);
|
|
}
|
|
}
|
|
|
|
&__sticky-header {
|
|
position: sticky;
|
|
top: 0;
|
|
background: var(--secondary);
|
|
z-index: z("base");
|
|
}
|
|
|
|
&__header {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--space-1);
|
|
padding: var(--space-2) var(--space-4);
|
|
overflow-x: auto;
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
@include viewport.from(sm) {
|
|
padding: var(--space-2) var(--space-3);
|
|
border-bottom: 1px solid var(--primary-low);
|
|
}
|
|
|
|
&::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
&__filter {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: var(--space-1);
|
|
padding: var(--space-2) var(--space-3);
|
|
|
|
@include viewport.from(sm) {
|
|
padding: var(--space-1) var(--space-2);
|
|
}
|
|
border: none;
|
|
border-radius: var(--d-border-radius);
|
|
background: transparent;
|
|
color: var(--primary-medium);
|
|
font-size: var(--font-down-1);
|
|
cursor: pointer;
|
|
white-space: nowrap;
|
|
transition: background 0.15s;
|
|
|
|
.emoji {
|
|
width: 1.15em;
|
|
height: 1.15em;
|
|
|
|
@include viewport.until(sm) {
|
|
width: 1.25em;
|
|
height: 1.25em;
|
|
}
|
|
}
|
|
|
|
&:hover {
|
|
.discourse-no-touch & {
|
|
background: var(--primary-very-low);
|
|
}
|
|
|
|
.discourse-touch & {
|
|
background: transparent;
|
|
}
|
|
}
|
|
|
|
&.is-active {
|
|
background: var(--tertiary-low);
|
|
color: var(--primary);
|
|
}
|
|
}
|
|
|
|
&__body {
|
|
overflow-y: auto;
|
|
|
|
@include viewport.from(sm) {
|
|
overscroll-behavior: contain;
|
|
height: auto;
|
|
max-height: 320px;
|
|
}
|
|
}
|
|
|
|
&__item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: var(--space-3);
|
|
padding: var(--space-2) var(--space-4);
|
|
|
|
@include viewport.from(sm) {
|
|
padding: var(--space-2) var(--space-3);
|
|
font-size: var(--font-down-1-rem);
|
|
}
|
|
|
|
&:hover {
|
|
.discourse-no-touch & {
|
|
background: var(--primary-very-low);
|
|
}
|
|
|
|
.discourse-touch & {
|
|
background: transparent;
|
|
}
|
|
}
|
|
}
|
|
|
|
.avatar {
|
|
background: var(--primary-low);
|
|
|
|
@include viewport.until(sm) {
|
|
width: 32px;
|
|
height: 32px;
|
|
}
|
|
}
|
|
|
|
&__user-info {
|
|
flex: 1;
|
|
min-width: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: flex-start;
|
|
}
|
|
|
|
&__name {
|
|
@include ellipsis;
|
|
color: var(--primary) !important;
|
|
max-width: 100%;
|
|
}
|
|
|
|
&__username {
|
|
color: var(--primary-medium) !important;
|
|
font-size: var(--font-down-1);
|
|
text-decoration: none;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
|
|
&:hover {
|
|
text-decoration: underline;
|
|
}
|
|
}
|
|
|
|
&__reaction {
|
|
color: var(--danger);
|
|
flex-shrink: 0;
|
|
margin-left: auto;
|
|
|
|
&.emoji {
|
|
width: 1.15em;
|
|
height: 1.15em;
|
|
|
|
@include viewport.until(sm) {
|
|
width: 1.25em;
|
|
height: 1.25em;
|
|
}
|
|
}
|
|
}
|
|
|
|
&__skeleton-item {
|
|
pointer-events: none;
|
|
}
|
|
|
|
&__skeleton-avatar,
|
|
&__skeleton-name,
|
|
&__skeleton-username,
|
|
&__skeleton-reaction {
|
|
background: var(--primary-low);
|
|
border-radius: var(--d-border-radius);
|
|
position: relative;
|
|
overflow: hidden;
|
|
|
|
&::after {
|
|
content: "";
|
|
position: absolute;
|
|
inset: 0;
|
|
transform: translateX(-100%);
|
|
background: linear-gradient(
|
|
90deg,
|
|
rgb(var(--skeleton-shimmer-rgb), 0) 0,
|
|
rgb(var(--skeleton-shimmer-rgb), 0.3) 50%,
|
|
rgb(var(--skeleton-shimmer-rgb), 0.5) 100%
|
|
);
|
|
|
|
@media (prefers-reduced-motion: no-preference) {
|
|
animation: post-users-popup-shimmer 1.25s infinite;
|
|
}
|
|
}
|
|
}
|
|
|
|
&__skeleton-avatar {
|
|
width: 24px;
|
|
height: 24px;
|
|
border-radius: 50%;
|
|
flex-shrink: 0;
|
|
|
|
@include viewport.until(sm) {
|
|
width: 32px;
|
|
height: 32px;
|
|
}
|
|
}
|
|
|
|
&__skeleton-name {
|
|
height: 12px;
|
|
width: 60%;
|
|
margin-top: 2px;
|
|
}
|
|
|
|
&__skeleton-username {
|
|
height: 10px;
|
|
width: 40%;
|
|
margin-top: var(--space-2);
|
|
}
|
|
|
|
&__skeleton-reaction {
|
|
width: 1.15em;
|
|
height: 1.15em;
|
|
flex-shrink: 0;
|
|
margin-left: auto;
|
|
|
|
@include viewport.until(sm) {
|
|
width: 1.25em;
|
|
height: 1.25em;
|
|
}
|
|
}
|
|
|
|
@keyframes post-users-popup-shimmer {
|
|
100% {
|
|
transform: translateX(100%);
|
|
}
|
|
}
|
|
}
|