mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 01:11:25 +00:00
Migrate remaining notification console methods to zustand (#873)
This commit is contained in:
@@ -1,14 +1,25 @@
|
||||
import create, { UseStore } from "zustand";
|
||||
import { ConsoleData } from "../Explorer/Menus/NotificationConsole/ConsoleData";
|
||||
|
||||
export interface NotificationConsoleState {
|
||||
isExpanded: boolean;
|
||||
inProgressConsoleDataIdToBeDeleted: string;
|
||||
consoleData: ConsoleData | undefined;
|
||||
expandConsole: () => void;
|
||||
// TODO Remove this method. Add a `closeConsole` method instead
|
||||
setIsExpanded: (isExpanded: boolean) => void;
|
||||
// TODO These two methods badly need a refactor. Not very react friendly.
|
||||
setNotificationConsoleData: (consoleData: ConsoleData) => void;
|
||||
setInProgressConsoleDataIdToBeDeleted: (id: string) => void;
|
||||
}
|
||||
|
||||
export const useNotificationConsole: UseStore<NotificationConsoleState> = create((set) => ({
|
||||
isExpanded: false,
|
||||
consoleData: undefined,
|
||||
inProgressConsoleDataIdToBeDeleted: "",
|
||||
expandConsole: () => set((state) => ({ ...state, isExpanded: true })),
|
||||
setIsExpanded: (isExpanded) => set((state) => ({ ...state, isExpanded })),
|
||||
setNotificationConsoleData: (consoleData: ConsoleData) => set((state) => ({ ...state, consoleData })),
|
||||
setInProgressConsoleDataIdToBeDeleted: (id: string) =>
|
||||
set((state) => ({ ...state, inProgressConsoleDataIdToBeDeleted: id })),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user