Skip to content
Merged
Show file tree
Hide file tree
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
56 changes: 0 additions & 56 deletions packages/shared/src/components/Feed.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3490,62 +3490,6 @@ describe('Feed excludedPostIds', () => {
});
});

describe('Feed footer and errorScreen', () => {
const lastPage: Connection<Post> = {
...defaultFeedPage,
pageInfo: { ...defaultFeedPage.pageInfo, hasNextPage: false },
};

it('shows the footer after the last page', async () => {
renderComponent(
[createFeedMock(lastPage)],
defaultUser,
SharedFeedPage.MyFeed,
ANONYMOUS_FEED_QUERY,
{ footer: <p>End of the feed</p> },
);

expect(await screen.findByText('End of the feed')).toBeInTheDocument();
});

it('hides the footer while another page follows', async () => {
renderComponent(
[
createFeedMock({
...lastPage,
pageInfo: { ...lastPage.pageInfo, hasNextPage: true },
}),
],
defaultUser,
SharedFeedPage.MyFeed,
ANONYMOUS_FEED_QUERY,
{ footer: <p>End of the feed</p> },
);

await waitFor(() =>
expect(screen.queryAllByTestId('postItem').length).toBeGreaterThan(0),
);
expect(screen.queryByText('End of the feed')).not.toBeInTheDocument();
});

it('shows the errorScreen when the first page fails', async () => {
renderComponent(
[
{
request: { query: ANONYMOUS_FEED_QUERY, variables },
result: { errors: [{ message: 'Unexpected error' }] },
},
],
defaultUser,
SharedFeedPage.Custom,
ANONYMOUS_FEED_QUERY,
{ errorScreen: <p>Could not load</p> },
);

expect(await screen.findByText('Could not load')).toBeInTheDocument();
});
});

