Skip to content

Commit

Permalink
[EN-6289] feat(cv): formations exp preview corrections (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulEntourage authored Sep 11, 2023
1 parent daaf255 commit 619e36c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ export const FormationsProfileCard = ({
...sortedFormations,
{
...fields,
dateStart: moment(fields.dateStart).toDate() as Date,
dateEnd: moment(fields.dateEnd).toDate() as Date,
dateStart: fields.dateStart
? (moment(fields.dateStart).toDate() as Date)
: null,
dateEnd: fields.dateEnd
? (moment(fields.dateEnd).toDate() as Date)
: null,
skills: fields.skills?.map((skill, i) => {
return {
name: skill.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ export const CVModalPreview = ({ imageUrl, cv }: ModalPreviewProps) => {
const [cvPreview, setCVPreview] = useState<CV>(cv);

useEffect(() => {
setCVPreview({ ...cv, urlImg: imageUrl });
const previewHash = Date.now();
const status = cv.status === 'Draft' ? 'Progress' : cv.status;
const baseUrl = `${process.env.AWSS3_IMAGE_DIRECTORY}${cv.UserId}.${status}`;
setCVPreview({ ...cv, urlImg: `${baseUrl}.jpg?${previewHash}` });
}, [imageUrl, cv]);

return (
<ModalGeneric title="Prévisualisation du CV" fullWidth>
<PageCVContent cv={cvPreview} actionDisabled />
<PageCVContent cv={cvPreview} actionDisabled isPreview />
<div className="uk-modal-footer uk-padding-remove-horizontal uk-padding-remove-bottom uk-margin-medium-top">
<Button onClick={onClose} style="default">
Fermer
Expand Down
20 changes: 12 additions & 8 deletions src/components/partials/CV/PageCvContent/PageCVContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ interface openedPanelType {
interface PageCVContentProps {
cv: CV;
actionDisabled?: boolean;
isPreview?: boolean;
}

export const PageCVContent = ({
cv,
actionDisabled = false,
isPreview = false,
}: PageCVContentProps) => {
const locations =
cv.locations && cv.locations.length > 0 ? sortByOrder(cv.locations) : [];
Expand All @@ -79,12 +81,14 @@ export const PageCVContent = ({

return (
<StyledCVPageContent>
<Link href="/candidats?employed=false" scroll={false} shallow passHref>
<StyledBackLink>
<Icon name="chevron-left" />
&nbsp;Retour à la page candidats
</StyledBackLink>
</Link>
{!isPreview && (
<Link href="/candidats?employed=false" scroll={false} shallow passHref>
<StyledBackLink>
<Icon name="chevron-left" />
&nbsp;Retour à la page candidats
</StyledBackLink>
</Link>
)}
<StyledCVPageContentHeader className={!isDesktop ? 'mobile' : ''}>
<div id="header-picture-share">
<StyledCVProfilePicture
Expand Down Expand Up @@ -402,7 +406,7 @@ export const PageCVContent = ({
<div>{experience.description}</div>
)}
<div>
{experience.skills.map(({ name, id }) => {
{experience.skills?.map(({ name, id }) => {
return (
<StyledSkillTag key={id}>{name}</StyledSkillTag>
);
Expand Down Expand Up @@ -487,7 +491,7 @@ export const PageCVContent = ({
<div>{formation.description}</div>
)}
<div>
{formation.skills.map(({ name, id }) => {
{formation.skills?.map(({ name, id }) => {
return (
<StyledSkillTag key={id}>{name}</StyledSkillTag>
);
Expand Down

0 comments on commit 619e36c

Please sign in to comment.