Skip to content

Commit

Permalink
🔨 REFACTOR: rename folder from user-stream to user-profile
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmoodak committed Jan 14, 2025
1 parent 9021ad1 commit 43c057b
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import { Context } from '@automattic/calypso-router';
import { ReactElement } from 'react';
import AsyncLoad from 'calypso/components/async-load';
import { trackPageLoad, trackScrollPage } from 'calypso/reader/controller-helper';
import type { AppState } from 'calypso/types';

interface Context {
interface UserPostsContext extends Context {
params: {
user_id: string;
};
store: {
getState: () => AppState;
};
primary: ReactElement;
}

const analyticsPageTitle = 'Reader';

export function userPosts( context: Context, next: () => void ): void {
export function userPosts( ctx: Context, next: () => void ): void {
const context = ctx as UserPostsContext;
const userId = context.params.user_id;
const basePath = '/read/users/:user_id';
const fullAnalyticsPageTitle = analyticsPageTitle + ' > User > ' + userId + ' > Posts';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import page from '@automattic/calypso-router';
import { useEffect } from 'react';
import { connect } from 'react-redux';
import { UserData } from 'calypso/lib/user/user';
import UserLists from 'calypso/reader/user-stream/views/lists';
import UserPosts from 'calypso/reader/user-stream/views/posts';
import UserLists from 'calypso/reader/user-profile/views/lists';
import UserPosts from 'calypso/reader/user-profile/views/posts';
import { requestUser } from 'calypso/state/reader/users/actions';
import './style.scss';

interface UserStreamProps {
interface UserProfileProps {
streamKey?: string;
userId: string;
user: UserData;
isLoading: boolean;
requestUser: ( userId: string ) => Promise< void >;
}

type UserStreamState = {
type UserProfileState = {
reader: {
users: {
items: Record< string, UserData >;
Expand All @@ -24,7 +24,9 @@ type UserStreamState = {
};
};

export function UserStream( { userId, requestUser, user, streamKey, isLoading }: UserStreamProps ) {
export function UserProfile( props: UserProfileProps ) {
const { userId, requestUser, user, streamKey, isLoading } = props;

useEffect( () => {
requestUser( userId );
}, [ userId, requestUser ] );
Expand Down Expand Up @@ -57,9 +59,9 @@ export function UserStream( { userId, requestUser, user, streamKey, isLoading }:
}

export default connect(
( state: UserStreamState, ownProps: UserStreamProps ) => ( {
( state: UserProfileState, ownProps: UserProfileProps ) => ( {
user: state.reader.users.items[ ownProps.userId ],
isLoading: state.reader.users.requesting[ ownProps.userId ] ?? false,
} ),
{ requestUser }
)( UserStream );
)( UserProfile );
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}

div.user-profile__content {
main.main.is-user-stream {
main.main.is-user-profile {
padding: 0;
border-block-end: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { formatListBullets, Icon } from '@wordpress/icons';
import { useTranslate } from 'i18n-calypso';
import EmptyContent from 'calypso/components/empty-content';
import { UserData } from 'calypso/lib/user/user';
import UserProfileHeader from 'calypso/reader/user-stream/components/user-profile-header';
import UserProfileHeader from 'calypso/reader/user-profile/components/user-profile-header';

interface UserListsProps {
user: UserData;
Expand All @@ -12,7 +12,7 @@ const UserLists = ( { user }: UserListsProps ): JSX.Element => {
const translate = useTranslate();

return (
<div className="user-stream__lists">
<div className="user-profile__lists">
<UserProfileHeader user={ user } />
<EmptyContent
illustration={ null }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useTranslate } from 'i18n-calypso';
import EmptyContent from 'calypso/components/empty-content';
import { UserData } from 'calypso/lib/user/user';
import Stream from 'calypso/reader/stream';
import UserProfileHeader from 'calypso/reader/user-stream/components/user-profile-header';
import UserProfileHeader from 'calypso/reader/user-profile/components/user-profile-header';

interface UserPostsProps {
streamKey: string;
Expand All @@ -16,7 +16,7 @@ const UserPosts = ( { streamKey, user }: UserPostsProps ): JSX.Element => {
return (
<Stream
streamKey={ streamKey }
className="is-user-stream"
className="is-user-profile"
listName={ translate( 'User Posts' ) }
showFollowButton={ false }
showSiteNameOnCards
Expand Down

0 comments on commit 43c057b

Please sign in to comment.