20 lines
981 B
TypeScript
20 lines
981 B
TypeScript
import type { PersonCard } from '../net/api.ts';
|
|
import { t } from '../i18n/strings.ts';
|
|
import { appendNeeds, appendPairs, appendRelatives, appendTags, section } from './personCardDom.ts';
|
|
|
|
export function fillOverview(parent: HTMLElement, card: PersonCard, onRelative: (id: string) => void): void {
|
|
appendPairs(parent, t('peopleBody'), card.body);
|
|
appendPairs(parent, t('peopleSkills'), card.skills);
|
|
appendTags(parent, t('peopleTraits'), card.traits.map((row) => row.label));
|
|
appendNeeds(parent, t('peopleNeeds'), card.needs);
|
|
|
|
const family = section(t('peopleFamily'));
|
|
appendRelatives(family, t('peopleParents'), card.family.parents, onRelative);
|
|
appendRelatives(family, t('peopleChildren'), card.family.children, onRelative);
|
|
appendRelatives(family, t('peopleSiblings'), card.family.siblings, onRelative);
|
|
appendRelatives(family, t('peoplePartners'), card.family.partners, onRelative);
|
|
if (family.childElementCount > 1) {
|
|
parent.append(family);
|
|
}
|
|
}
|