Display images, notes, sources for events as collapsible tabs (#158)

This commit is contained in:
czifumasa
2023-07-21 09:53:30 +02:00
committed by GitHub
parent 95f304eae3
commit de45eacbdb
7 changed files with 327 additions and 25 deletions

View File

@@ -27,7 +27,9 @@ function formatDate(date: TopolaDate, intl: IntlShape) {
formatOptions,
).format(dateObject);
return [translatedQualifier, translatedDate].join(' ');
return [translatedQualifier, translatedDate]
.filter((dateElement) => dateElement)
.join(' ');
}
function formatDateRage(dateRange: DateRange, intl: IntlShape) {

View File

@@ -291,3 +291,14 @@ export function getFileName(fileEntry: GedcomEntry): string | undefined {
return fileTitle && fileExtension && fileTitle + '.' + fileExtension;
}
export function getImageFileEntry(
objectEntry: GedcomEntry,
): GedcomEntry | undefined {
return objectEntry.tree.find(
(entry) =>
entry.tag === 'FILE' &&
entry.data.startsWith('http') &&
isImageFile(entry.data),
);
}