Skip to content

Commit

Permalink
Remove app state type
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Dec 20, 2024
1 parent 4889226 commit 2d96d05
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 37 deletions.
10 changes: 6 additions & 4 deletions packages/desktop-client/src/hooks/useSplitsExpanded.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import React, {
useRef,
} from 'react';

import {
type SplitMode,
type SplitState,
} from 'loot-core/client/state-types/app';
type SplitMode = 'collapse' | 'expand';
type SplitState = {
ids: string[];
mode: SplitMode;
transitionId: string | null;
};

type ToggleSplitAction = {
type: 'toggle-split';
Expand Down
20 changes: 16 additions & 4 deletions packages/loot-core/src/client/reducers/modals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ export const initialState: ModalsState = {
isHidden: false,
};

export function update(state = initialState, action: Action): ModalsState {
type ModalsAction =
| Action
// Temporary until we migrate to redux toolkit.
| {
type: 'app/setAppState';
payload: { loadingText: string | null };
};

export function update(
state = initialState,
action: ModalsAction,
): ModalsState {
switch (action.type) {
case constants.PUSH_MODAL:
// special case: don't show the keyboard shortcuts modal if there's already a modal open
Expand Down Expand Up @@ -44,11 +55,12 @@ export function update(state = initialState, action: Action): ModalsState {
...state,
modalStack: idx < 0 ? state.modalStack : state.modalStack.slice(0, idx),
};
case constants.SET_APP_STATE:
if ('loadingText' in action.state) {
// Temporary until we migrate to redux toolkit.
case 'app/setAppState':
if (action.payload.loadingText) {
return {
...state,
isHidden: action.state.loadingText != null,
isHidden: action.payload.loadingText != null,
};
}
break;
Expand Down
26 changes: 0 additions & 26 deletions packages/loot-core/src/client/state-types/app.d.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/loot-core/src/client/state-types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type * as constants from '../constants';

import type { AppActions, AppState } from './app';
import type { BudgetsActions, BudgetsState } from './budgets';
import type { ModalsActions, ModalsState } from './modals';
import type { NotificationsActions, NotificationsState } from './notifications';
Expand All @@ -12,7 +11,6 @@ export type CloseBudgetAction = {
};

export type Action =
| AppActions
| BudgetsActions
| ModalsActions
| NotificationsActions
Expand All @@ -21,7 +19,6 @@ export type Action =
| CloseBudgetAction;

export type State = {
app: AppState;
budgets: BudgetsState;
modals: ModalsState;
notifications: NotificationsState;
Expand Down

0 comments on commit 2d96d05

Please sign in to comment.