Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove unecessary spacing bewteen posts #346

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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