-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Move association and protected certificat to server c…
…omponent"" (#1054) * Revert "Revert "Move association and protected certificat to server component…" This reverts commit 7ad8552. * fix: notFoundInfo null should not display section Loader appears sooner. fix #1057 * fix: hide association & RNE for bots fix #1056 * fix: add no certificat found explanation when no certificats are found --------- Co-authored-by: Johan Girod <[email protected]>
- Loading branch information
1 parent
3f8460b
commit 7b925d1
Showing
26 changed files
with
262 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
app/(header-default)/labels-certificats/[slug]/_components/protected-certificats.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Suspense } from 'react'; | ||
import { OpqibiSection } from '#components/espace-agent-components/certifications/opqibi-section'; | ||
import { QualibatSection } from '#components/espace-agent-components/certifications/qualibat-section'; | ||
import { QualifelecSection } from '#components/espace-agent-components/certifications/qualifelec-section'; | ||
import { | ||
IAPINotRespondingError, | ||
isAPINotResponding, | ||
} from '#models/api-not-responding'; | ||
import { IUniteLegale } from '#models/core/types'; | ||
import { getOpqibi } from '#models/espace-agent/certificats/opqibi'; | ||
import { getQualibat } from '#models/espace-agent/certificats/qualibat'; | ||
import { getQualifelec } from '#models/espace-agent/certificats/qualifelec'; | ||
import { ISession } from '#models/user/session'; | ||
|
||
type IProps = { | ||
uniteLegale: IUniteLegale; | ||
session: ISession | null; | ||
hasOtherCertificates: boolean; | ||
}; | ||
|
||
export async function ProtectedCertificats({ | ||
uniteLegale, | ||
session, | ||
hasOtherCertificates, | ||
}: IProps) { | ||
const opqibi = getOpqibi(uniteLegale.siren, session?.user?.siret); | ||
const qualifelec = getQualifelec( | ||
uniteLegale.siege.siret, | ||
session?.user?.siret | ||
); | ||
const qualibat = getQualibat(uniteLegale.siege.siret, session?.user?.siret); | ||
|
||
return ( | ||
<> | ||
{!hasOtherCertificates && ( | ||
<Suspense> | ||
<NoCertificatsWarning certificats={[opqibi, qualifelec, qualibat]} /> | ||
</Suspense> | ||
)} | ||
<QualibatSection qualibat={qualibat} /> | ||
<QualifelecSection qualifelec={qualifelec} /> | ||
<OpqibiSection opqibi={opqibi} /> | ||
</> | ||
); | ||
} | ||
|
||
async function NoCertificatsWarning({ | ||
certificats: certificatsPromise, | ||
}: { | ||
certificats: Promise<IAPINotRespondingError | unknown>[]; | ||
}) { | ||
const certificats = await Promise.all(certificatsPromise); | ||
if (certificats.every((certificat) => isAPINotResponding(certificat))) { | ||
return <p>Aucun certificat n’a été trouvé pour cette entreprise.</p>; | ||
} | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.