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

Commit 4b8ede8

Browse files
committed
Update styling of RoleDetailsModal.
Client-side validation for InputJobDescription. Ensure custom/niche role does not appear in SelectRole page. Update ResultCard to read matching rate from search result.
1 parent 0d8961e commit 4b8ede8

File tree

10 files changed

+67
-31
lines changed

10 files changed

+67
-31
lines changed

src/components/MarkdownEditor/index.jsx

+3
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ const MarkdownEditor = (props) => {
5353
]}
5454
plugins={[]}
5555
/>
56+
{props.errorMessage && (
57+
<div styleName="message">{props.errorMessage}</div>
58+
)}
5659
</div>
5760
);
5861
};

src/components/MarkdownEditor/styles.module.scss

+16-15
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,6 @@
1212
overflow-y: auto;
1313
background: #fafafb;
1414
}
15-
.message {
16-
@include font-roboto;
17-
18-
width: 100%;
19-
text-align: center;
20-
min-height: 40px;
21-
line-height: 20px;
22-
padding: 9px 10px;
23-
margin: 10px 0 5px;
24-
font-size: 14px;
25-
color: #ff5b52;
26-
border: 1px solid #ffd5d1;
27-
cursor: auto;
28-
outline: none;
29-
}
3015
}
3116
.editor-container {
3217
:global {
@@ -72,3 +57,19 @@
7257
}
7358
}
7459
}
60+
61+
.message {
62+
@include font-roboto;
63+
64+
width: 100%;
65+
text-align: center;
66+
min-height: 40px;
67+
line-height: 20px;
68+
padding: 9px 10px;
69+
margin: 10px 0 5px;
70+
font-size: 14px;
71+
color: #ff5b52;
72+
border: 1px solid #ffd5d1;
73+
cursor: auto;
74+
outline: none;
75+
}

