Skip to content

Commit

Permalink
Reader profile: Stub out profile page (#97577)
Browse files Browse the repository at this point in the history
* Copy logic for feed stream to create user profile

* Remove extraneous code; attempt to fetch user data

* Remove unused code

---------

Co-authored-by: Ricardo Artemio Morales <[email protected]>, Dusty Reagan [email protected]
  • Loading branch information
artemiomorales authored Dec 19, 2024
1 parent 029c376 commit 3597977
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
37 changes: 37 additions & 0 deletions client/reader/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,43 @@ export function blogListing( context, next ) {
next();
}

export function userListing( context, next ) {
const userId = context.params.user_id;

if ( userId.trim().length === 0 ) {
next();
return;
}

const basePath = '/read/users/:user_id';
const fullAnalyticsPageTitle = analyticsPageTitle + ' > User > ' + userId;
const mcKey = 'blog';

trackPageLoad( basePath, fullAnalyticsPageTitle, mcKey );
recordTrack( 'calypso_reader_user_profile', { user_id: userId } );

context.primary = (
<AsyncLoad
require="calypso/reader/user-stream"
key={ 'user-' + userId }
streamKey={ 'user:' + userId }
userId={ userId }
trackScrollPage={ trackScrollPage.bind(
null,
basePath,
fullAnalyticsPageTitle,
analyticsPageTitle,
mcKey
) }
onUpdatesShown={ trackUpdatesLoaded.bind( null, mcKey ) }
suppressSiteNameLink
showBack={ userHasHistory( context ) }
placeholder={ null }
/>
);
next();
}

export function readA8C( context, next ) {
const basePath = sectionify( context.path );
const fullAnalyticsPageTitle = analyticsPageTitle + ' > A8C';
Expand Down
15 changes: 15 additions & 0 deletions client/reader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
blogListing,
feedDiscovery,
feedListing,
userListing,
following,
incompleteUrlRedirects,
legacyRedirects,
Expand Down Expand Up @@ -95,6 +96,20 @@ export default async function () {
clientRender
);

// User stream
if ( config.isEnabled( 'reader/user-profile' ) ) {
page(
'/read/users/:user_id',
blogDiscoveryByFeedId,
redirectLoggedOutToSignup,
updateLastRoute,
sidebar,
userListing,
makeLayout,
clientRender
);
}

// Old full post view
page( '/read/post/feed/:feed_id/:post_id', legacyRedirects );
page( '/read/post/id/:blog_id/:post_id', legacyRedirects );
Expand Down
5 changes: 5 additions & 0 deletions client/reader/user-stream/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const UserStream = () => {
return <div>User Profile Stream</div>;
};

export default UserStream;

0 comments on commit 3597977

Please sign in to comment.