mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-08-03 09:31:52 +00:00
WikiTree: Display decade if date is not available
WikiTree: Get image thumbnail instead of full image.
This commit is contained in:
@@ -60,6 +60,8 @@ interface Person {
|
|||||||
DeathDate: string;
|
DeathDate: string;
|
||||||
BirthLocation: string;
|
BirthLocation: string;
|
||||||
DeathLocation: string;
|
DeathLocation: string;
|
||||||
|
BirthDateDecade: string;
|
||||||
|
DeathDateDecade: string;
|
||||||
marriage_location: string;
|
marriage_location: string;
|
||||||
marriage_date: string;
|
marriage_date: string;
|
||||||
DataStatus?: {
|
DataStatus?: {
|
||||||
@@ -68,6 +70,7 @@ interface Person {
|
|||||||
};
|
};
|
||||||
PhotoData?: {
|
PhotoData?: {
|
||||||
path: string;
|
path: string;
|
||||||
|
url: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -431,26 +434,30 @@ function convertPerson(person: Person, intl: InjectedIntl): JsonIndi {
|
|||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
(person.BirthDate && person.BirthDate !== '0000-00-00') ||
|
(person.BirthDate && person.BirthDate !== '0000-00-00') ||
|
||||||
person.BirthLocation
|
person.BirthLocation ||
|
||||||
|
person.BirthDateDecade !== 'unknown'
|
||||||
) {
|
) {
|
||||||
const parsedDate = parseDate(
|
const parsedDate = parseDate(
|
||||||
person.BirthDate,
|
person.BirthDate,
|
||||||
person.DataStatus && person.DataStatus.BirthDate,
|
person.DataStatus && person.DataStatus.BirthDate,
|
||||||
);
|
);
|
||||||
indi.birth = Object.assign({}, parsedDate, {place: person.BirthLocation});
|
const date = parsedDate || parseDecade(person.BirthDateDecade);
|
||||||
|
indi.birth = Object.assign({}, date, {place: person.BirthLocation});
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
(person.DeathDate && person.DeathDate !== '0000-00-00') ||
|
(person.DeathDate && person.DeathDate !== '0000-00-00') ||
|
||||||
person.DeathLocation
|
person.DeathLocation ||
|
||||||
|
person.DeathDateDecade !== 'unknown'
|
||||||
) {
|
) {
|
||||||
const parsedDate = parseDate(
|
const parsedDate = parseDate(
|
||||||
person.DeathDate,
|
person.DeathDate,
|
||||||
person.DataStatus && person.DataStatus.DeathDate,
|
person.DataStatus && person.DataStatus.DeathDate,
|
||||||
);
|
);
|
||||||
indi.death = Object.assign({}, parsedDate, {place: person.DeathLocation});
|
const date = parsedDate || parseDecade(person.DeathDateDecade);
|
||||||
|
indi.death = Object.assign({}, date, {place: person.DeathLocation});
|
||||||
}
|
}
|
||||||
if (person.PhotoData) {
|
if (person.PhotoData) {
|
||||||
indi.images = [{url: `https://www.wikitree.com${person.PhotoData.path}`}];
|
indi.images = [{url: `https://www.wikitree.com${person.PhotoData.url}`}];
|
||||||
}
|
}
|
||||||
return indi;
|
return indi;
|
||||||
}
|
}
|
||||||
@@ -489,6 +496,10 @@ function parseDate(date: string, dataStatus?: string): DateOrRange | undefined {
|
|||||||
return {date: parsedDate};
|
return {date: parsedDate};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseDecade(decade: string): DateOrRange | undefined {
|
||||||
|
return decade !== 'unknown' ? {date: {text: decade}} : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a GEDCOM structure for the purpose of displaying the details
|
* Creates a GEDCOM structure for the purpose of displaying the details
|
||||||
* panel.
|
* panel.
|
||||||
|
|||||||
Reference in New Issue
Block a user