mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-23 02:41:02 +00:00
first commit
This commit is contained in:
33
src/renderer/features/window-slice.ts
Normal file
33
src/renderer/features/window-slice.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
import type { PayloadAction } from "@reduxjs/toolkit";
|
||||
|
||||
interface WindowState {
|
||||
draggingDisabled: boolean;
|
||||
scrollingDisabled: boolean;
|
||||
headerTitle: string;
|
||||
}
|
||||
|
||||
const initialState: WindowState = {
|
||||
draggingDisabled: false,
|
||||
scrollingDisabled: false,
|
||||
headerTitle: "",
|
||||
};
|
||||
|
||||
export const windowSlice = createSlice({
|
||||
name: "window",
|
||||
initialState,
|
||||
reducers: {
|
||||
toggleDragging: (state, action: PayloadAction<boolean>) => {
|
||||
state.draggingDisabled = action.payload;
|
||||
},
|
||||
toggleScrolling: (state, action: PayloadAction<boolean>) => {
|
||||
state.scrollingDisabled = action.payload;
|
||||
},
|
||||
setHeaderTitle: (state, action: PayloadAction<string>) => {
|
||||
state.headerTitle = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { toggleDragging, toggleScrolling, setHeaderTitle } =
|
||||
windowSlice.actions;
|
||||
Reference in New Issue
Block a user