Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit b9e544f

Browse files
committed
Made the working periods' table more compact.
1 parent ff9e07d commit b9e544f

File tree

8 files changed

+44
-17
lines changed

8 files changed

+44
-17
lines changed

src/components/ActionsMenu/index.jsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import compStyles from "./styles.module.scss";
1414
* @param {Object} props component properties
1515
* @param {'primary'|'error'|'warning'} [props.handleColor] menu handle color
1616
* @param {'small'|'medium'} [props.handleSize] menu handle size
17+
* @param {string} [props.handleText] text to show inside menu handle
1718
* @param {Array} props.items menu items
1819
* @param {'absolute'|'fixed'} [props.popupStrategy] popup positioning strategy
1920
* @param {boolean} [props.stopClickPropagation] whether to stop click event propagation
@@ -22,6 +23,7 @@ import compStyles from "./styles.module.scss";
2223
const ActionsMenu = ({
2324
handleColor = "primary",
2425
handleSize = "small",
26+
handleText,
2527
items = [],
2628
popupStrategy = "absolute",
2729
stopClickPropagation = false,
@@ -89,14 +91,16 @@ const ActionsMenu = ({
8991
<Button
9092
color={handleColor}
9193
size={handleSize}
94+
style={handleText ? "rounded" : "circle"}
9295
variant="contained"
9396
onClick={isOpen ? null : toggleMenu}
9497
className={cn(compStyles.handle, {
9598
[compStyles.handleMenuOpen]: isOpen,
9699
})}
97100
innerRef={setReferenceElement}
98101
>
99-
Actions <IconArrowDown className={compStyles.iconArrowDown} />
102+
{handleText ? <span>{handleText}&nbsp;</span> : null}
103+
<IconArrowDown className={compStyles.iconArrowDown} />
100104
</Button>
101105
{isOpen && (
102106
<Menu
@@ -113,6 +117,7 @@ const ActionsMenu = ({
113117
ActionsMenu.propTypes = {
114118
handleColor: PT.oneOf(["primary", "error", "warning"]),
115119
handleSize: PT.oneOf(["small", "medium"]),
120+
handleText: PT.string,
116121
items: PT.arrayOf(
117122
PT.shape({
118123
label: PT.string,

src/components/ActionsMenu/styles.module.scss

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@
88
.handle {
99
display: inline-flex;
1010
align-items: center;
11+
12+
> span {
13+
+ .iconArrowDown {
14+
margin-left: 8px;
15+
}
16+
}
1117
}
1218

1319
.iconArrowDown {
1420
display: inline-block;
1521
width: 12px;
1622
height: 8px;
17-
margin-left: 8px;
1823
}
1924

2025
.handleMenuOpen {

src/components/ProjectName/index.jsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ const ProjectName = ({ className, projectId }) => {
1313

1414
const projectName = getName(projectId) || projectId;
1515

16-
return (
17-
<span className={cn(styles.container, className)} title={projectName}>
18-
{projectName}
19-
</span>
20-
);
16+
return <span className={cn(styles.container, className)}>{projectName}</span>;
2117
};
2218

2319
ProjectName.propTypes = {

src/components/ProjectName/styles.module.scss

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
.container {
44
display: inline-block;
5-
max-width: 20em;
6-
overflow: hidden;
7-
text-overflow: ellipsis;
85
white-space: nowrap;
96
@include roboto-medium;
107
}

src/routes/WorkPeriods/components/PeriodAlerts/index.jsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ const PeriodAlerts = ({ alerts, className }) => {
4141
)}
4242
tooltipClassName={styles.tooltip}
4343
>
44-
{alerts
45-
? alerts.map((alertId) => ALERT_MESSAGE_MAP[alertId]).join(", ")
46-
: "None"}
44+
{alerts ? "" : "None"}
4745
</Tooltip>
4846
);
4947
};

src/routes/WorkPeriods/components/PeriodAlerts/styles.module.scss

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
&::before {
2222
content: "!";
2323
display: inline-block;
24-
margin-right: 4px;
2524
border: 2px solid $text-color;
2625
border-radius: 7px;
2726
padding: 1px 0 0;

src/routes/WorkPeriods/components/PeriodItem/index.jsx

+15-3
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,17 @@ const PeriodItem = ({
116116
[item.jobId]
117117
);
118118

119-
const projectId = useMemo(
119+
const projectIdAndTeamName = useMemo(
120120
() => (
121121
<span className={styles.tooltipContent}>
122122
<span className={styles.tooltipLabel}>Project ID:</span>&nbsp;
123123
{item.projectId}
124+
<br />
125+
<span className={styles.tooltipLabel}>Team Name:</span>&nbsp;
126+
<ProjectName
127+
className={styles.tooltipProjectName}
128+
projectId={item.projectId}
129+
/>
124130
</span>
125131
),
126132
[item.projectId]
@@ -184,8 +190,14 @@ const PeriodItem = ({
184190
</Tooltip>
185191
</td>
186192
<td className={styles.teamName}>
187-
<Tooltip content={projectId}>
188-
<ProjectName projectId={item.projectId} />
193+
<Tooltip
194+
targetClassName={styles.projectNameContainer}
195+
content={projectIdAndTeamName}
196+
>
197+
<ProjectName
198+
className={styles.projectName}
199+
projectId={item.projectId}
200+
/>
189201
</Tooltip>
190202
</td>
191203
<td className={styles.startDate}>{formatDate(item.bookingStart)}</td>

src/routes/WorkPeriods/components/PeriodItem/styles.module.scss

+15
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,21 @@ td.teamName {
9191
white-space: nowrap;
9292
}
9393

94+
.tooltipProjectName {
95+
font-weight: normal;
96+
}
97+
98+
.projectNameContainer {
99+
display: block;
100+
}
101+
102+
.projectName {
103+
display: block;
104+
width: 85px;
105+
text-overflow: ellipsis;
106+
overflow: hidden;
107+
}
108+
94109
td.startDate,
95110
td.endDate {
96111
padding-left: 10px;

0 commit comments

Comments
 (0)