Skip to content

feat(project): add new type of lists (recommendations) #556

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

Merged
merged 14 commits into from
Jun 24, 2024

Conversation

AntonLantukh
Copy link
Collaborator

@AntonLantukh AntonLantukh commented Jun 13, 2024

Description

  1. Add new "content_list" type support (recommendations).
  2. Support it for Landing Page and Menu.

Steps completed:

According to our definition of done, I have completed the following steps:

  • Acceptance criteria met
  • Unit tests added
  • Docs updated (including config and env variables)
  • Translations added
  • UX tested
  • Browsers / platforms tested
  • Rebased & ready to merge without conflicts
  • Reviewed own code

Copy link

github-actions bot commented Jun 13, 2024

Visit the preview URL for this PR (updated for commit ddeeb74):

https://ottwebapp--pr556-feat-add-content-lis-xm1980a1.web.app

(expires Wed, 24 Jul 2024 07:42:20 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: c198f8a3a199ba8747819f7f1e45cf602b777529

@AntonLantukh AntonLantukh force-pushed the feat/add-content-lists branch from 36c8ea9 to 03b0af8 Compare June 18, 2024 19:22
@AntonLantukh AntonLantukh marked this pull request as ready for review June 18, 2024 19:53
@AntonLantukh AntonLantukh requested a review from budzworthy as a code owner June 18, 2024 19:53
@AntonLantukh
Copy link
Collaborator Author

App Config for testing: 0i9cflkq

Copy link
Collaborator

@ChristiaanScheermeijer ChristiaanScheermeijer left a comment

Choose a reason for hiding this comment

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

The PR overall looks good, but I do have some questions:

  • Do you have content list IDs to test with? You just added it 😄
  • Do we need to add e2e testing for this?
  • Do we really need an abstraction for the content and playlist APIs or could it just be two separate services?
    • This could prevent some breaking changes in the usePlaylist hook for example
  • Should we use different names for the service/controller/types?
    • Content list can be confused with contentTypes
    • RecommendationsService sounds like it's used for different purposes
    • I suggest renaming it to PlaylistController, PlaylistService, PlaylistContentService and PLAYLIST_TYPE removing the content analogy from most most places

@AntonLantukh
Copy link
Collaborator Author

@ChristiaanScheermeijer

Do we need to add e2e testing for this?

We do need. I will add it to the Q3 plan.

Do we really need an abstraction for the content and playlist APIs or could it just be two separate services?
This could prevent some breaking changes in the usePlaylist hook for example.

Do you mean having two hooks "usePlaylist" and "usePlaylistContent" which could be called conditionally + removing the controller completely? We still need to know the type to make a decision, so there will be also a "parent" hook receiving it as an argument.

Should we use different names for the service/controller/types?

I agree naming is a problem. My idea was to consume playlists, content lists (recommendations), series using controller in the future. That is why I used "ContentController" name. We also have some plans to deliever an additional "media" endpoint returning data based on the content type (maybe series, stream data inside). Though it can be also overengineering to consider this case in advance and to avoid braking changes we could start with conditional calls.

Copy link
Contributor

@budzworthy budzworthy left a comment

Choose a reason for hiding this comment

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

I'm still going through some parts, but I think we can keep this change simpler without adding the content service abstractions. If we add the new content list endpoint to the existing Api Service, we can do switching at the hook or controller level to get playlists or content lists as needed.

@AntonLantukh AntonLantukh force-pushed the feat/add-content-lists branch from da89a6e to 8dc9523 Compare June 19, 2024 11:20
@AntonLantukh AntonLantukh force-pushed the feat/add-content-lists branch from 8dc9523 to f75a8f4 Compare June 19, 2024 11:22
@AntonLantukh
Copy link
Collaborator Author

@ChristiaanScheermeijer @dbudzins simplified approach without abstraction layer.

@AntonLantukh AntonLantukh force-pushed the feat/add-content-lists branch from 353e007 to 289fb21 Compare June 20, 2024 09:18
@AntonLantukh AntonLantukh force-pushed the feat/add-content-lists branch from 289fb21 to 1f52905 Compare June 20, 2024 09:26
@AntonLantukh
Copy link
Collaborator Author

@ChristiaanScheermeijer @dbudzins

  1. Switched to a separate endpoint for content lists.
  2. Reused PlaylistScreen for content lists.
  3. Changed interface of usePlaylist and added optional params (was needed in one place).
  4. Separated query options into a separate function to reuse in usePlaylists / usePlaylist

Copy link
Collaborator

@ChristiaanScheermeijer ChristiaanScheermeijer left a comment

Choose a reason for hiding this comment

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

Perfect @AntonLantukh! This looks good to me.

Only the playlistURL method has changed, but that's only used once in our platforms 😄

@AntonLantukh
Copy link
Collaborator Author

@ChristiaanScheermeijer rolled back playlistURL to the previous interface.

Comment on lines +72 to +77
const queryClient = useQueryClient();
const siteId = useConfigStore((state) => state.config.siteId);

const queryOptions = getPlaylistQueryOptions({ type, contentId, siteId, params, queryClient, enabled, usePlaceholderData });

return useQuery<Playlist | undefined, ApiError>(queryOptions);
Copy link
Contributor

@budzworthy budzworthy Jun 21, 2024

Choose a reason for hiding this comment

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

You've gotta add usePlacehoderData and params inputs to usePlaylists, but then you avoid the getQueryOptions construct, which is a bit non-standard I think.

(We can do this later. I know you want to get the changes out, and the double playlist hooks wasn't added from this PR)

Suggested change
const queryClient = useQueryClient();
const siteId = useConfigStore((state) => state.config.siteId);
const queryOptions = getPlaylistQueryOptions({ type, contentId, siteId, params, queryClient, enabled, usePlaceholderData });
return useQuery<Playlist | undefined, ApiError>(queryOptions);
return usePlaylists([{contentId, type}], enabled ? 1 : 0, usePlaceholderData, params)[0];

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't want to do it because of the different use case we have here. usePlaylists is intended to work with a list of shelves on the Landing Page. So it also covers the cases of Favorites and Continue Watching, while usePlaylist only supports content_list and playlist types which makes the purpose a bit different.

Copy link
Contributor

@budzworthy budzworthy left a comment

Choose a reason for hiding this comment

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

2 small comments. The one about the Routes and PlaylistScreenRouter component, I'd strongly suggest doing, but I'll approve as-is, because I know you're pressed for time.

Copy link
Contributor

@budzworthy budzworthy left a comment

Choose a reason for hiding this comment

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

lgtm

@AntonLantukh AntonLantukh merged commit 790932b into develop Jun 24, 2024
10 checks passed
@AntonLantukh AntonLantukh deleted the feat/add-content-lists branch June 24, 2024 10:39
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