chore(frontend): migrate utility JS files to TypeScript (#36721)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Evan Rusackas
2025-12-18 13:54:40 -08:00
committed by GitHub
parent 32435bc3e9
commit da8e077a44
12 changed files with 146 additions and 153 deletions

View File

@@ -20,8 +20,26 @@
import * as actions from '../actions/saveModalActions';
import { HYDRATE_EXPLORE } from '../actions/hydrateExplore';
export default function saveModalReducer(state = {}, action) {
const actionHandlers = {
interface SaveModalState {
isVisible?: boolean;
dashboards?: unknown[];
saveModalAlert?: string;
data?: unknown;
}
interface SaveModalAction {
type: string;
isVisible?: boolean;
choices?: unknown[];
userId?: string;
data?: unknown;
}
export default function saveModalReducer(
state: SaveModalState = {},
action: SaveModalAction,
): SaveModalState {
const actionHandlers: Record<string, () => SaveModalState> = {
[actions.SET_SAVE_CHART_MODAL_VISIBILITY]() {
return { ...state, isVisible: action.isVisible };
},
@@ -37,11 +55,12 @@ export default function saveModalReducer(state = {}, action) {
[actions.SAVE_SLICE_FAILED]() {
return { ...state, saveModalAlert: 'Failed to save slice' };
},
[actions.SAVE_SLICE_SUCCESS](data) {
return { ...state, data };
[actions.SAVE_SLICE_SUCCESS]() {
return { ...state, data: action.data };
},
[HYDRATE_EXPLORE]() {
return { ...action.data.saveModal };
const payload = action.data as { saveModal?: SaveModalState } | undefined;
return { ...payload?.saveModal };
},
};