diff --git a/app/soapbox/features/status/index.tsx b/app/soapbox/features/status/index.tsx index 6e643e017..2c8e1a75c 100644 --- a/app/soapbox/features/status/index.tsx +++ b/app/soapbox/features/status/index.tsx @@ -17,7 +17,7 @@ import { } from 'soapbox/actions/moderation'; import { getSettings } from 'soapbox/actions/settings'; import { getSoapboxConfig } from 'soapbox/actions/soapbox'; -import PullToRefresh from 'soapbox/components/pull-to-refresh'; +import ScrollableList from 'soapbox/components/scrollable_list'; import SubNavigation from 'soapbox/components/sub_navigation'; import { Column } from 'soapbox/components/ui'; import PlaceholderStatus from 'soapbox/features/placeholder/components/placeholder_status'; @@ -642,9 +642,11 @@ class Status extends ImmutablePureComponent { } render() { - let ancestors, descendants; const { status, ancestorsIds, descendantsIds, intl } = this.props; + const hasAncestors = ancestorsIds && ancestorsIds.size > 0; + const hasDescendants = descendantsIds && descendantsIds.size > 0; + if (!status && this.state.isLoaded) { // TODO: handle errors other than 404 with `this.state.error?.response?.status` return ( @@ -656,14 +658,6 @@ class Status extends ImmutablePureComponent { ); } - if (ancestorsIds && ancestorsIds.size > 0) { - ancestors = this.renderChildren(ancestorsIds); - } - - if (descendantsIds && descendantsIds.size > 0) { - descendants = this.renderChildren(descendantsIds); - } - type HotkeyHandlers = { [key: string]: (keyEvent?: KeyboardEvent) => void }; const handlers: HotkeyHandlers = { @@ -683,6 +677,76 @@ class Status extends ImmutablePureComponent { const username = String(status.getIn(['account', 'acct'])); const titleMessage = status.visibility === 'direct' ? messages.titleDirect : messages.title; + const focusedStatus = ( +
+ +
+ {/* @ts-ignore */} + + +
+ + +
+
+ + {hasDescendants && ( +
+ )} +
+ ); + + const children: JSX.Element[] = []; + + if (hasAncestors) { + children.push(...this.renderChildren(ancestorsIds).toArray()); + } + + children.push(focusedStatus); + + if (hasDescendants) { + children.push(...this.renderChildren(descendantsIds).toArray()); + } + return (
@@ -690,70 +754,9 @@ class Status extends ImmutablePureComponent {
- - {ancestors && ( -
{ancestors}
- )} - -
- -
- {/* @ts-ignore */} - - -
- - -
-
-
- - {descendants && ( - <> -
-
{descendants}
- - )} -
+ + {children} +
); diff --git a/app/styles/components/detailed-status.scss b/app/styles/components/detailed-status.scss index 1b14592a8..bbd9330ef 100644 --- a/app/styles/components/detailed-status.scss +++ b/app/styles/components/detailed-status.scss @@ -170,7 +170,7 @@ @apply sm:bg-white sm:dark:bg-slate-800 p-4 sm:shadow-xl sm:p-6 sm:rounded-xl; &__status { - @apply relative; + @apply relative pb-4; .status__wrapper { @apply shadow-none p-0; @@ -182,16 +182,7 @@ // } } - &__descendants { - @apply pt-4; - } - - &__descendants .thread__status { - // @apply py-4; - } - - &__descendants .status__content-wrapper, - &__ancestors .status__content-wrapper { + .status__content-wrapper { padding-left: calc(42px + 12px); } @@ -225,7 +216,7 @@ &--bottom { @apply block; - height: calc(100% - 42px - 8px); + height: calc(100% - 42px - 8px - 1rem); top: calc(12px + 42px); } }