Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.55k stars 2.89k forks source link

[$250] There is no way to identify the primary workspace, making it appear essentially random #52373

Open m-natarajan opened 2 days ago

m-natarajan commented 2 days ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.60-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @quinthar Slack conversation (hyperlinked to channel name): ts_external_expensify_retain

Action Performed:

Prerequisite: User have multiple workspaces

  1. Go to staging.new.expensify.com
  2. Click Settings > Workspaces

    Expected Result:

    Add some indicator in the workspace list as to which is primary Add some ability to make a given workspace primary

    Actual Result:

    There's no way to know which workspace is primary, nor control it, so it's essentially random.

    Workaround:

    Unknown

    Platforms:

    Which of our officially supported platforms is this issue occurring on?

    • [ ] Android: Standalone
    • [ ] Android: HybridApp
    • [ ] Android: mWeb Chrome
    • [ ] iOS: Standalone
    • [ ] iOS: HybridApp
    • [ ] iOS: mWeb Safari
    • [x] MacOS: Chrome / Safari
    • [ ] MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Snip - (1) New Expensify - Google Chrome (2)

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021857052923539231166
  • Upwork Job ID: 1857052923539231166
  • Last Price Increase: 2024-11-14
Issue OwnerCurrent Issue Owner: @Ollyws
melvin-bot[bot] commented 2 days ago

Triggered auto assignment to @twisterdotcom (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

Krishna2323 commented 2 days ago

Proposal


Please re-state the problem that we are trying to solve in this issue.

There is no way to identify the primary workspace, making it appear essentially random

What is the root cause of that problem?

New feature

What changes do you think we should make in order to solve the problem?


[!NOTE]
I don't think there is an api endpoint used in new dot to update the NVP_ACTIVE_POLICY_ID, so we need to add the api endpoint and the types for that.

What alternative solutions did you explore? (Optional)

Result

melvin-bot[bot] commented 2 days ago

Current assignee @twisterdotcom is eligible for the NewFeature assigner, not assigning anyone new.

melvin-bot[bot] commented 2 days ago

Triggered auto assignment to @dubielzyk-expensify (Design), see these Stack Overflow questions for more details.

twisterdotcom commented 2 days ago

Adding Design to show exactly how we want this to appear based on the outcome of the Slack thread here: https://expensify.slack.com/archives/C07NZ8B1VTQ/p1731356570733819?thread_ts=1731353082.160469&cid=C07NZ8B1VTQ

dubielzyk-expensify commented 1 day ago

Extending @dannymcclain's mock to add in the rest of the things asked in the Slack thread:

image image

Tooltip on badge hover for extra clarification:

image

cc @jamesdeanexpensify for copy 👀 on the tooltip

cc @Expensify/design

shawnborton commented 1 day ago

Looks great to me!

daledah commented 1 day ago

Edited by proposal-police: This proposal was edited at 2024-11-13 10:29:53 UTC.

Proposal

Please re-state the problem that we are trying to solve in this issue.

There's no way to know which workspace is primary, nor control it, so it's essentially random.

What is the root cause of that problem?

What changes do you think we should make in order to solve the problem?

A. Display the badge "Default" and its tooltip "This workspace will be used when sending receipts to receipts@expensify.com"

            {!!isDefault && (
                <Tooltip
                    maxWidth={200}
                    text={'This workspace will be used when sending receipts to receipts@expensify.com'}
                >
                    <View style={[styles.flexRow, styles.gap2, styles.alignItemsCenter, styles.justifyContentEnd]}>
                        <Badge
                            text={'Default'}
                            textStyles={styles.textStrong}
                            badgeStyles={[styles.alignSelfCenter, styles.badgeBordered]}
                        />
                    </View>
                </Tooltip>
            )}
    const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);

and when using WorkspacesListRow, use activePolicyID as:

                                isDefault={item.policyID === activePolicyID}

image

B. Display the option "Set as default workspace"

            if (item.policyID !== activePolicyID && isOwner) {
                threeDotsMenuItems.push({
                    icon: Expensicons.Star,
                    text: 'Set as default workspace',
                    onSelected: () => setPolicyAsDefault(item.policyID)
                });
            }

image

C. Handle setPolicyAsDefault


let activePolicyID: OnyxEntry<string>;
Onyx.connect({
    key: ONYXKEYS.NVP_ACTIVE_POLICY_ID,
    callback: (val) => {
        activePolicyID = val;
    },
});
function setPolicyAsDefault(policyID: string) {
    const optimisticData: OnyxUpdate[] = [
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: ONYXKEYS.NVP_ACTIVE_POLICY_ID,
            value: policyID,
        },
    ];

    const failureData: OnyxUpdate[] = [
        {
            onyxMethod: Onyx.METHOD.MERGE,
            key: ONYXKEYS.NVP_ACTIVE_POLICY_ID,
            value: activePolicyID,
        },
    ];

    const parameters = {
        policyID,
    };

    API.write('api-to-set-policy-as-default', parameters, {
        optimisticData,
        failureData,
    });
}

What alternative solutions did you explore? (Optional)

dannymcclain commented 1 day ago

Lovely, thanks @dubielzyk-expensify!

jamesdeanexpensify commented 1 day ago

Getting final votes on copy here.

jamesdeanexpensify commented 21 hours ago

For the tooltip copy when you hover over the Default badge, let's go with:

Receipts sent to receipts@expensify.com will appear in this workspace.

dubielzyk-expensify commented 19 hours ago

image

jamesdeanexpensify commented 19 hours ago

Looks good!

melvin-bot[bot] commented 5 hours ago

Job added to Upwork: https://www.upwork.com/jobs/~021857052923539231166

melvin-bot[bot] commented 5 hours ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws (External)