Open m-natarajan opened 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.
There is no way to identify the primary workspace, making it appear essentially random
New feature
activePolicyID
from useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
and use the condition activePolicyID === policyID
to display the badge.WorkspacesListPage
and create util function for updating the onyx values (NVP_ACTIVE_POLICY_ID) and making the api call. We might only want to show the Make default
option only if isOwner
is true, we can use the condition if (isOwner) {
or we can add the option without any condition.
https://github.com/Expensify/App/blob/f906450e22217cc377257e91378887debcbda1cf/src/pages/workspace/WorkspacesListPage.tsx#L156-L167[!NOTE]
I don't think there is an api endpoint used in new dot to update theNVP_ACTIVE_POLICY_ID
, so we need to add the api endpoint and the types for that.
Current assignee @twisterdotcom is eligible for the NewFeature assigner, not assigning anyone new.
Triggered auto assignment to @dubielzyk-expensify (Design
), see these Stack Overflow questions for more details.
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
Extending @dannymcclain's mock to add in the rest of the things asked in the Slack thread:
Tooltip on badge hover
for extra clarification:
cc @jamesdeanexpensify for copy 👀 on the tooltip
cc @Expensify/design
Looks great to me!
Edited by proposal-police: This proposal was edited at 2024-11-13 10:29:53 UTC.
There's no way to know which workspace is primary, nor control it, so it's essentially random.
A. Display the badge "Default" and its tooltip "This workspace will be used when sending receipts to receipts@expensify.com"
In WorkspacesListRow, introduce new param, isDefault?: boolean
.
Then in here, display the badge and tooltip if isDefault
is true
:
{!!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}
B. Display the option "Set as default workspace"
activePolicyID
and current user is owner. We can consider remove the isOwner
from this condition because the activePolicyID
is specific for each account. But it can be decided later: if (item.policyID !== activePolicyID && isOwner) {
threeDotsMenuItems.push({
icon: Expensicons.Star,
text: 'Set as default workspace',
onSelected: () => setPolicyAsDefault(item.policyID)
});
}
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,
});
}
Lovely, thanks @dubielzyk-expensify!
Getting final votes on copy here.
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.
Looks good!
Job added to Upwork: https://www.upwork.com/jobs/~021857052923539231166
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws (External
)
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
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?
Screenshots/Videos
Add any screenshot/video evidence
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @Ollyws