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: create library form (TEMP) #42

Conversation

rpenido
Copy link
Member

@rpenido rpenido commented Jun 20, 2024

Description

This PR adds a Create Library form to course-authoring.

image

More Info

Testing Instructions

  • Run your local stack on this branch for course authoring and feat: Create content in library permission added to API response openedx/edx-platform#34934 for edx-platform
  • Make sure you have the studio.library_authoring_mfe waffle flag DISABLED
  • Go to the Studio Home and go to the "Libraries" tab
  • Click on the "+ New library" button
  • You should be redirected to the new library form
  • Fill the fields trying some invalid data to check validation
  • Fill the fields correctly and hit "Create".
  • A new library should be created, and you should be redirected to its Home
  • Go back to Studio Home and create a new library using the same data (to force a duplicate ID)
  • You should see an error message after submitting

Private ref: FAL-3768

yusuf-musleh and others added 30 commits June 3, 2024 15:44
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.
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 from ca33c18 to 6acee0a Compare July 3, 2024 14:27
renovate bot and others added 5 commits July 8, 2024 06:49
* fix(deps): update dependency @openedx/paragon to v22.6.1

* fix: lint errors from stricter types in new paragon version

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
const intl = useIntl();
const navigate = useNavigate();

const [apiError, setApiError] = useState<React.ReactNode>();
Copy link
Member

Choose a reason for hiding this comment

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

You don't need to create your own apiError state. When you call useCreateLibraryV2() below, it returns an error and isError state variables that you can use. It also returns an isLoading which you can use to disable the UI and display a spinner while the API call happens. See https://tanstack.com/query/v4/docs/framework/react/reference/useMutation

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 @bradenmacdonald!
Didn't think this way the first time. I liked it: 9a23204

src/library-authoring/create-library/data/api.ts Outdated Show resolved Hide resolved
@rpenido rpenido force-pushed the rpenido/fal-3768-create-new-library-form branch from 4d9da7f to 63e7593 Compare July 9, 2024 14:16
@rpenido
Copy link
Member Author

rpenido commented Jul 10, 2024

Closed in favor of openedx#1116

@rpenido rpenido closed this Jul 10, 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.

6 participants