feat: clean code
This commit is contained in:
6 files changed
+1
-212
No files matched your search
@@ -1,9 +1,4 @@
|
||||
import { createSlice, type PayloadAction } from "@reduxjs/toolkit";
|
||||
import {
|
||||
DASHBOARD_CARD_IDS,
|
||||
defaultVisibleCards,
|
||||
type DashboardCardId,
|
||||
} from "@/Pages/Dashboard/dashboardCards";
|
||||
|
||||
type ThemeMode = "light" | "dark";
|
||||
type ChartType = "histogram" | "line";
|
||||
@@ -40,8 +35,6 @@ interface UIState {
|
||||
language: string;
|
||||
starPromptOpen: boolean;
|
||||
chartType: ChartType;
|
||||
dashboardCards: Record<DashboardCardId, boolean>;
|
||||
dashboardCardOrder: DashboardCardId[];
|
||||
}
|
||||
|
||||
const initialMode: ThemeMode = window?.matchMedia?.("(prefers-color-scheme: dark)")
|
||||
@@ -81,8 +74,6 @@ const initialState: UIState = {
|
||||
language: "en",
|
||||
starPromptOpen: true,
|
||||
chartType: "histogram",
|
||||
dashboardCards: { ...defaultVisibleCards },
|
||||
dashboardCardOrder: [...DASHBOARD_CARD_IDS],
|
||||
};
|
||||
|
||||
const uiSlice = createSlice({
|
||||
@@ -111,7 +102,6 @@ const uiSlice = createSlice({
|
||||
setShowURL: (state, action: PayloadAction<boolean>) => {
|
||||
state.showURL = action.payload;
|
||||
},
|
||||
|
||||
setTimezone: (state, action: PayloadAction<{ timezone: string }>) => {
|
||||
if (action.payload.timezone) {
|
||||
state.timezone = action.payload.timezone;
|
||||
@@ -126,27 +116,6 @@ const uiSlice = createSlice({
|
||||
setChartType: (state, action: PayloadAction<ChartType>) => {
|
||||
state.chartType = action.payload;
|
||||
},
|
||||
setDashboardCards: (
|
||||
state,
|
||||
action: PayloadAction<Record<DashboardCardId, boolean>>
|
||||
) => {
|
||||
state.dashboardCards = action.payload;
|
||||
},
|
||||
setDashboardCardsVisibility: (
|
||||
state,
|
||||
action: PayloadAction<{ id: DashboardCardId; visible: boolean }>
|
||||
) => {
|
||||
state.dashboardCards[action.payload.id] = action.payload.visible;
|
||||
},
|
||||
toggleDashboardCard: (state, action: PayloadAction<DashboardCardId>) => {
|
||||
state.dashboardCards[action.payload] = !state.dashboardCards[action.payload];
|
||||
},
|
||||
resetDashboardCards: (state) => {
|
||||
state.dashboardCards = { ...defaultVisibleCards };
|
||||
},
|
||||
setDashboardCardOrder: (state, action: PayloadAction<DashboardCardId[]>) => {
|
||||
state.dashboardCardOrder = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -163,9 +132,4 @@ export const {
|
||||
setLanguage,
|
||||
setStarPromptOpen,
|
||||
setChartType,
|
||||
setDashboardCards,
|
||||
setDashboardCardsVisibility,
|
||||
toggleDashboardCard,
|
||||
resetDashboardCards,
|
||||
setDashboardCardOrder,
|
||||
} = uiSlice.actions;
|
||||
Reference in new issue
Block a user