Skip to content

Conversation

@ChristopherChudzicki
Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki commented Jun 26, 2024

What are the relevant tickets?

https://github.com/mitodl/hq/issues/4712

Description (What does it do?)

Makes userlist bookmark and learningpath icon filled vs unfilled based on membership in at least 1 list.

Screenshots (if appropriate):

Cards
Screenshot 2024-06-26 at 6 32 13 PM

List Cards
Screenshot 2024-06-26 at 6 32 46 PM

List Cards, Mobile
Screenshot 2024-06-26 at 6 32 57 PM

How can this be tested?

  1. As a logged in user, click the bookmark button on a card to change its membership in "userlists".
    • try this throughout the app, particularly for horizontal "ListCard" (search page) and vertical cards
  2. When the resource belongs to at least one list, the bookmark should be filled.
  3. When the resource belongs to zero lists, the bookmark should be unfilled.
  4. The stafflist button should behave similarly.
  5. Try adding/removing featured courses (homepage "Featured Courses" carousel) to a userlist.
    • in contrast to RC, the carousel resources should maintain their order.

@ChristopherChudzicki ChristopherChudzicki added the Needs Review An open Pull Request that is ready for review label Jun 27, 2024
response.data.resource,
queryClient.setQueriesData<PaginatedLearningResourceList>(
learningResources.featured({}).queryKey,
(old) => updateListParentsOnAdd(response.data, old),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding updateListParentsOnAdd and updateListParentsOnDestroy :

  1. The featured carousel on the homepage is populated by an API that has an intentionally randomized order.
  2. In general throughout the app, when data might change, we tell react query "invalidate the cached data" and it re-fetches.
  3. Adding the featured courses to a userlist changes their data (it affects `resource.user_list_parents). However, if we invalidate the cache and refetch new, updated data, then the carousel order will change, which is strange.
    • you can see this behavior on RC / Prod, but the bookmarks won't fill / unfill, so it's less noticeable that position has changed.
  4. So instead of invalidating the cache and refetching the data, we manually update the data on the frontend.

We only do this for userlists, not for learnignpaths, because...

  • changing a resource's learningpath membershould can change whether it is a featured course or not, so we really do need to refetch the data.

@ChristopherChudzicki ChristopherChudzicki marked this pull request as ready for review June 27, 2024 20:13
@abeglova abeglova self-assigned this Jun 28, 2024
@abeglova
Copy link
Contributor

abeglova commented Jun 28, 2024

You should add a little more padding around the list icon, it overlaps the learning format on smaller mobile screens (chrome iphone SE screen shown) this doesn't happen on main

Screenshot 2024-06-28 at 12 28 44 PM

@ChristopherChudzicki
Copy link
Contributor Author

@abeglova One thing to keep in mind is that normal users only have a single icon—the list icon is only visible to staff.

But even for normal users, this exacerbates the overlap issue more than it should. I'll adjust a bit.

E.g.,

Screenshot 2024-06-28 at 12 57 52 PM

Copy link
Contributor

@abeglova abeglova left a comment

Choose a reason for hiding this comment

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

This works fantastic generally and looks great! Some small fixes are needed for smaller mobile screens.

Good point that the issue is mostly for just admins, not normal users

@ChristopherChudzicki
Copy link
Contributor Author

@abeglova I've tweaked the button positioning to account for button paddings. The cards should look good at 375px with one button, and may look good with 2 buttons depending on date length.

Screenshot 2024-06-28 at 2 37 18 PM Screenshot 2024-06-28 at 2 35 13 PM

Copy link
Contributor

@abeglova abeglova left a comment

Choose a reason for hiding this comment

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

lgtm

@ChristopherChudzicki
Copy link
Contributor Author

pre-commit.ci run

@ChristopherChudzicki
Copy link
Contributor Author

Since github says this is mergable, and pre-commit just says

timeout waiting for merge ref

I'm going to merge this.

@ChristopherChudzicki ChristopherChudzicki merged commit 859c808 into main Jun 28, 2024
@odlbot odlbot mentioned this pull request Jul 1, 2024
17 tasks
@odlbot odlbot mentioned this pull request Jul 1, 2024
19 tasks
@rhysyngsun rhysyngsun deleted the cc/filled-bookmark branch February 7, 2025 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review An open Pull Request that is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants