When showing data from WikiTree, don't show "all relatives" chart option

This commit is contained in:
Przemek Wiech
2020-01-20 19:34:20 +01:00
parent 100a84f452
commit d4bd801980
2 changed files with 18 additions and 7 deletions

View File

@@ -97,6 +97,8 @@ interface State {
chartType: ChartType;
/** Whether to show the error popup. */
showErrorPopup: boolean;
/** True if data is loaded from WikiTree. */
wikiTreeSource: boolean;
}
export class App extends React.Component<RouteComponentProps, {}> {
@@ -106,6 +108,7 @@ export class App extends React.Component<RouteComponentProps, {}> {
standalone: true,
chartType: ChartType.Hourglass,
showErrorPopup: false,
wikiTreeSource: false,
};
chartRef: Chart | null = null;
@@ -291,6 +294,7 @@ export class App extends React.Component<RouteComponentProps, {}> {
showSidePanel,
standalone,
chartType,
wikiTreeSource: source === 'wikitree',
}),
);
} catch (error) {
@@ -427,6 +431,7 @@ export class App extends React.Component<RouteComponentProps, {}> {
<TopBar
{...props}
gedcom={this.state.data && this.state.data.gedcom}
allowAllRelativesChart={!this.state.wikiTreeSource}
showingChart={
!!(
this.props.history.location.pathname === '/view' &&

View File

@@ -40,9 +40,13 @@ interface EventHandlers {
}
interface Props {
/** True if the application is currently showing a chart. */
showingChart: boolean;
/** Data used for the search index. */
gedcom?: GedcomData;
standalone: boolean;
/** Whether to show the "All relatives" chart type in the menu. */
allowAllRelativesChart: boolean;
eventHandlers: EventHandlers;
}
@@ -320,13 +324,15 @@ export class TopBar extends React.Component<
defaultMessage="Hourglass chart"
/>
</Dropdown.Item>
<Dropdown.Item onClick={() => this.changeView('relatives')}>
<Icon name="users" />
<FormattedMessage
id="menu.relatives"
defaultMessage="All relatives"
/>
</Dropdown.Item>
{this.props.allowAllRelativesChart ? (
<Dropdown.Item onClick={() => this.changeView('relatives')}>
<Icon name="users" />
<FormattedMessage
id="menu.relatives"
defaultMessage="All relatives"
/>
</Dropdown.Item>
) : null}
<Dropdown.Item onClick={() => this.changeView('fancy')}>
<Icon name="users" />
<FormattedMessage