From 1c31fa5bcb243b6d428e604ec75141631774c118 Mon Sep 17 00:00:00 2001 From: Gomathi9520 Date: Wed, 14 May 2025 10:07:19 +0530 Subject: [PATCH] Add new state management hooks for machine metrics and input values --- app/src/store/builder/store.ts | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/app/src/store/builder/store.ts b/app/src/store/builder/store.ts index 06c7bfc..b4534b5 100644 --- a/app/src/store/builder/store.ts +++ b/app/src/store/builder/store.ts @@ -451,4 +451,45 @@ export const useShortcutStore = create((set) => ({ setShowShortcuts: (value) => set({ showShortcuts: value }), toggleShortcuts: () => set((state) => ({ showShortcuts: !state.showShortcuts })), +})); + +export const useMachineCount = create((set: any) => ({ + machineCount: 0, + setMachineCount: (x: any) => set({ machineCount: x }), +})); +export const useMachineUptime = create((set: any) => ({ + machineActiveTime: 0, + setMachineActiveTime: (x: any) => set({ machineActiveTime: x }), +})); +export const useMaterialCycle = create((set: any) => ({ + materialCycleTime: 0, + setMaterialCycleTime: (x: any) => set({ materialCycleTime: x }), +})); + +export const useThroughPutData = create((set: any) => ({ + throughputData: 0, + setThroughputData: (x: any) => set({ throughputData: x }), +})); +export const useProductionCapacityData = create((set: any) => ({ + productionCapacityData: 0, + setProductionCapacityData: (x: any) => set({ productionCapacityData: x }), +})); + + +type InputValuesStore = { + inputValues: Record; + setInputValues: (values: Record) => void; + updateInputValue: (label: string, value: string) => void; // <- New +}; + +export const useInputValues = create((set) => ({ + inputValues: {}, + setInputValues: (values) => set({ inputValues: values }), + updateInputValue: (label, value) => + set((state) => ({ + inputValues: { + ...state.inputValues, + [label]: value, + }, + })), })); \ No newline at end of file