feat: Refactor simulation components and enhance product management with new features

This commit is contained in:
2025-04-24 11:07:15 +05:30
parent d53ef429c8
commit 85515c6cd3
7 changed files with 313 additions and 135 deletions

View File

@@ -22,4 +22,28 @@ export const useSelectedEventSphere = create<SelectedEventSphereState>()(
});
},
}))
);
interface SelectedProductState {
selectedProduct: { productId: string; productName: string };
setSelectedProduct: (productId: string, productName: string) => void;
clearSelectedProduct: () => void;
}
export const useSelectedProduct = create<SelectedProductState>()(
immer((set) => ({
selectedProduct: { productId: '', productName: '' },
setSelectedProduct: (productId, productName) => {
set((state) => {
state.selectedProduct.productId = productId;
state.selectedProduct.productName = productName;
});
},
clearSelectedProduct: () => {
set((state) => {
state.selectedProduct.productId = '';
state.selectedProduct.productName = '';
});
},
}))
);