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

Copy notebook exports via nb header #31

Open
wants to merge 7 commits into
base: next
Choose a base branch
from

Conversation

RickGove
Copy link

@RickGove RickGove commented Aug 4, 2021

Same as already approved PR, but much better functionality and looks

@RickGove RickGove changed the base branch from dev to next August 4, 2021 09:30
@@ -57,6 +58,9 @@ export const NotebookHeader = (props) => {
const [state, actions] = useNotebook()
const [documentMenuVisible, setDocumentMenuVisible] = useState()

let exports = []
Copy link
Owner

Choose a reason for hiding this comment

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

what's the exports purpose?

Copy link
Author

@RickGove RickGove Aug 16, 2021

Choose a reason for hiding this comment

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

Okay, so it has to be declared as an array, so that the exports can be iterated over. I will change it up though

@@ -291,6 +297,57 @@ export const NotebookHeader = (props) => {
// { hasMain, notebook, userProfile, notebookId, isOwner }
// )

const fallbackCopyTextToClipboard = (text) => {
Copy link
Owner

Choose a reason for hiding this comment

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

I'd extract this entire logic into a separate function or a custom hook - and i'd also check if there's a copy-to-clipboard package to use instead of hand-crafting it

}

const initCopy = () => {
let exportsAsString = ''
Copy link
Owner

Choose a reason for hiding this comment

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

I'd prepare the string in advanced so it can be shown to the user - this can be a large blob of text on some occasions and not necessarily what the user expects.

- Added a modal where you can choose which exports
- Now only shows # of exports
- Copy is using an NPM package
@RickGove RickGove requested a review from elis August 16, 2021 11:20
@RickGove RickGove requested a review from elis August 16, 2021 12:44
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.

2 participants