Skip to content

Commit 33616eb

Browse files
committed
fix: default badge is misaligned on medium screens
1 parent 5eca224 commit 33616eb

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

src/pages/workspace/WorkspacesListRow.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ 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';
2120
import useTheme from '@hooks/useTheme';
2221
import useThemeStyles from '@hooks/useThemeStyles';
2322
import {getDisplayNameOrDefault, getPersonalDetailsByIDs} from '@libs/PersonalDetailsUtils';
@@ -127,7 +126,7 @@ function WorkspacesListRow({
127126
const styles = useThemeStyles();
128127
const {translate} = useLocalize();
129128
const threeDotsMenuContainerRef = useRef<View>(null);
130-
const {shouldUseNarrowLayout} = useResponsiveLayout();
129+
const isNarrow = layoutWidth === CONST.LAYOUT_WIDTH.NARROW;
131130

132131
const ownerDetails = ownerAccountID && getPersonalDetailsByIDs({accountIDs: [ownerAccountID], currentUserAccountID: currentUserPersonalDetails.accountID}).at(0);
133132
const threeDotsMenuRef = useRef<{hidePopoverMenu: () => void; isPopupMenuVisible: boolean}>(null);
@@ -145,7 +144,7 @@ function WorkspacesListRow({
145144
}, [isLoadingBill, resetLoadingSpinnerIconIndex]);
146145

147146
const calculateAndSetThreeDotsMenuPosition = useCallback(() => {
148-
if (shouldUseNarrowLayout) {
147+
if (isNarrow) {
149148
return Promise.resolve({horizontal: 0, vertical: 0});
150149
}
151150
return new Promise<AnchorPosition>((resolve) => {
@@ -156,7 +155,7 @@ function WorkspacesListRow({
156155
});
157156
});
158157
});
159-
}, [shouldUseNarrowLayout]);
158+
}, [isNarrow]);
160159

161160
if (layoutWidth === CONST.LAYOUT_WIDTH.NONE) {
162161
// To prevent layout from jumping or rendering for a split second, when
@@ -165,12 +164,11 @@ function WorkspacesListRow({
165164
}
166165

167166
const isWide = layoutWidth === CONST.LAYOUT_WIDTH.WIDE;
168-
const isNarrow = layoutWidth === CONST.LAYOUT_WIDTH.NARROW;
169167

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

172170
const ThreeDotMenuOrPendingIcon = (
173-
<View style={[styles.flexRow, !shouldUseNarrowLayout && styles.workspaceThreeDotMenu]}>
171+
<View style={[styles.flexRow, !isNarrow && styles.workspaceThreeDotMenu]}>
174172
{!!isJoinRequestPending && (
175173
<View style={[styles.flexRow, styles.gap2, styles.alignItemsCenter, styles.justifyContentEnd]}>
176174
<Badge
@@ -237,7 +235,7 @@ function WorkspacesListRow({
237235
style={[styles.flex1, styles.flexGrow1, styles.textStrong, isDeleted ? styles.offlineFeedback.deleted : {}]}
238236
/>
239237
</View>
240-
{shouldUseNarrowLayout && ThreeDotMenuOrPendingIcon}
238+
{isNarrow && ThreeDotMenuOrPendingIcon}
241239
</View>
242240
<View style={[styles.flexRow, isWide && styles.flex1, isWide && styles.workspaceOwnerSectionMinWidth, styles.gap2, styles.alignItemsCenter]}>
243241
{!!ownerDetails && (
@@ -290,7 +288,7 @@ function WorkspacesListRow({
290288
</View>
291289
</View>
292290

293-
{!shouldUseNarrowLayout && ThreeDotMenuOrPendingIcon}
291+
{!isNarrow && ThreeDotMenuOrPendingIcon}
294292
</View>
295293
);
296294
}

0 commit comments

Comments
 (0)