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

Share identities via link #775

Merged
merged 35 commits into from May 16, 2019
Merged

Share identities via link #775

merged 35 commits into from May 16, 2019

Conversation

AquiGorka
Copy link
Contributor

@AquiGorka AquiGorka commented May 9, 2019

Share local identities via link (and import them too 😄 )

Summary

  • When clicking on share the selected identities are "bundled" into a link (base64 encoded)
  • When the user opens up the link a new modal will show (when the wrapper instance exists and the labels have been parsed from the url)
  • The user can choose which items to save. This implementation will remove the user's existing local identities and override with the selected ones.

How to test

  1. Use the branch corresponding to this pull request git fetch && git checkout feature/share-identities
  2. Install the dependencies and start the server npm i && npm run
  3. Open http://localhost:3000/ in your browser and load an organization (rinkeby).

Pending

  • Animations
    • To show the Save modal
    • To hide the Save modal
    • To hide the Share modal when link has been copied (or not, decision needed)
    • To show the Preferences modal when saving (or maybe not, decision needed)
  • Loader when "saving" shared labels

@AquiGorka AquiGorka changed the base branch from master to feature/granular-export-labels May 9, 2019 13:44
@AquiGorka AquiGorka force-pushed the feature/share-identities branch 2 times, most recently from b17f2e6 to 93e8bc0 Compare May 10, 2019 08:52
@bpierre
Copy link
Contributor

bpierre commented May 10, 2019

@AquiGorka is it ready to be reviewed? Asking because of the “pending” list.

@AquiGorka
Copy link
Contributor Author

AquiGorka commented May 10, 2019

@bpierre after discussing with @dizzypaty about the animations (and how the Save labels modal is part of Preferences) I will make some big changes to this code (mostly on how and where to render) so the code that shares and imports will likely stay the same.
Having said all that, early reviews are always helpful.

@bpierre
Copy link
Contributor

bpierre commented May 10, 2019

@dizzypaty @AquiGorka I’m wondering if we shouldn’t make it more explicit that we are importing data coming from the outside on the importing screen? Maybe using the word “importing” instead of “saving”, or by displaying a warning message? Otherwise a click on the “save” button might seem like a non-risky action, if the user assumes the data displayed is theirs.

@AquiGorka
Copy link
Contributor Author

"Save external custom labels"?

@AquiGorka AquiGorka force-pushed the feature/share-identities branch 2 times, most recently from 20bce07 to c5eb87a Compare May 10, 2019 14:57
@AquiGorka
Copy link
Contributor Author

@bpierre changes done, ready for review ✅

@AquiGorka AquiGorka changed the base branch from feature/granular-export-labels to master May 13, 2019 09:30
@AquiGorka AquiGorka force-pushed the feature/share-identities branch 2 times, most recently from 8d8ff3d to 354dd62 Compare May 13, 2019 10:13
@sohkai sohkai mentioned this pull request May 13, 2019
20 tasks
@dizzypaty
Copy link

Loading screen when saving shared custom labels

LoadingRing component

WebApp-1366px - preferences-1@2x

WebApp-1366px - preferences-1@2x-1

@sohkai
Copy link
Contributor

sohkai commented May 15, 2019

@AquiGorka I've merged with master, noticed a few things:

  • The "Export" button is still clickable if no identities are selected, even though the cursor seems to indicate it's been deactivated
  • On importing, the "confirm removal" modal appears (this behaviour doesn't exist on master so might be due to some API differences during the merge)

Copy link
Contributor

@bpierre bpierre left a comment

Choose a reason for hiding this comment

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

Looking good! I only have one important issue with unicode characters. Also, shouldn’t we have the same importation screen when we import from a file?

src/components/Preferences/LocalIdentities.js Outdated Show resolved Hide resolved
const handleDownload = useCallback(() => {
useEffect(() => {
if (shareModalOpen) {
setTimeout(() => inputRef.current.focus(), 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

👌

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, got this gem from your code 😄

src/components/Preferences/LocalIdentities.js Outdated Show resolved Hide resolved
Copy link
Contributor

@sohkai sohkai left a comment

Choose a reason for hiding this comment

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

Looks good, confirmed the fixes :).

Left a number of clean up / API comments that we don't need to fix immediately for this release.

src/components/Preferences/LocalIdentities.js Show resolved Hide resolved
src/components/Preferences/LocalIdentities.js Outdated Show resolved Hide resolved
src/components/Preferences/Preferences.js Outdated Show resolved Hide resolved
src/components/Preferences/Preferences.js Show resolved Hide resolved
src/components/Preferences/SharedLabels.js Show resolved Hide resolved
src/components/Preferences/SharedLabels.js Show resolved Hide resolved
src/hooks.js Show resolved Hide resolved
src/hooks.js Show resolved Hide resolved
}
}, [])

return { isSharedLink, setIsSharedLink, sharedLabels, removeSharedLink }
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than directly exposing setIsSharedLink and removeSharedLink, it seems like we could roll them into a single API?

And could we detect isSharedLink from a non-null sharedLabels?

],
[selected]
)
return { selected, setSelected, allSelected, someSelected }
Copy link
Contributor

@sohkai sohkai May 15, 2019

Choose a reason for hiding this comment

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

This also feels like we could include some of the toggling functionality (for toggling all and individual ids) to avoid repeating it.

Should we also use this directly in SelectableLocalIdentity?

Copy link
Contributor

@sohkai sohkai left a comment

Choose a reason for hiding this comment

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

Functionality all looks good to me, great job @AquiGorka! Let's work on the other review comments after this has been merged :).

AquiGorka and others added 3 commits May 16, 2019 09:34
Co-Authored-By: Brett Sun <qisheng.brett.sun@gmail.com>
Co-Authored-By: Brett Sun <qisheng.brett.sun@gmail.com>
@AquiGorka AquiGorka merged commit c7f2623 into master May 16, 2019
@AquiGorka AquiGorka deleted the feature/share-identities branch May 16, 2019 09:03
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.

None yet

4 participants