feat(invitations): add the invitation compose screen with a candidate-side preview
This commit is contained in:
1 parent
1a067221f7
commit
cb08f212cc
35 files changed
+4170
-67
No files matched your search
@@ -16,55 +16,74 @@ const contactLabels = {
|
||||
telegram: "Telegram компании",
|
||||
} as const;
|
||||
|
||||
export function CandidateCardPreview({ card }: CandidateCardPreviewProps) {
|
||||
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 (
|
||||
<article className={styles.card} aria-label="Предпросмотр карточки компании">
|
||||
<header className={styles.header}>
|
||||
<div>
|
||||
<NameHeading className={styles.name}>{card.name}</NameHeading>
|
||||
<p className={styles.level}>
|
||||
<TrustLevel
|
||||
level={organizationTrustLevel[card.verification_level]}
|
||||
label={candidateCardLevelLabels[card.verification_level]}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
{card.sphere ? <p className={styles.sphere}>{card.sphere}</p> : null}
|
||||
</header>
|
||||
{card.description ? <p className={styles.description}>{card.description}</p> : null}
|
||||
{contacts.length > 0 ? (
|
||||
<dl className={styles.contacts}>
|
||||
{contacts.map(({ label, value }) => (
|
||||
<div className={styles.contact} key={label}>
|
||||
<dt>{label}</dt>
|
||||
<dd>{value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
) : null}
|
||||
{card.representatives && card.representatives.length > 0 ? (
|
||||
<div className={styles.representatives}>
|
||||
<SubHeading>Представители компании</SubHeading>
|
||||
<ul>
|
||||
{card.representatives.map((representative, index) => (
|
||||
<li key={`${representative.name}-${index}`}>
|
||||
<span>{representative.name}</span>
|
||||
<span>{representative.job_title}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
) : null}
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
export function CandidateCardPreview({ card }: CandidateCardPreviewProps) {
|
||||
return (
|
||||
<Section
|
||||
title="Так карточку увидит кандидат"
|
||||
description="Проверьте описание и контакты, которые увидит кандидат."
|
||||
>
|
||||
<article className={styles.card} aria-label="Предпросмотр карточки компании">
|
||||
<header className={styles.header}>
|
||||
<div>
|
||||
<h3 className={styles.name}>{card.name}</h3>
|
||||
<p className={styles.level}>
|
||||
<TrustLevel
|
||||
level={organizationTrustLevel[card.verification_level]}
|
||||
label={candidateCardLevelLabels[card.verification_level]}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
{card.sphere ? <p className={styles.sphere}>{card.sphere}</p> : null}
|
||||
</header>
|
||||
{card.description ? <p className={styles.description}>{card.description}</p> : null}
|
||||
{contacts.length > 0 ? (
|
||||
<dl className={styles.contacts}>
|
||||
{contacts.map(({ label, value }) => (
|
||||
<div className={styles.contact} key={label}>
|
||||
<dt>{label}</dt>
|
||||
<dd>{value}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
) : null}
|
||||
{card.representatives && card.representatives.length > 0 ? (
|
||||
<div className={styles.representatives}>
|
||||
<h4>Представители компании</h4>
|
||||
<ul>
|
||||
{card.representatives.map((representative, index) => (
|
||||
<li key={`${representative.name}-${index}`}>
|
||||
<span>{representative.name}</span>
|
||||
<span>{representative.job_title}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
) : null}
|
||||
</article>
|
||||
<CompanyCardView card={card} />
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user