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

Added workspace Settings Modal #3602

Merged
merged 28 commits into from
Jun 24, 2021
Merged

Conversation

parasharrajat
Copy link
Member

@parasharrajat parasharrajat commented Jun 15, 2021

@marcaaron @roryabraham Please review. I believe needs improvements.

Details

Fixed Issues

Fixes #3566

Tests

QA Steps

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Overall design

workspace.mp4

When user is on Private Domain

image

When user Is on public Domain

image

When the user has card Enabled

image

Final Web | Desktop

workspace-w.mp4

Mobile Web

workspace-m.mp4

iOS

Android

workspace-a.mp4

@parasharrajat parasharrajat requested a review from a team as a code owner June 15, 2021 23:34
@parasharrajat parasharrajat changed the title Added workspace Settings Modal [WIP] Added workspace Settings Modal Jun 15, 2021
@MelvinBot MelvinBot requested review from Beamanator and removed request for a team June 15, 2021 23:34
@shawnborton
Copy link
Contributor

I know this is a WIP but going to start leaving some design feedback here so you have it. If you take a look at the original mockups, I think the goal is to have the workspace appear as a modal on wide screens - similar to how viewing an attachment looks. On smaller screens, we basically just repeat the same navigation pattern as the chat portion of the app where we have a menu (the left list of chats) where you can navigate to a specific page (aka a chat).

There's a couple of other small tweaks I am noticing - the background color on the right side should be white, there should be a small border between the left and the right pane (on desktop), and the "Borton Enterprises" area should basically reuse the exact styling when you view your own profile and see an avatar + name underneath.

Also cc @michelle-thompson to follow along for this one too.

@parasharrajat
Copy link
Member Author

I am not sure what would be the Mobile behavior for this. But I have used back type for the drawer which behaves like stack and Workspace Card page slides from right above the drawer.

Q: Please let me know what would be mobile look and behavior of this?

The page will connect to ONYXKEYS.USER and look at the isOnPublicDomain property

Here the property is wrong but I improvised.

So we have three different conditions.

  1. If the user is on a public domain, the “Get Started” button will be hidden and some alternate copy will be shown.
  2. If the user is on a non-public domain, and the domain is already provisioned for the expensify card, then this will display a link for configuring cards that will link to OldDot. (expensify.com.dev/domain_companycards)
  3. In all other cases (if they have no Verified Business Account ["VBA"], or if they have any number of VBAs), this will display a button that says “Get Started”. The button will navigate the user to http://.../bankAccount/new.

Questions:

  1. Where will we show the link? what would be the link text? What will happen to Get Started Button? Color of the Link? Will it be underlined? This (expensify.com.dev/domain_companycards) domain does not lead anywhere?
  2. How to check if the user has no Verified Business Account or they have any number of VBAs ?

@parasharrajat
Copy link
Member Author

Thanks, @shawnborton I was about to tag you. Please look at the above questions.

src/languages/en.js Outdated Show resolved Hide resolved
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 like a really great start to me overall. I left mostly small comments and non blockers but there are a few requests. 🚀

src/ROUTES.js Outdated Show resolved Hide resolved
src/languages/en.js Outdated Show resolved Hide resolved
src/libs/Navigation/AppNavigator/AuthScreens.js Outdated Show resolved Hide resolved
src/libs/Navigation/linkingConfig.js Outdated Show resolved Hide resolved
src/pages/workspace/WorkspaceCard.js Outdated Show resolved Hide resolved
src/pages/workspace/WorkspaceCard.js Outdated Show resolved Hide resolved
src/styles/styles.js Outdated Show resolved Hide resolved
@parasharrajat
Copy link
Member Author

Please help me with these questions @marcaaron. #3602 (comment)

@marcaaron
Copy link
Contributor

I am not sure what would be the Mobile behavior for this. But I have used back type for the drawer which behaves like stack and Workspace Card page slides from right above the drawer. Q: Please let me know what would be mobile look and behavior of this?

This behavior makes sense to me, but perhaps @shawnborton has another idea. My feeling is that we can start with this and switch it up later, but probably design has a better idea than me of what would be best.

Where will we show the link? what would be the link text? What will happen to Get Started Button? Color of the Link? Will it be underlined?

I'll let @shawnborton take those.

This (expensify.com.dev/domain_companycards) domain does not lead anywhere?

This should be https://expensify.com/domain_companycards and not have the .dev (which is for local use)

How to check if the user has no Verified Business Account or they have any number of VBAs ?

