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

Commit 2270993

Browse files
committed
fix: Increase job description length, Change minimum job duration
- Validate job descriptions are no longer than 100,000 characters - Validate duration is 4 or greater in Team Details Modal - Change width of Customer scroll Resolves: #362, #374
1 parent b1153ad commit 2270993

File tree

4 files changed

+116
-100
lines changed

4 files changed

+116
-100
lines changed

src/routes/CreateNewTeam/components/TeamDetailsModal/index.jsx

+101-93
Original file line numberDiff line numberDiff line change
@@ -133,100 +133,108 @@ function TeamDetailsModal({ open, onClose, submitForm, addedRoles }) {
133133
<th>Start month</th>
134134
<th></th>
135135
</tr>
136-
{addedRoles.map(({ searchId: id, name, numberOfResources, durationWeeks, startMonth }) => (
137-
<tr styleName="role-row" key={id}>
138-
<td>{name}</td>
139-
<td>
140-
<Field
141-
validate={validateExists}
142-
name={`${id}.numberOfResources`}
143-
initialValue={numberOfResources}
144-
>
145-
{({ input, meta }) => (
146-
<NumberInput
147-
name={input.name}
148-
value={input.value}
149-
onChange={input.onChange}
150-
onBlur={input.onBlur}
151-
onFocus={input.onFocus}
152-
min="1"
153-
error={meta.touched && meta.error}
154-
/>
136+
{addedRoles.map(
137+
({
138+
searchId: id,
139+
name,
140+
numberOfResources,
141+
durationWeeks,
142+
startMonth,
143+
}) => (
144+
<tr styleName="role-row" key={id}>
145+
<td>{name}</td>
146+
<td>
147+
<Field
148+
validate={validateExists}
149+
name={`${id}.numberOfResources`}
150+
initialValue={numberOfResources}
151+
>
152+
{({ input, meta }) => (
153+
<NumberInput
154+
name={input.name}
155+
value={input.value}
156+
onChange={input.onChange}
157+
onBlur={input.onBlur}
158+
onFocus={input.onFocus}
159+
min="1"
160+
error={meta.touched && meta.error}
161+
/>
162+
)}
163+
</Field>
164+
<Error name={`${id}.numberOfResources`} />
165+
</td>
166+
<td>
167+
<Field
168+
validate={validateExists}
169+
name={`${id}.durationWeeks`}
170+
initialValue={durationWeeks}
171+
>
172+
{({ input, meta }) => (
173+
<NumberInput
174+
name={input.name}
175+
value={input.value}
176+
onChange={input.onChange}
177+
onBlur={input.onBlur}
178+
onFocus={input.onFocus}
179+
min="4"
180+
error={meta.touched && meta.error}
181+
/>
182+
)}
183+
</Field>
184+
<Error name={`${id}.durationWeeks`} />
185+
</td>
186+
<td>
187+
{startMonth || startMonthVisible[id] ? (
188+
<>
189+
<Field
190+
name={`${id}.startMonth`}
191+
initialValue={new Date(startMonth).getTime()}
192+
>
193+
{(props) => (
194+
<MonthPicker
195+
name={props.input.name}
196+
value={props.input.value}
197+
onChange={props.input.onChange}
198+
onBlur={props.input.onBlur}
199+
onFocus={props.input.onFocus}
200+
/>
201+
)}
202+
</Field>
203+
<Error name={`${id}.startMonth`} />
204+
</>
205+
) : (
206+
<div styleName="flex-container">
207+
<button
208+
styleName="toggle-button"
209+
onClick={() =>
210+
setStartMonthVisible((prevState) => ({
211+
...prevState,
212+
[id]: true,
213+
}))
214+
}
215+
>
216+
Add Start Month
217+
</button>
218+
<InformationTooltip
219+
iconSize="14px"
220+
text="Requested start month for this position."
221+
/>
222+
</div>
155223
)}
156-
</Field>
157-
<Error name={`${id}.numberOfResources`} />
158-
</td>
159-
<td>
160-
<Field
161-
validate={validateExists}
162-
name={`${id}.durationWeeks`}
163-
initialValue={durationWeeks}
164-
>
165-
{({ input, meta }) => (
166-
<NumberInput
167-
name={input.name}
168-
value={input.value}
169-
onChange={input.onChange}
170-
onBlur={input.onBlur}
171-
onFocus={input.onFocus}
172-
min="1"
173-
error={meta.touched && meta.error}
174-
/>
175-
)}
176-
</Field>
177-
<Error name={`${id}.durationWeeks`} />
178-
</td>
179-
<td>
180-
{startMonth || startMonthVisible[id] ? (
181-
<>
182-
<Field
183-
name={`${id}.startMonth`}
184-
initialValue={new Date(startMonth).getTime()}
185-
>
186-
{(props) => (
187-
<MonthPicker
188-
name={props.input.name}
189-
value={props.input.value}
190-
onChange={props.input.onChange}
191-
onBlur={props.input.onBlur}
192-
onFocus={props.input.onFocus}
193-
/>
194-
)}
195-
</Field>
196-
<Error name={`${id}.startMonth`} />
197-
</>
198-
) : (
199-
<div styleName="flex-container">
200-
<button
201-
styleName="toggle-button"
202-
onClick={() =>
203-
setStartMonthVisible((prevState) => ({
204-
...prevState,
205-
[id]: true,
206-
}))
207-
}
208-
>
209-
Add Start Month
210-
</button>
211-
<InformationTooltip
212-
iconSize="14px"
213-
text="Requested start month for this position."
214-
/>
215-
</div>
216-
)}
217-
</td>
218-
<td>
219-
<button
220-
styleName="delete-role"
221-
onClick={() => {
222-
dispatch(deleteSearchedRole(id));
223-
}}
224-
>
225-
<IconCrossLight height="12px" width="12px" />
226-
</button>
227-
</td>
228-
</tr>
229-
))}
224+
</td>
225+
<td>
226+
<button
227+
styleName="delete-role"
228+
onClick={() => {
229+
dispatch(deleteSearchedRole(id));
230+
}}
231+
>
232+
<IconCrossLight height="12px" width="12px" />
233+
</button>
234+
</td>
235+
</tr>
236+
)
237+
)}
230238
</table>
231239
</div>
232240
</BaseCreateModal>

src/routes/CreateNewTeam/components/TeamDetailsModal/utils/validator.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ const validateNumber = (number) => {
1818
return undefined;
1919
};
2020

21+
const validateGreaterThan = (number, min) => {
22+
const isInvalidNum = validateNumber(number);
23+
if (isInvalidNum) return isInvalidNum;
24+
25+
return number < min
26+
? "Talent as a Service engagements have a 4 week minimum commitment."
27+
: undefined;
28+
};
29+
2130
const validateMonth = (monthString) => {
2231
const then = new Date(monthString);
2332
const now = new Date();
@@ -35,7 +44,7 @@ const validateMonth = (monthString) => {
3544
const validateRole = (role) => {
3645
const roleErrors = {};
3746
roleErrors.numberOfResources = validateNumber(role.numberOfResources);
38-
roleErrors.durationWeeks = validateNumber(role.durationWeeks);
47+
roleErrors.durationWeeks = validateGreaterThan(role.durationWeeks, 4);
3948
if (role.startMonth) {
4049
roleErrors.startMonth = validateMonth(role.startMonth);
4150
}

src/routes/CreateNewTeam/pages/InputJobDescription/index.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function InputJobDescription() {
5656
<SearchAndSubmit
5757
stages={stages}
5858
setStages={setStages}
59-
isCompletenessDisabled={jdString.length < 10 || jdString.length > 2000}
59+
isCompletenessDisabled={jdString.length < 10 || jdString.length > 100000}
6060
completenessStyle="input-job-description"
6161
searchObject={searchObject}
6262
page="jd"
@@ -88,8 +88,8 @@ function InputJobDescription() {
8888
placeholder="input job description"
8989
onChange={onEditChange}
9090
errorMessage={
91-
jdString.length > 2000
92-
? "Maximum of 2000 characters. Please reduce job description length."
91+
jdString.length > 100000
92+
? "Maximum of 100,000 characters. Please reduce job description length."
9393
: ""
9494
}
9595
/>

src/routes/CreateNewTeam/styles.module.scss

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
.logos {
22
position: fixed;
33
bottom: 15px;
4-
width: calc(100vw - 340px);
5-
margin-left: 35px;
4+
width: calc(100vw - 270px);
65
z-index: -1;
76
}
87

98
@media only screen and (max-width: 1023px) {
109
.logos {
11-
width: calc(100vw - 70px)
10+
width: 100vw;
1211
}
1312
}
1413

0 commit comments

Comments
 (0)