update commandBar duck to RTK (#7370)
Some checks are pending
autofix.ci / autofix (push) Waiting to run
CI / lint (push) Waiting to run
CI / filename-matching (push) Waiting to run
CI / mypy (push) Waiting to run
CI / individual-coverage (push) Waiting to run
CI / test (macos-latest, 3.13) (push) Waiting to run
CI / test (ubuntu-latest, 3.10) (push) Waiting to run
CI / test (ubuntu-latest, 3.11) (push) Waiting to run
CI / test (ubuntu-latest, 3.12) (push) Waiting to run
CI / test (ubuntu-latest, 3.13) (push) Waiting to run
CI / test (windows-latest, 3.13) (push) Waiting to run
CI / test-old-dependencies (push) Waiting to run
CI / build (macos-13, macos-x86_64) (push) Waiting to run
CI / build (macos-14, macos-arm64) (push) Waiting to run
CI / build (ubuntu-20.04, linux) (push) Waiting to run
CI / build (windows-2019, windows) (push) Waiting to run
CI / build-wheel (push) Waiting to run
CI / build-windows-installer (push) Waiting to run
CI / test-web-ui (push) Waiting to run
CI / test-docker (push) Blocked by required conditions
CI / docs (push) Waiting to run
CI / check (push) Blocked by required conditions
CI / deploy-docker (push) Blocked by required conditions
CI / deploy (push) Blocked by required conditions

This commit is contained in:
Matteo Luppi 2024-12-04 09:42:48 +01:00 committed by GitHub
parent ba356376c0
commit 6dce751e62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
export const TOGGLE_VISIBILITY = "COMMANDBAR_TOGGLE_VISIBILITY"; import { createSlice } from "@reduxjs/toolkit";
interface CommandBarState { interface CommandBarState {
visible: boolean; visible: boolean;
@ -8,19 +8,16 @@ export const defaultState: CommandBarState = {
visible: false, visible: false,
}; };
export default function reducer(state = defaultState, action): CommandBarState { export const commandBarSlice = createSlice({
switch (action.type) { name: "commandBar",
case TOGGLE_VISIBILITY: initialState: defaultState,
return { reducers: {
...state, toggleVisibility(state) {
visible: !state.visible, state.visible = !state.visible;
}; },
},
});
default: const { actions, reducer } = commandBarSlice;
return state; export const { toggleVisibility } = actions;
} export default reducer;
}
export function toggleVisibility() {
return { type: TOGGLE_VISIBILITY };
}