From 683a9282bfabb125b7d5856ca73125fa5a0c51f1 Mon Sep 17 00:00:00 2001 From: Marcel Gerber Date: Thu, 19 Dec 2024 18:18:10 +0100 Subject: [PATCH] refactor: use consistent names -- chart views & narrative charts --- adminSiteClient/AdminSidebar.tsx | 2 +- adminSiteClient/ChartEditor.ts | 4 +-- adminSiteClient/ChartViewIndexPage.tsx | 2 +- adminSiteClient/EditorReferencesTab.tsx | 2 +- adminSiteClient/SaveButtons.tsx | 8 ++--- baker/SiteBaker.tsx | 30 +++++++++---------- baker/siteRenderers.tsx | 2 +- ...454799588-PostsGdocsLinksAddChartViews.ts} | 4 +-- db/model/ChartView.ts | 8 ++--- db/model/Gdoc/GdocBase.ts | 27 +++++++---------- db/model/Link.ts | 4 +-- .../grapher/src/core/GrapherConstants.ts | 4 +-- packages/@ourworldindata/grapher/src/index.ts | 2 +- .../types/src/gdocTypes/Gdoc.ts | 4 +-- packages/@ourworldindata/types/src/index.ts | 2 +- site/gdocs/OwidGdoc.tsx | 8 ++--- site/gdocs/components/NarrativeChart.tsx | 14 +++++---- site/gdocs/utils.tsx | 6 ++-- site/multiembedder/MultiEmbedder.tsx | 24 +++++++-------- 19 files changed, 78 insertions(+), 79 deletions(-) rename db/migration/{1734454799588-PostsGdocsLinksAddNarrativeCharts.ts => 1734454799588-PostsGdocsLinksAddChartViews.ts} (85%) diff --git a/adminSiteClient/AdminSidebar.tsx b/adminSiteClient/AdminSidebar.tsx index cb5e5eecf53..96eccd26fa4 100644 --- a/adminSiteClient/AdminSidebar.tsx +++ b/adminSiteClient/AdminSidebar.tsx @@ -37,7 +37,7 @@ export const AdminSidebar = (): React.ReactElement => ( {chartViewsFeatureEnabled && (
  • - Narrative views + Narrative charts
  • )} diff --git a/adminSiteClient/ChartEditor.ts b/adminSiteClient/ChartEditor.ts index 1a4747fbb39..25b10df424d 100644 --- a/adminSiteClient/ChartEditor.ts +++ b/adminSiteClient/ChartEditor.ts @@ -200,7 +200,7 @@ export class ChartEditor extends AbstractChartEditor { ) } - async saveAsNarrativeView(): Promise { + async saveAsChartView(): Promise { const { patchConfig, grapher } = this const chartJson = omit(patchConfig, CHART_VIEW_PROPS_TO_OMIT) @@ -208,7 +208,7 @@ export class ChartEditor extends AbstractChartEditor { const suggestedName = grapher.title ? slugify(grapher.title) : undefined const name = prompt( - "Please enter a programmatic name for the narrative view. Note that this name cannot be changed later.", + "Please enter a programmatic name for the narrative chart. Note that this name cannot be changed later.", suggestedName ) diff --git a/adminSiteClient/ChartViewIndexPage.tsx b/adminSiteClient/ChartViewIndexPage.tsx index fca45f0728d..267bd50c10b 100644 --- a/adminSiteClient/ChartViewIndexPage.tsx +++ b/adminSiteClient/ChartViewIndexPage.tsx @@ -134,7 +134,7 @@ export function ChartViewIndexPage() { }, [admin]) return ( - +
    -

    Narrative views based on this chart

    +

    Narrative charts based on this chart

      {props.references.chartViews.map((chartView) => (
    • diff --git a/adminSiteClient/SaveButtons.tsx b/adminSiteClient/SaveButtons.tsx index dbb9ed71714..bca6555c51a 100644 --- a/adminSiteClient/SaveButtons.tsx +++ b/adminSiteClient/SaveButtons.tsx @@ -63,8 +63,8 @@ class SaveButtonsForChart extends React.Component<{ void this.props.editor.saveAsNewGrapher() } - @action.bound onSaveAsNarrativeView() { - void this.props.editor.saveAsNarrativeView() + @action.bound onSaveAsChartView() { + void this.props.editor.saveAsChartView() } @action.bound onPublishToggle() { @@ -122,10 +122,10 @@ class SaveButtonsForChart extends React.Component<{
      )} diff --git a/baker/SiteBaker.tsx b/baker/SiteBaker.tsx index 29dc2c2c934..52f9b4cb51a 100644 --- a/baker/SiteBaker.tsx +++ b/baker/SiteBaker.tsx @@ -56,7 +56,7 @@ import { grabMetadataForGdocLinkedIndicator, TombstonePageData, gdocUrlRegex, - NarrativeViewInfo, + ChartViewInfo, } from "@ourworldindata/utils" import { execWrapper } from "../db/execWrapper.js" import { countryProfileSpecs } from "../site/countryProfileProjects.js" @@ -110,7 +110,7 @@ import { getTombstones } from "../db/model/GdocTombstone.js" import { bakeAllMultiDimDataPages } from "./MultiDimBaker.js" import { getAllLinkedPublishedMultiDimDataPages } from "../db/model/MultiDimDataPage.js" import { getPublicDonorNames } from "../db/model/Donor.js" -import { getNarrativeViewsInfo } from "../db/model/ChartView.js" +import { getChartViewsInfo } from "../db/model/ChartView.js" type PrefetchedAttachments = { donors: string[] @@ -122,7 +122,7 @@ type PrefetchedAttachments = { explorers: Record } linkedIndicators: Record - narrativeViewsInfo: Record + linkedChartViews: Record } // These aren't all "wordpress" steps @@ -462,10 +462,10 @@ export class SiteBaker { name: `✅ Prefetched ${publishedAuthors.length} authors`, }) - const narrativeViewsInfo = await getNarrativeViewsInfo(knex) - const narrativeViewsInfoByName = keyBy(narrativeViewsInfo, "name") + const chartViewsInfo = await getChartViewsInfo(knex) + const chartViewsInfoByName = keyBy(chartViewsInfo, "name") this.progressBar.tick({ - name: `✅ Prefetched ${narrativeViewsInfo.length} chart views`, + name: `✅ Prefetched ${chartViewsInfo.length} chart views`, }) const prefetchedAttachments = { @@ -478,7 +478,7 @@ export class SiteBaker { graphers: publishedChartsBySlug, }, linkedIndicators: datapageIndicatorsById, - narrativeViewsInfo: narrativeViewsInfoByName, + linkedChartViews: chartViewsInfoByName, } this.progressBar.tick({ name: "✅ Prefetched attachments" }) this._prefetchedAttachmentsCache = prefetchedAttachments @@ -490,7 +490,7 @@ export class SiteBaker { imageFilenames, linkedGrapherSlugs, linkedExplorerSlugs, - linkedNarrativeChartNames, + linkedChartViewNames, ] = picks const linkedDocuments = pick( this._prefetchedAttachmentsCache.linkedDocuments, @@ -539,9 +539,9 @@ export class SiteBaker { this._prefetchedAttachmentsCache.linkedAuthors.filter( (author) => authorNames.includes(author.name) ), - narrativeViewsInfo: pick( - this._prefetchedAttachmentsCache.narrativeViewsInfo, - linkedNarrativeChartNames + linkedChartViews: pick( + this._prefetchedAttachmentsCache.linkedChartViews, + linkedChartViewNames ), } } @@ -634,7 +634,7 @@ export class SiteBaker { publishedGdoc.linkedImageFilenames, publishedGdoc.linkedChartSlugs.grapher, publishedGdoc.linkedChartSlugs.explorer, - publishedGdoc.linkedNarrativeChartNames, + publishedGdoc.linkedChartViewNames, ]) publishedGdoc.donors = attachments.donors publishedGdoc.linkedAuthors = attachments.linkedAuthors @@ -645,7 +645,7 @@ export class SiteBaker { ...attachments.linkedCharts.explorers, } publishedGdoc.linkedIndicators = attachments.linkedIndicators - publishedGdoc.narrativeViewsInfo = attachments.narrativeViewsInfo + publishedGdoc.linkedChartViews = attachments.linkedChartViews // this is a no-op if the gdoc doesn't have an all-chart block if ("loadRelatedCharts" in publishedGdoc) { @@ -893,7 +893,7 @@ export class SiteBaker { dataInsight.linkedImageFilenames, dataInsight.linkedChartSlugs.grapher, dataInsight.linkedChartSlugs.explorer, - dataInsight.linkedNarrativeChartNames, + dataInsight.linkedChartViewNames, ]) dataInsight.linkedDocuments = attachments.linkedDocuments dataInsight.imageMetadata = { @@ -967,7 +967,7 @@ export class SiteBaker { publishedAuthor.linkedImageFilenames, publishedAuthor.linkedChartSlugs.grapher, publishedAuthor.linkedChartSlugs.explorer, - publishedAuthor.linkedNarrativeChartNames, + publishedAuthor.linkedChartViewNames, ]) // We don't need these to be attached to the gdoc in the current diff --git a/baker/siteRenderers.tsx b/baker/siteRenderers.tsx index 52856e0b6ed..d7973ad0520 100644 --- a/baker/siteRenderers.tsx +++ b/baker/siteRenderers.tsx @@ -439,7 +439,7 @@ ${dataInsights latestDataInsights: get(post, "latestDataInsights", []), homepageMetadata: get(post, "homepageMetadata", {}), latestWorkLinks: get(post, "latestWorkLinks", []), - narrativeViewsInfo: get(post, "narrativeViewsInfo", {}), + linkedChartViews: get(post, "linkedChartViews", {}), }} > diff --git a/db/migration/1734454799588-PostsGdocsLinksAddNarrativeCharts.ts b/db/migration/1734454799588-PostsGdocsLinksAddChartViews.ts similarity index 85% rename from db/migration/1734454799588-PostsGdocsLinksAddNarrativeCharts.ts rename to db/migration/1734454799588-PostsGdocsLinksAddChartViews.ts index cb1d710cf9c..06596eea89b 100644 --- a/db/migration/1734454799588-PostsGdocsLinksAddNarrativeCharts.ts +++ b/db/migration/1734454799588-PostsGdocsLinksAddChartViews.ts @@ -1,12 +1,12 @@ import { MigrationInterface, QueryRunner } from "typeorm" -export class PostsGdocsLinksAddNarrativeCharts1734454799588 +export class PostsGdocsLinksAddChartViews1734454799588 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { await queryRunner.query(` ALTER TABLE posts_gdocs_links - MODIFY linkType ENUM ('gdoc', 'url', 'grapher', 'explorer', 'narrative-chart') NULL`) + MODIFY linkType ENUM ('gdoc', 'url', 'grapher', 'explorer', 'chart-view') NULL`) } public async down(queryRunner: QueryRunner): Promise { diff --git a/db/model/ChartView.ts b/db/model/ChartView.ts index 5a7e609694f..2bfd5ad8ed3 100644 --- a/db/model/ChartView.ts +++ b/db/model/ChartView.ts @@ -1,11 +1,11 @@ -import { NarrativeViewInfo, JsonString } from "@ourworldindata/types" +import { ChartViewInfo, JsonString } from "@ourworldindata/types" import * as db from "../db.js" -export const getNarrativeViewsInfo = async ( +export const getChartViewsInfo = async ( knex: db.KnexReadonlyTransaction, names?: string[] -): Promise => { - type RawRow = Omit & { +): Promise => { + type RawRow = Omit & { queryParamsForParentChart: JsonString } let rows: RawRow[] diff --git a/db/model/Gdoc/GdocBase.ts b/db/model/Gdoc/GdocBase.ts index 9d1ebf9cf7e..b41e193e554 100644 --- a/db/model/Gdoc/GdocBase.ts +++ b/db/model/Gdoc/GdocBase.ts @@ -48,7 +48,7 @@ import { getVariableMetadata, getVariableOfDatapageIfApplicable, } from "../Variable.js" -import { createLinkForNarrativeChart, createLinkFromUrl } from "../Link.js" +import { createLinkForChartView, createLinkFromUrl } from "../Link.js" import { getMultiDimDataPageBySlug, isMultiDimDataPagePublished, @@ -56,7 +56,7 @@ import { import { ARCHVED_THUMBNAIL_FILENAME, ChartConfigType, - NarrativeViewInfo, + ChartViewInfo, DEFAULT_THUMBNAIL_FILENAME, GrapherInterface, LatestDataInsight, @@ -67,7 +67,7 @@ import { OwidGdocLinkType, OwidGdocType, } from "@ourworldindata/types" -import { getNarrativeViewsInfo } from "../ChartView.js" +import { getChartViewsInfo } from "../ChartView.js" export class GdocBase implements OwidGdocBaseInterface { id!: string @@ -91,7 +91,7 @@ export class GdocBase implements OwidGdocBaseInterface { linkedIndicators: Record = {} linkedDocuments: Record = {} latestDataInsights: LatestDataInsight[] = [] - narrativeViewsInfo?: Record = {} + linkedChartViews?: Record = {} _omittableFields: string[] = [] constructor(id?: string) { @@ -295,9 +295,9 @@ export class GdocBase implements OwidGdocBaseInterface { return { grapher: [...grapher], explorer: [...explorer] } } - get linkedNarrativeChartNames(): string[] { + get linkedChartViewNames(): string[] { const filteredLinks = this.links - .filter((link) => link.linkType === "narrative-chart") + .filter((link) => link.linkType === OwidGdocLinkType.ChartView) .map((link) => link.target) return filteredLinks @@ -350,7 +350,7 @@ export class GdocBase implements OwidGdocBaseInterface { }), ]) .with({ type: "narrative-chart" }, (block) => [ - createLinkForNarrativeChart({ + createLinkForChartView({ name: block.name, source: this, componentType: block.type, @@ -718,14 +718,9 @@ export class GdocBase implements OwidGdocBaseInterface { } } - async loadNarrativeViewsInfo( - knex: db.KnexReadonlyTransaction - ): Promise { - const result = await getNarrativeViewsInfo( - knex, - this.linkedNarrativeChartNames - ) - this.narrativeViewsInfo = keyBy(result, "name") + async loadChartViewsInfo(knex: db.KnexReadonlyTransaction): Promise { + const result = await getChartViewsInfo(knex, this.linkedChartViewNames) + this.linkedChartViews = keyBy(result, "name") } async fetchAndEnrichGdoc(): Promise { @@ -873,7 +868,7 @@ export class GdocBase implements OwidGdocBaseInterface { await this.loadImageMetadataFromDB(knex) await this.loadLinkedCharts(knex) await this.loadLinkedIndicators() // depends on linked charts - await this.loadNarrativeViewsInfo(knex) + await this.loadChartViewsInfo(knex) await this._loadSubclassAttachments(knex) await this.validate(knex) } diff --git a/db/model/Link.ts b/db/model/Link.ts index c2a62a16cc0..bb0d2941cf4 100644 --- a/db/model/Link.ts +++ b/db/model/Link.ts @@ -63,7 +63,7 @@ export function createLinkFromUrl({ } satisfies DbInsertPostGdocLink } -export function createLinkForNarrativeChart({ +export function createLinkForChartView({ name, source, componentType, @@ -74,7 +74,7 @@ export function createLinkForNarrativeChart({ }): DbInsertPostGdocLink { return { target: name, - linkType: OwidGdocLinkType.NarrativeChart, + linkType: OwidGdocLinkType.ChartView, queryString: "", hash: "", text: "", diff --git a/packages/@ourworldindata/grapher/src/core/GrapherConstants.ts b/packages/@ourworldindata/grapher/src/core/GrapherConstants.ts index a4f8a896827..dc7143bc79e 100644 --- a/packages/@ourworldindata/grapher/src/core/GrapherConstants.ts +++ b/packages/@ourworldindata/grapher/src/core/GrapherConstants.ts @@ -5,8 +5,8 @@ import type { GrapherProgrammaticInterface } from "./Grapher" export const GRAPHER_EMBEDDED_FIGURE_ATTR = "data-grapher-src" export const GRAPHER_EMBEDDED_FIGURE_CONFIG_ATTR = "data-grapher-config" -export const GRAPHER_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR = - "data-grapher-view-config" +export const GRAPHER_CHART_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR = + "data-grapher-chart-view-config" export const GRAPHER_PAGE_BODY_CLASS = "StandaloneGrapherOrExplorerPage" export const GRAPHER_IS_IN_IFRAME_CLASS = "IsInIframe" diff --git a/packages/@ourworldindata/grapher/src/index.ts b/packages/@ourworldindata/grapher/src/index.ts index 8815ad4a847..554f3f38f91 100644 --- a/packages/@ourworldindata/grapher/src/index.ts +++ b/packages/@ourworldindata/grapher/src/index.ts @@ -10,7 +10,7 @@ export { ChartDimension } from "./chart/ChartDimension" export { GRAPHER_EMBEDDED_FIGURE_ATTR, GRAPHER_EMBEDDED_FIGURE_CONFIG_ATTR, - GRAPHER_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR, + GRAPHER_CHART_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR, GRAPHER_PAGE_BODY_CLASS, GRAPHER_IS_IN_IFRAME_CLASS, DEFAULT_GRAPHER_WIDTH, diff --git a/packages/@ourworldindata/types/src/gdocTypes/Gdoc.ts b/packages/@ourworldindata/types/src/gdocTypes/Gdoc.ts index 9f75af5e70d..318c5d1e5b2 100644 --- a/packages/@ourworldindata/types/src/gdocTypes/Gdoc.ts +++ b/packages/@ourworldindata/types/src/gdocTypes/Gdoc.ts @@ -55,7 +55,7 @@ export interface LinkedChart { } // An object containing metadata needed for embedded narrative charts -export interface NarrativeViewInfo { +export interface ChartViewInfo { name: string title: string chartConfigId: string @@ -281,7 +281,7 @@ export enum OwidGdocLinkType { Url = "url", Grapher = "grapher", Explorer = "explorer", - NarrativeChart = "narrative-chart", + ChartView = "chart-view", } export interface OwidGdocLinkJSON { diff --git a/packages/@ourworldindata/types/src/index.ts b/packages/@ourworldindata/types/src/index.ts index 9e94a05ee01..a8a3f80db50 100644 --- a/packages/@ourworldindata/types/src/index.ts +++ b/packages/@ourworldindata/types/src/index.ts @@ -332,7 +332,7 @@ export { type OwidGdocContent, type OwidGdocIndexItem, extractGdocIndexItem, - type NarrativeViewInfo, + type ChartViewInfo, } from "./gdocTypes/Gdoc.js" export { diff --git a/site/gdocs/OwidGdoc.tsx b/site/gdocs/OwidGdoc.tsx index f12ac4a0387..f86302c6746 100644 --- a/site/gdocs/OwidGdoc.tsx +++ b/site/gdocs/OwidGdoc.tsx @@ -13,7 +13,7 @@ import { OwidGdocMinimalPostInterface, OwidGdocHomepageMetadata, DbEnrichedLatestWork, - NarrativeViewInfo, + ChartViewInfo, } from "@ourworldindata/types" import { get, getOwidGdocFromJSON } from "@ourworldindata/utils" import { DebugProvider } from "./DebugContext.js" @@ -36,7 +36,7 @@ export type Attachments = { latestDataInsights?: LatestDataInsight[] homepageMetadata?: OwidGdocHomepageMetadata latestWorkLinks?: DbEnrichedLatestWork[] - narrativeViewsInfo?: Record + linkedChartViews?: Record } export const AttachmentsContext = createContext({ @@ -49,7 +49,7 @@ export const AttachmentsContext = createContext({ latestDataInsights: [], homepageMetadata: {}, latestWorkLinks: [], - narrativeViewsInfo: {}, + linkedChartViews: {}, }) export const DocumentContext = createContext<{ isPreviewing: boolean }>({ @@ -134,7 +134,7 @@ export function OwidGdoc({ latestDataInsights: get(props, "latestDataInsights", []), homepageMetadata: get(props, "homepageMetadata", {}), latestWorkLinks: get(props, "latestWorkLinks", []), - narrativeViewsInfo: get(props, "narrativeViewsInfo", {}), + linkedChartViews: get(props, "linkedChartViews", {}), }} > diff --git a/site/gdocs/components/NarrativeChart.tsx b/site/gdocs/components/NarrativeChart.tsx index 7cb3311515c..68d14e7be81 100644 --- a/site/gdocs/components/NarrativeChart.tsx +++ b/site/gdocs/components/NarrativeChart.tsx @@ -1,11 +1,12 @@ import React, { useContext, useRef } from "react" import { useEmbedChart } from "../../hooks.js" import { EnrichedBlockNarrativeChart } from "@ourworldindata/types" -import { renderSpans, useNarrativeViewsInfo } from "../utils.js" +import { renderSpans, useLinkedChartView } from "../utils.js" import cx from "classnames" import { GRAPHER_PREVIEW_CLASS } from "../../SiteConstants.js" import { BlockErrorFallback } from "./BlockErrorBoundary.js" import { DocumentContext } from "../OwidGdoc.js" +import { GRAPHER_CHART_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR } from "@ourworldindata/grapher" export default function NarrativeChart({ d, @@ -19,7 +20,7 @@ export default function NarrativeChart({ const refChartContainer = useRef(null) useEmbedChart(0, refChartContainer) - const viewMetadata = useNarrativeViewsInfo(d.name) + const viewMetadata = useLinkedChartView(d.name) const { isPreviewing } = useContext(DocumentContext) @@ -29,8 +30,8 @@ export default function NarrativeChart({ ) @@ -50,12 +51,15 @@ export default function NarrativeChart({
      {/* diff --git a/site/gdocs/utils.tsx b/site/gdocs/utils.tsx index afb6af58134..550e26ac963 100644 --- a/site/gdocs/utils.tsx +++ b/site/gdocs/utils.tsx @@ -147,9 +147,9 @@ export function useDonors(): string[] | undefined { return donors } -export const useNarrativeViewsInfo = (name: string) => { - const { narrativeViewsInfo } = useContext(AttachmentsContext) - return narrativeViewsInfo?.[name] +export const useLinkedChartView = (name: string) => { + const { linkedChartViews } = useContext(AttachmentsContext) + return linkedChartViews?.[name] } const LinkedA = ({ span }: { span: SpanLink }): React.ReactElement => { diff --git a/site/multiembedder/MultiEmbedder.tsx b/site/multiembedder/MultiEmbedder.tsx index bf7bf2e7cc2..675121e7bcd 100644 --- a/site/multiembedder/MultiEmbedder.tsx +++ b/site/multiembedder/MultiEmbedder.tsx @@ -10,7 +10,7 @@ import { migrateSelectedEntityNamesParam, SelectionArray, migrateGrapherConfigToLatestVersion, - GRAPHER_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR, + GRAPHER_CHART_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR, } from "@ourworldindata/grapher" import { fetchText, @@ -22,7 +22,7 @@ import { MultiDimDataPageConfig, extractMultiDimChoicesFromQueryStr, fetchWithRetry, - NarrativeViewInfo, + ChartViewInfo, queryParamsToStr, } from "@ourworldindata/utils" import { action } from "mobx" @@ -47,7 +47,7 @@ import Bugsnag from "@bugsnag/js" import { embedDynamicCollectionGrapher } from "../collections/DynamicCollection.js" import { match } from "ts-pattern" -type EmbedType = "grapher" | "explorer" | "multiDim" | "grapherView" +type EmbedType = "grapher" | "explorer" | "multiDim" | "chartView" const figuresFromDOM = ( container: HTMLElement | Document = document, @@ -123,7 +123,7 @@ class MultiEmbedder { .concat( figuresFromDOM( container, - GRAPHER_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR + GRAPHER_CHART_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR ) ) @@ -272,12 +272,12 @@ class MultiEmbedder { embedUrl, }) } - async renderGrapherViewIntoFigure(figure: Element) { + async renderChartViewIntoFigure(figure: Element) { const viewConfigRaw = figure.getAttribute( - GRAPHER_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR + GRAPHER_CHART_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR ) if (!viewConfigRaw) return - const viewConfig: NarrativeViewInfo = JSON.parse(viewConfigRaw) + const viewConfig: ChartViewInfo = JSON.parse(viewConfigRaw) if (!viewConfig) return const configUrl = `${GRAPHER_DYNAMIC_CONFIG_URL}/by-uuid/${viewConfig.chartConfigId}.config.json` @@ -303,16 +303,16 @@ class MultiEmbedder { EXPLORER_EMBEDDED_FIGURE_SELECTOR ) const isMultiDim = figure.hasAttribute("data-is-multi-dim") - const isGrapherView = figure.hasAttribute( - GRAPHER_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR + const isChartView = figure.hasAttribute( + GRAPHER_CHART_VIEW_EMBEDDED_FIGURE_CONFIG_ATTR ) const embedType: EmbedType = isExplorer ? "explorer" : isMultiDim ? "multiDim" - : isGrapherView - ? "grapherView" + : isChartView + ? "chartView" : "grapher" const hasPreview = isExplorer ? false : !!figure.querySelector("img") @@ -328,7 +328,7 @@ class MultiEmbedder { await match(embedType) .with("explorer", () => this.renderExplorerIntoFigure(figure)) .with("multiDim", () => this.renderMultiDimIntoFigure(figure)) - .with("grapherView", () => this.renderGrapherViewIntoFigure(figure)) + .with("chartView", () => this.renderChartViewIntoFigure(figure)) .with("grapher", () => this.renderGrapherIntoFigure(figure)) .exhaustive() }