Skip to content

Commit

Permalink
enhance(admin): remove narrative charts feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber committed Jan 14, 2025
1 parent 775d64b commit 70798fd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 42 deletions.
13 changes: 5 additions & 8 deletions adminSiteClient/AdminSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
} from "@fortawesome/free-solid-svg-icons"

import { ETL_WIZARD_URL } from "../settings/clientSettings.js"
import { chartViewsFeatureEnabled } from "./ChartViewEditor.js"

export const AdminSidebar = (): React.ReactElement => (
<aside className="AdminSidebar">
Expand All @@ -34,13 +33,11 @@ export const AdminSidebar = (): React.ReactElement => (
<FontAwesomeIcon icon={faChartBar} /> Charts
</Link>
</li>
{chartViewsFeatureEnabled && (
<li>
<Link to="/chartViews">
<FontAwesomeIcon icon={faPanorama} /> Narrative charts
</Link>
</li>
)}
<li>
<Link to="/chartViews">
<FontAwesomeIcon icon={faPanorama} /> Narrative charts
</Link>
</li>
<li>
<Link to="/posts">
<FontAwesomeIcon icon={faFile} /> Posts
Expand Down
7 changes: 0 additions & 7 deletions adminSiteClient/ChartViewEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ import {
References,
type EditorTab,
} from "./AbstractChartEditor.js"
import { BAKED_BASE_URL, ENV } from "../settings/clientSettings.js"
import {
CHART_VIEW_PROPS_TO_OMIT,
CHART_VIEW_PROPS_TO_PERSIST,
GrapherInterface,
} from "@ourworldindata/types"
import { diffGrapherConfigs, omit, pick } from "@ourworldindata/utils"

// Don't yet show chart views in the admin interface
// This is low-stakes - if it shows up anyhow (e.g. on staging servers), it's not a big deal.
// TODO: Remove this flag once we're launching this feature
export const chartViewsFeatureEnabled =
ENV === "development" || BAKED_BASE_URL.includes("narrative-")

export interface Chart {
id: number
title?: string
Expand Down
48 changes: 21 additions & 27 deletions adminSiteClient/SaveButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
import { AbstractChartEditor } from "./AbstractChartEditor.js"
import {
ChartViewEditor,
chartViewsFeatureEnabled,
isChartViewEditorInstance,
} from "./ChartViewEditor.js"
import { NarrativeChartNameModal } from "./NarrativeChartNameModal.js"
Expand Down Expand Up @@ -136,32 +135,27 @@ class SaveButtonsForChart extends Component<{
{grapher.isPublished ? "Unpublish" : "Publish"}
</button>
</div>
{chartViewsFeatureEnabled && (
<>
<div className="mt-2">
<button
className="btn btn-primary"
onClick={() => {
this.narrativeChartNameModalOpen = "open"
this.narrativeChartNameModalError =
undefined
}}
disabled={isSavingDisabled}
>
Save as narrative chart
</button>
</div>
<NarrativeChartNameModal
open={this.narrativeChartNameModalOpen}
initialName={this.initialNarrativeChartName}
errorMsg={this.narrativeChartNameModalError}
onSubmit={this.onSubmitNarrativeChartButton}
onCancel={() =>
(this.narrativeChartNameModalOpen = "closed")
}
/>
</>
)}
<div className="mt-2">
<button
className="btn btn-primary"
onClick={() => {
this.narrativeChartNameModalOpen = "open"
this.narrativeChartNameModalError = undefined
}}
disabled={isSavingDisabled}
>
Save as narrative chart
</button>
</div>
<NarrativeChartNameModal
open={this.narrativeChartNameModalOpen}
initialName={this.initialNarrativeChartName}
errorMsg={this.narrativeChartNameModalError}
onSubmit={this.onSubmitNarrativeChartButton}
onCancel={() =>
(this.narrativeChartNameModalOpen = "closed")
}
/>
{editingErrors.map((error, i) => (
<div key={i} className="alert alert-danger mt-2">
{error}
Expand Down

0 comments on commit 70798fd

Please sign in to comment.