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

Commit cc48edc

Browse files
committed
fix: use internal links instead of "a"
- also, fix User profile link and refactor
1 parent ec0e3b6 commit cc48edc

File tree

5 files changed

+23
-26
lines changed

5 files changed

+23
-26
lines changed

src/components/User/index.jsx

+17-13
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,27 @@ import PT from "prop-types";
99
import "./styles.module.scss";
1010
import { formatFullName } from "utils/format";
1111
import { TOPCODER_COMMUNITY_WEBSITE_URL } from "../../../config";
12+
import { Link } from "@reach/router";
1213

13-
const User = ({ user, hideFullName = false }) => {
14-
{
15-
console.log(user);
16-
}
14+
const User = ({ user, hideFullName = false, handleLinkTo }) => {
1715
return (
1816
<div styleName="user">
1917
<Avatar {...user} />
2018
<div styleName="user-details">
21-
<a
22-
href={
23-
user.teamId
24-
? `/taas/myteams/${user.teamId}/rb/${user.id}`
25-
: `${TOPCODER_COMMUNITY_WEBSITE_URL}/members/${user.handle}`
26-
}
27-
>
28-
<strong>{user.handle}</strong>
29-
</a>
19+
{/* if "handleLinkTo" is provided, use it as internal link, otherwise as external profile link */}
20+
{handleLinkTo ? (
21+
<Link to={handleLinkTo}>
22+
<strong>{user.handle}</strong>
23+
</Link>
24+
) : (
25+
<a
26+
href={`${TOPCODER_COMMUNITY_WEBSITE_URL}/members/${user.handle}`}
27+
target="_blank"
28+
>
29+
<strong>{user.handle}</strong>
30+
</a>
31+
)}
32+
3033
{!hideFullName && (
3134
<div>{formatFullName(user.firstName, user.lastName)}</div>
3235
)}
@@ -43,6 +46,7 @@ User.propTypes = {
4346
handle: PT.string,
4447
}),
4548
hideFullName: PT.bool,
49+
handleLinkTo: PT.string,
4650
};
4751

4852
export default User;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ const TeamMembers = ({ team }) => {
115115
user={{
116116
...member,
117117
photoUrl: member.photo_url,
118-
teamId: team.id,
119118
}}
119+
handleLinkTo={`/taas/myteams/${team.id}/rb/${member.id}`}
120120
/>
121121
</div>
122122
<div styleName="table-group-first-inner">

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Button from "components/Button";
1111
import { POSITION_STATUS, POSITION_STATUS_TO_TEXT, RATE_TYPE } from "constants";
1212
import "./styles.module.scss";
1313
import { formatDateRange } from "utils/format";
14+
import { Link } from "@reach/router";
1415

1516
const TeamPositions = ({ teamId, positions }) => {
1617
return (
@@ -33,12 +34,12 @@ const TeamPositions = ({ teamId, positions }) => {
3334
<div styleName="table-row" key={index}>
3435
<div styleName="table-group-first">
3536
<div styleName="table-cell cell-skills">
36-
<a
37+
<Link
3738
styleName="job-title"
38-
href={`/taas/myteams/${teamId}/positions/${position.id}`}
39+
to={`/taas/myteams/${teamId}/positions/${position.id}`}
3940
>
4041
<strong>{position.title}</strong>
41-
</a>
42+
</Link>
4243
<SkillsList skills={position.skills} limit={5} />
4344
</div>
4445
<div styleName="table-group-first-inner">

src/routes/PositionDetails/components/PositionCandidates/index.jsx

+1-8
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,7 @@ const populateSkillsMatched = (position, candidate) => ({
5555
skillsMatched: _.intersectionBy(position.skills, candidate.skills, "id"),
5656
});
5757

58-
const PositionCandidates = ({
59-
position,
60-
candidateStatus,
61-
updateCandidate,
62-
teamId,
63-
}) => {
58+
const PositionCandidates = ({ position, candidateStatus, updateCandidate }) => {
6459
const { candidates } = position;
6560
const [sortBy, setSortBy] = useState(CANDIDATES_SORT_BY.SKILL_MATCHED);
6661
const filteredCandidates = useMemo(
@@ -170,7 +165,6 @@ const PositionCandidates = ({
170165
user={{
171166
...candidate,
172167
photoUrl: candidate.photo_url,
173-
teamId: teamId,
174168
}}
175169
hideFullName
176170
/>
@@ -247,7 +241,6 @@ const PositionCandidates = ({
247241
PositionCandidates.propType = {
248242
position: PT.object,
249243
candidateStatus: PT.oneOf(Object.values(CANDIDATE_STATUS)),
250-
teamId: PT.string.isRequired,
251244
};
252245

253246
export default PositionCandidates;

src/routes/PositionDetails/index.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ const PositionDetails = ({ teamId, positionId }) => {
5050
position={position}
5151
candidateStatus={candidateStatus}
5252
updateCandidate={updateCandidate}
53-
teamId={teamId}
5453
/>
5554
</>
5655
)}

0 commit comments

Comments
 (0)