import type { Organization } from "../../../shared/api/schemas"; import { Section, TrustLevel } from "../../../shared/ui"; import { candidateCardLevelLabels, organizationTrustLevel } from "../model/verification-labels"; import styles from "./candidate-card-preview.module.css"; type CandidateCard = Organization["candidate_card"]; type CandidateCardPreviewProps = { card: CandidateCard; }; const contactLabels = { website: "Сайт", email: "Почта для связи", phone: "Телефон компании", telegram: "Telegram компании", } as const; type CompanyCardViewProps = { card: CandidateCard; /** Level of the company name heading inside the surrounding outline. */ headingLevel?: 3 | 4; }; /** * The card of the organization exactly as a candidate sees it, built from * `candidate_card` that the server returns to the owner. It shows no * membership, role, account, or verification basis. */ export function CompanyCardView({ card, headingLevel = 3 }: CompanyCardViewProps) { const contacts = (Object.keys(contactLabels) as (keyof typeof contactLabels)[]).flatMap((key) => { const value = card.contacts[key]; return value ? [{ label: contactLabels[key], value }] : []; }); const NameHeading = headingLevel === 3 ? "h3" : "h4"; const SubHeading = headingLevel === 3 ? "h4" : "h5"; return (
{card.name}

{card.sphere ?

{card.sphere}

: null}
{card.description ?

{card.description}

: null} {contacts.length > 0 ? (
{contacts.map(({ label, value }) => (
{label}
{value}
))}
) : null} {card.representatives && card.representatives.length > 0 ? (
Представители компании
) : null}
); } export function CandidateCardPreview({ card }: CandidateCardPreviewProps) { return (
); }