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

feat: library home page bare bones (TEMP) #37

Conversation

rpenido
Copy link
Member

@rpenido rpenido commented May 31, 2024

Description

This PR adds a "Bare Bones" version of the Library Home and updates the SearchResult component to redirect to this new page.

image

image

More Info

Testing Instructions

  • Run your local stack on this branch
  • Make sure you have the studio.library_authoring_mfe waffle flag DISABLED
  • Go to the Studio Home and check the "Libraries" tab
  • Click on one library with components
  • Check if the component count is shown in the last card and the "Components" tab
  • Use the keyword search box and check if the component count is filtered accordingly
  • Navigate through the Home, Components and Collections tab and check if you can navigate back using the "Back" button from the brownser
  • Go back to the Studio Home and open a library WITHOUT components
  • You should see a message with a button that will allow the user to add new components (not implemented yet)
  • Go back to the Studio Home and open the search modal
  • Find a library v2 component and click on it. It should redirect to the new Library Home.

Private ref: FAL-3753

When lib mode is set to "mixed", both "Libraries" and "Legacy Libraries" tabs are show in the Studio Home. When "Libraries" is clicked, v2 libraries are fetched, when "Legacy Libraries" is clicked, v1 libraries are fetched.

When lib mode is set to "v1 only" or "v2 only", only one tab "Libraries" is show and only the respective libraries are fetched when the tab is clicked.
This is to switch between different library modes.
The path updates when selecting tabs, when accessing the url with the path directly it will open its respective tab. Navigating using the browser back/forward buttons is also supported.
@yusuf-musleh yusuf-musleh force-pushed the yusuf-musleh/lib-v2-tab-studio-home branch from 049e490 to 9c6e1e6 Compare June 3, 2024 12:45
This commit is temporary as the current frontend build system in tests doesnt support TS syntax. That should be fixed soon, and this commit should be removed.
This is a temporary commit since there are currently no webpack loaders that support tsx files in the test running. This commit should be removed once that is fixed upstream.
@rpenido rpenido force-pushed the rpenido/fal-3753-library-home-page-bare-bones branch 3 times, most recently from b698d89 to 4391778 Compare June 4, 2024 01:15
@yusuf-musleh yusuf-musleh force-pushed the yusuf-musleh/lib-v2-tab-studio-home branch from 975b8db to 8b96268 Compare June 4, 2024 12:54
@rpenido rpenido force-pushed the rpenido/fal-3753-library-home-page-bare-bones branch from 4391778 to f8db853 Compare June 4, 2024 17:56
@rpenido rpenido marked this pull request as draft June 5, 2024 13:08
Copy link

@yusuf-musleh yusuf-musleh left a comment

Choose a reason for hiding this comment

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

@rpenido Great work on this! Overall it works pretty well, just found a things that need to be fixed and some small nits.

src/index.jsx Outdated
Comment on lines 57 to 59
<Route path="/legacy-libraries" element={<StudioHome />} />
<Route path="/library/:libraryId" element={<LibraryV2Placeholder />} />
<Route path="/library/:libraryId/*" element={<LibraryAuthoringPage />} />
<Route path="/course/:courseId/*" element={<CourseAuthoringRoutes />} />

Choose a reason for hiding this comment

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

If you click on the "Create Library" button when the studio.library_authoring_mfe flag is disabled, it navigates to the http://apps.local.edly.io:2001/course-authoring/library/create (which renders the placeholder page as a temporary thing I added in my PR), however that's broken because it assumes create is a libraryKey and the backend errors out.

Not sure where it should redirect to, maybe a new placeholder "create" page?

Copy link
Member Author

Choose a reason for hiding this comment

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

I created a placeholder for the New Library page (a24b3ba)
Also, I didn't find a task to create this form in the course authoring. CC @ChrisChV

Copy link
Member

Choose a reason for hiding this comment

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

@rpenido Yes, there is no such screen in the mockups. @bradenmacdonald I guess that's included in another epic?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, we missed that. I'll create a story for it. For now, just use the placeholder.

Copy link
Member

Choose a reason for hiding this comment

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

Here is the story for it: openedx#1077

Comment on lines 12 to 13
<div>You have not added any content to this library yet.</div>
<Button iconBefore={Add}>Add Content</Button>

Choose a reason for hiding this comment

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

nit: The text here in both the div and button is missing internationalization.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for catching that! Fixed: 4deaea9

