Skip to content

Commit

Permalink
enhance(admin): don't show slug for narrative charts
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Jan 9, 2025
1 parent b943f29 commit d69d129
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions adminSiteClient/EditorTextTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -139,19 +144,21 @@ export class EditorTextTab<
/>
)}
{this.showAnyAnnotationFieldInTitleToggle && <hr />}
<AutoTextField
label="/grapher"
value={grapher.displaySlug}
onValue={this.onSlug}
isAuto={grapher.slug === undefined}
onToggleAuto={() =>
(grapher.slug =
grapher.slug === undefined
? grapher.displaySlug
: undefined)
}
helpText="Human-friendly URL for this chart"
/>
{this.showChartSlug && (
<AutoTextField
label="/grapher"
value={grapher.displaySlug}
onValue={this.onSlug}
isAuto={grapher.slug === undefined}
onToggleAuto={() =>
(grapher.slug =
grapher.slug === undefined
? grapher.displaySlug
: undefined)
}
helpText="Human-friendly URL for this chart"
/>
)}
<BindAutoStringExt
label="Subtitle"
readFn={(grapher) => grapher.currentSubtitle}
Expand Down

0 comments on commit d69d129

Please sign in to comment.