I think the language here is perhaps confusing and there is no need to check whether they have "no VBA" or "any number of VBAs" since that would cover all possible scenarios 😅

So, I think the relevant information we need is just:

  1. Is the user on a public domain
  2. Is that domain already configured to use the Expensify card

cc @MitchExpensify @kevinksullivan to make sure that last assumption is correct

@shawnborton
Copy link
Contributor

I am not sure what would be the Mobile behavior for this. But I have used back type for the drawer which behaves like stack and Workspace Card page slides from right above the drawer. Q: Please let me know what would be mobile look and behavior of this?

I think it would behave just like navigating to a chat from the home screen.

Where will we show the link? what would be the link text? What will happen to Get Started Button? Color of the Link? Will it be underlined?

Apologies as I am not following here - what is the link that you referencing?

@kevinksullivan
Copy link
Contributor

kevinksullivan commented Jun 16, 2021

So, I think the relevant information we need is just:

Is the user on a public domain
Is that domain already configured to use the Expensify card

@marcaaron this is correct, so we do not have to check whether a VBA exists or not. Just if the user is on a public domain and if not, whether that domain has an enabled expensify card already.

Public domain

Non-Public Domain, Expensify Card already enabled

image

Non-Public Domain, Expensify Card not enabled

Where will we show the link? what would be the link text? What will happen to Get Started Button? Color of the Link? Will it be underlined? This (expensify.com.dev/domain_companycards) domain does not lead anywhere?

How to check if the user has no Verified Business Account or they have any number of VBAs ?

@parasharrajat
Copy link
Member Author

@roryabraham How to check if domain is already provisioned for the expensify card or Expensify Card already enabled ?

@parasharrajat
Copy link
Member Author

@roryabraham
Lols. I am thrilled. How can I guess the exactly correct key without even looking at the data or knowing context. I used isCardEnabled which is correct. I can also say that you chose this variable name 🕵️

@parasharrajat parasharrajat requested a review from marcaaron June 16, 2021 22:03
@parasharrajat
Copy link
Member Author

@shawnborton I checked the profile page Avatar size and font size for the name but that seems smaller in comparison to the mockups here. Their font size is 17 and the avatar size is 80x80. What are the values here?

@parasharrajat
Copy link
Member Author

@marcaaron I assume that the Close button on both sidebar and Card page should close the whole workspace Modal and the back arrow should just shift back in history. I have used HeaderWithbackbutton Component and it does not seem to work well. The back arrow and close button on the sidebar do not do anyting and the Close button on Arrow sometimes closes the modal and sometimes takes us back to the Report Page. I would like to ask what should I do here.

I am thinking custom handler for the card page back button to OpenDrawer. Not sure about the dismissModal.

@marcaaron
Copy link
Contributor

I assume that the Close button on both sidebar and Card page should close the whole workspace Modal

That's correct.

and the back arrow should just shift back in history

No, I don't think it would change the history. We will want to just open the drawer for the new drawer navigator. You can take a look at how we handle this for the ReportView + sidebar here e.g.

https://github.com/Expensify/Expensify.cash/blob/2c831b06e70b19a932165921416741d8b5561d56/src/pages/home/ReportScreen.js#L90-L93
https://github.com/Expensify/Expensify.cash/blob/2c831b06e70b19a932165921416741d8b5561d56/src/libs/Navigation/Navigation.js#L46-L56

But let me know if this doesn't work and I can help figure out alternatives.

@parasharrajat
Copy link
Member Author

parasharrajat commented Jun 23, 2021

#3602 (comment)

@shawnborton Any input? Thanks.

@parasharrajat
Copy link
Member Author

parasharrajat commented Jun 23, 2021

@marcaaron
So I tried navigation options. But I am not able to figure out how to navigate back to the main drawer. If I call dismissModal on the Close button on Sidebar. It does not do anything. It keeps me in the WorkspaceSidebar. These nested navigators are very confusing.

I did

