Skip to content

Commit

Permalink
fix: remove unecessary spacing bewteen posts #346
Browse files Browse the repository at this point in the history
  • Loading branch information
admin committed Nov 9, 2024
1 parent 2ff540d commit 4d85690
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/soapbox/components/status_list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Ad from 'soapbox/features/ads/components/ad';
import FeedSuggestions from 'soapbox/features/feed-suggestions/feed-suggestions';
import PlaceholderStatus from 'soapbox/features/placeholder/components/placeholder_status';
import PendingStatus from 'soapbox/features/ui/components/pending_status';
import { useSoapboxConfig } from 'soapbox/hooks';
import { useAppSelector, useSoapboxConfig } from 'soapbox/hooks';
import useAds from 'soapbox/queries/ads';

import type { OrderedSet as ImmutableOrderedSet } from 'immutable';
Expand Down Expand Up @@ -63,6 +63,9 @@ const StatusList: React.FC<IStatusList> = ({
const adsInterval = Number(soapboxConfig.extensions.getIn(['ads', 'interval'], 40)) || 0;
const node = useRef<VirtuosoHandle>(null);

const suggestedProfiles = useAppSelector((state) => state.suggestions.items);
const areSuggestedProfilesLoaded = useAppSelector((state) => state.suggestions.isLoading);

const getFeaturedStatusCount = () => {
return featuredStatusIds?.size || 0;
};
Expand Down Expand Up @@ -167,9 +170,10 @@ const StatusList: React.FC<IStatusList> = ({
));
};

const renderFeedSuggestions = (): React.ReactNode => {
const renderFeedSuggestions = useCallback((): React.ReactNode => {
if (!areSuggestedProfilesLoaded && suggestedProfiles.size === 0) return null;
return <FeedSuggestions key='suggestions' />;
};
}, [areSuggestedProfilesLoaded, suggestedProfiles.size]);

const renderStatuses = (): React.ReactNode[] => {
if (isLoading || statusIds.size > 0) {
Expand All @@ -181,7 +185,8 @@ const StatusList: React.FC<IStatusList> = ({
if (statusId === null) {
acc.push(renderLoadGap(index));
} else if (statusId.startsWith('末suggestions-')) {
acc.push(renderFeedSuggestions());
const suggestions = renderFeedSuggestions();
if (suggestions) acc.push(suggestions);
} else if (statusId.startsWith('末pending-')) {
acc.push(renderPendingStatus(statusId));
} else {
Expand Down Expand Up @@ -233,12 +238,9 @@ const StatusList: React.FC<IStatusList> = ({
placeholderComponent={PlaceholderStatus}
placeholderCount={20}
ref={node}
className={classNames('divide-y divide-solid divide-gray-200 dark:divide-slate-700', {
className={classNames('flex flex-col gap-3 divide-y divide-solid divide-gray-200 dark:divide-slate-700', {
'divide-none': divideType !== 'border',
})}
itemClassName={classNames({
'pb-3': divideType !== 'border',
})}
{...other}
>
{renderScrollableContent()}
Expand Down

0 comments on commit 4d85690

Please sign in to comment.