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

Add a modal screen for creating a new workspace #3547

Merged
merged 9 commits into from
Jun 14, 2021

Conversation

HorusGoul
Copy link
Contributor

@HorusGoul HorusGoul commented Jun 11, 2021

Details

Adds a new modal screen for creating workspaces (UI only this is not connected to the backend yet). Only accessible through the web with the path /workspace/new for now.

Fixed Issues

Fixes https://github.com/Expensify/Expensify/issues/166035

Tests

  1. Open E.cash and log in.
  2. Change the URL to http://localhost:8080/workspace/new
  3. Make sure everything looks like it should.

QA Steps

  1. Open E.cash and log in.
  2. Change the URL to https://staging.expensify.cash/workspace/new
  3. Make sure everything looks like it should.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

image

Mobile Web

image

Desktop

image

iOS

image

Android

image

@HorusGoul HorusGoul self-assigned this Jun 11, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Jun 11, 2021

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@HorusGoul
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@HorusGoul HorusGoul changed the title [WIP] Add a modal screen for creating a new workspace Add a modal screen for creating a new workspace Jun 11, 2021
@HorusGoul HorusGoul marked this pull request as ready for review June 11, 2021 16:30
@HorusGoul HorusGoul requested a review from a team as a code owner June 11, 2021 16:30
@MelvinBot MelvinBot requested review from mountiny and removed request for a team June 11, 2021 16:30
@HorusGoul HorusGoul requested a review from marcaaron June 11, 2021 16:30
marcaaron
marcaaron previously approved these changes Jun 11, 2021
Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

Looks really great, I don't have too many critiques (only NABs). Nice job! :)

/>
</>
)}
</AttachmentPicker>
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB, this might be a case where we can convert this pattern into a slightly more complex component. But we can perhaps wait until it is used a third time? Just something I thought about since we have mostly the same UI pattern used in the ProfilePage.js

}

NewWorkspacePage.propTypes = propTypes;
NewWorkspacePage.displayName = 'NewWorkspacePage';
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB, class components do not require this displayName

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True!

* @param {Function} openPicker
* @returns {Array}
*/
createMenuItems(openPicker) {
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB, these options really only need to be updated if the translation theme changes, but I don't think it's worth optimizing for so this function works for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left the function because we'll need it when we connect this with the backend, and we need to decide whether to show the Delete Image item or not based on the state.

}

render() {
const {translate} = this.props;
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB, IIRC we have some kind of specific advice on when to destructure something in the style guide. but generally prefer explicit use of this.props when there is a mix of props and state to avoid confusion about which things come from where. That said, t's quite easy to see what's happening here so I won't block.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@marcaaron
Copy link
Contributor

Oh yes just remembered something. Technically this should be behind a beta... so we'll need to block access for now.

Here's a strategy I used to achieve this that you can copy.

https://github.com/Expensify/Expensify.cash/blob/19ad75ea6b6905ce31f37b5e8251d98e23add5a1/src/pages/BusinessBankAccount/NewPage.js#L72-L76

mountiny
mountiny previously approved these changes Jun 12, 2021
Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

Great update! Works well in my browser. i will not merge it now as Marc has mentioned the beta access.

@HorusGoul HorusGoul dismissed stale reviews from mountiny and marcaaron via 5c1003f June 14, 2021 09:37
@HorusGoul
Copy link
Contributor Author

HorusGoul commented Jun 14, 2021

@marcaaron That works! However, I found this error caused by the Navigation.dismissModal(); call:

image

It's definitely related to that call being a side effect, and side effects inside the render function are illegal. We can solve that error by creating a utility component to dismiss modals in a declarative way, like this:

 if (!Permissions.canUseFreePlan(this.props.betas)) {
       console.debug('Not showing new bank account page because user is not on free plan beta');
       return <Navigation.DismissModal />;  
 } 

I went ahead and added the change to this PR in a separate commit. Let me know what you think.

Comment on lines +70 to +73
if (!Permissions.canUseFreePlan(this.props.betas)) {
console.debug('Not showing new workspace page because user is not on free plan beta');
return <Navigation.DismissModal />;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Good call! Let's then not forget to refactor the rest of the app to use this.

@marcaaron marcaaron merged commit bdf2144 into main Jun 14, 2021
@marcaaron marcaaron deleted the horus-modal-screen-new-workspace branch June 14, 2021 16:44
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

onSelected: () => {
openPicker({
onPicked: () => {
// TODO: connect with setWorkspaceAvatar function
Copy link
Contributor

Choose a reason for hiding this comment

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

@HorusGoul are you up for creating a follow up issue to track the changes we need to make to "complete" this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!

@OSBotify
Copy link
Contributor

🚀 Deployed to staging in version: 1.0.68-5🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@isagoico
Copy link

@HorusGoul I'm unable to access the link https://staging.expensify.cash/workspace/new (even with a expensifail account) is there any permissions needed to be able to see the page?

@HorusGoul
Copy link
Contributor Author

I can't access the page in staging either. @marcaaron, do we have enabled the free plan beta in staging/prod for our accounts?

image

@marcaaron
Copy link
Contributor

Hmm I don't think there is any difference between betas on staging vs. production. Something else might be happening here. I checked my localStorage in staging.expensify.cash and did not see the freePlan beta there

However, pn both production and staging I was able to see that the freePlan beta is available on my expensifail.com account.

Here's where that list is pulled from
https://github.com/Expensify/Web-Expensify/blob/03d5b177058f6c1343fec5eea9233a8411c8ca51/lib/BetaManager.php#L186-L204

@OSBotify
Copy link
Contributor

🚀 Deployed to production in version: 1.0.73-3🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

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.

5 participants