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

Feature/sc 27328/options popover component2 #2172

Open
wants to merge 85 commits into
base: feature/sc-27327/source-click-should-open-in-new-tab2
Choose a base branch
from

Conversation

stevekaplan123
Copy link
Contributor

Description

The 'options popover component' is a menu providing sheet viewers with the ability to save/remove the sheet (saved texts and sheets can be seen at /texts/saved), make a copy of the sheet, export the sheet to google docs, add the sheet to a collection, or share the sheet. Most of this functionality used to exist in AboutSheet.jsx which would show in the Connections Panel. It is now possible to open a dropdown menu and choose one of these options from the main panel of the sheets viewer. Depending on what option was chosen, the user is then shown a modal either showing the status of the action chosen or allowing the user to choose what to do next. For example, if the user copies the sheet, they will see a modal that says "Copying..." and once copied, will show a link to the copied sheet. Exporting to google docs and saving the sheet is similar and show the status of the exported/saved sheet. On the other hand, for adding to a collection, the user is presented with a modal allowing them to choose what collection(s) to add the sheet to, and allowing them to create a new collection. Likewise, for sharing the sheet, the user is presented with a modal allowing them to choose different ways of sharing the sheet (through different social media).

Code Changes

The core of the code for this set of features is in SheetOptions.jsx, which has two stages: (1) First, the user clicks on an ellipse to show a DropdownMenu with all of the options listed above. (2) Second, a modal appears showing the status of the action chosen or a menu, making heavy usage of a few new generic components, such as Modal and GenericSheetModal. The Modal I placed in the /common directory while the GenericSheetModal I implemented in SheetOptions. I had to make a few relatively minor changes to DropdownMenu to be able to pass down callback functions, for example. I also modified the generic sefaria.js apiRequestWithBody so that I could handle the errors directly instead of apiRequestWithBody handling the errors for me. This was necessary to implement Google Export as the API generates a 401 authentication error if the user hasn't setup their gauth credentials with Sefaria.

…nto feature/sc-27328/options-popover-component
…nto feature/sc-27328/options-popover-component
…nto feature/sc-27328/options-popover-component
…nto feature/sc-27328/options-popover-component
…nto feature/sc-27328/options-popover-component
…nto feature/sc-27328/options-popover-component
…into feature/sc-27328/options-popover-component2
…into feature/sc-27328/options-popover-component2
…into feature/sc-27328/options-popover-component2
…into feature/sc-27328/options-popover-component2
…into feature/sc-27328/options-popover-component2
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.

1 participant