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 27825/add to sheet2 #2179

Open
wants to merge 56 commits into
base: feature/sc-27328/options-popover-component2
Choose a base branch
from

Conversation

stevekaplan123
Copy link
Contributor

Description

The feature this PR implements is that it attaches an "Add to Sheet" button to every segment of the sheet. The button is hidden, but when the user clicks on the segment, the "Add to Sheet" button appears. After the user clicks the "Add to Sheet" button, a modal appears allowing the user to select which of the user's sheets to add the segment to.

Code Changes

  1. I inherited 100 lines of code in Sheet.jsx (pre-modularization) that renders the sheet segments. At one point in this project, I moved them into their own function getSources(). However, in this PR, I needed to modify this function in order to render an "Add to Sheet" button inside each segment, and so I took the opportunity to re-factor getSources() so that it is now a 20 line function. I also moved the segment components from SheetContent.jsx to SheetContentSegments.jsx, although I simply copied and pasted and so git lost track of the relevant commits. I added a component AddToSheetButton in SheetContent.jsx that I pass down to each of the sheet segment components in SheetContentSegments.
  2. As the other modals (CopyModal, SaveModal, GoogleExportModal, etc.) are present in SheetOptions.jsx, I put the AddToSourceSheetModal in SheetOptions.jsx. This is questionable. Perhaps it should be in SheetContent.jsx as it is not triggered by the dropdown menu in SheetOptions.jsx. In any case, AddToSourceSheetModal simply wraps a previously existing component AddToSourceSheetBox with a Modal component. I had to slightly modify AddToSourceSheetBox to not show the google doc advertisement.

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