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

[CP Staging] Fix: align badge in workspace list #40599

Merged
merged 6 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion src/pages/workspace/WorkspacesListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function WorkspacesListPage({policies, reimbursementAccount, reports, session}:
{translate('workspace.common.workspaceType')}
</Text>
</View>
<View style={[styles.ml10, styles.mr2]} />
<View style={[styles.WorkspaceRightColumn, styles.mr2]} />
</View>
);
}, [isLessThanMediumScreen, styles, translate]);
Expand Down
20 changes: 17 additions & 3 deletions src/pages/workspace/WorkspacesListRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function WorkspacesListRow({
</>
)}
</View>
<View style={[styles.flexRow, isWide && !isJoinRequestPending && styles.flex1, styles.gap2, isNarrow && styles.mr5, styles.alignItemsCenter]}>
<View style={[styles.flexRow, isWide && styles.flex1, styles.gap2, isNarrow && styles.mr5, styles.alignItemsCenter]}>
<Icon
src={workspaceTypeIcon(workspaceType)}
width={variables.workspaceTypeIconWidth}
Expand All @@ -206,7 +206,18 @@ function WorkspacesListRow({
</View>
<View style={[isNarrow && styles.mr5]}>
{isJoinRequestPending && (
<View style={[styles.flexRow, styles.gap2, styles.alignItemsCenter, styles.flex1, styles.justifyContentEnd, styles.mln6, styles.pr4]}>
<View
style={[
styles.flexRow,
styles.gap2,
styles.alignItemsCenter,
styles.flex1,
styles.justifyContentEnd,
styles.mln6,
!isNarrow && styles.pr4,
isNarrow && styles.workspaceListBadge,
]}
>
<Badge
text={translate('workspace.common.requested')}
textStyles={styles.textStrong}
Expand All @@ -220,7 +231,10 @@ function WorkspacesListRow({
<View style={[styles.flexRow, styles.flex0, styles.gap2, isNarrow && styles.mr5, styles.alignItemsCenter]}>
<BrickRoadIndicatorIcon brickRoadIndicator={brickRoadIndicator} />
</View>
<View ref={threeDotsMenuContainerRef}>
<View
ref={threeDotsMenuContainerRef}
style={[styles.workspaceThreeDotMenu]}
>
<ThreeDotsMenu
onIconPress={() => {
if (isSmallScreenWidth) {
Expand Down
14 changes: 14 additions & 0 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3207,6 +3207,20 @@ const styles = (theme: ThemeColors) =>
marginLeft: 3,
},

WorkspaceRightColumn: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WorkspaceRightColumn: {
workspaceRightColumn: {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solved.

marginLeft: 99,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm why are we taking this kind of approach with hard-coded values instead of just using flex to fill up space?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you get 99 from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

width of the badge
image

the value was 40 which is the with of the 3 dots menu

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can use 100 or any higher value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the table header, we have a non-visible 4th column, all the 1st 3 columns use flex to stretch on the space equally. and we do hard-coded spacing for the 4th column to make sure it takes the lowest space.

image

I set the value to 100 to fit the badge in some cases and the 3 dots menu.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm but you can tell that the columns in the header don't perfectly match up with the content below. Owner looks like it's too far to the left for instance, compared to the content below it.

Why wouldn't that invisible 4th column header just match the width of the 4th column in the table?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a screenshot from stagging

image

As you can see, under Owner, the content has some margins, that push the content to the right a bit, and this is why you see

the header don't perfectly match up with the content below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is why 100px

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but if there is no badge present, that means we just have a bunch of dead space?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and No

Yes because technically it's true.

No because the space is already empty:
image

and if you think we need the space in small screens, the layout change on small screens to
image

So I think it's not a wasted space.

But if you want, I can create a logic to find out if there well be a badge for Request, then adjust this value 100/40

},

workspaceThreeDotMenu: {
marginLeft: 59,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does 59 come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

99 (badge width) - 40 (3 dots width)

},

workspaceListBadge: {
flexDirection: 'column',
justifyContent: 'flex-start',
marginTop: 6,
},

autoGrowHeightMultilineInput: {
maxHeight: 115,
},
Expand Down
Loading