Skip to content

Commit

Permalink
🐛 Fix skill display issue (#582)
Browse files Browse the repository at this point in the history
* comment filter

* replace a tag with span when there is no marketing url
  • Loading branch information
Aibono1225 authored Jan 4, 2024
1 parent 7a8d28f commit 1454f96
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
13 changes: 11 additions & 2 deletions src/components/skills-list/skills-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ const SkillsList = ({ crmData }) => {
const intermediateSkills = crmData?.skills?.intermediateSkills ?? [];
const advancedSkills = crmData?.skills?.advancedSkills ?? [];

const SkillLink = ({ skill }) => {
return skill.marketingPageUrl ? (
<a href={skill.marketingPageUrl}>{skill.service}</a>
) : (
<span>{skill.service}</span>
);
};

return (
<>
{((advancedSkills && !!advancedSkills.length) ||
Expand All @@ -14,7 +22,7 @@ const SkillsList = ({ crmData }) => {
<span>
{advancedSkills.map((skill, i, arr) => (
<strong key={`advancedSkill-${i}`}>
<a href={skill.marketingPageUrl}>{skill.service}</a>
<SkillLink skill={skill} />
{(i !== arr.length - 1 ||
(i === arr.length - 1 && intermediateSkills.length > 0)) && (
<span className="skill-separator"> | </span>
Expand All @@ -23,7 +31,7 @@ const SkillsList = ({ crmData }) => {
))}
{intermediateSkills.map((skill, i, arr) => (
<span key={`intermediateSkill-${i}`}>
<a href={skill.marketingPageUrl}>{skill.service}</a>
<SkillLink skill={skill} />
{i !== arr.length - 1 && (
<span className="skill-separator"> | </span>
)}
Expand All @@ -39,6 +47,7 @@ const SkillsList = ({ crmData }) => {

SkillsList.propTypes = {
crmData: PropTypes.object.isRequired,
skill: PropTypes.object.isRequired,
};

export default SkillsList;
43 changes: 21 additions & 22 deletions src/helpers/CRMApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,27 @@ const getUsersSkills = async () => {
});

const usersSkillsReq = await axios.get(`${crmUrl}/ssw_userskills`);
const usersSkills = usersSkillsReq.data.value
.map((us) => {
const skill = skills.find((s) => s.ssw_skillid === us._ssw_skillid_value);
const marketingPage =
skill?.[
'_ssw_marketingpage_value@OData.Community.Display.V1.FormattedValue'
] ?? '';

const userSkill = {
userId: us._ssw_systemuserid_value,
experienceLevel: getExperienceLevel(us.ssw_level),
sortOrder: us.ssw_sortorder || null,
technology: skill?.ssw_name ?? '',
marketingPage,
marketingPageUrl: consultingPages[marketingPage],
published:
skill?.['[email protected]'] ?? '',
};

return userSkill;
})
.filter((us) => us.published === 'Published');
const usersSkills = usersSkillsReq.data.value.map((us) => {
const skill = skills.find((s) => s.ssw_skillid === us._ssw_skillid_value);
const marketingPage =
skill?.[
'_ssw_marketingpage_value@OData.Community.Display.V1.FormattedValue'
] ?? '';

const userSkill = {
userId: us._ssw_systemuserid_value,
experienceLevel: getExperienceLevel(us.ssw_level),
sortOrder: us.ssw_sortorder || null,
technology: skill?.ssw_name ?? '',
marketingPage,
marketingPageUrl: consultingPages[marketingPage],
published:
skill?.['[email protected]'] ?? '',
};

return userSkill;
});
// .filter((us) => us.published === 'Published');

return usersSkills;
};
Expand Down

0 comments on commit 1454f96

Please sign in to comment.