Skip to content
Open
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
29 changes: 17 additions & 12 deletions packages/shared/src/components/MainFeedLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ import { useFeeds } from '../hooks/feed/useFeeds';
import { WebappShortcutsRow } from '../features/shortcuts/components/WebappShortcutsRow';
import { AskSearchBanner } from './marketing/banners/AskSearchBanner';
import { FeedEngagementBanner } from './brand/FeedEngagementBanner';
import { ExploreSignupStrip } from './auth/ExploreSignupStrip';
import {
PublicPageSignupBanner,
usePublicPageSignupBanner,
} from './auth/PublicPageSignupBanner';
import FeedContext from '../contexts/FeedContext';
import AuthContext from '../contexts/AuthContext';
import type { LoggedUser } from '../lib/user';
Expand Down Expand Up @@ -249,7 +252,7 @@ export default function MainFeedLayout({
}: MainFeedLayoutProps): ReactElement {
useScrollRestoration();
const { sortingEnabled, loadedSettings } = useContext(SettingsContext);
const { user, isTokenValid } = useContext(AuthContext);
const { user, isTokenValid, isAuthReady } = useContext(AuthContext);
const { alerts } = useContext(AlertContext);
const { numCards: feedSpacinessCards } = useContext(FeedContext);
const feedWidthStyle = {
Expand Down Expand Up @@ -850,12 +853,23 @@ export default function MainFeedLayout({
chipsTopContent
);

const isSignupBannerVisible = usePublicPageSignupBanner();
const showSignupBanner =
!isExtension && isExploreHub && isSignupBannerVisible;
// Both pin to the window's bottom edge, so an anonymous visitor gets the
// signup banner or the sponsor dock, never both. Auth unknown counts as
// "banner may show": the boot cache readies GrowthBook before the remote
// boot answers, and the dock must not enroll a visitor it is about to
// leave.
const mayShowSignupBanner =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking nit. showSignupBanner and mayShowSignupBanner spell out the same policy in two expressions: one through usePublicPageSignupBanner, the other inline. They agree today, but if someone later changes the banner's gate (a breakpoint, a new exclusion) they can drift apart. The dock would then be suppressed where no banner shows, or both would render. Consider deriving one from the other, e.g. showSignupBanner = mayShowSignupBanner && isAuthReady && !user, or exporting a single "may show" helper next to usePublicPageSignupBanner.

Reviewed by AI.

!isExtension && isExploreHub && isLaptop && (!isAuthReady || !user);
// Read here rather than inside the feed or the strip: this is the one place
// that owns both, so the card can only ever go missing on a surface that is
// mounting the strip — with headlines in it — in the card's place.
const sponsorStrip = useSponsorStripFeed({
feedName,
disableAds: feedProps?.disableAds,
suppressed: mayShowSignupBanner,
});
const v2ActionButtons = feedProps?.actionButtons;
const showFeedV2PageHeader =
Expand Down Expand Up @@ -887,16 +901,6 @@ export default function MainFeedLayout({
<FeedPageLayoutComponent
className={classNames('relative', disableTopPadding && '!pt-0')}
>
{!isExtension && isExploreHub && (
<div className={feedWidthClassName} style={feedWidthStyle}>
<ExploreSignupStrip
className={classNames(
'mb-4',
!shouldUseCommentFeedLayout && feedGutter,
)}
/>
</div>
)}
{isAnyExplore && !showExploreV2PageHeader && <FeedExploreComponent />}
{isSearchOn && !isSearchPageLaptop && search}
{isSearchOn && !isSearchPageLaptop && (
Expand Down Expand Up @@ -953,6 +957,7 @@ export default function MainFeedLayout({
)
)}
{children}
{showSignupBanner && <PublicPageSignupBanner />}
</FeedPageLayoutComponent>
{/* Docked outside the page container so it spans the feed column and
pins to the window, and mounted here rather than in each app's
Expand Down
3 changes: 3 additions & 0 deletions packages/shared/src/components/auth/AuthenticationBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ const Section = classed('div', 'flex flex-col');

interface AuthenticationBannerProps extends PropsWithChildren {
compact?: boolean;
targetId?: string;
}

export function AuthenticationBanner({
children,
compact,
targetId,
}: AuthenticationBannerProps): ReactElement {
const { showLogin } = useAuthContext();

Expand Down Expand Up @@ -75,6 +77,7 @@ export function AuthenticationBanner({
ignoreMessages
formRef={null as unknown as React.MutableRefObject<HTMLFormElement>}
trigger={AuthTriggers.Onboarding}
targetId={targetId}
simplified
defaultDisplay={AuthDisplay.OnboardingSignup}
forceDefaultDisplay
Expand Down
142 changes: 0 additions & 142 deletions packages/shared/src/components/auth/ExploreSignupStrip.spec.tsx

This file was deleted.

84 changes: 0 additions & 84 deletions packages/shared/src/components/auth/ExploreSignupStrip.tsx

This file was deleted.

Loading
Loading