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

@@ -26,6 +26,7 @@ import {
CircleRenderer,
ChartColors as TopolaChartColors,
} from 'topola';
import {usePrevious} from './util/previous-hook';
/** How much to zoom when using the +/- buttons. */
const ZOOM_FACTOR = 1.3;
@@ -217,6 +218,7 @@ export async function downloadPdf() {
export enum ChartType {
Hourglass,
Relatives,
Donatso,
Fancy,
}
@@ -402,14 +404,6 @@ class ChartWrapper {
}
}
function usePrevious<T>(value: T): T | undefined {
const ref = useRef<T | undefined>(undefined);
useEffect(() => {
ref.current = value;
});
return ref.current;
}
export function Chart(props: ChartProps) {
const chartWrapper = useRef(new ChartWrapper());
const prevProps = usePrevious(props);