import { Button, ErrorState, ForbiddenState, isAccessDenied, LoadingState, StatusView, TrustLevel, } from "../../../shared/ui"; import { useMatchCandidateCard, useMatchCandidateEvidence } from "../api/card"; import { describeCardFailure } from "../model/card-failure"; import { presentCard, presentEvidence } from "../model/card-presentation"; import styles from "./candidate-card-details.module.css"; type CandidateCardDetailsProps = { id: string; accountId: string; organizationId: string; candidateHandle: string; /** False keeps the panel mounted but out of the page, so closing does not read the card again. */ open: boolean; }; function ReadFailure({ error, isRetrying, onRetry, fallbackTitle, }: { error: unknown; isRetrying: boolean; onRetry: () => void; fallbackTitle: string; }) { const failure = describeCardFailure(error); if (failure) { return ( {isRetrying ? "Повторяем..." : "Повторить"} ) : null } /> ); } if (isAccessDenied(error)) return ; return ( ); } /** * The full anonymous card of one result and its evidence section, read from * the card endpoints when the employer opens it. The card belongs to the * whole candidate, so it lists every specialization the candidate published, * each with its own confirmation status. */ export function CandidateCardDetails({ id, accountId, organizationId, candidateHandle, open, }: CandidateCardDetailsProps) { const card = useMatchCandidateCard(accountId, organizationId, candidateHandle, true); const hasCategories = Boolean(card.data?.categories && card.data.categories.length > 0); const evidence = useMatchCandidateEvidence( accountId, organizationId, candidateHandle, card.isSuccess && hasCategories, ); const details = card.data ? presentCard(card.data) : null; const facts = evidence.data ? presentEvidence(evidence.data) : null; return ( ); }