Skip to content

Commit b91891e

Browse files
committed
remove redudant changes
1 parent 33616eb commit b91891e

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/pages/workspace/WorkspacesListRow.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentU
1717
import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails';
1818
import WorkspacesListRowDisplayName from '@components/WorkspacesListRowDisplayName';
1919
import useLocalize from '@hooks/useLocalize';
20+
import useResponsiveLayout from '@hooks/useResponsiveLayout';
2021
import useTheme from '@hooks/useTheme';
2122
import useThemeStyles from '@hooks/useThemeStyles';
2223
import {getDisplayNameOrDefault, getPersonalDetailsByIDs} from '@libs/PersonalDetailsUtils';
@@ -126,6 +127,7 @@ function WorkspacesListRow({
126127
const styles = useThemeStyles();
127128
const {translate} = useLocalize();
128129
const threeDotsMenuContainerRef = useRef<View>(null);
130+
const {shouldUseNarrowLayout} = useResponsiveLayout();
129131
const isNarrow = layoutWidth === CONST.LAYOUT_WIDTH.NARROW;
130132

131133
const ownerDetails = ownerAccountID && getPersonalDetailsByIDs({accountIDs: [ownerAccountID], currentUserAccountID: currentUserPersonalDetails.accountID}).at(0);
@@ -144,7 +146,7 @@ function WorkspacesListRow({
144146
}, [isLoadingBill, resetLoadingSpinnerIconIndex]);
145147

146148
const calculateAndSetThreeDotsMenuPosition = useCallback(() => {
147-
if (isNarrow) {
149+
if (shouldUseNarrowLayout) {
148150
return Promise.resolve({horizontal: 0, vertical: 0});
149151
}
150152
return new Promise<AnchorPosition>((resolve) => {
@@ -155,7 +157,7 @@ function WorkspacesListRow({
155157
});
156158
});
157159
});
158-
}, [isNarrow]);
160+
}, [shouldUseNarrowLayout]);
159161

160162
if (layoutWidth === CONST.LAYOUT_WIDTH.NONE) {
161163
// To prevent layout from jumping or rendering for a split second, when
@@ -168,7 +170,7 @@ function WorkspacesListRow({
168170
const isDeleted = style && Array.isArray(style) ? style.includes(styles.offlineFeedback.deleted) : false;
169171

170172
const ThreeDotMenuOrPendingIcon = (
171-
<View style={[styles.flexRow, !isNarrow && styles.workspaceThreeDotMenu]}>
173+
<View style={[styles.flexRow, !shouldUseNarrowLayout && styles.workspaceThreeDotMenu]}>
172174
{!!isJoinRequestPending && (
173175
<View style={[styles.flexRow, styles.gap2, styles.alignItemsCenter, styles.justifyContentEnd]}>
174176
<Badge
@@ -196,7 +198,7 @@ function WorkspacesListRow({
196198
)}
197199
{!isJoinRequestPending && (
198200
<View style={[styles.flexRow, styles.ml2, styles.gap1]}>
199-
<View style={[styles.flexRow, styles.gap2, styles.alignItemsCenter, isNarrow && styles.workspaceListRBR]}>
201+
<View style={[styles.flexRow, styles.gap2, styles.alignItemsCenter, shouldUseNarrowLayout && styles.workspaceListRBR]}>
200202
<BrickRoadIndicatorIcon brickRoadIndicator={brickRoadIndicator} />
201203
</View>
202204
<View ref={threeDotsMenuContainerRef}>
@@ -218,7 +220,7 @@ function WorkspacesListRow({
218220
return (
219221
<View style={[styles.flexRow, styles.highlightBG, rowStyles, style, isWide && styles.gap5, styles.br3, styles.p5]}>
220222
<View style={[isWide ? styles.flexRow : styles.flexColumn, styles.flex1, isWide && styles.gap5]}>
221-
<View style={[styles.flexRow, styles.justifyContentBetween, styles.flex2, isNarrow && styles.mb3, styles.alignItemsCenter]}>
223+
<View style={[styles.flexRow, styles.justifyContentBetween, styles.flex2, shouldUseNarrowLayout && styles.mb3, styles.alignItemsCenter]}>
222224
<View style={[styles.flexRow, styles.gap3, styles.flex1, styles.alignItemsCenter]}>
223225
<Avatar
224226
imageStyles={[styles.alignSelfCenter]}

0 commit comments

Comments
 (0)