Skip to content

Commit

Permalink
feat: Add metadata flag
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Nov 28, 2022
1 parent b5fed5e commit 14ecd8c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
22 changes: 14 additions & 8 deletions app/components/chart-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ import { HintYellow } from "@/components/hint";
import { MetadataPanel } from "@/components/metadata-panel";
import { ChartConfig, DataSource, useConfiguratorState } from "@/configurator";
import { DataSetTable } from "@/configurator/components/datatable";
import { useDataCubeMetadataWithComponentValuesQuery } from "@/graphql/query-hooks";
import { flag } from "@/configurator/components/flag";
import {
DimensionMetadataFragment,
useDataCubeMetadataWithComponentValuesQuery,
} from "@/graphql/query-hooks";
import { DataCubePublicationStatus } from "@/graphql/resolver-types";
import { useLocale } from "@/locales/use-locale";
import useEvent from "@/utils/use-event";
Expand Down Expand Up @@ -86,7 +90,7 @@ export const ChartPreviewInner = ({

const handleToggleTableView = useEvent(() => setIsTablePreview((c) => !c));

const allDimensions = useMemo(() => {
const allDimensions: DimensionMetadataFragment[] = useMemo(() => {
return [
...(metaData?.dataCubeByIri?.dimensions ?? []),
...(metaData?.dataCubeByIri?.measures ?? []),
Expand Down Expand Up @@ -148,12 +152,14 @@ export const ChartPreviewInner = ({
)}
</Typography>

<MetadataPanel
datasetIri={dataSetIri}
dataSource={dataSource}
dimensions={allDimensions}
top={96}
/>
{flag("metadata") && (
<MetadataPanel
datasetIri={dataSetIri}
dataSource={dataSource}
dimensions={allDimensions}
top={96}
/>
)}
</Flex>
<Head>
<title key="title">
Expand Down
22 changes: 14 additions & 8 deletions app/components/chart-published.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ import {
PublishedConfiguratorStateProvider,
} from "@/configurator";
import { DataSetTable } from "@/configurator/components/datatable";
import { flag } from "@/configurator/components/flag";
import { parseDate } from "@/configurator/components/ui-helpers";
import {
DEFAULT_DATA_SOURCE,
useIsTrustedDataSource,
} from "@/domain/datasource";
import { useDataCubeMetadataWithComponentValuesQuery } from "@/graphql/query-hooks";
import {
DimensionMetadataFragment,
useDataCubeMetadataWithComponentValuesQuery,
} from "@/graphql/query-hooks";
import { DataCubePublicationStatus } from "@/graphql/resolver-types";
import { useLocale } from "@/locales/use-locale";
import useEvent from "@/utils/use-event";
Expand Down Expand Up @@ -120,7 +124,7 @@ export const ChartPublishedInner = ({
} = useChartTablePreview();
const handleToggleTableView = useEvent(() => setIsTablePreview((c) => !c));

const allDimensions = useMemo(() => {
const allDimensions: DimensionMetadataFragment[] = useMemo(() => {
return [
...(metaData?.dataCubeByIri?.dimensions ?? []),
...(metaData?.dataCubeByIri?.measures ?? []),
Expand Down Expand Up @@ -177,12 +181,14 @@ export const ChartPublishedInner = ({
{meta.title[locale]}
</Typography>

<MetadataPanel
datasetIri={dataSet}
dataSource={dataSource}
dimensions={allDimensions}
container={rootRef.current}
/>
{flag("metadata") && (
<MetadataPanel
datasetIri={dataSet}
dataSource={dataSource}
dimensions={allDimensions}
container={rootRef.current}
/>
)}
</Flex>

{meta.description[locale] && (
Expand Down

0 comments on commit 14ecd8c

Please sign in to comment.