describe('Feed excludePinnedPosts', () => {
const [firstEdge, secondEdge, ...restEdges] = defaultFeedPage.edges;
const pinnedTitle = getPostTitle(firstEdge.node, 'pinned');
Expand Down
13 changes: 0 additions & 13 deletions packages/shared/src/components/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ export interface FeedProps<T>
feedContainerRef?: React.Ref<HTMLDivElement>;
disableListFrame?: boolean;
topContent?: ReactNode;
/** Rendered after the last post once the feed cannot fetch more. */
footer?: ReactNode;
/** Shown instead of the feed when its first page fails to load. */
errorScreen?: ReactNode;
/**
* Search feeds only: correlation id for the query execution and the backend
* search version behind it. Both ride along on every engagement event so the
Expand Down Expand Up @@ -195,8 +191,6 @@ export default function Feed<T>({
disableListFrame = false,
excludePinnedPosts = false,
topContent: topContentProp,
footer,
errorScreen,
searchId,
searchVersion,
isExplaining = false,
Expand Down Expand Up @@ -702,10 +696,6 @@ export default function Feed<T>({
}
};

if (errorScreen && feedError && !items.length) {
return <>{errorScreen}</>;
}

if (isError) {
return <FeedErrorScreen error={feedError} />;
}
Expand Down Expand Up @@ -851,9 +841,6 @@ export default function Feed<T>({
{!isFetching && !isInitialLoading && !isHorizontal && (
<InfiniteScrollScreenOffset ref={infiniteScrollRef} />
)}
{!!footer && !canFetchMore && !isFetching && !isInitialLoading && (
<div className="col-span-full">{footer}</div>
)}
{selectedPost &&
PostModal &&
(!shouldUseListFeedLayout ||
Expand Down
6 changes: 3 additions & 3 deletions packages/shared/src/components/feeds/UnifiedMobileFeedNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ interface ChipItem {

const GROUP_ORDER: ChipGroup[] = ['forYou', 'categories', 'rest'];

export const chipBaseClass =
const chipBaseClass =
'shell-press shrink-0 rounded-10 border px-2.5 py-1.5 font-bold typo-callout';
export const chipActiveClass =
const chipActiveClass =
'border-border-subtlest-tertiary bg-surface-float text-text-primary hover:bg-surface-hover';
export const chipInactiveClass =
const chipInactiveClass =
'border-transparent text-text-tertiary hover:text-text-primary';

interface UnifiedMobileFeedNavProps {
Expand Down
2 changes: 0 additions & 2 deletions packages/shared/src/components/post/BasePostContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export function BasePostContent({
engagementProps,
shouldOnboardAuthor,
aboveComments,
belowComments,
commentAds,
isPostPage,
boostOrigin,
Expand Down Expand Up @@ -105,7 +104,6 @@ export function BasePostContent({
actionsClassName={hasCapsule ? 'hidden tablet:flex' : undefined}
/>
)}
{belowComments}
</BoostOriginContextProvider>
);
}
9 changes: 2 additions & 7 deletions packages/shared/src/components/post/PostContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import usePostContent from '../../hooks/usePostContent';
import { BasePostContent } from './BasePostContent';
import { combinedClicks } from '../../lib/click';
import type { PostContentProps, PostNavigationProps } from './common';
import { PostContainer, getPostWidgetsClassName } from './common';
import { PostContainer } from './common';
import YoutubeVideo from '../video/YoutubeVideo';
import { useTrackPostView } from '../../hooks/post/useTrackPostView';
import { TruncateText } from '../utilities';
Expand Down Expand Up @@ -94,7 +94,6 @@ export function PostContentRaw({
contentLeading,
renderSummarySegments,
aboveComments,
belowComments,
commentAds,
shouldTrackView,
}: PostContentRawProps): ReactElement {
Expand Down Expand Up @@ -174,7 +173,6 @@ export function PostContentRaw({
{contentLeading}
<BasePostContent
aboveComments={aboveComments}
belowComments={belowComments}
commentAds={commentAds}
className={{
...className,
Expand Down Expand Up @@ -336,10 +334,7 @@ export function PostContentRaw({
<PostWidgets
onReadArticle={onReadArticle}
post={post}
className={getPostWidgetsClassName(
'!gap-2 pb-8 pt-4 tablet:border-l tablet:border-border-subtlest-tertiary',
!!belowComments,
)}
className="!gap-2 pb-8 pt-4 tablet:border-l tablet:border-border-subtlest-tertiary"
onClose={onClose}
origin={origin}
onCopyPostLink={onCopyPostLink}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
CommunitySentiment,
mapCommunitySentimentPost,
} from './focus/CommunitySentiment';
import { getPostWidgetsClassName } from './common';
import { Origin } from '../../lib/log';

type SocialTwitterPostContentRawProps = Omit<PostContentProps, 'post'> & {
Expand All @@ -55,7 +54,6 @@ export function SocialTwitterPostContentRaw({
onClose,
isBannerVisible,
isPostPage,
belowComments,
shouldTrackView = true,
}: SocialTwitterPostContentRawProps): ReactElement {
const isBoostButtonVisible = useShowBoostButton({ post });
Expand Down Expand Up @@ -150,7 +148,6 @@ export function SocialTwitterPostContentRaw({
},
}}
isPostPage={isPostPage}
belowComments={belowComments}
isFallback={isFallback}
customNavigation={customNavigation}
shouldOnboardAuthor={shouldOnboardAuthor}
Expand Down Expand Up @@ -239,10 +236,7 @@ export function SocialTwitterPostContentRaw({
onCopyPostLink={onCopyPostLink}
onReadArticle={onReadArticle}
post={post}
className={getPostWidgetsClassName(
'mb-6 !gap-2 border-l border-border-subtlest-tertiary pt-4 laptop:mb-0',
!!belowComments,
)}
className="mb-6 !gap-2 border-l border-border-subtlest-tertiary pt-4 laptop:mb-0"
onClose={onClose}
origin={origin}
/>
Expand Down
8 changes: 1 addition & 7 deletions packages/shared/src/components/post/SquadPostContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
mapCommunitySentimentPost,
} from './focus/CommunitySentiment';
import { SelectionSnapshotBar } from '../../features/snapshot/SelectionSnapshotBar';
import { getPostWidgetsClassName } from './common';
import { Origin } from '../../lib/log';

// The three bodies share one call site, so they share one props shape; each
Expand Down Expand Up @@ -83,7 +82,6 @@ export function SquadPostContentRaw({
onClose,
isBannerVisible,
isPostPage,
belowComments,
shouldTrackView,
}: SquadPostContentRawProps): ReactElement {
const contentRef = useRef<HTMLDivElement>(null);
Expand Down Expand Up @@ -181,7 +179,6 @@ export function SquadPostContentRaw({
},
}}
isPostPage={isPostPage}
belowComments={belowComments}
isFallback={isFallback}
customNavigation={customNavigation}
shouldOnboardAuthor={shouldOnboardAuthor}
Expand Down Expand Up @@ -251,10 +248,7 @@ export function SquadPostContentRaw({
onCopyPostLink={onCopyPostLink}
onReadArticle={onReadArticle}
post={post}
className={getPostWidgetsClassName(
'mb-6 !gap-2 border-l border-border-subtlest-tertiary pt-4 laptop:mb-0',
!!belowComments,
)}
className="mb-6 !gap-2 border-l border-border-subtlest-tertiary pt-4 laptop:mb-0"
onClose={onClose}
origin={origin}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ParagraphSnapshotButtons } from '../../../features/snapshot/ParagraphSn
import { SelectionSnapshotBar } from '../../../features/snapshot/SelectionSnapshotBar';
import { CollectionPostWidgets } from './CollectionPostWidgets';
import type { PostContentProps, PostNavigationProps } from '../common';
import { PostContainer, getPostWidgetsClassName } from '../common';
import { PostContainer } from '../common';
import { Pill } from '../../Pill';
import { CollectionsIntro } from '../widgets';
import { webappUrl } from '../../../lib/constants';
Expand Down Expand Up @@ -53,7 +53,6 @@ export const CollectionPostContentRaw = ({
backToSquad,
isBannerVisible,
isPostPage,
belowComments,
shouldTrackView,
}: CollectionPostContentRawProps): ReactElement => {
const { subject } = useToastNotification();
Expand Down Expand Up @@ -133,7 +132,6 @@ export const CollectionPostContentRaw = ({
},
}}
isPostPage={isPostPage}
belowComments={belowComments}
isFallback={isFallback}
customNavigation={customNavigation}
shouldOnboardAuthor={shouldOnboardAuthor}
Expand Down Expand Up @@ -203,7 +201,7 @@ export const CollectionPostContentRaw = ({
<CollectionPostWidgets
onCopyPostLink={onCopyPostLink}
post={post}
className={getPostWidgetsClassName('pb-8 pt-6', !!belowComments)}
className="pb-8 pt-6"
onClose={onClose}
origin={origin}
/>
Expand Down
18 changes: 0 additions & 18 deletions packages/shared/src/components/post/common.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import classNames from 'classnames';
import type {
CSSProperties,
KeyboardEventHandler,
Expand Down Expand Up @@ -110,12 +109,6 @@ export interface PostContentProps
renderSummarySegments?: (summary: string) => ReactNode;
/** Rendered between the article content and the engagement block. */
aboveComments?: ReactNode;
/**
* Rendered after the comments, at the end of the post's main column. Only
* the webapp post page passes it (the post page feed): the modal, the
* reader and the history pane render the same component without it.
*/
belowComments?: ReactNode;
/** Interleaves the comment thread — see PostEngagements. */
commentAds?: {
interleaveEvery: number;
Expand Down Expand Up @@ -146,7 +139,6 @@ export interface BasePostContentProps extends UsePostContentProps {
engagementProps?: UsePostContent;
shouldOnboardAuthor?: boolean;
aboveComments?: ReactNode;
belowComments?: ReactNode;
commentAds?: {
interleaveEvery: number;
renderInterleaved: (occurrence: number) => ReactNode;
Expand All @@ -156,13 +148,3 @@ export interface BasePostContentProps extends UsePostContentProps {
isPostPage?: boolean;
boostOrigin?: Origin;
}

/**
* The widgets column under a post's main column. Below laptop the page is one
* column, so with a feed after the comments (`belowComments`) the widgets
* would sit under an endless feed. Keep them for laptop up only.
*/
export const getPostWidgetsClassName = (
className: string,
hasBelowComments: boolean,
): string => classNames(className, hasBelowComments && 'hidden laptop:flex');
46 changes: 0 additions & 46 deletions packages/shared/src/components/post/feed/PostPageFeed.module.css

This file was deleted.

Loading
Loading