return (
<Stack gap={3}>
<Section title="Recently Modified">
Recently modified components and collections will be displayed here.

Choose a reason for hiding this comment

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

nit: Similarly here, internationalize text.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed: 4deaea9

Comment on lines 149 to 151
if (libraryAuthoringMfeUrl) {
return `${libraryAuthoringMfeUrl}${urlSuffix}`;
}

Choose a reason for hiding this comment

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

When clicking on the search result it still redirects to the library authoring mfe when the flag is disabled. I think it missing && redirectToLibraryAuthoringMfe in the check.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed: c2bdecf

When lib mode is set to "mixed", both "Libraries" and "Legacy Libraries" tabs are show in the Studio Home. When "Libraries" is clicked, v2 libraries are fetched, when "Legacy Libraries" is clicked, v1 libraries are fetched.

When lib mode is set to "v1 only" or "v2 only", only one tab "Libraries" is show and only the respective libraries are fetched when the tab is clicked.
This is to switch between different library modes.
The path updates when selecting tabs, when accessing the url with the path directly it will open its respective tab. Navigating using the browser back/forward buttons is also supported.
This commit is temporary as the current frontend build system in tests doesnt support TS syntax. That should be fixed soon, and this commit should be removed.
This is a temporary commit since there are currently no webpack loaders that support tsx files in the test running. This commit should be removed once that is fixed upstream.
@rpenido rpenido force-pushed the rpenido/fal-3753-library-home-page-bare-bones branch 4 times, most recently from 3af4eef to 8ef4e0c Compare June 7, 2024 18:48
@rpenido rpenido force-pushed the rpenido/fal-3753-library-home-page-bare-bones branch from 8ef4e0c to 72edfac Compare June 7, 2024 18:59
Copy link

@yusuf-musleh yusuf-musleh left a comment

Choose a reason for hiding this comment

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

@rpenido Great work here! Thanks for addressing the issues, things are working well!

Left a few final nits/comments.

src/library-authoring/LibraryAuthoringPage.jsx Outdated Show resolved Hide resolved
index_name: 'studio',
api_key: 'test-key',
});
//

Choose a reason for hiding this comment

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

nit: extra blank comment

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed: 388c40e

Choose a reason for hiding this comment

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

Seems like this file slipped thought and got pushed accidentally.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed: 388c40e

Comment on lines 95 to 100
<SearchField
value={searchKeywords}
placeholder={intl.formatMessage(messages.searchPlaceholder)}
onChange={(value) => setSearchKeywords(value)}
className="w-50"
/>

Choose a reason for hiding this comment

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

The onSubmit still needs to be defined here, as if you press "Enter" it causes an error onSubmit is not a function. We can pass in a no-op function () => {} since the search is already performed onChange so it doesn't fire again.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! Fixed: 388c40e

Copy link

codecov bot commented Jun 19, 2024

Codecov Report

Attention: Patch coverage is 95.75758% with 7 lines in your changes missing coverage. Please review.

Please upload report for BASE (yusuf-musleh/lib-v2-tab-studio-home@e2ed3bc). Learn more about missing BASE report.

Current head 942cbff differs from pull request most recent head 94f483b

Please upload reports for the commit 94f483b to get more accurate results.

Files Patch % Lines
...tudio-home/tabs-section/libraries-v2-tab/index.jsx 80.95% 3 Missing and 1 partial ⚠️
src/header/Header.jsx 80.00% 1 Missing ⚠️
src/library-authoring/LibraryAuthoringPage.jsx 96.29% 1 Missing ⚠️
src/studio-home/tabs-section/index.jsx 96.42% 1 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                           @@
##             yusuf-musleh/lib-v2-tab-studio-home      #37   +/-   ##
======================================================================
  Coverage                                       ?   92.49%           
======================================================================
  Files                                          ?      718           
  Lines                                          ?    12745           
  Branches                                       ?     2809           
======================================================================
  Hits                                           ?    11789           
  Misses                                         ?      918           
  Partials                                       ?       38           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yusuf-musleh yusuf-musleh force-pushed the yusuf-musleh/lib-v2-tab-studio-home branch from 2e3fa43 to 09e3979 Compare June 19, 2024 14:42
@rpenido rpenido force-pushed the rpenido/fal-3753-library-home-page-bare-bones branch from 9ca7038 to 18a8482 Compare June 20, 2024 02:21
@rpenido rpenido force-pushed the rpenido/fal-3753-library-home-page-bare-bones branch from 18a8482 to 2d3be09 Compare June 20, 2024 02:22
rpenido and others added 5 commits June 19, 2024 23:29
This PR adds a new configuration flag that shows/hides tabs in studio home along with some new functionality around to V1 and V2 Libraries.

When the new LIBRARY_MODE flag is set to "mixed" (default in dev) it will show "Libraries" and "Legacy Libraries" tabs that correspond to v1 and v2 tabs respectively.

When the new LIBRARY_MODE flag is set to "v1 only" (default in production) or "v2 only", only one tab "Libraries" is shown and only the respective libraries are fetched when the tab is clicked.

In addition to the above changes, the URL/route now updates when clicking on the tabs, and navigating to it directly would open up that tab as well as a new placeholder page that you will be redirected to when clicking on a v2 library if the library authoring MFE is not enabled.
@rpenido
Copy link
Member Author

rpenido commented Jun 20, 2024

Closed in favor of: openedx#1076

@rpenido rpenido closed this Jun 20, 2024
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.

4 participants