From d69d129935e65e8ccf4dc7b4558fbd71b583a014 Mon Sep 17 00:00:00 2001 From: Marcel Gerber Date: Thu, 9 Jan 2025 13:42:35 +0100 Subject: [PATCH] enhance(admin): don't show slug for narrative charts --- adminSiteClient/EditorTextTab.tsx | 33 +++++++++++++++++++------------ 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/adminSiteClient/EditorTextTab.tsx b/adminSiteClient/EditorTextTab.tsx index b259827bdd..a8106b6e96 100644 --- a/adminSiteClient/EditorTextTab.tsx +++ b/adminSiteClient/EditorTextTab.tsx @@ -19,6 +19,7 @@ import { } from "./Forms.js" import { AbstractChartEditor } from "./AbstractChartEditor.js" import { ErrorMessages } from "./ChartEditorTypes.js" +import { isChartViewEditorInstance } from "./ChartViewEditor.js" @observer export class EditorTextTab< @@ -74,6 +75,10 @@ export class EditorTextTab< return this.props.errorMessages } + @computed get showChartSlug() { + return !isChartViewEditorInstance(this.props.editor) + } + @computed get showAnyAnnotationFieldInTitleToggle() { const { features } = this.props.editor return ( @@ -139,19 +144,21 @@ export class EditorTextTab< /> )} {this.showAnyAnnotationFieldInTitleToggle &&
} - - (grapher.slug = - grapher.slug === undefined - ? grapher.displaySlug - : undefined) - } - helpText="Human-friendly URL for this chart" - /> + {this.showChartSlug && ( + + (grapher.slug = + grapher.slug === undefined + ? grapher.displaySlug + : undefined) + } + helpText="Human-friendly URL for this chart" + /> + )} grapher.currentSubtitle}