Commit fdf3061a authored by Aron Fiechter's avatar Aron Fiechter
Browse files

Year range hover also changes inner nodes

The year range of any inner node is defined as the union of the year ranges of all its children.
parent 01fd36c3
......@@ -499,10 +499,25 @@ class Voronoi extends React.Component {
* @returns {boolean}
*/
isEntityInYearRange(e) {
const { start, end } = this.props.yearRange;
const entityYears = this.props.resultsById[e.name]?.years;
const {
yearRange: { start, end },
data: rootData,
resultsById,
} = this.props;
const entity = resultsById[e.name];
const allChildren = this.findChildrenOf([e], rootData.nodes);
const entityYears = [
...new Set(
entity?.years
? entity.years
: allChildren.map((c) => resultsById[c.name]).flatMap((c) => c?.years || []),
),
];
// If entity does not have years, it's not a document/dossier
if (entityYears?.length) {
if (entityYears.length !== 0) {
return entityYears.some((y) => y >= start && y <= end);
}
return true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment