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

fix deleted workspace offline not visible & crossed out #36224

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions src/pages/workspace/WorkspacesListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,21 @@ function WorkspacesListPage({policies, allPolicyMembers, reimbursementAccount, r
}

return (
<OfflineWithFeedback
key={`${item.title}_${index}`}
pendingAction={item.pendingAction}
errorRowStyles={styles.ph5}
onClose={item.dismissError}
errors={item.errors}
<PressableWithoutFeedback
role={CONST.ROLE.BUTTON}
accessibilityLabel="row"
style={[styles.mh5, styles.mb3]}
disabled={item.disabled}
onPress={item.action}
>
<PressableWithoutFeedback
role={CONST.ROLE.BUTTON}
accessibilityLabel="row"
style={[styles.mh5, styles.mb3]}
disabled={item.disabled}
onPress={item.action}
>
{({hovered}) => (
{({hovered}) => (
<OfflineWithFeedback
key={`${item.title}_${index}`}
pendingAction={item.pendingAction}
errorRowStyles={styles.ph5}
onClose={item.dismissError}
errors={item.errors}
>
<WorkspacesListRow
title={item.title}
menuItems={threeDotsMenuItems}
Expand All @@ -193,10 +193,11 @@ function WorkspacesListPage({policies, allPolicyMembers, reimbursementAccount, r
rowStyles={hovered && styles.hoveredComponentBG}
layoutWidth={isSmallScreenWidth ? CONST.LAYOUT_WIDTH.NARROW : CONST.LAYOUT_WIDTH.WIDE}
brickRoadIndicator={item.brickRoadIndicator}
shouldDisableThreeDotsMenu={item.disabled}
/>
)}
</PressableWithoutFeedback>
</OfflineWithFeedback>
</OfflineWithFeedback>
)}
</PressableWithoutFeedback>
);
},
[isSmallScreenWidth, styles.mb3, styles.mh5, styles.ph5, styles.hoveredComponentBG, translate],
Expand Down
26 changes: 19 additions & 7 deletions src/pages/workspace/WorkspacesListRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ type WorkspacesListRowProps = WithCurrentUserPersonalDetailsProps & {
* component will return null to prevent layout from jumping on initial render and when parent width changes. */
layoutWidth?: ValueOf<typeof CONST.LAYOUT_WIDTH>;

/** Additional styles applied to the row */
/** Custom styles applied to the row */
rowStyles?: StyleProp<ViewStyle>;

/** Additional styles from OfflineWithFeedback applied to the row */
style?: StyleProp<ViewStyle>;

/** The type of brick road indicator to show. */
brickRoadIndicator?: ValueOf<typeof CONST.BRICK_ROAD_INDICATOR_STATUS>;

/** Determines if three dots menu should be shown or not */
shouldDisableThreeDotsMenu?: boolean;
};

type BrickRoadIndicatorIconProps = {
Expand Down Expand Up @@ -89,7 +95,9 @@ function WorkspacesListRow({
currentUserPersonalDetails,
layoutWidth = CONST.LAYOUT_WIDTH.NONE,
rowStyles,
style,
brickRoadIndicator,
shouldDisableThreeDotsMenu,
}: WorkspacesListRowProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand Down Expand Up @@ -120,8 +128,10 @@ function WorkspacesListRow({
const isWide = layoutWidth === CONST.LAYOUT_WIDTH.WIDE;
const isNarrow = layoutWidth === CONST.LAYOUT_WIDTH.NARROW;

const isDeleted = style && Array.isArray(style) ? style.includes(styles.offlineFeedback.deleted) : false;

return (
<View style={[isWide ? styles.flexRow : styles.flexColumn, isWide && styles.gap5, styles.highlightBG, styles.br3, styles.pv5, styles.pl5, rowStyles]}>
<View style={[isWide ? styles.flexRow : styles.flexColumn, isWide && styles.gap5, styles.highlightBG, styles.br3, styles.pv5, styles.pl5, rowStyles, style]}>
<View style={[styles.flexRow, isWide && styles.flex1, styles.gap3, isNarrow && [styles.mb3, styles.mr2], styles.alignItemsCenter]}>
<Avatar
imageStyles={[styles.alignSelfCenter]}
Expand All @@ -133,7 +143,7 @@ function WorkspacesListRow({
/>
<Text
numberOfLines={1}
style={[styles.flex1, styles.flexGrow1, styles.textStrong]}
style={[styles.flex1, styles.flexGrow1, styles.textStrong, isDeleted ? styles.offlineFeedback.deleted : {}]}
>
{title}
</Text>
Expand All @@ -143,6 +153,7 @@ function WorkspacesListRow({
<ThreeDotsMenu
menuItems={menuItems}
anchorPosition={{horizontal: 0, vertical: 0}}
disabled={shouldDisableThreeDotsMenu}
/>
</>
)}
Expand All @@ -158,13 +169,13 @@ function WorkspacesListRow({
<View style={styles.flex1}>
<Text
numberOfLines={1}
style={[styles.labelStrong]}
style={[styles.labelStrong, isDeleted ? styles.offlineFeedback.deleted : {}]}
>
{PersonalDetailsUtils.getDisplayNameOrDefault(ownerDetails)}
</Text>
<Text
numberOfLines={1}
style={[styles.textMicro, styles.textSupporting]}
style={[styles.textMicro, styles.textSupporting, isDeleted ? styles.offlineFeedback.deleted : {}]}
>
{ownerDetails.login}
</Text>
Expand All @@ -182,13 +193,13 @@ function WorkspacesListRow({
<View style={styles.flex1}>
<Text
numberOfLines={1}
style={[styles.labelStrong]}
style={[styles.labelStrong, isDeleted ? styles.offlineFeedback.deleted : {}]}
>
{userFriendlyWorkspaceType}
</Text>
<Text
numberOfLines={1}
style={[styles.textMicro, styles.textSupporting]}
style={[styles.textMicro, styles.textSupporting, isDeleted ? styles.offlineFeedback.deleted : {}]}
>
{translate('workspace.common.plan')}
</Text>
Expand All @@ -215,6 +226,7 @@ function WorkspacesListRow({
anchorAlignment={{horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT, vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP}}
iconStyles={[styles.mr2]}
shouldOverlay
disabled={shouldDisableThreeDotsMenu}
/>
</View>
</>
Expand Down
Loading