diff --git a/src/frontend/views/Dashboard/Widget/_manage/Form.tsx b/src/frontend/views/Dashboard/Widget/_manage/Form.tsx index 89f7f8462..c6057e24d 100644 --- a/src/frontend/views/Dashboard/Widget/_manage/Form.tsx +++ b/src/frontend/views/Dashboard/Widget/_manage/Form.tsx @@ -37,27 +37,28 @@ import { MessageDescriptor } from "@lingui/core"; import { useDomainMessages } from "frontend/lib/crud-config"; import { LANG_DOMAINS } from "frontend/lib/crud-config/lang-domains"; import { DashboardWidgetPresentation } from "../Presentation"; -import { WIDGET_CONFIG } from "../constants"; +import { BASE_WIDGET_CONFIG } from "../constants"; import { PortalFormFields, PortalFormSchema } from "./portal"; import { WidgetFormField } from "./types"; import { DASHBOARD_WIDGET_HEIGHTS } from "./constants"; +import { usePortalDashboardTypesOptions } from "../portal"; -const DashboardTypesOptions: { +const FormSchema: Partial> = { + "summary-card": ["color", "icon"], + table: [], + ...PortalFormSchema, +}; + +const baseDashboardTypesOptions: { label: MessageDescriptor; value: IWidgetConfig["_type"]; -}[] = typescriptSafeObjectDotEntries(WIDGET_CONFIG).map( +}[] = typescriptSafeObjectDotEntries(BASE_WIDGET_CONFIG).map( ([value, { label }]) => ({ label, value: value as IWidgetConfig["_type"], }) ); -const FormSchema: Partial> = { - "summary-card": ["color", "icon"], - table: [], - ...PortalFormSchema, -}; - export function useRunWidgetScript() { return useMutation({ mutationFn: async (script: string) => @@ -89,6 +90,8 @@ export function DashboardWidgetForm({ } }, [initialValues]); + const portalDashboardTypesOptions = usePortalDashboardTypesOptions(); + return ( <>
diff --git a/src/frontend/views/Dashboard/Widget/constants.tsx b/src/frontend/views/Dashboard/Widget/constants.tsx index 203c54c2f..f20402a33 100644 --- a/src/frontend/views/Dashboard/Widget/constants.tsx +++ b/src/frontend/views/Dashboard/Widget/constants.tsx @@ -8,7 +8,7 @@ import { IWidgetConfigBag } from "./types"; import { TableWidgetSchema } from "./_render/Table/types"; import { SummaryCardWidgetSchema } from "./_render/Summary/types"; -const BASE_WIDGET_CONFIG: Partial< +export const BASE_WIDGET_CONFIG: Partial< Record > = { table: { diff --git a/src/frontend/views/Dashboard/Widget/portal/index.ts b/src/frontend/views/Dashboard/Widget/portal/index.ts index 4d2a7ffc4..6b6d223a5 100644 --- a/src/frontend/views/Dashboard/Widget/portal/index.ts +++ b/src/frontend/views/Dashboard/Widget/portal/index.ts @@ -1,2 +1,3 @@ export { PORTAL_WIDGET_CONFIG } from "./main/constants"; export { PortalDashboardWidget } from "./main/DashboardWidget"; +export { usePortalDashboardTypesOptions } from "./main/constants"; diff --git a/src/frontend/views/Dashboard/Widget/portal/main/constants.ts b/src/frontend/views/Dashboard/Widget/portal/main/constants.ts index 88c47cd4f..1eb5555ad 100644 --- a/src/frontend/views/Dashboard/Widget/portal/main/constants.ts +++ b/src/frontend/views/Dashboard/Widget/portal/main/constants.ts @@ -4,3 +4,7 @@ import { IWidgetConfigBag } from "../../types"; export const PORTAL_WIDGET_CONFIG: Partial< Record > = {}; + +export const usePortalDashboardTypesOptions = () => { + return []; +}; diff --git a/src/shared/constants/portal/menu/index.d.ts b/src/shared/constants/portal/menu/index.ts similarity index 100% rename from src/shared/constants/portal/menu/index.d.ts rename to src/shared/constants/portal/menu/index.ts diff --git a/src/shared/constants/portal/menu/main.d.ts b/src/shared/constants/portal/menu/main.ts similarity index 100% rename from src/shared/constants/portal/menu/main.d.ts rename to src/shared/constants/portal/menu/main.ts