Files
twenty/packages/twenty-front/src/modules/page-layout/constants/GraphWidgetSizes.ts
T
Paul Rastoin 4135a6473a [BREAKING_CHANGE_DASHBOARDS][DASHBOARD_CACHE_FLUSH_REQUIRED] Refactor page layout widget configuration type (#16671)
# Introduction
In this pull-request we're refactoring the page layout widget
configuration entity to be containing its discriminated key simplifying
underlying code and maintainability
- Made the configuration and title non nullable
- Introduced a generic predicate for the `widgetConfigurationType`
- Upgraded command to remove `graphType` and insert new
`configurationType` to existing entries
- Migrated frontend to new type system

---------

Co-authored-by: bosiraphael <raphael.bosi@gmail.com>
Co-authored-by: Raphaël Bosi <71827178+bosiraphael@users.noreply.github.com>
2025-12-29 15:46:59 +01:00

28 lines
775 B
TypeScript

import { type WidgetSizeConfig } from '@/page-layout/types/WidgetSizeConfig';
import { WidgetConfigurationType } from '~/generated/graphql';
export const GRAPH_WIDGET_SIZES: Partial<
Record<WidgetConfigurationType, WidgetSizeConfig>
> = {
[WidgetConfigurationType.AGGREGATE_CHART]: {
default: { w: 2, h: 2 },
minimum: { w: 2, h: 2 },
},
[WidgetConfigurationType.GAUGE_CHART]: {
default: { w: 3, h: 4 },
minimum: { w: 3, h: 4 },
},
[WidgetConfigurationType.PIE_CHART]: {
default: { w: 4, h: 4 },
minimum: { w: 3, h: 4 },
},
[WidgetConfigurationType.BAR_CHART]: {
default: { w: 6, h: 6 },
minimum: { w: 4, h: 4 },
},
[WidgetConfigurationType.LINE_CHART]: {
default: { w: 6, h: 10 },
minimum: { w: 4, h: 4 },
},
};