function navigate(route = ROUTES.HOME) {
    if (route === ROUTES.HOME || route === ROUTES.WORKSPACE) {
        if (isLoggedIn) {
            openDrawer();
            return;
        }

        // If we're navigating to the signIn page while logged out, pop whatever screen is on top
        // since it's guaranteed that the sign in page will be underneath (since it's the initial route).
        navigationRef.current.dispatch(StackActions.pop());
        return;
    }
    ......

added check for workspace route here. Code is updated to reflect that.

@marcaaron
Copy link
Contributor

Will pull down the branch in a bit and see if I can think of anything.

@parasharrajat
Copy link
Member Author

@michelle-thompson Could you please help me deciding this #3602 (comment)?

@marcaaron
Copy link
Contributor

@parasharrajat it seems like what's happening here is that we do not remove the WorkspaceSettings screen when we call dismissModal() because the call to goBack() will open the drawer and then an additional call to openDrawer() is made which will do nothing since it's already open.

I believe this is because those methods will refer to the drawer navigator that is on the top of the stack. So, what we need to do is:

  1. Check to see if we have a drawer when dismissing the modal
  2. Pop the screen instead
  3. Don't call goBack() or openDrawer() in this case since we should return the user back to whatever is sitting underneath the second drawer navigator.
diff --git a/src/libs/Navigation/Navigation.js b/src/libs/Navigation/Navigation.js
index 55a222d15..1cab26ba4 100644
--- a/src/libs/Navigation/Navigation.js
+++ b/src/libs/Navigation/Navigation.js
@@ -78,6 +78,11 @@ function dismissModal(shouldOpenDrawer = false) {

     // This should take us to the first view of the modal's stack navigator
     navigationRef.current.dispatch((state) => {
+        // If this is a nested drawer navigator then we must pop this screen
+        if (state.type === 'drawer') {
+            return StackActions.pop();
+        }
+
         // If there are multiple routes then we can pop back to the first route
         if (state.routes.length > 1) {
             return StackActions.popToTop();

I tested this change and I think it will work, but let me know what you think.

@parasharrajat
Copy link
Member Author

That makes sense to me. let me try.

@parasharrajat
Copy link
Member Author

parasharrajat commented Jun 23, 2021

That worked like a charm. Thanks for the help. Code pushed. Waiting for Final Design related questions. It seems that I have spent most of the time waiting for getting answers related to designs.

@parasharrajat
Copy link
Member Author

@shawnborton It slipped from my mind. I will be needing those icons on the left sidebar. I know that this was not part of original task but thought it can be combined so I made the sidebar as well.
Thank you.

@shawnborton
Copy link
Contributor

I think the people icon already exists as we use it in the Create menu for Groups.

Here is the Expensify Card icon: expensifycard.svg.zip

@shawnborton
Copy link
Contributor

@parasharrajat regarding your comment above about the avatar and font size, I think ideally we use the same avatar and font size as this view here:
image

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.

Just a few comments mostly looking great to me.

@@ -43,7 +43,7 @@ function goBack() {
* @param {String} route
*/
function navigate(route = ROUTES.HOME) {
if (route === ROUTES.HOME) {
if (route === ROUTES.HOME || route === ROUTES.WORKSPACE) {
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB, when we are navigating to /workspace we are assuming that we're already navigated to /workspace/card or some other route. We should maybe add a comment to clarify what's happening here and the intended behavior e.g.

If someone tries to navigate to /workspace when the workspace drawer is not open the home drawer will toggle. In this case, we should navigate to a sub-route of workspace instead e.g. /workspace/card

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, this also kind of makes me think that it might be incorrect to have this check in general right?

We already established that calling Navigation.goBack() will toggle the drawer. So maybe we can do that instead of navigating to /workspace when we want to toggle the workspace sidebar open?

Copy link
Member Author

Choose a reason for hiding this comment

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

But when we will navigate over the WorkspaceSetting Modal, then go back will switch those screens, Let's say first we got Card page then people page. So on the people page, goback should take us to Card apge.

Copy link
Member Author

Choose a reason for hiding this comment

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

@marcaaron Please tell me if I need to do these changes as well. Otherwise, PR is ready for review.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not really following as there's no way to access the the /workspace/people from /workspace/card, but it's not a blocker for me just something that seems weird / confusing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. I think it's better than we can adjust that later when we implement other pages like /workspace/people.

src/libs/Navigation/Navigation.js Outdated Show resolved Hide resolved
src/libs/Navigation/Navigation.js Outdated Show resolved Hide resolved
src/pages/workspace/WorkspaceSidebar.js Outdated Show resolved Hide resolved
src/pages/workspace/WorkspaceCardPage.js Outdated Show resolved Hide resolved
src/pages/workspace/WorkspaceSidebar.js Outdated Show resolved Hide resolved
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.

LGTM, great work @parasharrajat ! 🙇

@marcaaron marcaaron merged commit aee074b into Expensify:main Jun 24, 2021
@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.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging in version: 1.0.73-4🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production in version: 1.0.74-0🚀

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

@parasharrajat parasharrajat deleted the workspace branch November 20, 2023 13:07
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.

Create a new settings page for configuring the Expensify Card on a .cash workspace
6 participants