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 Profile: Add empty user profile content #98296

Merged
merged 2 commits into from
Jan 14, 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
19 changes: 18 additions & 1 deletion client/reader/user-stream/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import page from '@automattic/calypso-router';
import { useTranslate } from 'i18n-calypso';
import { useEffect } from 'react';
import { connect } from 'react-redux';
import EmptyContent from 'calypso/components/empty-content';
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';
Expand All @@ -25,14 +27,29 @@ type UserStreamState = {
};

export function UserStream( { userId, requestUser, user, streamKey, isLoading }: UserStreamProps ) {
const translate = useTranslate();

useEffect( () => {
requestUser( userId );
}, [ userId, requestUser ] );

if ( isLoading || ! user ) {
if ( isLoading ) {
return <></>;
}

if ( ! user ) {
return (
<EmptyContent
illustration="/calypso/images/illustrations/illustration-404.svg"
title={ translate( 'Uh oh. User not found.' ) }
line={ translate( 'Sorry, the user you were looking for could not be found.' ) }
action={ translate( 'Return to Reader' ) }
actionURL="/read"
className="user-profile__404"
/>
);
}

const currentPath = page.current;

const renderContent = (): React.ReactNode => {
Expand Down
6 changes: 6 additions & 0 deletions client/reader/user-stream/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
}
}

.user-profile__404.empty-content {
max-width: initial;
margin: initial;
padding-top: initial;
}

div.user-profile__content {
main.main.is-user-stream {
padding: 0;
Expand Down
Loading