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

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.

…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
@yitzhakc yitzhakc requested a review from saengel January 6, 2025 07:50
Copy link
Contributor

@saengel saengel left a comment

Choose a reason for hiding this comment

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

Overall looks great, and everything worked wonderfully locally!

Most of the comments are very very very minor and nitpicky comments about spacing to improve code readability. It could very well be we have different conventions, in which case feel free to ignore!

One thing that goes beyond that though is just a question about the default lorem ipsum text passed into DropdownMenuItemWithIcon. I'm wondering if we should reverse the logic of that / discuss more together, otherwise it could interfere with some pre-existing implementations.

static/css/s2.css Show resolved Hide resolved
static/js/Misc.jsx Outdated Show resolved Hide resolved
static/js/common/DropdownMenu.jsx Outdated Show resolved Hide resolved
static/js/common/DropdownMenu.jsx Outdated Show resolved Hide resolved
static/js/common/DropdownMenu.jsx Outdated Show resolved Hide resolved
static/js/sheets/SheetOptions.jsx Show resolved Hide resolved
static/js/sheets/SheetOptions.jsx Show resolved Hide resolved
static/js/sheets/SheetOptions.jsx Show resolved Hide resolved
static/js/sheets/SheetOptions.jsx Outdated Show resolved Hide resolved
static/js/sheets/SheetOptions.jsx Outdated Show resolved Hide resolved
@stevekaplan123 stevekaplan123 merged commit 3ecaca0 into feature/sc-27327/source-click-should-open-in-new-tab2 Jan 13, 2025
14 of 16 checks passed
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