Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Conversation

@mxstbr
Copy link
Contributor

@mxstbr mxstbr commented Feb 11, 2019

Status

  • WIP
  • Ready for review
  • Needs testing

Deploy after merge (delete what needn't be deployed)

  • hyperion (frontend)

Related issues (delete if you don't know of any)
Closes #4611

Adds ability to import JSON file with emails of users to be invited to community. Demo (note that UI is not polished, only the functionality):

spectrum-import-users-emails

Click to see test files
  • users-emails.json:

    ["hi@bryn.io", "hi@brianlovin.com", "hi@mxstbr.com"]
  • users-with-names.json:

    [
      { "email": "arnold@schwarzenegger.at", "name": "Arnold" },
      { "email": "elon@musk.com", "name": "Elon" },
      { "email": "notanemail", "name": "Wrong" }
    ]

Todo

  • Show error when file import fails with parse error
  • Button styling
  • Add help text somewhere explaining the supported data shape

@mxstbr
Copy link
Contributor Author

mxstbr commented Feb 11, 2019

Added error handling (note the selected file names):

screen shot 2019-02-11 at 11 35 56
screen shot 2019-02-11 at 11 36 43

@mxstbr
Copy link
Contributor Author

mxstbr commented Feb 11, 2019

@brianlovin any ideas where best to put the help text about the supported file type and format? Do we have an existing pattern for that?

@spectrum-bot
Copy link

spectrum-bot bot commented Feb 11, 2019

Warnings
⚠️

These modified files do not have Flow enabled:

  • src/components/emailInvitationForm/style.js
  • src/components/mediaInput/index.js

Generated by 🚫 dangerJS

@brianlovin
Copy link
Contributor

@brianlovin any ideas where best to put the help text about the supported file type and format? Do we have an existing pattern for that?

We don't have an existing pattern for this. Maybe it could look like this instead:

screenshot 2019-02-11 17 43 49

I don't think we need to describe the optional method of uploading an array of objects; if people find that error message, they can do it, but ideally they just upload the array of emails. What do you think?

@mxstbr
Copy link
Contributor Author

mxstbr commented Feb 12, 2019

Looks good to me, will clean this up!

@mxstbr
Copy link
Contributor Author

mxstbr commented Feb 12, 2019

Updated based on your suggestions, ready for another review @brianlovin!

screen shot 2019-02-12 at 11 37 53

@brianlovin
Copy link
Contributor

@mxstbr check 9e9e31a for some logic changes:

  • removes duplicates in the uploaded .json file; also de-duplicates from the existing state.contacts
  • clears the input value after an upload is processed - this allows a person to upload the same file again if they messed up (eg upload, delete a couple email rows, re-upload)

You can see this in action better by uploading

[
  "hi@bryn.io",
  "hi@brianlovin.com",
  "hi@mxstbr.com",
  "hi@bryn.io",
  "hi@brianlovin.com",
  "hi@mxstbr.com",
  "hi@bryn.io",
  "hi@brianlovin.com",
  "hi@mxstbr.com",
  "bad.email",
  "shouldnt@work.com"
]

Then in the frontend, try typing one of the existing emails (like hi@brianlovin.com), then upload the file. Duplicates will be removed, and you should see bad.email highlighted with a red border.

Copy link
Contributor Author

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

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

Super nice, let's ship it!

@brianlovin
Copy link
Contributor

Once tests pass I'll merge :)

brianlovin
brianlovin previously approved these changes Feb 12, 2019
@brianlovin brianlovin merged commit 5e0a2fa into alpha Feb 13, 2019
@brianlovin brianlovin deleted the import-user-emails branch February 13, 2019 03:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants