Skip to content

Commit

Permalink
🐛 Pas vraiment un fix sur la timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
VioMrqs committed Sep 18, 2024
1 parent 8842487 commit 2d35b18
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { IdentifiantProjet } from '@potentiel-domain/common';

export type TimelineProps = {
projectEventList: ProjectEventListDTO;
identifiantProjet: IdentifiantProjet.RawType
identifiantProjet: IdentifiantProjet.RawType;
};

type ItemProps =
Expand All @@ -67,7 +67,7 @@ export const Timeline = ({
events,
project: { status },
},
identifiantProjet
identifiantProjet,
}: TimelineProps) => {
const itemProps: ItemProps[] = [
extractDesignationItemProps(events, status, identifiantProjet),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,54 +1,59 @@
import React from 'react';
import { ItemDate, PastIcon, ItemTitle, ContentArea } from '.';
import { DesignationItemProps } from '../helpers/extractDesignationItemProps';
import { DownloadLink } from '../..';
import { afficherDate } from '../../../helpers';

// TODO: revoir cette partie
// en trouvant la date de génération (date de notification) ?

export const DesignationItem = ({
certificate,
role,
date,
projectStatus,
}: DesignationItemProps) => (
<>
<PastIcon />
<ContentArea>
<ItemDate date={date} />
<ItemTitle title="Notification des résultats" />
{certificate ? (
<Certificate {...{ certificate, role, projectStatus }} />
) : (
role === 'porteur-projet' && <span>Votre attestation sera disponible sous 24h</span>
)}
</ContentArea>
</>
);

type CertificateProps = {
certificate: Exclude<DesignationItemProps['certificate'], undefined>;
projectStatus: DesignationItemProps['projectStatus'];
identifiantProjet,
}: DesignationItemProps) => {
return (
<>
<PastIcon />
<ContentArea>
<ItemDate date={date} />
<ItemTitle title="Notification des résultats" />
{/* <Attestation {...{ certificate, projectStatus, identifiantProjet }} /> */}
</ContentArea>
</>
);
};

const Certificate = ({ certificate, projectStatus }: CertificateProps) => {
const { status } = certificate;
// type CertificateProps = {
// certificate?: Exclude<DesignationItemProps['certificate'], undefined>;
// projectStatus: DesignationItemProps['projectStatus'];
// identifiantProjet: DesignationItemProps['identifiantProjet'];
// };

if (status === 'not-applicable') {
return <span>Attestation non disponible pour cette période</span>;
}
// const Attestation = ({ certificate, projectStatus, identifiantProjet }: CertificateProps) => {
// const { status } = certificate;

const { url: fileUrl, date } = certificate;
// if (status === 'not-applicable') {
// return <span>Attestation non disponible pour cette période</span>;
// }

const urlTitle =
projectStatus === 'Eliminé'
? status === 'generated'
? `avis de rejet (édité`
: `avis de rejet (transmis`
: status === 'generated'
? `attestation de désignation (éditée`
: `attestation de désignation (transmise`;
return (
<DownloadLink {...{ fileUrl }}>{`Télécharger l'${urlTitle} le ${afficherDate(
date,
)})`}</DownloadLink>
);
};
//const { url: fileUrl, date } = certificate;

// const urlTitle =
// projectStatus === 'Eliminé'
// ? status === 'generated'
// ? `avis de rejet (édité`
// : `avis de rejet (transmis`
// : status === 'generated'
// ? `attestation de désignation (éditée`
// : `attestation de désignation (transmise`;

// return (
// <DownloadLinkButton
// fileUrl={Routes.Candidature.téléchargerAttestation(identifiantProjet)}
// className="m-auto"
// >
// {`Télécharger l'${urlTitle}}) le ${afficherDate(
// date,)})`}
// </DownloadLinkButton>
// );
// };
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { or } from '../../../../core/utils';
import { Routes } from '@potentiel-applications/routes';
import { IdentifiantProjet } from '@potentiel-domain/common';

// TODO: reprendre cette partie

export type DesignationItemProps = {
type: 'designation';
date: number;
Expand Down

0 comments on commit 2d35b18

Please sign in to comment.