First version of integrating donatso/family-chart #185

This commit is contained in:
Przemek Więch
2025-01-16 17:54:20 +01:00
parent 5526d3dbf5
commit ae7357f27c
7 changed files with 957 additions and 22 deletions

View File

@@ -47,6 +47,7 @@ import {
WikiTreeDataSource,
WikiTreeSourceSpec,
} from './datasource/wikitree';
import {DonatsoChart} from './donatso-chart';
/**
* Load GEDCOM URL from REACT_APP_STATIC_URL environment variable.
@@ -142,6 +143,7 @@ function getArguments(location: H.Location<any>): Arguments {
const chartTypes = new Map<string | undefined, ChartType>([
['relatives', ChartType.Relatives],
['fancy', ChartType.Fancy],
['donatso', ChartType.Donatso],
]);
const hash = getParam('file');
@@ -481,6 +483,30 @@ export function App() {
setShowErrorPopup(false);
}
function renderChart(selection: IndiInfo) {
if (chartType === ChartType.Donatso) {
return (
<DonatsoChart
data={data!.chartData}
selection={selection}
onSelection={onSelection}
/>
);
}
return (
<Chart
data={data!.chartData}
selection={selection}
chartType={chartType}
onSelection={onSelection}
freezeAnimation={freezeAnimation}
colors={config.color}
hideIds={config.id}
hideSex={config.sex}
/>
);
}
function renderMainArea() {
switch (state) {
case AppState.SHOWING_CHART:
@@ -523,16 +549,7 @@ export function App() {
{state === AppState.LOADING_MORE ? (
<Loader active size="small" className="loading-more" />
) : null}
<Chart
data={data!.chartData}
selection={updatedSelection}
chartType={chartType}
onSelection={onSelection}
freezeAnimation={freezeAnimation}
colors={config.color}
hideIds={config.id}
hideSex={config.sex}
/>
{renderChart(updatedSelection)}
{showSidePanel ? (
<Media greaterThanOrEqual="large" className="sidePanel">
<Tab panes={sidePanelTabs} />