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

User Profile: List component #98225

Merged
merged 11 commits into from
Jan 16, 2025
Merged

Conversation

artemiomorales
Copy link
Contributor

@artemiomorales artemiomorales commented Jan 10, 2025

Related to https://github.com/Automattic/loop/issues/271

Proposed Changes

This PR adds a component containing a user's public lists on the profile page.

Why are these changes being made?

Part of an overall project to create a user profile page.

Testing Instructions

  • Check out 169751-ghe-Automattic/wpcom in your sandbox (this contains the new /v1/read/lists/{user_slug} endpoint used in this PR)
  • Visit http://calypso.localhost:3000/read/users/218803706/lists — see that the lists component is being rendered.
  • Test other user pages too with the following URL format: /read/users/{user_id}/lists

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@matticbot
Copy link
Contributor

matticbot commented Jan 10, 2025

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~85 bytes added 📈 [gzipped])

name                             parsed_size           gzip_size
write-flow                            +291 B  (+0.0%)      +63 B  (+0.0%)
site-blocks                           +291 B  (+0.0%)      +63 B  (+0.0%)
reader                                +291 B  (+0.0%)      +63 B  (+0.0%)
plugins                               +291 B  (+0.0%)      +63 B  (+0.0%)
link-in-bio-tld-flow                  +291 B  (+0.0%)      +63 B  (+0.0%)
jetpack-cloud-plugin-management       +291 B  (+0.0%)      +63 B  (+0.0%)
home                                  +291 B  (+0.0%)      +63 B  (+0.0%)
build-flow                            +291 B  (+0.0%)      +63 B  (+0.0%)
comments                               +82 B  (+0.0%)      +22 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~1746 bytes added 📈 [gzipped])

name                                                     parsed_size             gzip_size
async-load-calypso-reader-user-stream                        +7618 B  (+182.9%)    +1638 B  (+100.6%)
async-load-design-blocks                                      +291 B    (+0.0%)      +63 B    (+0.0%)
async-load-calypso-components-web-preview-component           +291 B    (+0.1%)      +63 B    (+0.0%)
async-load-calypso-blocks-support-article-dialog-dialog       +291 B    (+0.3%)      +63 B    (+0.2%)
async-load-calypso-reader-sidebar                             +237 B    (+0.2%)      +45 B    (+0.2%)
async-load-calypso-reader-list-stream                         +237 B    (+1.6%)      +45 B    (+1.0%)
async-load-calypso-reader-list-manage                         +237 B    (+0.8%)      +45 B    (+0.6%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Comment on lines 35 to 43
return Object.assign( {}, state, keyBy( action.lists, 'ID' ) );
case READER_LIST_REQUEST_SUCCESS:
case READER_LIST_UPDATE_SUCCESS:
return Object.assign( {}, state, keyBy( [ action.data.list ], 'ID' ) );
case READER_LIST_DELETE:
if ( ! ( action.listId in state ) ) {
return state;
}
return omit( state, action.listId );
Copy link
Contributor Author

@artemiomorales artemiomorales Jan 13, 2025

Choose a reason for hiding this comment

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

Do we no longer need these cases?

Copy link
Contributor Author

@artemiomorales artemiomorales Jan 13, 2025

Choose a reason for hiding this comment

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

Overall, I think there may be obsolete lists functionality in here confounding the situation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change isn't necessary for this PR and deals with existing functionality, so I reverted it.
As we continue working on the Lists feature, we can determine later whether it makes sense to refactor.

@artemiomorales
Copy link
Contributor Author

I reused the post card for some basic styling for this list component. How does this look?

It'd be nice to have an icon for the list a la Blue Sky, but we don't have support for that.

I'd consider making the text smaller, and also put the description in a lighter color, though think it's also fine as is.

Do we have a design system or language we should follow? I figured it'd be good to get feedback before investing time into tweaking it.

Screenshot 2025-01-13 at 13 10 00

userSlug: action.userSlug,
lists: apiResponse?.lists,
} ),
onError: () => noop,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we have an error state? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think an error state could be handled as part of a separate PR.

@artemiomorales artemiomorales force-pushed the try/user-profile-list-stream branch from 1069ade to 8888f2a Compare January 13, 2025 22:28
@artemiomorales artemiomorales marked this pull request as ready for review January 13, 2025 22:29
@artemiomorales artemiomorales requested a review from a team as a code owner January 13, 2025 22:29
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 13, 2025
@matticbot
Copy link
Contributor

matticbot commented Jan 13, 2025

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications

To test WordPress.com changes, run install-plugin.sh $pluginSlug try/user-profile-list-stream on your sandbox.

Comment on lines 15 to 26
.user-profile__lists-body {
max-width: 768px;
margin: 0 auto;

.user-profile__lists .reader-post-card__title {
margin-top: 0;

.reader-post-card__title-link {
font-size: 1.25rem;
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just realized I can probably clean up these class names a bit. Will do that tomorrow.

/>
<div className="user-profile__lists-body">
{ lists.map( ( list: List ) => (
<div className="card reader-post-card is-compact is-clickable" key={ list.ID }>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<div className="card reader-post-card is-compact is-clickable" key={ list.ID }>
<div className="card reader-post-card is-compact" key={ list.ID }>

This is-clickable class makes the entire card look clickable with the cursor, but only the List title is actually a link. We should probably remove is-clickable here or make the whole card a link. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made the whole card a link! I think that experience is clearer.

Copy link
Member

@DustyReagan DustyReagan left a comment

Choose a reason for hiding this comment

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

I left a comment about the clickable area. Also, we could probably improve the mobile view. But overall this is working and looks good to me. I think we can ship it and iterate on it.

@artemiomorales artemiomorales merged commit ed3c9fc into trunk Jan 16, 2025
13 checks passed
@artemiomorales artemiomorales deleted the try/user-profile-list-stream branch January 16, 2025 18:19
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants