historyPanelSwitchSlice.ts 658 B

1234567891011121314151617181920212223242526
  1. import { createSlice } from '@reduxjs/toolkit';
  2. interface HistoryPanelSwitchState {
  3. currentPanel: 'OperationPanel' | 'SendPanel';
  4. }
  5. const initialState: HistoryPanelSwitchState = {
  6. currentPanel: 'OperationPanel',
  7. };
  8. const historyPanelSwitchSlice = createSlice({
  9. name: 'historyPanelSwitch',
  10. initialState,
  11. reducers: {
  12. switchToOperationPanel: (state) => {
  13. state.currentPanel = 'OperationPanel';
  14. },
  15. switchToSendPanel: (state) => {
  16. state.currentPanel = 'SendPanel';
  17. },
  18. },
  19. });
  20. export const { switchToOperationPanel, switchToSendPanel } =
  21. historyPanelSwitchSlice.actions;
  22. export default historyPanelSwitchSlice.reducer;