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

Reader: clean up scrolling on disabled onboarding modal #99181

Merged
merged 1 commit into from
Feb 3, 2025
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
136 changes: 69 additions & 67 deletions client/reader/onboarding/subscribe-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,80 +306,82 @@ const SubscribeModal: React.FC< SubscribeModalProps > = ( { isOpen, onClose } )
<Modal
onRequestClose={ handleClose }
isFullScreen
className="subscribe-modal"
className={ clsx( 'subscribe-modal', {
'is-disabled': promptVerification,
} ) }
headerActions={ headerActions }
isDismissible={ false }
>
{ promptVerification && <SubscribeVerificationNudge /> }
<div
className={ clsx( 'subscribe-modal__content', {
'subscribe-modal__disabled-for-verification': promptVerification,
} ) }
>
<div className="subscribe-modal__site-list-column">
<h2 className="subscribe-modal__title">{ __( "Discover sites that you'll love" ) }</h2>
<p className="subscribe-modal__description">
{ __(
'Preview sites by clicking below, then subscribe to any site that inspires you.'
<div className="subscribe-modal__container">
{ promptVerification && <SubscribeVerificationNudge /> }
<div className="subscribe-modal__content">
<div className="subscribe-modal__site-list-column">
<h2 className="subscribe-modal__title">
{ __( "Discover sites that you'll love" ) }
</h2>
<p className="subscribe-modal__description">
{ __(
'Preview sites by clicking below, then subscribe to any site that inspires you.'
) }
</p>
{ isLoading && <LoadingPlaceholder /> }
{ ! isLoading && combinedRecommendations.length === 0 && (
<p>{ __( 'No recommendations available at the moment.' ) }</p>
) }
</p>
{ isLoading && <LoadingPlaceholder /> }
{ ! isLoading && combinedRecommendations.length === 0 && (
<p>{ __( 'No recommendations available at the moment.' ) }</p>
) }
{ ! isLoading && combinedRecommendations.length > 0 && (
<div className="subscribe-modal__recommended-sites">
{ displayedRecommendations.map( ( site: CardData ) => (
<ConnectedReaderSubscriptionListItem
key={ site.feed_ID }
feedId={ site.feed_ID }
siteId={ site.site_ID }
site={ site }
url={ site.site_URL }
showLastUpdatedDate={ false }
showNotificationSettings={ false }
showFollowedOnDate={ false }
followSource="reader-onboarding-modal"
disableSuggestedFollows
replaceStreamClickWithItemClick
onItemClick={ () => handleItemClick( site ) }
isSelected={ selectedSite?.feed_ID === site.feed_ID }
onFollowToggle={ ( following: boolean ) =>
handleFollowToggle( site, following )
}
/>
) ) }
</div>
) }
{ currentPage < maxPages && (
<Button
className="subscribe-modal__load-more-button"
onClick={ handleLoadMore }
variant="link"
>
{ __( 'Load more recommendations' ) }
</Button>
) }
</div>
<div className="subscribe-modal__preview-column">
<div className="subscribe-modal__preview-placeholder">
{ selectedSite && (
<>
<div className="subscribe-modal__preview-stream-header">
<h3>{ formatUrl( selectedSite.site_URL ) }</h3>
</div>
<div className="subscribe-modal__preview-stream-container">
<TypedStream
streamKey={ `feed:${ selectedSite.feed_ID }` }
className="is-site-stream subscribe-modal__preview-stream"
followSource="reader_subscribe_modal"
useCompactCards
trackScrollPage={ trackScrollPage.bind( null ) }
{ ! isLoading && combinedRecommendations.length > 0 && (
<div className="subscribe-modal__recommended-sites">
{ displayedRecommendations.map( ( site: CardData ) => (
<ConnectedReaderSubscriptionListItem
key={ site.feed_ID }
feedId={ site.feed_ID }
siteId={ site.site_ID }
site={ site }
url={ site.site_URL }
showLastUpdatedDate={ false }
showNotificationSettings={ false }
showFollowedOnDate={ false }
followSource="reader-onboarding-modal"
disableSuggestedFollows
replaceStreamClickWithItemClick
onItemClick={ () => handleItemClick( site ) }
isSelected={ selectedSite?.feed_ID === site.feed_ID }
onFollowToggle={ ( following: boolean ) =>
handleFollowToggle( site, following )
}
/>
</div>
</>
) ) }
</div>
) }
{ currentPage < maxPages && (
<Button
className="subscribe-modal__load-more-button"
onClick={ handleLoadMore }
variant="link"
>
{ __( 'Load more recommendations' ) }
</Button>
) }
</div>
<div className="subscribe-modal__preview-column">
<div className="subscribe-modal__preview-placeholder">
{ selectedSite && (
<>
<div className="subscribe-modal__preview-stream-header">
<h3>{ formatUrl( selectedSite.site_URL ) }</h3>
</div>
<div className="subscribe-modal__preview-stream-container">
<TypedStream
streamKey={ `feed:${ selectedSite.feed_ID }` }
className="is-site-stream subscribe-modal__preview-stream"
followSource="reader_subscribe_modal"
useCompactCards
trackScrollPage={ trackScrollPage.bind( null ) }
/>
</div>
</>
) }
</div>
</div>
</div>
</div>
</Modal>
Expand Down
21 changes: 16 additions & 5 deletions client/reader/onboarding/subscribe-modal/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ body.is-reader-page .subscribe-modal__preview-column .reader__card.card.is-place
}
}

&__disabled-for-verification {
opacity: 0.5;
pointer-events: none;
}

&__site-list-column {
flex: 1;
padding: 20px 20px 0;
Expand Down Expand Up @@ -154,4 +149,20 @@ body.is-reader-page .subscribe-modal__preview-column .reader__card.card.is-place
}
}
}

&.is-disabled {
.subscribe-modal__container {
height: calc( 100vh - 188px ); // Modal margin + modal padding + modal heading
overflow: hidden;
padding: 1px;
}
.subscribe-modal__content {
opacity: 0.5;
pointer-events: none;
}
.subscribe-modal__preview-stream-container,
.subscribe-modal__site-list-column {
overflow-y: hidden;
}
}
}