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

add SuggestedUser card row in mobile feed #2417

Merged
merged 12 commits into from
Apr 12, 2024

Conversation

Rohan-cp
Copy link
Collaborator

@Rohan-cp Rohan-cp commented Apr 9, 2024

Summary of Changes

Adds a new suggested profile section in the Feed, that shows up 4 feed items down the list.

Demo

Screen.Recording.2024-04-11.at.22.14.00.mov

Edge Cases

light mode

Screenshot 2024-04-11 at 22 13 23

Testing Steps

Provide steps on how the reviewer can test the changes.

Checklist

Please make sure to review and check all of the following:

  • I've tested the changes and all tests pass.
  • (if web) I've tested the changes on various desktop screen sizes to ensure responsiveness.
  • (if mobile) I've tested the changes on both light and dark modes.

Copy link

vercel bot commented Apr 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gallery ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2024 6:35pm

@github-actions github-actions bot added the mobile label Apr 9, 2024
Copy link

github-actions bot commented Apr 9, 2024

Bundle Sizes

Compared against a0a7efb

Route: No significant changes found

Dynamic import: No significant changes found

Comment on lines 385 to 406
let postCount = 0;
const itemsWithSuggestedProfileRow = [];
let insertedRow = false;

for (const item of items) {
if (!insertedRow && item.kind === 'post-item-header') {
postCount++;
if (postCount === SUGGESTED_PROFILE_ROW_IDX) {
itemsWithSuggestedProfileRow.push({
kind: 'suggested-profile-row',
event: null,
post: null,
queryRef: query,
key: 'suggested-profile-row',
eventId: 'suggested-profile-row',
itemType: null,
} as FeedListItemType);
insertedRow = true;
}
}
itemsWithSuggestedProfileRow.push(item);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. could we add an explainer / comment block for what's going on here?
  2. do we need to mark insertedRow as true? i assume postCount === SUGGESTED_PROFILE_ROW_IDX would only be true a single time anyway?

overall i'm wondering if there could be a simpler way to do this without the loop, like:

const itemsWithSuggestedProfileRow = [
  ...items.slice(0, 8),
  { kind: 'suggested-profile-row', /* rest of the object */ }
  ...items.slice(8)
]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yo @Robinnnnn, you're right we don't need the insertedRow variable, removed that now.

Regarding using the splice, I think we can't use the hardcoded value for the index because the items of the list are feed-post-header, feed-post-socialize-section, etc (basically subsections of a single post in the feed for all the posts) so we want to add the row only when it is before a feed-post-header

Or it might end up after a post and before its mint button for example.

Screenshot 2024-04-12 at 00 28 45

@Robinnnnn Robinnnnn merged commit fa90cde into main Apr 12, 2024
8 of 9 checks passed
@Robinnnnn Robinnnnn deleted the rohan/add-suggested-users-mobilefeed branch April 12, 2024 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants