Skip to content

Commit

Permalink
Move components/GoalTimeline/Redux to goals/Redux
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec committed Mar 8, 2024
1 parent 03a10d5 commit 41ac138
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 49 deletions.
2 changes: 1 addition & 1 deletion src/components/App/DefaultState.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { defaultState as goalsState } from "components/GoalTimeline/Redux/GoalReduxTypes";
import { defaultState as loginState } from "components/Login/Redux/LoginReduxTypes";
import { defaultState as currentProjectState } from "components/Project/ProjectReduxTypes";
import { defaultState as exportProjectState } from "components/ProjectExport/Redux/ExportProjectReduxTypes";
import { defaultState as pronunciationsState } from "components/Pronunciations/Redux/PronunciationsReduxTypes";
import { defaultState as treeViewState } from "components/TreeView/Redux/TreeViewReduxTypes";
import { defaultState as characterInventoryState } from "goals/CharacterInventory/Redux/CharacterInventoryReduxTypes";
import { defaultState as mergeDuplicateGoal } from "goals/MergeDuplicates/Redux/MergeDupsReduxTypes";
import { defaultState as goalsState } from "goals/Redux/GoalReduxTypes";
import { defaultState as reviewEntriesState } from "goals/ReviewEntries/Redux/ReviewEntriesReduxTypes";
import { defaultState as analyticsState } from "types/Redux/analyticsReduxTypes";

Expand Down
5 changes: 1 addition & 4 deletions src/components/GoalTimeline/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import { useTranslation } from "react-i18next";

import { getCurrentPermissions, getGraylistEntries } from "backend";
import GoalList from "components/GoalTimeline/GoalList";
import {
asyncAddGoal,
asyncGetUserEdits,
} from "components/GoalTimeline/Redux/GoalActions";
import { asyncAddGoal, asyncGetUserEdits } from "goals/Redux/GoalActions";
import { StoreState } from "types";
import { Goal, GoalType } from "types/goals";
import { useAppDispatch, useAppSelector } from "types/hooks";
Expand Down
18 changes: 9 additions & 9 deletions src/components/GoalTimeline/tests/GoalRedux.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ import "tests/reactI18nextMock";
import { Edit, MergeUndoIds, Permission, User, UserEdit } from "api/models";
import * as LocalStorage from "backend/localStorage";
import GoalTimeline from "components/GoalTimeline";
import {
addCharInvChangesToGoal,
addCompletedMergeToGoal,
asyncAddGoal,
asyncAdvanceStep,
asyncGetUserEdits,
asyncUpdateGoal,
setCurrentGoal,
} from "components/GoalTimeline/Redux/GoalActions";
import {
CharacterChange,
CharacterStatus,
Expand All @@ -28,6 +19,15 @@ import {
ReviewDeferredDups,
} from "goals/MergeDuplicates/MergeDupsTypes";
import { goalDataMock } from "goals/MergeDuplicates/Redux/tests/MergeDupsDataMock";
import {
addCharInvChangesToGoal,
addCompletedMergeToGoal,
asyncAddGoal,
asyncAdvanceStep,
asyncGetUserEdits,
asyncUpdateGoal,
setCurrentGoal,
} from "goals/Redux/GoalActions";
import { setupStore } from "store";
import { GoalStatus, GoalType } from "types/goals";
import { Path } from "types/path";
Expand Down
9 changes: 3 additions & 6 deletions src/components/GoalTimeline/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@ import "tests/reactI18nextMock";

import { Permission } from "api/models";
import GoalTimeline, { createSuggestionData } from "components/GoalTimeline";
import {
type GoalsState,
defaultState,
} from "components/GoalTimeline/Redux/GoalReduxTypes";
import { type GoalsState, defaultState } from "goals/Redux/GoalReduxTypes";
import { Goal, GoalType } from "types/goals";
import { goalTypeToGoal } from "utilities/goalUtilities";

jest.mock("backend", () => ({
getCurrentPermissions: () => mockGetCurrentPermissions(),
getGraylistEntries: (maxLists: number) => mockGetGraylistEntries(maxLists),
}));
jest.mock("components/GoalTimeline/Redux/GoalActions", () => ({
jest.mock("components/Pronunciations/Recorder");
jest.mock("goals/Redux/GoalActions", () => ({
asyncAddGoal: (goal: Goal) => mockChooseGoal(goal),
asyncGetUserEdits: () => jest.fn(),
}));
jest.mock("components/Pronunciations/Recorder");
jest.mock("types/hooks", () => {
return {
...jest.requireActual("types/hooks"),
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProjectScreen/CreateProjectActions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { WritingSystem } from "api/models";
import { createProject, finishUploadLift, getProject } from "backend";
import router from "browserRouter";
import { asyncCreateUserEdits } from "components/GoalTimeline/Redux/GoalActions";
import { setNewCurrentProject } from "components/Project/ProjectActions";
import { asyncCreateUserEdits } from "goals/Redux/GoalActions";
import { StoreStateDispatch } from "types/Redux/actions";
import { Path } from "types/path";
import { newProject } from "types/project";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import { Action, PayloadAction } from "@reduxjs/toolkit";
import { Project } from "api/models";
import { getFrontierWords } from "backend";
import router from "browserRouter";
import {
addCharInvChangesToGoal,
asyncUpdateGoal,
} from "components/GoalTimeline/Redux/GoalActions";
import { asyncUpdateCurrentProject } from "components/Project/ProjectActions";
import {
CharacterStatus,
Expand All @@ -27,6 +23,10 @@ import {
CharacterSetEntry,
getCharacterStatus,
} from "goals/CharacterInventory/Redux/CharacterInventoryReduxTypes";
import {
addCharInvChangesToGoal,
asyncUpdateGoal,
} from "goals/Redux/GoalActions";
import { StoreState } from "types";
import { StoreStateDispatch } from "types/Redux/actions";
import { Path } from "types/path";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ jest.mock("backend", () => ({
getFrontierWords: (...args: any[]) => mockGetFrontierWords(...args),
}));
jest.mock("browserRouter");
jest.mock("components/GoalTimeline/Redux/GoalActions", () => ({
asyncUpdateGoal: (...args: any[]) => mockAsyncUpdateGoal(...args),
addCharInvChangesToGoal: (...args: any[]) =>
mockAddCharInvChangesToGoal(...args),
}));
jest.mock("components/Project/ProjectActions", () => ({
asyncUpdateCurrentProject: (...args: any[]) =>
mockAsyncUpdateCurrentProject(...args),
}));
jest.mock("goals/Redux/GoalActions", () => ({
asyncUpdateGoal: (...args: any[]) => mockAsyncUpdateGoal(...args),
addCharInvChangesToGoal: (...args: any[]) =>
mockAddCharInvChangesToGoal(...args),
}));

const mockAddCharInvChangesToGoal = jest.fn();
const mockAsyncUpdateCurrentProject = jest.fn();
Expand Down
2 changes: 1 addition & 1 deletion src/goals/DefaultGoal/BaseGoalScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import loadable from "@loadable/component";
import { ReactElement, useEffect } from "react";

import { setCurrentGoal } from "components/GoalTimeline/Redux/GoalActions";
import PageNotFound from "components/PageNotFound/component";
import DisplayProgress from "goals/DefaultGoal/DisplayProgress";
import Loading from "goals/DefaultGoal/Loading";
import { clearTree } from "goals/MergeDuplicates/Redux/MergeDupsActions";
import { setCurrentGoal } from "goals/Redux/GoalActions";
import { resetReviewEntries } from "goals/ReviewEntries/Redux/ReviewEntriesActions";
import { StoreState } from "types";
import { Goal, GoalStatus, GoalType } from "types/goals";
Expand Down
2 changes: 1 addition & 1 deletion src/goals/DefaultGoal/NextGoalScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ReactElement } from "react";
import { useNavigate } from "react-router-dom";

import { asyncAddGoal } from "components/GoalTimeline/Redux/GoalActions";
import PageNotFound from "components/PageNotFound/component";
import MergeDupsContinueDialog from "goals/MergeDuplicates/MergeDupsContinueDialog";
import { asyncAddGoal } from "goals/Redux/GoalActions";
import { StoreState } from "types";
import { GoalType } from "types/goals";
import { useAppDispatch, useAppSelector } from "types/hooks";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { ReactElement, useState } from "react";
import { useTranslation } from "react-i18next";

import { LoadingButton } from "components/Buttons";
import { asyncAdvanceStep } from "components/GoalTimeline/Redux/GoalActions";
import {
deferMerge,
mergeAll,
setSidebar,
} from "goals/MergeDuplicates/Redux/MergeDupsActions";
import { asyncAdvanceStep } from "goals/Redux/GoalActions";
import { useAppDispatch } from "types/hooks";
import theme from "types/theme";

Expand Down
8 changes: 4 additions & 4 deletions src/goals/MergeDuplicates/Redux/MergeDupsActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import { Action, PayloadAction } from "@reduxjs/toolkit";

import { Word } from "api/models";
import * as backend from "backend";
import {
addCompletedMergeToGoal,
asyncUpdateGoal,
} from "components/GoalTimeline/Redux/GoalActions";
import {
defaultSidebar,
MergeTreeReference,
Expand Down Expand Up @@ -38,6 +34,10 @@ import {
OrderSensePayload,
SetVernacularPayload,
} from "goals/MergeDuplicates/Redux/MergeDupsReduxTypes";
import {
addCompletedMergeToGoal,
asyncUpdateGoal,
} from "goals/Redux/GoalActions";
import { StoreState } from "types";
import { StoreStateDispatch } from "types/Redux/actions";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import * as Backend from "backend";
import { getDuplicates, getGraylistEntries } from "backend";
import { getCurrentUser, getProjectId } from "backend/localStorage";
import router from "browserRouter";
import { CharacterChange } from "goals/CharacterInventory/CharacterInventoryTypes";
import { dispatchMergeStepData } from "goals/MergeDuplicates/Redux/MergeDupsActions";
import {
addCharInvChangesToGoalAction,
addCompletedMergeToGoalAction,
Expand All @@ -15,9 +17,7 @@ import {
setGoalDataAction,
setGoalStatusAction,
updateStepFromDataAction,
} from "components/GoalTimeline/Redux/GoalReducer";
import { CharacterChange } from "goals/CharacterInventory/CharacterInventoryTypes";
import { dispatchMergeStepData } from "goals/MergeDuplicates/Redux/MergeDupsActions";
} from "goals/Redux/GoalReducer";
import { EntryEdit } from "goals/ReviewEntries/ReviewEntriesTypes";
import { StoreState } from "types";
import { StoreStateDispatch } from "types/Redux/actions";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createSlice } from "@reduxjs/toolkit";

import { defaultState } from "components/GoalTimeline/Redux/GoalReduxTypes";
import {
MergeDupsData,
MergesCompleted,
} from "goals/MergeDuplicates/MergeDupsTypes";
import { defaultState } from "goals/Redux/GoalReduxTypes";
import {
EntriesEdited,
EntryEdit,
Expand Down
File renamed without changes.
5 changes: 1 addition & 4 deletions src/goals/ReviewEntries/Redux/ReviewEntriesActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import { Action, PayloadAction } from "@reduxjs/toolkit";

import { Pronunciation, Sense, Word } from "api/models";
import * as backend from "backend";
import {
addEntryEditToGoal,
asyncUpdateGoal,
} from "components/GoalTimeline/Redux/GoalActions";
import { uploadFileFromPronunciation } from "components/Pronunciations/utilities";
import { addEntryEditToGoal, asyncUpdateGoal } from "goals/Redux/GoalActions";
import {
deleteWordAction,
resetReviewEntriesAction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jest.mock("backend", () => ({
updateWord: (word: Word) => mockUpdateWord(word),
uploadAudio: (args: any[]) => mockUploadAudio(...args),
}));
jest.mock("components/GoalTimeline/Redux/GoalActions", () => ({
jest.mock("goals/Redux/GoalActions", () => ({
addEntryEditToGoal: () => jest.fn(),
asyncUpdateGoal: () => jest.fn(),
}));
Expand Down
2 changes: 1 addition & 1 deletion src/goals/ReviewEntries/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jest.mock("backend", () => ({
getFrontierWords: (...args: any[]) => mockGetFrontierWords(...args),
}));
jest.mock("components/TreeView", () => "div");
jest.mock("components/GoalTimeline/Redux/GoalActions", () => ({}));
jest.mock("goals/Redux/GoalActions", () => ({}));
jest.mock("types/hooks", () => ({
useAppDispatch: () => jest.fn(),
}));
Expand Down
2 changes: 1 addition & 1 deletion src/rootReducer.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { combineReducers, Reducer } from "redux";

import goalsReducer from "components/GoalTimeline/Redux/GoalReducer";
import loginReducer from "components/Login/Redux/LoginReducer";
import projectReducer from "components/Project/ProjectReducer";
import exportProjectReducer from "components/ProjectExport/Redux/ExportProjectReducer";
import pronunciationsReducer from "components/Pronunciations/Redux/PronunciationsReducer";
import treeViewReducer from "components/TreeView/Redux/TreeViewReducer";
import characterInventoryReducer from "goals/CharacterInventory/Redux/CharacterInventoryReducer";
import mergeDupStepReducer from "goals/MergeDuplicates/Redux/MergeDupsReducer";
import goalsReducer from "goals/Redux/GoalReducer";
import reviewEntriesReducer from "goals/ReviewEntries/Redux/ReviewEntriesReducer";
import { StoreState } from "types";
import analyticsReducer from "types/Redux/analytics";
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { GoalsState } from "components/GoalTimeline/Redux/GoalReduxTypes";
import { LoginState } from "components/Login/Redux/LoginReduxTypes";
import { CurrentProjectState } from "components/Project/ProjectReduxTypes";
import { ExportProjectState } from "components/ProjectExport/Redux/ExportProjectReduxTypes";
import { PronunciationsState } from "components/Pronunciations/Redux/PronunciationsReduxTypes";
import { TreeViewState } from "components/TreeView/Redux/TreeViewReduxTypes";
import { CharacterInventoryState } from "goals/CharacterInventory/Redux/CharacterInventoryReduxTypes";
import { MergeTreeState } from "goals/MergeDuplicates/Redux/MergeDupsReduxTypes";
import { GoalsState } from "goals/Redux/GoalReduxTypes";
import { ReviewEntriesState } from "goals/ReviewEntries/Redux/ReviewEntriesReduxTypes";
import { AnalyticsState } from "types/Redux/analyticsReduxTypes";

Expand Down

0 comments on commit 41ac138

Please sign in to comment.