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

Commit 9f52f0b

Browse files
authored
Merge pull request #88 from yoution/issue-35
fix: issue #35
2 parents aff92db + abac3ef commit 9f52f0b

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

src/routes/MyTeamsDetails/components/TeamPositions/index.jsx

+13-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import SkillsList, { skillShape } from "components/SkillsList";
1010
import Button from "components/Button";
1111
import { POSITION_STATUS, POSITION_STATUS_TO_TEXT, RATE_TYPE } from "constants";
1212
import "./styles.module.scss";
13-
import { formatJobDate } from "utils/format";
13+
import { formatJobDate, formatOpenPositions } from "utils/format";
1414
import { Link } from "@reach/router";
1515

16-
const TeamPositions = ({ teamId, positions }) => {
16+
const TeamPositions = ({ teamId, positions, resources }) => {
1717
return (
1818
<div styleName="team-positions">
1919
<div styleName="team-position-header">
@@ -41,6 +41,7 @@ const TeamPositions = ({ teamId, positions }) => {
4141
<strong>{position.title}</strong>
4242
</Link>
4343
<SkillsList skills={position.skills} limit={5} />
44+
<div>{formatOpenPositions(position, resources)}</div>
4445
</div>
4546
<div styleName="table-group-first-inner">
4647
<div styleName="table-cell cell-date">
@@ -89,6 +90,16 @@ TeamPositions.propTypes = {
8990
status: PT.oneOf(Object.values(POSITION_STATUS)),
9091
})
9192
),
93+
resources: PT.arrayOf(
94+
PT.shape({
95+
id: PT.string,
96+
handle: PT.string,
97+
firstName: PT.string,
98+
lastName: PT.string,
99+
skills: PT.arrayOf(skillShape),
100+
skillsMatched: PT.number,
101+
})
102+
),
92103
};
93104

94105
export default TeamPositions;

src/routes/MyTeamsDetails/index.jsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ const MyTeamsDetails = ({ teamId }) => {
2828
<PageHeader title={team.name} backTo="/taas/myteams" />
2929
<TeamSummary team={team} />
3030
<TeamMembers team={team} />
31-
<TeamPositions positions={team.jobs || []} teamId={teamId} />
31+
<TeamPositions
32+
positions={team.jobs || []}
33+
teamId={teamId}
34+
resources={team.resources}
35+
/>
3236
</>
3337
)}
3438
</Page>

src/utils/format.js

+20
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,26 @@ export const formatPageTitle = (pageTitle) => {
201201
return formattedPageTitle;
202202
};
203203

204+
/**
205+
* Format open positions.
206+
*
207+
* @param {Object} job job object
208+
* @param {Array} resources resource list
209+
*
210+
* @returns {string} open positions string
211+
*/
212+
export const formatOpenPositions = (job, resources) => {
213+
const jobResources = _.filter(resources, { jobId: job.id });
214+
if (jobResources.length === 0) {
215+
return `${formatPlural(job.numPositions, "open position")}`;
216+
} else {
217+
return `${jobResources.length} / ${formatPlural(
218+
job.numPositions,
219+
"open position"
220+
)}`;
221+
}
222+
};
223+
204224
/**
205225
* Format job date
206226
*

0 commit comments

Comments
 (0)