Skip to content

Commit

Permalink
Return fallback for previous data format
Browse files Browse the repository at this point in the history
  • Loading branch information
DaryaLari committed Dec 10, 2024
1 parent dc34e2b commit cf76b9b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/shared/types/dash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export type DashTabItem =
| DashTabItemImage;

type BackgroundSettings = {
enabled?: boolean;
color: string;
};

Expand Down
4 changes: 3 additions & 1 deletion src/ui/components/DashKit/plugins/Image/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ function PluginImage(props: Props, _ref?: React.LegacyRef<HTMLDivElement>) {
w: null,
};
const backgroundEnabled = Boolean(
background?.color && background?.color !== CustomPaletteColors.NONE,
background?.enabled !== false &&
background?.color &&
background?.color !== CustomPaletteColors.NONE,
);
const {classMod, style} = React.useMemo(() => {
return getPreparedWrapSettings(backgroundEnabled, background?.color);
Expand Down
4 changes: 3 additions & 1 deletion src/ui/components/DashKit/plugins/Text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ const textPlugin = {
const data = props.data as DashTabItemText['data'];

const showBgColor = Boolean(
data.background?.color && data.background?.color !== CustomPaletteColors.NONE,
data.background?.enabled !== false &&
data.background?.color &&
data.background?.color !== CustomPaletteColors.NONE,
);

const {classMod, style} = getPreparedWrapSettings(showBgColor, data.background?.color);
Expand Down
4 changes: 3 additions & 1 deletion src/ui/components/DashKit/plugins/Title/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ const titlePlugin: PluginTitle = {
const content = <DashKitPluginTitle {...props} ref={forwardedRef} />;

const showBgColor = Boolean(
data.background?.color && data.background?.color !== CustomPaletteColors.NONE,
data.background?.enabled !== false &&
data.background?.color &&
data.background?.color !== CustomPaletteColors.NONE,
);

const {classMod, style} = getPreparedWrapSettings(showBgColor, data.background?.color);
Expand Down
1 change: 1 addition & 0 deletions src/ui/components/DashKit/plugins/Widget/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type CurrentTab = {
autoHeight?: boolean;
enableActionParams?: boolean;
background?: {
enabled?: boolean;
color: string;
};
};
Expand Down
4 changes: 3 additions & 1 deletion src/ui/components/Widgets/Chart/ChartWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,9 @@ export const ChartWidget = (props: ChartWidgetProps) => {
}, [editMode, widgetType]);

const showBgColor = Boolean(
currentTab.background?.color && currentTab.background?.color !== 'transparent',
currentTab?.enabled !== false &&
currentTab.background?.color &&
currentTab.background?.color !== 'transparent',
);

const {classMod, style} = getPreparedWrapSettings(showBgColor, currentTab.background?.color);
Expand Down

0 comments on commit cf76b9b

Please sign in to comment.