Add Donatso family chart to menu

This commit is contained in:
Przemek Więch
2025-01-21 22:53:36 +01:00
parent 6266ca8982
commit 061bb55359
3 changed files with 18 additions and 1 deletions

View File

@@ -1,5 +1,9 @@
# Changelog # Changelog
## 2025-01-21
- Added new chart type based on [github.com/donatso/family-chart](https://github.com/donatso/family-chart)
## 2023-08-25 ## 2023-08-25
- Added support for loading gedzip files - Added support for loading gedzip files

View File

@@ -577,6 +577,7 @@ export function App() {
allowAllRelativesChart={ allowAllRelativesChart={
sourceSpec?.source !== DataSourceEnum.WIKITREE sourceSpec?.source !== DataSourceEnum.WIKITREE
} }
allowPrintAndDownload={chartType !== ChartType.Donatso}
showingChart={ showingChart={
history.location.pathname === '/view' && history.location.pathname === '/view' &&
(state === AppState.SHOWING_CHART || (state === AppState.SHOWING_CHART ||

View File

@@ -32,6 +32,7 @@ interface Props {
standalone: boolean; standalone: boolean;
/** Whether to show the "All relatives" chart type in the menu. */ /** Whether to show the "All relatives" chart type in the menu. */
allowAllRelativesChart: boolean; allowAllRelativesChart: boolean;
allowPrintAndDownload: boolean;
eventHandlers: EventHandlers; eventHandlers: EventHandlers;
/** Whether to show additional WikiTree menus. */ /** Whether to show additional WikiTree menus. */
showWikiTreeMenus: boolean; showWikiTreeMenus: boolean;
@@ -72,6 +73,13 @@ export function TopBar(props: Props) {
/> />
</Dropdown.Item> </Dropdown.Item>
) : null} ) : null}
<Dropdown.Item onClick={() => changeView('donatso')}>
<Icon name="users" />
<FormattedMessage
id="menu.donatso"
defaultMessage="Donatso family chart"
/>
</Dropdown.Item>
<Dropdown.Item onClick={() => changeView('fancy')}> <Dropdown.Item onClick={() => changeView('fancy')}>
<Icon name="users" /> <Icon name="users" />
<FormattedMessage <FormattedMessage
@@ -85,7 +93,10 @@ export function TopBar(props: Props) {
case ScreenSize.LARGE: case ScreenSize.LARGE:
return ( return (
<> <>
<Menu.Item onClick={props.eventHandlers.onPrint}> <Menu.Item
onClick={props.eventHandlers.onPrint}
disabled={!props.allowPrintAndDownload}
>
<Icon name="print" /> <Icon name="print" />
<FormattedMessage id="menu.print" defaultMessage="Print" /> <FormattedMessage id="menu.print" defaultMessage="Print" />
</Menu.Item> </Menu.Item>
@@ -101,6 +112,7 @@ export function TopBar(props: Props) {
</div> </div>
} }
className="item" className="item"
disabled={!props.allowPrintAndDownload}
> >
<Dropdown.Menu> <Dropdown.Menu>
<Dropdown.Item onClick={props.eventHandlers.onDownloadPdf}> <Dropdown.Item onClick={props.eventHandlers.onDownloadPdf}>