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

View File

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