src/constants/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -360,3 +360,8 @@ export const MAX_ALLOWED_INTERVIEWS = 3;
360360
* Matching rate to show in CreateNewTeam ResultCard
361361
*/
362362
export const MATCHING_RATE = "80";
363+
364+
/**
365+
* Custom role names to remove from RoleList component
366+
*/
367+
export const CUSTOM_ROLE_NAMES = ["custom", "niche"];

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const CircularProgressBar = ({ size, progress, children, strokeWidth }) => {
1414
const radius = size / 2 - strokeWidth / 2;
1515
const circumference = 2 * Math.PI * radius;
1616
useEffect(() => {
17-
const progressOffset = ((100 - progress) / 100) * circumference;
17+
const progressOffset = (1 - progress) * circumference;
1818
setOffset(progressOffset);
1919
circleRef.current.style = "transition: stroke-dashoffset 850ms ease-in-out";
2020
}, [setOffset, progress, circumference, offset]);

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

+10-5
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,23 @@ function formatRate(value) {
2323
return formatMoney(value);
2424
}
2525

26+
function formatPercent(value) {
27+
return `${Math.round(value * 100)}%`;
28+
}
29+
2630
function ResultCard({ role }) {
2731
const {
2832
numberOfMembersAvailable,
2933
isExternalMember,
34+
matchingRate,
3035
rates: [rates],
3136
} = role;
3237
const [userHandle, setUserHandle] = useState(null);
3338
const [showRates, setShowRates] = useState(false);
3439

3540
useEffect(() => {
3641
getAuthUserProfile().then((res) => {
37-
setUserHandle(res.handle || null);
42+
setUserHandle(res?.handle || null);
3843
});
3944
}, []);
4045

@@ -44,8 +49,8 @@ function ResultCard({ role }) {
4449
<IconEarthCheck />
4550
<h3>We have matching profiles</h3>
4651
<p>
47-
We have qualified candidates who match {MATCHING_RATE}% or more of
48-
your job requirements.
52+
We have qualified candidates who match {formatPercent(matchingRate)}
53+
{matchingRate < 1 ? " or more " : " "} of your job requirements.
4954
</p>
5055
<Curve styleName="curve" />
5156
<IconEarthCheck styleName="transparent-icon" />
@@ -217,11 +222,11 @@ function ResultCard({ role }) {
217222
<div>
218223
<CircularProgressBar
219224
size="160"
220-
progress={MATCHING_RATE}
225+
progress={matchingRate}
221226
strokeWidth="6"
222227
children={
223228
<div styleName="progressbar-child">
224-
<h4>{MATCHING_RATE}%</h4>
229+
<h4>{formatPercent(matchingRate)}</h4>
225230
<p>Matching rate</p>
226231
</div>
227232
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function RoleDetailsModal({ roleId, open, onClose }) {
4848
[role, imgError]
4949
);
5050

51-
const skills = role ? role.listOfSkills : [];
51+
const skills = role && role.listOfSkills ? role.listOfSkills : [];
5252

5353
const hideSkills = () => {
5454
onClose();

src/routes/CreateNewTeam/components/RoleDetailsModal/styles.module.scss

+17-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,23 @@
1414
}
1515

1616
.markdown-container {
17-
// not adds specificity to override style
18-
p:not(table) {
19-
@include font-roboto;
20-
color: #2a2a2a;
21-
font-size: 16px;
22-
line-height: 26px;
17+
:global {
18+
// resets styles in markdown-viewer
19+
.tui-editor-contents {
20+
@include font-roboto;
21+
color: #2a2a2a;
22+
font-size: 16px;
23+
line-height: 26px;
24+
ul {
25+
list-style: initial;
26+
>li {
27+
margin-bottom: 10px;
28+
&::before {
29+
background: none;
30+
}
31+
}
32+
}
33+
}
2334
}
2435
}
2536

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import NoMatchingProfilesResultCard from "../NoMatchingProfilesResultCard";
1717
import { searchRoles } from "services/teams";
1818
import { setCurrentStage } from "utils/helpers";
1919
import { addRoleSearchId, addSearchedRole } from "../../actions";
20+
import { CUSTOM_ROLE_NAMES } from "constants";
2021
import "./styles.module.scss";
2122

2223
function SearchContainer({
@@ -51,7 +52,7 @@ function SearchContainer({
5152
.then((res) => {
5253
const name = _.get(res, "data.name");
5354
const searchId = _.get(res, "data.roleSearchRequestId");
54-
if (name && !name.toLowerCase().includes("niche")) {
55+
if (name && !CUSTOM_ROLE_NAMES.includes(name.toLowerCase())) {
5556
setMatchingRole(res.data);
5657
dispatch(addSearchedRole({ searchId, name }));
5758
} else if (searchId) {

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function InputJobDescription() {
2626
<SearchAndSubmit
2727
stages={stages}
2828
setStages={setStages}
29-
isCompletenessDisabled={jdString.length < 10}
29+
isCompletenessDisabled={jdString.length < 10 || jdString.length > 255}
3030
completenessStyle="input-job-description"
3131
searchObject={{ jobDescription: jdString }}
3232
toRender={
@@ -40,6 +40,11 @@ function InputJobDescription() {
4040
height="482px"
4141
placeholder="input job description"
4242
onChange={onEditChange}
43+
errorMessage={
44+
jdString.length > 255
45+
? "Maximum of 255 characters. Please reduce job description length."
46+
: ""
47+
}
4348
/>
4449
</div>
4550
</>

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ import React, { useCallback, useState } from "react";
88
import { useData } from "hooks/useData";
99
import RolesList from "./components/RolesList";
1010
import { getRoles } from "services/roles";
11+
import { CUSTOM_ROLE_NAMES } from "constants";
1112
import LoadingIndicator from "components/LoadingIndicator";
1213
import RoleDetailsModal from "../../components/RoleDetailsModal";
1314
import SearchAndSubmit from "../../components/SearchAndSubmit";
1415

16+
// Remove custom roles from role list
17+
const removeCustomRoles = (roles) =>
18+
roles.filter(({ name }) => !CUSTOM_ROLE_NAMES.includes(name.toLowerCase()));
19+
1520
function SelectRole() {
1621
const [stages, setStages] = useState([
1722
{ name: "Select a Role", isCurrent: true },
@@ -47,7 +52,7 @@ function SelectRole() {
4752
toRender={
4853
<>
4954
<RolesList
50-
roles={roles}
55+
roles={removeCustomRoles(roles)}
5156
selectedRoleId={selectedRoleId}
5257
toggleRole={toggleRole}
5358
onDescriptionClick={onDescriptionClick}

0 commit comments

Comments
 (0)