feat: Refactor simulation components and enhance product management with new features
This commit is contained in:
@@ -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 = '';
|
||||
});
|
||||
},
|
||||
}))
|
||||
);
|
||||
Reference in New Issue
Block a user