Fix status jumping bug

This part is too complex.
The thread can get very fancy and it's impossible to handle all use-cases without a lot of code.
Solution is just fading all of them out while loading.
This commit is contained in:
Lim Chee Aun 2022-12-20 15:32:31 +08:00
parent c16b7764f2
commit 8babc97877
2 changed files with 15 additions and 15 deletions

View file

@ -273,6 +273,14 @@ a.mention span {
.timeline.contextual > li.thread .replies li:before {
left: calc(50px + 16px + 16px);
}
.timeline.contextual.loading > li:not(.hero) {
opacity: 0.2;
pointer-events: none;
background-image: none !important;
}
.timeline.contextual.loading > li:not(.hero):before {
content: none !important;
}
.timeline-deck.compact .status {
max-height: max(25vh, 160px);

View file

@ -23,19 +23,7 @@ function StatusPage({ id }) {
useEffect(async () => {
const containsStatus = statuses.find((s) => s.id === id);
const statusesWithSameAccountID = statuses.filter(
(s) => s.accountID === containsStatus?.accountID,
);
if (statusesWithSameAccountID.length > 1) {
setStatuses(
statusesWithSameAccountID.map((s) => ({
...s,
thread: true,
descendant: undefined,
ancestor: undefined,
})),
);
} else {
if (!containsStatus) {
setStatuses([{ id }]);
}
@ -200,7 +188,11 @@ function StatusPage({ id }) {
</Link>
</div>
</header>
<ul class="timeline flat contextual">
<ul
class={`timeline flat contextual ${
uiState === 'loading' ? 'loading' : ''
}`}
>
{statuses.slice(0, limit).map((status) => {
const {
id: statusID,
@ -216,7 +208,7 @@ function StatusPage({ id }) {
ref={isHero ? heroStatusRef : null}
class={`${ancestor ? 'ancestor' : ''} ${
descendant ? 'descendant' : ''
} ${thread ? 'thread' : ''}`}
} ${thread ? 'thread' : ''} ${isHero ? 'hero' : ''}`}
>
{isHero ? (
<Status statusID={statusID} withinContext size="l" />