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

Commit 961b1a4

Browse files
authored
Merge pull request #24 from topcoder-platform/feature/work-periods-part-2
Feature/work periods part 2
2 parents 681485b + aebce9b commit 961b1a4

File tree

17 files changed

+78
-108
lines changed

17 files changed

+78
-108
lines changed

src/components/Checkbox/styles.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ input.checkbox {
5656
border-radius: 3px;
5757
line-height: 18px;
5858
user-select: none;
59+
background-color: #fff;
5960
color: transparent;
6061

6162
&::before {
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
import React, { useContext, useEffect } from "react";
1+
import React, { memo, useContext, useEffect } from "react";
22
import PT from "prop-types";
33
import cn from "classnames";
44
import { ProjectNameContext } from "components/ProjectNameContextProvider";
55
import styles from "./styles.module.scss";
66

77
const ProjectName = ({ className, projectId }) => {
88
const [getName, fetchName] = useContext(ProjectNameContext);
9+
910
useEffect(() => {
1011
fetchName(projectId);
1112
}, [fetchName, projectId]);
1213

14+
const projectName = getName(projectId) || projectId;
15+
1316
return (
14-
<span className={cn(styles.container, className)}>
15-
{getName(projectId) || projectId}
17+
<span className={cn(styles.container, className)} title={projectName}>
18+
{projectName}
1619
</span>
1720
);
1821
};
@@ -22,4 +25,4 @@ ProjectName.propTypes = {
2225
projectId: PT.number.isRequired,
2326
};
2427

25-
export default ProjectName;
28+
export default memo(ProjectName);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
@import "styles/mixins";
22

33
.container {
4+
display: block;
5+
max-width: 20em;
6+
overflow: hidden;
7+
text-overflow: ellipsis;
8+
white-space: nowrap;
49
@include roboto-medium;
510
}

src/components/SearchHandleField/styles.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@import "styles/mixins";
33

44
.container {
5+
z-index: 3;
56
position: relative;
67
display: flex;
78
align-items: center;

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

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
hideWorkPeriodDetails,
1313
setBillingAccount,
1414
setDetailsHidePastPeriods,
15-
// setDetailsLockWorkingDays,
1615
} from "store/actions/workPeriods";
1716
import styles from "./styles.module.scss";
1817
import { updateWorkPeriodBillingAccount } from "store/thunks/workPeriods";
@@ -42,7 +41,6 @@ const PeriodDetails = ({ className, details, isDisabled, isFailed }) => {
4241
periodsVisible,
4342
periodsIsLoading,
4443
hidePastPeriods,
45-
// lockWorkingDays,
4644
} = details;
4745

4846
const onHideDetailsBtnClick = useCallback(() => {
@@ -56,13 +54,6 @@ const PeriodDetails = ({ className, details, isDisabled, isFailed }) => {
5654
[dispatch, periodId]
5755
);
5856

59-
// const onChangeLockWorkingDays = useCallback(
60-
// (lock) => {
61-
// dispatch(setDetailsLockWorkingDays(periodId, lock));
62-
// },
63-
// [dispatch, periodId]
64-
// );
65-
6657
const onChangeBillingAccount = useCallback(
6758
(value) => {
6859
dispatch(setBillingAccount(periodId, value));
@@ -113,16 +104,6 @@ const PeriodDetails = ({ className, details, isDisabled, isFailed }) => {
113104
</div>
114105
</div>
115106
</div>
116-
{/* <div className={styles.lockWorkingDaysSection}>
117-
<div className={styles.sectionLabel}>Lock Working Days</div>
118-
<Toggle
119-
size="small"
120-
className={styles.lockWorkingDaysToggle}
121-
name={`rb_lck_wd_${periodId}`}
122-
onChange={onChangeLockWorkingDays}
123-
isOn={lockWorkingDays}
124-
/>
125-
</div> */}
126107
<div className={styles.billingAccountSection}>
127108
<div className={styles.sectionLabel}>Billing Account</div>
128109
<SelectField
@@ -188,7 +169,7 @@ PeriodDetails.propTypes = {
188169
billingAccounts: PT.arrayOf(
189170
PT.shape({
190171
label: PT.string.isRequired,
191-
value: PT.string.isRequired,
172+
value: PT.number.isRequired,
192173
})
193174
),
194175
billingAccountsError: PT.string,
@@ -197,7 +178,6 @@ PeriodDetails.propTypes = {
197178
periodsVisible: PT.array.isRequired,
198179
periodsIsLoading: PT.bool.isRequired,
199180
hidePastPeriods: PT.bool.isRequired,
200-
lockWorkingDays: PT.bool.isRequired,
201181
}).isRequired,
202182
isDisabled: PT.bool.isRequired,
203183
isFailed: PT.bool.isRequired,

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,6 @@
6969
color: #e90c5a;
7070
}
7171

72-
.lockWorkingDaysSection {
73-
margin-top: 19px;
74-
}
75-
76-
.lockWorkingDaysToggle {
77-
margin-top: 6px;
78-
}
79-
8072
.billingAccountSection {
8173
margin-top: 13px;
8274
}

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,12 @@ PeriodItem.propTypes = {
166166
billingAccountId: PT.number.isRequired,
167167
billingAccounts: PT.arrayOf(
168168
PT.shape({
169-
value: PT.string.isRequired,
170169
label: PT.string.isRequired,
170+
value: PT.number.isRequired,
171171
})
172-
),
172+
).isRequired,
173173
billingAccountsIsLoading: PT.bool.isRequired,
174-
periods: PT.arrayOf(
175-
PT.shape({
176-
id: PT.string.isRequired,
177-
})
178-
),
174+
periods: PT.array.isRequired,
179175
periodsIsLoading: PT.bool.isRequired,
180176
}),
181177
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ PeriodsHistoryItem.propTypes = {
105105
endDate: PT.oneOfType([PT.string, PT.number]).isRequired,
106106
paymentStatus: PT.string.isRequired,
107107
payments: PT.array,
108-
weeklyRate: PT.number.isRequired,
108+
weeklyRate: PT.number,
109109
workingDays: PT.number.isRequired,
110110
}).isRequired,
111111
currentStartDate: PT.oneOfType([PT.string, PT.number, PT.object]).isRequired,

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,20 @@ const PeriodsSelectionMessage = ({ className }) => {
2929
dispatch(toggleWorkingPeriodsAll());
3030
}, [dispatch]);
3131

32-
const infoText = isSelectedAll
33-
? `All ${totalCount} Records are selected. `
34-
: `All ${pageSize} Records on this page are selected. `;
35-
const btnText = isSelectedAll
36-
? "Deselect"
37-
: `Select all ${totalCount} Records`;
38-
3932
return (
4033
<div className={cn(styles.container, className)}>
41-
{isSelectedVisible && (
34+
{isSelectedVisible && totalCount > pageSize && (
4235
<span className={styles.message}>
43-
{infoText}
36+
{isSelectedAll
37+
? `All ${totalCount} Records are selected. `
38+
: `All ${pageSize} Records on this page are selected. `}
4439
<span
4540
className={styles.button}
4641
onClick={onBtnClick}
4742
role="button"
4843
tabIndex={0}
4944
>
50-
{btnText}
45+
{isSelectedAll ? "Deselect" : `Select all ${totalCount} Records`}
5146
</span>
5247
</span>
5348
)}

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

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@ import styles from "./styles.module.scss";
88
* payments have been scheduled or failed to schedule.
99
*
1010
* @param {Object} props component properties
11+
* @param {number} props.resourcesSucceededCount the number of resources
12+
* for which payments have been successfully scheduled
13+
* @param {Array} [props.resourcesFailed] array with data for resources
14+
* for which payments were failed to be scheduled
15+
* @param {number} props.resourcesFailedCount the number of resources
16+
* for which payments were failed to be scheduled
17+
* @param {() => void} [props.remove] function that must be called
18+
* on toast message removal intent
1119
* @returns {JSX.Element}
1220
*/
1321
const ToastPaymentsWarning = ({
14-
resourcesSucceeded,
1522
resourcesSucceededCount,
1623
resourcesFailed,
1724
resourcesFailedCount,
@@ -23,15 +30,6 @@ const ToastPaymentsWarning = ({
2330
<div className={styles.sectionTitle}>
2431
Payment scheduled for {resourcesSucceededCount} resources
2532
</div>
26-
{resourcesSucceeded && resourcesSucceeded.length && (
27-
<div className={styles.periodsSucceeded}>
28-
{resourcesSucceeded.map((period) => (
29-
<div key={period.workPeriodId} className={styles.periodSucceeded}>
30-
{period.workPeriodId}
31-
</div>
32-
))}
33-
</div>
34-
)}
3533
</div>
3634
<div className={styles.sectionFailed}>
3735
<div className={styles.sectionTitle}>
@@ -54,12 +52,6 @@ const ToastPaymentsWarning = ({
5452
};
5553

5654
ToastPaymentsWarning.propTypes = {
57-
resourcesSucceeded: PT.arrayOf(
58-
PT.shape({
59-
workPeriodId: PT.string.isRequired,
60-
amount: PT.number,
61-
})
62-
),
6355
resourcesSucceededCount: PT.number.isRequired,
6456
resourcesFailed: PT.arrayOf(
6557
PT.shape({

0 commit comments

Comments
 (0)