Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Activate shared filters for "tab" layout #1586

Merged
merged 4 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/chart-panel.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Box, BoxProps, Theme } from "@mui/material";
import { makeStyles } from "@mui/styles";
import clsx from "clsx";
import React, { forwardRef, HTMLProps } from "react";
import React, { HTMLProps, forwardRef } from "react";

import ChartPanelLayoutCanvas, {
chartPanelLayoutGridClasses,
Expand Down
24 changes: 16 additions & 8 deletions app/components/chart-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import {
useDraggable,
useDroppable,
} from "@dnd-kit/core";
import { Trans, t } from "@lingui/macro";
import { t, Trans } from "@lingui/macro";
import { Box, IconButton, useEventCallback } from "@mui/material";
import { makeStyles } from "@mui/styles";
import Head from "next/head";
import React, {
ReactNode,
forwardRef,
ReactNode,
useCallback,
useMemo,
useState,
Expand All @@ -36,6 +36,7 @@ import {
} from "@/components/chart-table-preview";
import { useChartStyles } from "@/components/chart-utils";
import { ChartWithFilters } from "@/components/chart-with-filters";
import { DashboardInteractiveFilters } from "@/components/dashboard-interactive-filters";
import DebugPanel from "@/components/debug-panel";
import { DragHandle, DragHandleProps } from "@/components/drag-handle";
import Flex from "@/components/flex";
Expand All @@ -46,10 +47,10 @@ import { BANNER_MARGIN_TOP } from "@/components/presence";
import {
ChartConfig,
DataSource,
Layout,
getChartConfig,
hasChartConfigs,
isConfiguring,
Layout,
useConfiguratorState,
} from "@/configurator";
import { Description, Title } from "@/configurator/components/annotators";
Expand Down Expand Up @@ -84,11 +85,18 @@ export const ChartPreview = (props: ChartPreviewProps) => {
// Important to keep the key here to force re-rendering of the chart when
// we switch tabs in the configurator, otherwise we end up with the wrong
// data in the downstream hooks (useDataCubesMetadataQuery, etc.)
<ChartTablePreviewProvider key={state.activeChartKey}>
<ChartWrapper editing={editing} layoutType={layout.type}>
<ChartPreviewInner dataSource={dataSource} />
</ChartWrapper>
</ChartTablePreviewProvider>
<>
{state.state !== "CONFIGURING_CHART" ? (
<DashboardInteractiveFilters
key={state.chartConfigs.map((x) => x.key).join(",")}
/>
) : null}
<ChartTablePreviewProvider key={state.activeChartKey}>
<ChartWrapper editing={editing} layoutType={layout.type}>
<ChartPreviewInner dataSource={dataSource} />
</ChartWrapper>
</ChartTablePreviewProvider>
</>
);
};

Expand Down
2 changes: 2 additions & 0 deletions app/components/chart-published.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from "@/components/chart-table-preview";
import { useChartStyles } from "@/components/chart-utils";
import { ChartWithFilters } from "@/components/chart-with-filters";
import { DashboardInteractiveFilters } from "@/components/dashboard-interactive-filters";
import Flex from "@/components/flex";
import { HintBlue, HintRed, HintYellow } from "@/components/hint";
import {
Expand Down Expand Up @@ -149,6 +150,7 @@ export const ChartPublished = (props: ChartPublishedProps) => {
)}
</Flex>
<ChartTablePreviewProvider>
<DashboardInteractiveFilters />
<ChartWrapper layoutType={state.layout.type}>
<ChartPublishedInner
dataSource={dataSource}
Expand Down
18 changes: 10 additions & 8 deletions app/components/chart-selection-tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -936,14 +936,16 @@ const TabContent = (props: TabContentProps) => {
</Button>

{label ? (
<Button
variant="text"
color="primary"
className={classes.label}
onClick={onSwitchClick}
>
{label}
</Button>
<Tooltip title={label} enterDelay={750}>
<Button
variant="text"
color="primary"
className={classes.label}
onClick={onSwitchClick}
>
{label}
</Button>
</Tooltip>
) : null}
{editable && (
<Button
Expand Down
1 change: 1 addition & 0 deletions app/configurator/components/layout-configurator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ const LayoutSharedFiltersConfigurator = () => {
);

switch (layout.type) {
case "tab":
case "dashboard":
return (
<ControlSection
Expand Down
Loading