Skip to content

Commit 9305ed1

Browse files
committed
BuildList item. Horizontal scroll is shown with long branch name
closes Visual-Regression-Tracker/Visual-Regression-Tracker#315
1 parent 2544c10 commit 9305ed1

File tree

2 files changed

+39
-11
lines changed

2 files changed

+39
-11
lines changed

src/components/BuildDetails.tsx

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@ import {
55
Grid,
66
Box,
77
LinearProgress,
8+
Tooltip,
89
} from "@material-ui/core";
910
import { BuildStatusChip } from "./BuildStatusChip";
1011
import { formatDateTime } from "../_helpers/format.helper";
1112
import { useBuildState } from "../contexts";
12-
import { LOCATOR_BUILD_DETAILS } from '../constants/help';
13+
import { LOCATOR_BUILD_DETAILS } from "../constants/help";
1314

1415
const BuildDetails: React.FunctionComponent = () => {
1516
const { selectedBuild } = useBuildState();
17+
const buildNumber = React.useMemo(
18+
() => `#${selectedBuild?.number} ${selectedBuild?.ciBuildId || ""}`,
19+
[selectedBuild?.number, selectedBuild?.ciBuildId]
20+
);
1621

1722
if (!selectedBuild) {
1823
return null;
@@ -25,13 +30,24 @@ const BuildDetails: React.FunctionComponent = () => {
2530
<Grid item>
2631
<Box m={0.5}>
2732
<Grid container spacing={1} alignItems="center">
28-
<Grid item>
29-
<Typography variant="subtitle2">{`#${selectedBuild.number} ${
30-
selectedBuild.ciBuildId || ""
31-
}`}</Typography>
33+
<Grid item style={{ maxWidth: "20%", whiteSpace: "nowrap" }}>
34+
<Tooltip title={buildNumber}>
35+
<Typography
36+
variant="subtitle2"
37+
style={{ overflow: "hidden", textOverflow: "ellipsis" }}
38+
>
39+
{buildNumber}
40+
</Typography>
41+
</Tooltip>
3242
</Grid>
33-
<Grid item>
34-
<Chip size="small" label={selectedBuild.branchName} />
43+
<Grid item style={{ maxWidth: "70%" }}>
44+
<Tooltip title={selectedBuild.branchName}>
45+
<Chip
46+
size="small"
47+
style={{ maxWidth: "100%" }}
48+
label={selectedBuild.branchName}
49+
/>
50+
</Tooltip>
3551
</Grid>
3652
<Grid item>
3753
<BuildStatusChip status={selectedBuild.status} />

src/components/BuildList/index.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
Menu,
1616
MenuItem,
1717
Box,
18+
Tooltip,
1819
} from "@material-ui/core";
1920
import { MoreVert } from "@material-ui/icons";
2021
import {
@@ -136,9 +137,14 @@ const BuildList: FunctionComponent = () => {
136137
<ListItemText
137138
disableTypography
138139
primary={
139-
<Typography variant="subtitle2">{`#${build.number} ${
140-
build.ciBuildId || ""
141-
}`}</Typography>
140+
<Typography
141+
variant="subtitle2"
142+
style={{
143+
wordWrap: "break-word",
144+
}}
145+
>
146+
{`#${build.number} ${build.ciBuildId || ""}`}
147+
</Typography>
142148
}
143149
secondary={
144150
<Grid container direction="column">
@@ -150,7 +156,13 @@ const BuildList: FunctionComponent = () => {
150156
<Grid item>
151157
<Grid container justifyContent="space-between">
152158
<Grid item>
153-
<Chip size="small" label={build.branchName} />
159+
<Tooltip title={build.branchName}>
160+
<Chip
161+
size="small"
162+
label={build.branchName}
163+
style={{ maxWidth: 180 }}
164+
/>
165+
</Tooltip>
154166
</Grid>
155167
<Grid item>
156168
<BuildStatusChip status={build.status} />

0 commit comments

Comments
 (0)