From 4b013a83761f2f95511f7c172802e2d553efc637 Mon Sep 17 00:00:00 2001 From: Yumin Cho Date: Sat, 18 May 2024 23:03:30 +0900 Subject: [PATCH 1/5] fix: correct properties and export planner item interfaces --- src/shapes/state/planner/ItemFocus.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/shapes/state/planner/ItemFocus.ts b/src/shapes/state/planner/ItemFocus.ts index e9fc116..eb657bc 100644 --- a/src/shapes/state/planner/ItemFocus.ts +++ b/src/shapes/state/planner/ItemFocus.ts @@ -20,7 +20,7 @@ export interface ArbitraryPseudoCourse { old_code: string; } -interface NoneItem { +export interface NoneItem { from: ItemFocusFrom.NONE; clicked: false; item?: null; @@ -30,37 +30,37 @@ interface NoneItem { lectures?: null; } -interface ListItem { +export interface ListItem { from: ItemFocusFrom.LIST; clicked: boolean; item?: null; course?: Course | ArbitraryPseudoCourse; category?: null; - reviews?: Review; - lectures?: Lecture; + reviews?: Review[]; + lectures?: Lecture[]; } -interface AddingItem { +export interface AddingItem { from: ItemFocusFrom.ADDING; clicked: true; item?: null; course?: Course | ArbitraryPseudoCourse; category?: null; - reviews?: Review; - lectures?: Lecture; + reviews?: Review[]; + lectures?: Lecture[]; } -interface TableItem { +export interface TableItem { from: ItemFocusFrom.TABLE_TAKEN | ItemFocusFrom.TABLE_FUTURE | ItemFocusFrom.TABLE_ARBITRARY; clicked: boolean; item?: TakenPlannerItem | FuturePlannerItem | ArbitraryPlannerItem; course?: Course | ArbitraryPseudoCourse; category?: null; - reviews?: Review; - lecture?: Lecture; + reviews?: Review[]; + lecture?: Lecture[]; } -interface CategoryItem { +export interface CategoryItem { from: ItemFocusFrom.CATEGORY; clicked: boolean; item?: null; From e2b8a4e43833b272b06f235831824ae1ec43cb2d Mon Sep 17 00:00:00 2001 From: Yumin Cho Date: Sat, 18 May 2024 23:09:15 +0900 Subject: [PATCH 2/5] feat: add reducer return types --- src/reducers/dictionary/courseFocus.ts | 2 +- src/reducers/dictionary/list.ts | 2 +- src/reducers/dictionary/search.ts | 2 +- src/reducers/planner/itemFocus.ts | 28 +++++++++++++-------- src/reducers/planner/list.ts | 2 +- src/reducers/planner/planner.ts | 4 +-- src/reducers/planner/search.ts | 2 +- src/reducers/timetable/lectureFocus.ts | 2 +- src/reducers/timetable/list.ts | 2 +- src/reducers/timetable/search.ts | 3 +-- src/reducers/timetable/semester.ts | 2 +- src/reducers/timetable/timetable.ts | 4 +-- src/reducers/write-reviews/latestReviews.ts | 2 +- src/reducers/write-reviews/likedReviews.ts | 2 +- src/reducers/write-reviews/rankedReviews.ts | 2 +- src/reducers/write-reviews/reviewsFocus.ts | 2 +- 16 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/reducers/dictionary/courseFocus.ts b/src/reducers/dictionary/courseFocus.ts index 1f4e2c5..4695e07 100644 --- a/src/reducers/dictionary/courseFocus.ts +++ b/src/reducers/dictionary/courseFocus.ts @@ -23,7 +23,7 @@ const initialState: CourseFocusState = { lectures: null, }; -const courseFocus = (state = initialState, action: DictionaryAction) => { +const courseFocus = (state = initialState, action: DictionaryAction): CourseFocusState => { switch (action.type) { case RESET: { return initialState; diff --git a/src/reducers/dictionary/list.ts b/src/reducers/dictionary/list.ts index 471ee73..fb4ebdd 100644 --- a/src/reducers/dictionary/list.ts +++ b/src/reducers/dictionary/list.ts @@ -39,7 +39,7 @@ const initialState: ListState = { readCourses: [], }; -const list = (state = initialState, action: DictionaryAction) => { +const list = (state = initialState, action: DictionaryAction): ListState => { switch (action.type) { case RESET: { return initialState; diff --git a/src/reducers/dictionary/search.ts b/src/reducers/dictionary/search.ts index 2de5e93..d88a37d 100644 --- a/src/reducers/dictionary/search.ts +++ b/src/reducers/dictionary/search.ts @@ -17,7 +17,7 @@ const initialState: SearchState = { lastSearchOption: {}, }; -const search = (state = initialState, action: CourseAction) => { +const search = (state = initialState, action: CourseAction): SearchState => { switch (action.type) { case RESET: { return initialState; diff --git a/src/reducers/planner/itemFocus.ts b/src/reducers/planner/itemFocus.ts index eafdbcd..55810fe 100644 --- a/src/reducers/planner/itemFocus.ts +++ b/src/reducers/planner/itemFocus.ts @@ -9,9 +9,15 @@ import { ItemFocusAction, } from '@/actions/planner/itemFocus'; import { ItemFocusFrom } from '@/shapes/enum'; -import ItemFocus from '@/shapes/state/planner/ItemFocus'; +import ItemFocus, { + AddingItem, + CategoryItem, + ListItem, + NoneItem, + TableItem, +} from '@/shapes/state/planner/ItemFocus'; -const initialState: ItemFocus = { +const initialState = { from: ItemFocusFrom.NONE, clicked: false, item: null, @@ -19,7 +25,7 @@ const initialState: ItemFocus = { category: null, reviews: null, lectures: null, -}; +} as ItemFocus; /* 모든 ItemFocus 는 아래 5가지 중 하나의 타입을 가짐 @@ -49,7 +55,7 @@ const initialState: ItemFocus = { 0, 1 중 하나. 0이면 필수 과목, 1이면 선택 과목. (ex. [0, 1, 0] => 기초 1번째 필수 과목) */ -const itemFocus = (state: ItemFocus = initialState, action: ItemFocusAction) => { +const itemFocus = (state = initialState, action: ItemFocusAction): ItemFocus => { switch (action.type) { case RESET: { return initialState; @@ -63,8 +69,8 @@ const itemFocus = (state: ItemFocus = initialState, action: ItemFocusAction) => clicked: action.clicked, item: action.item, course: action.course, - changedItem, - }; + ...changedItem, + } as ListItem | AddingItem | TableItem; } case CLEAR_ITEM_FOCUS: { return { @@ -75,33 +81,33 @@ const itemFocus = (state: ItemFocus = initialState, action: ItemFocusAction) => course: null, reviews: null, lectures: null, - }; + } as NoneItem; } case SET_CATEGORY_FOCUS: { return { ...state, from: ItemFocusFrom.CATEGORY, category: action.category, - }; + } as CategoryItem; } case CLEAR_CATEGORY_FOCUS: { return { ...state, from: ItemFocusFrom.NONE, category: null, - }; + } as NoneItem; } case SET_REVIEWS: { return { ...state, reviews: action.reviews, - }; + } as ListItem | AddingItem | TableItem; } case SET_LECTURES: { return { ...state, lectures: action.lectures, - }; + } as ListItem | AddingItem | TableItem; } default: { return state; diff --git a/src/reducers/planner/list.ts b/src/reducers/planner/list.ts index 3b16782..3e596da 100644 --- a/src/reducers/planner/list.ts +++ b/src/reducers/planner/list.ts @@ -42,7 +42,7 @@ const initialState: ListState = { }, }; -const list = (state = initialState, action: ListAction) => { +const list = (state = initialState, action: ListAction): ListState => { switch (action.type) { case RESET: { return initialState; diff --git a/src/reducers/planner/planner.ts b/src/reducers/planner/planner.ts index 377f6e0..c5adc56 100644 --- a/src/reducers/planner/planner.ts +++ b/src/reducers/planner/planner.ts @@ -70,7 +70,7 @@ const getListNameOfType = (type: PlannerItemType) => { SET_IS_TRACK_SETTINGS_SECTION_OPEN planner 관련 정보를 수정하는 팝업창이 열려있는지 여부를 변경하는 action */ -const planner = (state = initialState, action: PlannerAction) => { +const planner = (state = initialState, action: PlannerAction): PlannerState => { switch (action.type) { case RESET: { return initialState; @@ -218,7 +218,7 @@ const planner = (state = initialState, action: PlannerAction) => { return t; }); newPlanners.sort((t1, t2) => t1.arrange_order - t2.arrange_order); - const updatedPlanner = newPlanners.find((t) => t.id === state.selectedPlanner?.id); + const updatedPlanner = newPlanners.find((t) => t.id === state.selectedPlanner?.id) || null; return { ...state, planners: newPlanners, diff --git a/src/reducers/planner/search.ts b/src/reducers/planner/search.ts index 24e308b..e8d6585 100644 --- a/src/reducers/planner/search.ts +++ b/src/reducers/planner/search.ts @@ -17,7 +17,7 @@ const initialState: SearchState = { lastSearchOption: {}, }; -const search = (state = initialState, action: SearchAction) => { +const search = (state = initialState, action: SearchAction): SearchState => { switch (action.type) { case RESET: { return initialState; diff --git a/src/reducers/timetable/lectureFocus.ts b/src/reducers/timetable/lectureFocus.ts index 25bc787..6b9d97d 100644 --- a/src/reducers/timetable/lectureFocus.ts +++ b/src/reducers/timetable/lectureFocus.ts @@ -31,7 +31,7 @@ const initialState: LectureFocusState = { multipleDetails: [], }; -const lectureFocus = (state = initialState, action: LectureFocusAction) => { +const lectureFocus = (state = initialState, action: LectureFocusAction): LectureFocusState => { switch (action.type) { case RESET: { return initialState; diff --git a/src/reducers/timetable/list.ts b/src/reducers/timetable/list.ts index 4c60473..06988d6 100644 --- a/src/reducers/timetable/list.ts +++ b/src/reducers/timetable/list.ts @@ -43,7 +43,7 @@ const initialState: ListState = { isLectureListOpenOnMobile: false, }; -const list = (state = initialState, action: LectureListAction) => { +const list = (state = initialState, action: LectureListAction): ListState => { const groupLectures = (lectures: Lecture[]) => { const sortedLectures = lectures.sort((a, b) => { if (a.old_code !== b.old_code) { diff --git a/src/reducers/timetable/search.ts b/src/reducers/timetable/search.ts index db0e1a1..a392a96 100644 --- a/src/reducers/timetable/search.ts +++ b/src/reducers/timetable/search.ts @@ -9,7 +9,6 @@ import { } from '@/actions/timetable/search'; import { Day } from '@/shapes/enum'; import LectureLastSearchOption from '@/shapes/state/timetable/LectureLastSearchOption'; -import { stat } from 'fs'; interface SearchState { open: boolean; @@ -27,7 +26,7 @@ const initialState: SearchState = { classtimeDay: null, }; -const search = (state = initialState, action: SearchAction) => { +const search = (state = initialState, action: SearchAction): SearchState => { switch (action.type) { case RESET: { return initialState; diff --git a/src/reducers/timetable/semester.ts b/src/reducers/timetable/semester.ts index 62936eb..ddf1bb9 100644 --- a/src/reducers/timetable/semester.ts +++ b/src/reducers/timetable/semester.ts @@ -11,7 +11,7 @@ const initialState: SemesterState = { semester: null, }; -const semester = (state = initialState, action: SemesterAction) => { +const semester = (state = initialState, action: SemesterAction): SemesterState => { switch (action.type) { case RESET: { return initialState; diff --git a/src/reducers/timetable/timetable.ts b/src/reducers/timetable/timetable.ts index d7acdb9..1466b28 100644 --- a/src/reducers/timetable/timetable.ts +++ b/src/reducers/timetable/timetable.ts @@ -44,7 +44,7 @@ const initialState: TimetableState = { isTimetableTabsOpenOnMobile: false, }; -const timetable = (state = initialState, action: TimetableAction) => { +const timetable = (state = initialState, action: TimetableAction): TimetableState => { switch (action.type) { case RESET: { return initialState; @@ -186,7 +186,7 @@ const timetable = (state = initialState, action: TimetableAction) => { return t; }); newTables.sort((t1, t2) => t1.arrange_order - t2.arrange_order); - const updatedTable = newTables.find((t) => t.id === state.selectedTimetable?.id); + const updatedTable = newTables.find((t) => t.id === state.selectedTimetable?.id) || null; return { ...state, timetables: newTables, selectedTimetable: updatedTable }; } case UPDATE_CELL_SIZE: { diff --git a/src/reducers/write-reviews/latestReviews.ts b/src/reducers/write-reviews/latestReviews.ts index 121749b..d980a42 100644 --- a/src/reducers/write-reviews/latestReviews.ts +++ b/src/reducers/write-reviews/latestReviews.ts @@ -14,7 +14,7 @@ const initialState: LatestReviewsState = { reviews: null, }; -const latestReviews = (state = initialState, action: LatestReviewsAction) => { +const latestReviews = (state = initialState, action: LatestReviewsAction): LatestReviewsState => { switch (action.type) { case RESET: { return initialState; diff --git a/src/reducers/write-reviews/likedReviews.ts b/src/reducers/write-reviews/likedReviews.ts index 06c1578..702aed7 100644 --- a/src/reducers/write-reviews/likedReviews.ts +++ b/src/reducers/write-reviews/likedReviews.ts @@ -8,7 +8,7 @@ const initialState: LikedReviewsState = { reviews: null, }; -const likedReviews = (state = initialState, action: LikedReviewsAction) => { +const likedReviews = (state = initialState, action: LikedReviewsAction): LikedReviewsState => { switch (action.type) { case RESET: { return initialState; diff --git a/src/reducers/write-reviews/rankedReviews.ts b/src/reducers/write-reviews/rankedReviews.ts index a7a586b..76e8c28 100644 --- a/src/reducers/write-reviews/rankedReviews.ts +++ b/src/reducers/write-reviews/rankedReviews.ts @@ -20,7 +20,7 @@ const initialState: RankedReviewState = { reviewCountBySemester: {}, }; -const latestReviews = (state = initialState, action: RankedReviewsAction) => { +const latestReviews = (state = initialState, action: RankedReviewsAction): RankedReviewState => { switch (action.type) { case RESET: { return initialState; diff --git a/src/reducers/write-reviews/reviewsFocus.ts b/src/reducers/write-reviews/reviewsFocus.ts index 37cf623..8dfcfb6 100644 --- a/src/reducers/write-reviews/reviewsFocus.ts +++ b/src/reducers/write-reviews/reviewsFocus.ts @@ -22,7 +22,7 @@ const initialState: ReviewsFocusState = { reviews: null, }; -const reviewsFocus = (state = initialState, action: ReviewsFocusAction) => { +const reviewsFocus = (state = initialState, action: ReviewsFocusAction): ReviewsFocusState => { switch (action.type) { case RESET: { return initialState; From b4c61be82aafebe64f733a98859d81c56daab146 Mon Sep 17 00:00:00 2001 From: Yumin Cho Date: Sun, 19 May 2024 01:09:11 +0900 Subject: [PATCH 3/5] refactor: move redux files to a separate folder --- src/App.jsx | 20 +++++++++---------- .../account/FavoriteDepartmentsSubSection.jsx | 2 +- .../coursedetail/CourseDetailSection.jsx | 4 ++-- .../coursedetail/CourseReviewsSubSection.jsx | 4 ++-- .../courselist/CourseListSection.jsx | 4 ++-- .../dictionary/courselist/CourseListTabs.jsx | 4 ++-- .../courselist/CourseSearchSubSection.jsx | 6 +++--- .../sections/main/ReviewWriteFeedSection.jsx | 2 +- .../sections/planner/TrackSettingsSection.jsx | 5 ++++- .../planner/courselist/CourseListSection.jsx | 4 ++-- .../planner/courselist/CourseListTabs.jsx | 4 ++-- .../courselist/CourseSearchSubSection.jsx | 6 +++--- .../CourseCustomizeSubSection.jsx | 4 ++-- .../coursemanage/CourseManageSection.jsx | 6 +++++- .../plannerandinfos/PlannerSubSection.jsx | 4 ++-- .../planner/plannerandinfos/PlannerTabs.jsx | 2 +- .../plannerandinfos/SummarySubSection.jsx | 2 +- .../plannerandinfos/TrackSubSection.jsx | 2 +- .../lecturedetail/LectureDetailSection.jsx | 6 +++--- .../lecturelist/LectureListSection.jsx | 11 ++++++---- .../timetable/lecturelist/LectureListTabs.jsx | 8 ++++++-- .../lecturelist/LectureSearchSubSection.jsx | 6 +++--- .../timetable/semester/SemesterSection.jsx | 2 +- .../timetableandinfos/ExamSubSection.jsx | 5 ++++- .../timetableandinfos/MapSubSection.jsx | 5 ++++- .../timetableandinfos/ShareSubSection.jsx | 4 ++-- .../timetableandinfos/SummarySubSection.jsx | 5 ++++- .../timetableandinfos/TimetableSubSection.jsx | 11 ++++++---- .../timetableandinfos/TimetableTabs.jsx | 2 +- .../reviewsleft/ReviewsMenusSubSection.jsx | 2 +- .../reviewsleft/TakenLecturesSubSection.jsx | 5 ++++- .../reviewsright/LatestReviewsSubSection.jsx | 4 ++-- .../reviewsright/LectureReviewsSubSection.jsx | 9 ++++++--- .../reviewsright/LikedReviewsSubSection.jsx | 4 ++-- .../reviewsright/MyReviewsSubSection.jsx | 2 +- .../reviewsright/RankedReviewsSubSection.jsx | 4 ++-- src/pages/DictionaryPage.jsx | 6 +++--- src/pages/PlannerPage.jsx | 8 ++++---- src/pages/TimetablePage.jsx | 10 +++++----- src/pages/WriteReviewsPage.jsx | 11 ++++++---- src/{ => redux}/actions/common/media.ts | 0 src/{ => redux}/actions/common/semester.ts | 0 src/{ => redux}/actions/common/track.ts | 0 src/{ => redux}/actions/common/user.ts | 0 .../actions/dictionary/courseFocus.ts | 0 src/{ => redux}/actions/dictionary/list.ts | 0 src/{ => redux}/actions/dictionary/search.ts | 0 src/{ => redux}/actions/planner/itemFocus.ts | 0 src/{ => redux}/actions/planner/list.ts | 0 src/{ => redux}/actions/planner/planner.ts | 0 src/{ => redux}/actions/planner/search.ts | 0 .../actions/timetable/lectureFocus.ts | 0 src/{ => redux}/actions/timetable/list.ts | 0 src/{ => redux}/actions/timetable/search.ts | 0 src/{ => redux}/actions/timetable/semester.ts | 0 .../actions/timetable/timetable.ts | 0 .../actions/write-reviews/latestReviews.ts | 0 .../actions/write-reviews/likedReviews.ts | 0 .../actions/write-reviews/rankedReviews.ts | 0 .../actions/write-reviews/reviewsFocus.ts | 0 src/redux/index.ts | 18 +++++++++++++++++ src/{ => redux}/reducers/common/index.ts | 0 src/{ => redux}/reducers/common/media.ts | 0 src/{ => redux}/reducers/common/semester.ts | 0 src/{ => redux}/reducers/common/track.ts | 0 src/{ => redux}/reducers/common/user.ts | 0 .../reducers/dictionary/courseFocus.ts | 2 +- src/{ => redux}/reducers/dictionary/index.ts | 0 src/{ => redux}/reducers/dictionary/list.ts | 2 +- src/{ => redux}/reducers/dictionary/search.ts | 2 +- src/{ => redux}/reducers/planner/index.ts | 0 src/{ => redux}/reducers/planner/itemFocus.ts | 2 +- src/{ => redux}/reducers/planner/list.ts | 0 src/{ => redux}/reducers/planner/planner.ts | 2 +- src/{ => redux}/reducers/planner/search.ts | 2 +- src/{ => redux}/reducers/timetable/index.ts | 0 .../reducers/timetable/lectureFocus.ts | 0 src/{ => redux}/reducers/timetable/list.ts | 2 +- src/{ => redux}/reducers/timetable/search.ts | 2 +- .../reducers/timetable/semester.ts | 2 +- .../reducers/timetable/timetable.ts | 0 .../reducers/write-reviews/index.ts | 0 .../reducers/write-reviews/latestReviews.ts | 2 +- .../reducers/write-reviews/likedReviews.ts | 2 +- .../reducers/write-reviews/rankedReviews.ts | 2 +- .../reducers/write-reviews/reviewsFocus.ts | 2 +- 86 files changed, 156 insertions(+), 103 deletions(-) rename src/{ => redux}/actions/common/media.ts (100%) rename src/{ => redux}/actions/common/semester.ts (100%) rename src/{ => redux}/actions/common/track.ts (100%) rename src/{ => redux}/actions/common/user.ts (100%) rename src/{ => redux}/actions/dictionary/courseFocus.ts (100%) rename src/{ => redux}/actions/dictionary/list.ts (100%) rename src/{ => redux}/actions/dictionary/search.ts (100%) rename src/{ => redux}/actions/planner/itemFocus.ts (100%) rename src/{ => redux}/actions/planner/list.ts (100%) rename src/{ => redux}/actions/planner/planner.ts (100%) rename src/{ => redux}/actions/planner/search.ts (100%) rename src/{ => redux}/actions/timetable/lectureFocus.ts (100%) rename src/{ => redux}/actions/timetable/list.ts (100%) rename src/{ => redux}/actions/timetable/search.ts (100%) rename src/{ => redux}/actions/timetable/semester.ts (100%) rename src/{ => redux}/actions/timetable/timetable.ts (100%) rename src/{ => redux}/actions/write-reviews/latestReviews.ts (100%) rename src/{ => redux}/actions/write-reviews/likedReviews.ts (100%) rename src/{ => redux}/actions/write-reviews/rankedReviews.ts (100%) rename src/{ => redux}/actions/write-reviews/reviewsFocus.ts (100%) create mode 100644 src/redux/index.ts rename src/{ => redux}/reducers/common/index.ts (100%) rename src/{ => redux}/reducers/common/media.ts (100%) rename src/{ => redux}/reducers/common/semester.ts (100%) rename src/{ => redux}/reducers/common/track.ts (100%) rename src/{ => redux}/reducers/common/user.ts (100%) rename src/{ => redux}/reducers/dictionary/courseFocus.ts (97%) rename src/{ => redux}/reducers/dictionary/index.ts (100%) rename src/{ => redux}/reducers/dictionary/list.ts (97%) rename src/{ => redux}/reducers/dictionary/search.ts (94%) rename src/{ => redux}/reducers/planner/index.ts (100%) rename src/{ => redux}/reducers/planner/itemFocus.ts (98%) rename src/{ => redux}/reducers/planner/list.ts (100%) rename src/{ => redux}/reducers/planner/planner.ts (99%) rename src/{ => redux}/reducers/planner/search.ts (95%) rename src/{ => redux}/reducers/timetable/index.ts (100%) rename src/{ => redux}/reducers/timetable/lectureFocus.ts (100%) rename src/{ => redux}/reducers/timetable/list.ts (99%) rename src/{ => redux}/reducers/timetable/search.ts (97%) rename src/{ => redux}/reducers/timetable/semester.ts (86%) rename src/{ => redux}/reducers/timetable/timetable.ts (100%) rename src/{ => redux}/reducers/write-reviews/index.ts (100%) rename src/{ => redux}/reducers/write-reviews/latestReviews.ts (96%) rename src/{ => redux}/reducers/write-reviews/likedReviews.ts (83%) rename src/{ => redux}/reducers/write-reviews/rankedReviews.ts (95%) rename src/{ => redux}/reducers/write-reviews/reviewsFocus.ts (95%) diff --git a/src/App.jsx b/src/App.jsx index 8a3406a..955f7bc 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -19,16 +19,16 @@ import PrivacyPage from './pages/PrivacyPage'; import TestPage from './pages/TestPage'; import ErrorPage from './pages/ErrorPage'; -import dictionaryReducer from './reducers/dictionary/index'; -import timetableReducer from './reducers/timetable/index'; -import writeReviewsReducer from './reducers/write-reviews/index'; -import commonReducer from './reducers/common/index'; -import plannerReducer from './reducers/planner/index'; - -import { setUser } from './actions/common/user'; -import { setSemesters } from './actions/common/semester'; -import { setTracks } from './actions/common/track'; -import { setIsPortrait } from './actions/common/media'; +import dictionaryReducer from './redux/reducers/dictionary/index'; +import timetableReducer from './redux/reducers/timetable/index'; +import writeReviewsReducer from './redux/reducers/write-reviews/index'; +import commonReducer from './redux/reducers/common/index'; +import plannerReducer from './redux/reducers/planner/index'; + +import { setUser } from './redux/actions/common/user'; +import { setSemesters } from './redux/actions/common/semester'; +import { setTracks } from './redux/actions/common/track'; +import { setIsPortrait } from './redux/actions/common/media'; import BannerPopup from '@/common/components/popup/bannerPopup/BannerPopup'; import CampaignPopupImage from '@/features/campaign/components/popup/CampaignPopupImage'; diff --git a/src/components/sections/account/FavoriteDepartmentsSubSection.jsx b/src/components/sections/account/FavoriteDepartmentsSubSection.jsx index 74e80af..b82090e 100644 --- a/src/components/sections/account/FavoriteDepartmentsSubSection.jsx +++ b/src/components/sections/account/FavoriteDepartmentsSubSection.jsx @@ -8,7 +8,7 @@ import { appBoundClassNames as classNames } from '../../../common/boundClassName import SearchFilter from '../../SearchFilter'; -import { setUser } from '../../../actions/common/user'; +import { setUser } from '../../../redux/actions/common/user'; import userShape from '../../../shapes/model/session/UserShape'; diff --git a/src/components/sections/dictionary/coursedetail/CourseDetailSection.jsx b/src/components/sections/dictionary/coursedetail/CourseDetailSection.jsx index 321a5ee..ae1af5a 100644 --- a/src/components/sections/dictionary/coursedetail/CourseDetailSection.jsx +++ b/src/components/sections/dictionary/coursedetail/CourseDetailSection.jsx @@ -18,8 +18,8 @@ import { clearCourseFocus, setLectures, setReviews, -} from '../../../../actions/dictionary/courseFocus'; -import { addCourseRead } from '../../../../actions/dictionary/list'; +} from '../../../../redux/actions/dictionary/courseFocus'; +import { addCourseRead } from '../../../../redux/actions/dictionary/list'; import courseFocusShape from '../../../../shapes/state/dictionary/CourseFocusShape'; import userShape from '../../../../shapes/model/session/UserShape'; diff --git a/src/components/sections/dictionary/coursedetail/CourseReviewsSubSection.jsx b/src/components/sections/dictionary/coursedetail/CourseReviewsSubSection.jsx index b64c019..251185e 100644 --- a/src/components/sections/dictionary/coursedetail/CourseReviewsSubSection.jsx +++ b/src/components/sections/dictionary/coursedetail/CourseReviewsSubSection.jsx @@ -10,8 +10,8 @@ import ReviewBlock from '../../../blocks/ReviewBlock'; import ReviewWriteBlock from '../../../blocks/ReviewWriteBlock'; import SearchFilter from '../../../SearchFilter'; -import { updateReview } from '../../../../actions/dictionary/courseFocus'; -import { updateUserReview } from '../../../../actions/common/user'; +import { updateReview } from '../../../../redux/actions/dictionary/courseFocus'; +import { updateUserReview } from '../../../../redux/actions/common/user'; import courseFocusShape from '../../../../shapes/state/dictionary/CourseFocusShape'; import userShape from '../../../../shapes/model/session/UserShape'; diff --git a/src/components/sections/dictionary/courselist/CourseListSection.jsx b/src/components/sections/dictionary/courselist/CourseListSection.jsx index 35caedd..b279571 100644 --- a/src/components/sections/dictionary/courselist/CourseListSection.jsx +++ b/src/components/sections/dictionary/courselist/CourseListSection.jsx @@ -13,8 +13,8 @@ import CourseSearchSubSection from './CourseSearchSubSection'; import CourseBlock from '../../../blocks/CourseBlock'; import { isFocused, isDimmedCourse } from '../../../../utils/courseUtils'; -import { setCourseFocus, clearCourseFocus } from '../../../../actions/dictionary/courseFocus'; -import { openSearch } from '../../../../actions/dictionary/search'; +import { setCourseFocus, clearCourseFocus } from '../../../../redux/actions/dictionary/courseFocus'; +import { openSearch } from '../../../../redux/actions/dictionary/search'; import courseShape from '../../../../shapes/model/subject/CourseShape'; import courseFocusShape from '../../../../shapes/state/dictionary/CourseFocusShape'; diff --git a/src/components/sections/dictionary/courselist/CourseListTabs.jsx b/src/components/sections/dictionary/courselist/CourseListTabs.jsx index 97f58f9..7cf22ce 100644 --- a/src/components/sections/dictionary/courselist/CourseListTabs.jsx +++ b/src/components/sections/dictionary/courselist/CourseListTabs.jsx @@ -9,8 +9,8 @@ import { appBoundClassNames as classNames } from '../../../../common/boundClassN import { CourseListCode } from '@/shapes/enum'; -import { openSearch, closeSearch } from '../../../../actions/dictionary/search'; -import { setSelectedListCode, setListCourses } from '../../../../actions/dictionary/list'; +import { openSearch, closeSearch } from '../../../../redux/actions/dictionary/search'; +import { setSelectedListCode, setListCourses } from '../../../../redux/actions/dictionary/list'; import userShape from '../../../../shapes/model/session/UserShape'; import courseListsShape from '../../../../shapes/state/dictionary/CourseListsShape'; diff --git a/src/components/sections/dictionary/courselist/CourseSearchSubSection.jsx b/src/components/sections/dictionary/courselist/CourseSearchSubSection.jsx index 3e019a5..150e0bc 100644 --- a/src/components/sections/dictionary/courselist/CourseSearchSubSection.jsx +++ b/src/components/sections/dictionary/courselist/CourseSearchSubSection.jsx @@ -13,9 +13,9 @@ import Divider from '../../../Divider'; import SearchFilter from '../../../SearchFilter'; import Scroller from '../../../Scroller'; -import { closeSearch, setLastSearchOption } from '../../../../actions/dictionary/search'; -import { setListCourses, clearSearchListCourses } from '../../../../actions/dictionary/list'; -import { clearCourseFocus } from '../../../../actions/dictionary/courseFocus'; +import { closeSearch, setLastSearchOption } from '../../../../redux/actions/dictionary/search'; +import { setListCourses, clearSearchListCourses } from '../../../../redux/actions/dictionary/list'; +import { clearCourseFocus } from '../../../../redux/actions/dictionary/courseFocus'; import { getTypeOptions, diff --git a/src/components/sections/main/ReviewWriteFeedSection.jsx b/src/components/sections/main/ReviewWriteFeedSection.jsx index 533e460..2ee65cd 100644 --- a/src/components/sections/main/ReviewWriteFeedSection.jsx +++ b/src/components/sections/main/ReviewWriteFeedSection.jsx @@ -8,7 +8,7 @@ import { appBoundClassNames as classNames } from '../../../common/boundClassName import ReviewWriteBlock from '../../blocks/ReviewWriteBlock'; -import { updateUserReview } from '../../../actions/common/user'; +import { updateUserReview } from '../../../redux/actions/common/user'; import lectureShape from '../../../shapes/model/subject/LectureShape'; import reviewShape from '../../../shapes/model/review/ReviewShape'; diff --git a/src/components/sections/planner/TrackSettingsSection.jsx b/src/components/sections/planner/TrackSettingsSection.jsx index 1d94f8a..a6de919 100644 --- a/src/components/sections/planner/TrackSettingsSection.jsx +++ b/src/components/sections/planner/TrackSettingsSection.jsx @@ -11,7 +11,10 @@ import Scroller from '../../Scroller'; import CloseButton from '../../CloseButton'; import SearchFilter from '../../SearchFilter'; -import { setIsTrackSettingsSectionOpen, updatePlanner } from '../../../actions/planner/planner'; +import { + setIsTrackSettingsSectionOpen, + updatePlanner, +} from '../../../redux/actions/planner/planner'; import { getAdditionalTrackName, diff --git a/src/components/sections/planner/courselist/CourseListSection.jsx b/src/components/sections/planner/courselist/CourseListSection.jsx index 881abbb..9b08dce 100644 --- a/src/components/sections/planner/courselist/CourseListSection.jsx +++ b/src/components/sections/planner/courselist/CourseListSection.jsx @@ -20,8 +20,8 @@ import { isAddedCourse, } from '../../../../utils/itemUtils'; import { isDimmedListCourse, isClickedListCourse } from '../../../../utils/itemFocusUtils'; -import { setItemFocus, clearItemFocus } from '../../../../actions/planner/itemFocus'; -import { openSearch } from '../../../../actions/planner/search'; +import { setItemFocus, clearItemFocus } from '../../../../redux/actions/planner/itemFocus'; +import { openSearch } from '../../../../redux/actions/planner/search'; import itemFocusShape from '../../../../shapes/state/planner/ItemFocusShape'; import courseListsShape from '../../../../shapes/state/dictionary/CourseListsShape'; diff --git a/src/components/sections/planner/courselist/CourseListTabs.jsx b/src/components/sections/planner/courselist/CourseListTabs.jsx index 893dbc4..a928470 100644 --- a/src/components/sections/planner/courselist/CourseListTabs.jsx +++ b/src/components/sections/planner/courselist/CourseListTabs.jsx @@ -9,8 +9,8 @@ import { appBoundClassNames as classNames } from '../../../../common/boundClassN import { CourseListCode } from '@/shapes/enum'; -import { openSearch, closeSearch } from '../../../../actions/planner/search'; -import { setSelectedListCode, setListCourses } from '../../../../actions/planner/list'; +import { openSearch, closeSearch } from '../../../../redux/actions/planner/search'; +import { setSelectedListCode, setListCourses } from '../../../../redux/actions/planner/list'; import userShape from '../../../../shapes/model/session/UserShape'; import courseListsShape from '../../../../shapes/state/dictionary/CourseListsShape'; diff --git a/src/components/sections/planner/courselist/CourseSearchSubSection.jsx b/src/components/sections/planner/courselist/CourseSearchSubSection.jsx index 5498d74..fbbe59d 100644 --- a/src/components/sections/planner/courselist/CourseSearchSubSection.jsx +++ b/src/components/sections/planner/courselist/CourseSearchSubSection.jsx @@ -12,9 +12,9 @@ import Divider from '../../../Divider'; import SearchFilter from '../../../SearchFilter'; import Scroller from '../../../Scroller'; -import { closeSearch, setLastSearchOption } from '../../../../actions/planner/search'; -import { setListCourses, clearSearchListCourses } from '../../../../actions/planner/list'; -import { clearItemFocus } from '../../../../actions/planner/itemFocus'; +import { closeSearch, setLastSearchOption } from '../../../../redux/actions/planner/search'; +import { setListCourses, clearSearchListCourses } from '../../../../redux/actions/planner/list'; +import { clearItemFocus } from '../../../../redux/actions/planner/itemFocus'; import { getTypeOptions, diff --git a/src/components/sections/planner/coursemanage/CourseCustomizeSubSection.jsx b/src/components/sections/planner/coursemanage/CourseCustomizeSubSection.jsx index bc5228c..e27527a 100644 --- a/src/components/sections/planner/coursemanage/CourseCustomizeSubSection.jsx +++ b/src/components/sections/planner/coursemanage/CourseCustomizeSubSection.jsx @@ -16,8 +16,8 @@ import { getSemesterName } from '../../../../utils/semesterUtils'; import { getCourseOfItem, getSemesterOfItem } from '../../../../utils/itemUtils'; import { ItemFocusFrom } from '@/shapes/enum'; -import { updateItemInPlanner } from '../../../../actions/planner/planner'; -import { setItemFocus } from '../../../../actions/planner/itemFocus'; +import { updateItemInPlanner } from '../../../../redux/actions/planner/planner'; +import { setItemFocus } from '../../../../redux/actions/planner/itemFocus'; import userShape from '../../../../shapes/model/session/UserShape'; import itemFocusShape from '../../../../shapes/state/planner/ItemFocusShape'; diff --git a/src/components/sections/planner/coursemanage/CourseManageSection.jsx b/src/components/sections/planner/coursemanage/CourseManageSection.jsx index 91d3bd6..bec2eaa 100644 --- a/src/components/sections/planner/coursemanage/CourseManageSection.jsx +++ b/src/components/sections/planner/coursemanage/CourseManageSection.jsx @@ -16,7 +16,11 @@ import CourseCustomizeSubSection from './CourseCustomizeSubSection'; import CourseInfoSubSection from './CourseInfoSubSection'; import CourseReviewsSubSection from './CourseReviewsSubSection'; -import { clearItemFocus, setLectures, setReviews } from '../../../../actions/planner/itemFocus'; +import { + clearItemFocus, + setLectures, + setReviews, +} from '../../../../redux/actions/planner/itemFocus'; import itemFocusShape from '../../../../shapes/state/planner/ItemFocusShape'; import { ItemFocusFrom } from '@/shapes/enum'; diff --git a/src/components/sections/planner/plannerandinfos/PlannerSubSection.jsx b/src/components/sections/planner/plannerandinfos/PlannerSubSection.jsx index 55390a3..95b3eaa 100644 --- a/src/components/sections/planner/plannerandinfos/PlannerSubSection.jsx +++ b/src/components/sections/planner/plannerandinfos/PlannerSubSection.jsx @@ -8,13 +8,13 @@ import { range, sortBy, sum, sumBy } from 'lodash'; import { appBoundClassNames as classNames } from '../../../../common/boundClassNames'; import { PLANNER_DEFAULT_CREDIT } from '../../../../common/constants'; -import { setItemFocus, clearItemFocus } from '../../../../actions/planner/itemFocus'; +import { setItemFocus, clearItemFocus } from '../../../../redux/actions/planner/itemFocus'; import { addItemToPlanner, removeItemFromPlanner, updateCellSize, updateItemInPlanner, -} from '../../../../actions/planner/planner'; +} from '../../../../redux/actions/planner/planner'; import { ItemFocusFrom } from '@/shapes/enum'; diff --git a/src/components/sections/planner/plannerandinfos/PlannerTabs.jsx b/src/components/sections/planner/plannerandinfos/PlannerTabs.jsx index 8bcdd4e..b2ca720 100644 --- a/src/components/sections/planner/plannerandinfos/PlannerTabs.jsx +++ b/src/components/sections/planner/plannerandinfos/PlannerTabs.jsx @@ -15,7 +15,7 @@ import { createPlanner, deletePlanner, reorderPlanner, -} from '../../../../actions/planner/planner'; +} from '../../../../redux/actions/planner/planner'; import userShape from '../../../../shapes/model/session/UserShape'; import plannerShape from '../../../../shapes/model/planner/PlannerShape'; diff --git a/src/components/sections/planner/plannerandinfos/SummarySubSection.jsx b/src/components/sections/planner/plannerandinfos/SummarySubSection.jsx index 20b8e73..1d5fe48 100644 --- a/src/components/sections/planner/plannerandinfos/SummarySubSection.jsx +++ b/src/components/sections/planner/plannerandinfos/SummarySubSection.jsx @@ -25,7 +25,7 @@ import { } from '../../../../utils/itemCategoryUtils'; import { CategoryFirstIndex } from '@/shapes/enum'; -import { setCategoryFocus, clearCategoryFocus } from '../../../../actions/planner/itemFocus'; +import { setCategoryFocus, clearCategoryFocus } from '../../../../redux/actions/planner/itemFocus'; class SummarySubSection extends Component { setFocusOnCategory = (category) => { diff --git a/src/components/sections/planner/plannerandinfos/TrackSubSection.jsx b/src/components/sections/planner/plannerandinfos/TrackSubSection.jsx index 81523c9..ee9ea33 100644 --- a/src/components/sections/planner/plannerandinfos/TrackSubSection.jsx +++ b/src/components/sections/planner/plannerandinfos/TrackSubSection.jsx @@ -6,7 +6,7 @@ import PropTypes from 'prop-types'; import { appBoundClassNames as classNames } from '../../../../common/boundClassNames'; import Attributes from '../../../Attributes'; -import { setIsTrackSettingsSectionOpen } from '../../../../actions/planner/planner'; +import { setIsTrackSettingsSectionOpen } from '../../../../redux/actions/planner/planner'; import plannerShape from '../../../../shapes/model/planner/PlannerShape'; import { getAdditionalTrackName, diff --git a/src/components/sections/timetable/lecturedetail/LectureDetailSection.jsx b/src/components/sections/timetable/lecturedetail/LectureDetailSection.jsx index 6cdbe36..1da429b 100644 --- a/src/components/sections/timetable/lecturedetail/LectureDetailSection.jsx +++ b/src/components/sections/timetable/lecturedetail/LectureDetailSection.jsx @@ -13,12 +13,12 @@ import Scroller from '../../../Scroller'; import CloseButton from '../../../CloseButton'; import ReviewSimpleBlock from '../../../blocks/ReviewSimpleBlock'; -import { clearLectureFocus, setReviews } from '../../../../actions/timetable/lectureFocus'; -import { addLectureToCart, deleteLectureFromCart } from '../../../../actions/timetable/list'; +import { clearLectureFocus, setReviews } from '../../../../redux/actions/timetable/lectureFocus'; +import { addLectureToCart, deleteLectureFromCart } from '../../../../redux/actions/timetable/list'; import { addLectureToTimetable, removeLectureFromTimetable, -} from '../../../../actions/timetable/timetable'; +} from '../../../../redux/actions/timetable/timetable'; import { LectureFocusFrom } from '@/shapes/enum'; import { LectureListCode } from '@/shapes/enum'; diff --git a/src/components/sections/timetable/lecturelist/LectureListSection.jsx b/src/components/sections/timetable/lecturelist/LectureListSection.jsx index 8418512..81f1cc6 100644 --- a/src/components/sections/timetable/lecturelist/LectureListSection.jsx +++ b/src/components/sections/timetable/lecturelist/LectureListSection.jsx @@ -12,14 +12,17 @@ import CloseButton from '../../../CloseButton'; import LectureSearchSubSection from './LectureSearchSubSection'; import LectureGroupBlock from '../../../blocks/LectureGroupBlock'; -import { setLectureFocus, clearLectureFocus } from '../../../../actions/timetable/lectureFocus'; +import { + setLectureFocus, + clearLectureFocus, +} from '../../../../redux/actions/timetable/lectureFocus'; import { addLectureToCart, deleteLectureFromCart, setIsLectureListOpenOnMobile, -} from '../../../../actions/timetable/list'; -import { openSearch } from '../../../../actions/timetable/search'; -import { addLectureToTimetable } from '../../../../actions/timetable/timetable'; +} from '../../../../redux/actions/timetable/list'; +import { openSearch } from '../../../../redux/actions/timetable/search'; +import { addLectureToTimetable } from '../../../../redux/actions/timetable/timetable'; import { LectureFocusFrom } from '@/shapes/enum'; import { LectureListCode } from '@/shapes/enum'; diff --git a/src/components/sections/timetable/lecturelist/LectureListTabs.jsx b/src/components/sections/timetable/lecturelist/LectureListTabs.jsx index 61abe92..f389f75 100644 --- a/src/components/sections/timetable/lecturelist/LectureListTabs.jsx +++ b/src/components/sections/timetable/lecturelist/LectureListTabs.jsx @@ -13,8 +13,12 @@ import { setSelectedListCode, setListLectures, clearAllListsLectures, -} from '../../../../actions/timetable/list'; -import { openSearch, closeSearch, setLastSearchOption } from '../../../../actions/timetable/search'; +} from '../../../../redux/actions/timetable/list'; +import { + openSearch, + closeSearch, + setLastSearchOption, +} from '../../../../redux/actions/timetable/search'; import userShape from '../../../../shapes/model/session/UserShape'; import lectureListsShape from '../../../../shapes/state/timetable/LectureListsShape'; diff --git a/src/components/sections/timetable/lecturelist/LectureSearchSubSection.jsx b/src/components/sections/timetable/lecturelist/LectureSearchSubSection.jsx index b2d5ed1..ecf4c5f 100644 --- a/src/components/sections/timetable/lecturelist/LectureSearchSubSection.jsx +++ b/src/components/sections/timetable/lecturelist/LectureSearchSubSection.jsx @@ -19,9 +19,9 @@ import { closeSearch, clearClasstimeOptions, setLastSearchOption, -} from '../../../../actions/timetable/search'; -import { setListLectures, clearSearchListLectures } from '../../../../actions/timetable/list'; -import { clearLectureFocus } from '../../../../actions/timetable/lectureFocus'; +} from '../../../../redux/actions/timetable/search'; +import { setListLectures, clearSearchListLectures } from '../../../../redux/actions/timetable/list'; +import { clearLectureFocus } from '../../../../redux/actions/timetable/lectureFocus'; import { LectureFocusFrom } from '@/shapes/enum'; diff --git a/src/components/sections/timetable/semester/SemesterSection.jsx b/src/components/sections/timetable/semester/SemesterSection.jsx index 48ca542..28a61ad 100644 --- a/src/components/sections/timetable/semester/SemesterSection.jsx +++ b/src/components/sections/timetable/semester/SemesterSection.jsx @@ -6,7 +6,7 @@ import ReactGA from 'react-ga4'; import { appBoundClassNames as classNames } from '../../../../common/boundClassNames'; -import { setSemester } from '../../../../actions/timetable/semester'; +import { setSemester } from '../../../../redux/actions/timetable/semester'; import semesterShape from '../../../../shapes/model/subject/SemesterShape'; diff --git a/src/components/sections/timetable/timetableandinfos/ExamSubSection.jsx b/src/components/sections/timetable/timetableandinfos/ExamSubSection.jsx index 9db8275..d556388 100644 --- a/src/components/sections/timetable/timetableandinfos/ExamSubSection.jsx +++ b/src/components/sections/timetable/timetableandinfos/ExamSubSection.jsx @@ -7,7 +7,10 @@ import { appBoundClassNames as classNames } from '../../../../common/boundClassN import Scroller from '../../../Scroller'; -import { clearMultipleFocus, setMultipleFocus } from '../../../../actions/timetable/lectureFocus'; +import { + clearMultipleFocus, + setMultipleFocus, +} from '../../../../redux/actions/timetable/lectureFocus'; import lectureFocusShape from '../../../../shapes/state/timetable/LectureFocusShape'; import timetableShape, { diff --git a/src/components/sections/timetable/timetableandinfos/MapSubSection.jsx b/src/components/sections/timetable/timetableandinfos/MapSubSection.jsx index feeff72..6b3461b 100644 --- a/src/components/sections/timetable/timetableandinfos/MapSubSection.jsx +++ b/src/components/sections/timetable/timetableandinfos/MapSubSection.jsx @@ -5,7 +5,10 @@ import { withTranslation } from 'react-i18next'; import { appBoundClassNames as classNames } from '../../../../common/boundClassNames'; -import { clearMultipleFocus, setMultipleFocus } from '../../../../actions/timetable/lectureFocus'; +import { + clearMultipleFocus, + setMultipleFocus, +} from '../../../../redux/actions/timetable/lectureFocus'; import lectureFocusShape from '../../../../shapes/state/timetable/LectureFocusShape'; import timetableShape, { diff --git a/src/components/sections/timetable/timetableandinfos/ShareSubSection.jsx b/src/components/sections/timetable/timetableandinfos/ShareSubSection.jsx index 3bed505..9e7a381 100644 --- a/src/components/sections/timetable/timetableandinfos/ShareSubSection.jsx +++ b/src/components/sections/timetable/timetableandinfos/ShareSubSection.jsx @@ -7,8 +7,8 @@ import qs from 'qs'; import { appBoundClassNames as classNames } from '../../../../common/boundClassNames'; -import { setIsLectureListOpenOnMobile } from '../../../../actions/timetable/list'; -import { setIsTimetableTabsOpenOnMobile } from '../../../../actions/timetable/timetable'; +import { setIsLectureListOpenOnMobile } from '../../../../redux/actions/timetable/list'; +import { setIsTimetableTabsOpenOnMobile } from '../../../../redux/actions/timetable/timetable'; import timetableShape, { myPseudoTimetableShape, diff --git a/src/components/sections/timetable/timetableandinfos/SummarySubSection.jsx b/src/components/sections/timetable/timetableandinfos/SummarySubSection.jsx index 60a79d0..7abc753 100644 --- a/src/components/sections/timetable/timetableandinfos/SummarySubSection.jsx +++ b/src/components/sections/timetable/timetableandinfos/SummarySubSection.jsx @@ -7,7 +7,10 @@ import { sumBy } from 'lodash'; import { appBoundClassNames as classNames } from '../../../../common/boundClassNames'; import { getAverageScoreLabel } from '../../../../utils/scoreUtils'; -import { clearMultipleFocus, setMultipleFocus } from '../../../../actions/timetable/lectureFocus'; +import { + clearMultipleFocus, + setMultipleFocus, +} from '../../../../redux/actions/timetable/lectureFocus'; import { LectureFocusFrom } from '@/shapes/enum'; diff --git a/src/components/sections/timetable/timetableandinfos/TimetableSubSection.jsx b/src/components/sections/timetable/timetableandinfos/TimetableSubSection.jsx index 83f0ab9..bef6193 100644 --- a/src/components/sections/timetable/timetableandinfos/TimetableSubSection.jsx +++ b/src/components/sections/timetable/timetableandinfos/TimetableSubSection.jsx @@ -9,21 +9,24 @@ import { TIMETABLE_START_HOUR, TIMETABLE_END_HOUR } from '../../../../common/con import TimetableTile from '@/components/tiles/TimetableTile'; -import { setLectureFocus, clearLectureFocus } from '../../../../actions/timetable/lectureFocus'; +import { + setLectureFocus, + clearLectureFocus, +} from '../../../../redux/actions/timetable/lectureFocus'; import { setSelectedListCode, setIsLectureListOpenOnMobile, -} from '../../../../actions/timetable/list'; +} from '../../../../redux/actions/timetable/list'; import { setClasstimeOptions, clearClasstimeOptions, openSearch, -} from '../../../../actions/timetable/search'; +} from '../../../../redux/actions/timetable/search'; import { setIsDragging, updateCellSize, removeLectureFromTimetable, -} from '../../../../actions/timetable/timetable'; +} from '../../../../redux/actions/timetable/timetable'; import { LectureFocusFrom } from '@/shapes/enum'; import { LectureListCode } from '@/shapes/enum'; diff --git a/src/components/sections/timetable/timetableandinfos/TimetableTabs.jsx b/src/components/sections/timetable/timetableandinfos/TimetableTabs.jsx index 3900f3f..b13f2b2 100644 --- a/src/components/sections/timetable/timetableandinfos/TimetableTabs.jsx +++ b/src/components/sections/timetable/timetableandinfos/TimetableTabs.jsx @@ -17,7 +17,7 @@ import { duplicateTimetable, reorderTimetable, setIsTimetableTabsOpenOnMobile, -} from '../../../../actions/timetable/timetable'; +} from '../../../../redux/actions/timetable/timetable'; import userShape from '../../../../shapes/model/session/UserShape'; import timetableShape, { diff --git a/src/components/sections/write-reviews/reviewsleft/ReviewsMenusSubSection.jsx b/src/components/sections/write-reviews/reviewsleft/ReviewsMenusSubSection.jsx index 5d17c36..98334b5 100644 --- a/src/components/sections/write-reviews/reviewsleft/ReviewsMenusSubSection.jsx +++ b/src/components/sections/write-reviews/reviewsleft/ReviewsMenusSubSection.jsx @@ -6,7 +6,7 @@ import ReactGA from 'react-ga4'; import { appBoundClassNames as classNames } from '../../../../common/boundClassNames'; -import { setReviewsFocus } from '../../../../actions/write-reviews/reviewsFocus'; +import { setReviewsFocus } from '../../../../redux/actions/write-reviews/reviewsFocus'; import { ReviewsFocusFrom } from '@/shapes/enum'; import userShape from '../../../../shapes/model/session/UserShape'; diff --git a/src/components/sections/write-reviews/reviewsleft/TakenLecturesSubSection.jsx b/src/components/sections/write-reviews/reviewsleft/TakenLecturesSubSection.jsx index 58bc01e..c0e7a23 100644 --- a/src/components/sections/write-reviews/reviewsleft/TakenLecturesSubSection.jsx +++ b/src/components/sections/write-reviews/reviewsleft/TakenLecturesSubSection.jsx @@ -10,7 +10,10 @@ import Divider from '../../../Divider'; import Scroller from '../../../Scroller'; import LectureSimpleBlock from '../../../blocks/LectureSimpleBlock'; -import { setReviewsFocus, clearReviewsFocus } from '../../../../actions/write-reviews/reviewsFocus'; +import { + setReviewsFocus, + clearReviewsFocus, +} from '../../../../redux/actions/write-reviews/reviewsFocus'; import { ReviewsFocusFrom } from '@/shapes/enum'; import { unique } from '../../../../utils/commonUtils'; diff --git a/src/components/sections/write-reviews/reviewsright/LatestReviewsSubSection.jsx b/src/components/sections/write-reviews/reviewsright/LatestReviewsSubSection.jsx index 97e80ce..adeface 100644 --- a/src/components/sections/write-reviews/reviewsright/LatestReviewsSubSection.jsx +++ b/src/components/sections/write-reviews/reviewsright/LatestReviewsSubSection.jsx @@ -12,8 +12,8 @@ import Scroller from '../../../Scroller'; import CloseButton from '../../../CloseButton'; import ReviewBlock from '../../../blocks/ReviewBlock'; -import { addReviews } from '../../../../actions/write-reviews/latestReviews'; -import { clearReviewsFocus } from '../../../../actions/write-reviews/reviewsFocus'; +import { addReviews } from '../../../../redux/actions/write-reviews/latestReviews'; +import { clearReviewsFocus } from '../../../../redux/actions/write-reviews/reviewsFocus'; import reviewShape from '../../../../shapes/model/review/ReviewShape'; import reviewsFocusShape from '../../../../shapes/state/write-reviews/ReviewsFocusShape'; diff --git a/src/components/sections/write-reviews/reviewsright/LectureReviewsSubSection.jsx b/src/components/sections/write-reviews/reviewsright/LectureReviewsSubSection.jsx index c04e575..c702773 100644 --- a/src/components/sections/write-reviews/reviewsright/LectureReviewsSubSection.jsx +++ b/src/components/sections/write-reviews/reviewsright/LectureReviewsSubSection.jsx @@ -13,9 +13,12 @@ import Divider from '../../../Divider'; import ReviewWriteBlock from '../../../blocks/ReviewWriteBlock'; import ReviewBlock from '../../../blocks/ReviewBlock'; -import { setReviews, clearReviewsFocus } from '../../../../actions/write-reviews/reviewsFocus'; -import { updateUserReview } from '../../../../actions/common/user'; -import { updateReview as UpdateLatestReview } from '../../../../actions/write-reviews/latestReviews'; +import { + setReviews, + clearReviewsFocus, +} from '../../../../redux/actions/write-reviews/reviewsFocus'; +import { updateUserReview } from '../../../../redux/actions/common/user'; +import { updateReview as UpdateLatestReview } from '../../../../redux/actions/write-reviews/latestReviews'; import userShape from '../../../../shapes/model/session/UserShape'; import reviewsFocusShape from '../../../../shapes/state/write-reviews/ReviewsFocusShape'; diff --git a/src/components/sections/write-reviews/reviewsright/LikedReviewsSubSection.jsx b/src/components/sections/write-reviews/reviewsright/LikedReviewsSubSection.jsx index 8aa42c8..2cdf0ea 100644 --- a/src/components/sections/write-reviews/reviewsright/LikedReviewsSubSection.jsx +++ b/src/components/sections/write-reviews/reviewsright/LikedReviewsSubSection.jsx @@ -11,8 +11,8 @@ import Scroller from '../../../Scroller'; import CloseButton from '../../../CloseButton'; import ReviewBlock from '../../../blocks/ReviewBlock'; -import { setReviews } from '../../../../actions/write-reviews/likedReviews'; -import { clearReviewsFocus } from '../../../../actions/write-reviews/reviewsFocus'; +import { setReviews } from '../../../../redux/actions/write-reviews/likedReviews'; +import { clearReviewsFocus } from '../../../../redux/actions/write-reviews/reviewsFocus'; import userShape from '../../../../shapes/model/session/UserShape'; import reviewsFocusShape from '../../../../shapes/state/write-reviews/ReviewsFocusShape'; diff --git a/src/components/sections/write-reviews/reviewsright/MyReviewsSubSection.jsx b/src/components/sections/write-reviews/reviewsright/MyReviewsSubSection.jsx index 90e090f..6aa4f82 100644 --- a/src/components/sections/write-reviews/reviewsright/MyReviewsSubSection.jsx +++ b/src/components/sections/write-reviews/reviewsright/MyReviewsSubSection.jsx @@ -10,7 +10,7 @@ import Scroller from '../../../Scroller'; import CloseButton from '../../../CloseButton'; import ReviewBlock from '../../../blocks/ReviewBlock'; -import { clearReviewsFocus } from '../../../../actions/write-reviews/reviewsFocus'; +import { clearReviewsFocus } from '../../../../redux/actions/write-reviews/reviewsFocus'; import userShape from '../../../../shapes/model/session/UserShape'; import reviewsFocusShape from '../../../../shapes/state/write-reviews/ReviewsFocusShape'; diff --git a/src/components/sections/write-reviews/reviewsright/RankedReviewsSubSection.jsx b/src/components/sections/write-reviews/reviewsright/RankedReviewsSubSection.jsx index 39846d1..ff436db 100644 --- a/src/components/sections/write-reviews/reviewsright/RankedReviewsSubSection.jsx +++ b/src/components/sections/write-reviews/reviewsright/RankedReviewsSubSection.jsx @@ -13,11 +13,11 @@ import CloseButton from '../../../CloseButton'; import ReviewBlock from '../../../blocks/ReviewBlock'; import SemesterBlock from '../../../blocks/SemesterBlock'; -import { clearReviewsFocus } from '../../../../actions/write-reviews/reviewsFocus'; +import { clearReviewsFocus } from '../../../../redux/actions/write-reviews/reviewsFocus'; import { addSemesterReviews, setSemesterReviewCount, -} from '../../../../actions/write-reviews/rankedReviews'; +} from '../../../../redux/actions/write-reviews/rankedReviews'; import reviewsFocusShape from '../../../../shapes/state/write-reviews/ReviewsFocusShape'; import { getSemesterName } from '../../../../utils/semesterUtils'; diff --git a/src/pages/DictionaryPage.jsx b/src/pages/DictionaryPage.jsx index 7c76696..ffbe710 100644 --- a/src/pages/DictionaryPage.jsx +++ b/src/pages/DictionaryPage.jsx @@ -12,14 +12,14 @@ import CourseListSection from '../components/sections/dictionary/courselist/Cour import CourseDetailSection from '../components/sections/dictionary/coursedetail/CourseDetailSection'; import CourseListTabs from '../components/sections/dictionary/courselist/CourseListTabs'; -import { reset as resetCourseFocus, setCourseFocus } from '../actions/dictionary/courseFocus'; +import { reset as resetCourseFocus, setCourseFocus } from '../redux/actions/dictionary/courseFocus'; import { reset as resetList, setSelectedListCode, setListCourses, clearSearchListCourses, -} from '../actions/dictionary/list'; -import { reset as resetSearch, closeSearch } from '../actions/dictionary/search'; +} from '../redux/actions/dictionary/list'; +import { reset as resetSearch, closeSearch } from '../redux/actions/dictionary/search'; import { performSearchCourses } from '../common/commonOperations'; import { parseQueryString } from '@/common/utils/parseQueryString'; diff --git a/src/pages/PlannerPage.jsx b/src/pages/PlannerPage.jsx index 8cda98a..5f39273 100644 --- a/src/pages/PlannerPage.jsx +++ b/src/pages/PlannerPage.jsx @@ -5,10 +5,10 @@ import PropTypes from 'prop-types'; import { appBoundClassNames as classNames } from '../common/boundClassNames'; -import { reset as resetCourseFocus } from '../actions/planner/itemFocus'; -import { reset as resetList } from '../actions/planner/list'; -import { reset as resetSearch } from '../actions/planner/search'; -import { reset as resetPlanner } from '../actions/planner/planner'; +import { reset as resetCourseFocus } from '../redux/actions/planner/itemFocus'; +import { reset as resetList } from '../redux/actions/planner/list'; +import { reset as resetSearch } from '../redux/actions/planner/search'; +import { reset as resetPlanner } from '../redux/actions/planner/planner'; import plannerShape from '../shapes/model/planner/PlannerShape'; diff --git a/src/pages/TimetablePage.jsx b/src/pages/TimetablePage.jsx index c482e29..cdf725c 100644 --- a/src/pages/TimetablePage.jsx +++ b/src/pages/TimetablePage.jsx @@ -5,15 +5,15 @@ import PropTypes from 'prop-types'; import { appBoundClassNames as classNames } from '../common/boundClassNames'; -import { reset as resetLectureFocus } from '../actions/timetable/lectureFocus'; -import { reset as resetList } from '../actions/timetable/list'; -import { reset as resetSearch } from '../actions/timetable/search'; -import { reset as resetSemester } from '../actions/timetable/semester'; +import { reset as resetLectureFocus } from '../redux/actions/timetable/lectureFocus'; +import { reset as resetList } from '../redux/actions/timetable/list'; +import { reset as resetSearch } from '../redux/actions/timetable/search'; +import { reset as resetSemester } from '../redux/actions/timetable/semester'; import { reset as resetTimetable, setSelectedTimetable, setIsTimetableTabsOpenOnMobile, -} from '../actions/timetable/timetable'; +} from '../redux/actions/timetable/timetable'; import CloseButton from '../components/CloseButton'; import Divider from '../components/Divider'; diff --git a/src/pages/WriteReviewsPage.jsx b/src/pages/WriteReviewsPage.jsx index 0f80056..489cc73 100644 --- a/src/pages/WriteReviewsPage.jsx +++ b/src/pages/WriteReviewsPage.jsx @@ -15,10 +15,13 @@ import MyReviewsSubSection from '../components/sections/write-reviews/reviewsrig import LikedReviewsSubSection from '../components/sections/write-reviews/reviewsright/LikedReviewsSubSection'; import RankedReviewsSubSection from '../components/sections/write-reviews/reviewsright/RankedReviewsSubSection'; -import { reset as resetReviewsFocus, setReviewsFocus } from '../actions/write-reviews/reviewsFocus'; -import { reset as resetLatestReviews } from '../actions/write-reviews/latestReviews'; -import { reset as resetLikedReviews } from '../actions/write-reviews/likedReviews'; -import { reset as resetRankedReviews } from '../actions/write-reviews/rankedReviews'; +import { + reset as resetReviewsFocus, + setReviewsFocus, +} from '../redux/actions/write-reviews/reviewsFocus'; +import { reset as resetLatestReviews } from '../redux/actions/write-reviews/latestReviews'; +import { reset as resetLikedReviews } from '../redux/actions/write-reviews/likedReviews'; +import { reset as resetRankedReviews } from '../redux/actions/write-reviews/rankedReviews'; import { ReviewsFocusFrom } from '@/shapes/enum'; import reviewsFocusShape from '../shapes/state/write-reviews/ReviewsFocusShape'; diff --git a/src/actions/common/media.ts b/src/redux/actions/common/media.ts similarity index 100% rename from src/actions/common/media.ts rename to src/redux/actions/common/media.ts diff --git a/src/actions/common/semester.ts b/src/redux/actions/common/semester.ts similarity index 100% rename from src/actions/common/semester.ts rename to src/redux/actions/common/semester.ts diff --git a/src/actions/common/track.ts b/src/redux/actions/common/track.ts similarity index 100% rename from src/actions/common/track.ts rename to src/redux/actions/common/track.ts diff --git a/src/actions/common/user.ts b/src/redux/actions/common/user.ts similarity index 100% rename from src/actions/common/user.ts rename to src/redux/actions/common/user.ts diff --git a/src/actions/dictionary/courseFocus.ts b/src/redux/actions/dictionary/courseFocus.ts similarity index 100% rename from src/actions/dictionary/courseFocus.ts rename to src/redux/actions/dictionary/courseFocus.ts diff --git a/src/actions/dictionary/list.ts b/src/redux/actions/dictionary/list.ts similarity index 100% rename from src/actions/dictionary/list.ts rename to src/redux/actions/dictionary/list.ts diff --git a/src/actions/dictionary/search.ts b/src/redux/actions/dictionary/search.ts similarity index 100% rename from src/actions/dictionary/search.ts rename to src/redux/actions/dictionary/search.ts diff --git a/src/actions/planner/itemFocus.ts b/src/redux/actions/planner/itemFocus.ts similarity index 100% rename from src/actions/planner/itemFocus.ts rename to src/redux/actions/planner/itemFocus.ts diff --git a/src/actions/planner/list.ts b/src/redux/actions/planner/list.ts similarity index 100% rename from src/actions/planner/list.ts rename to src/redux/actions/planner/list.ts diff --git a/src/actions/planner/planner.ts b/src/redux/actions/planner/planner.ts similarity index 100% rename from src/actions/planner/planner.ts rename to src/redux/actions/planner/planner.ts diff --git a/src/actions/planner/search.ts b/src/redux/actions/planner/search.ts similarity index 100% rename from src/actions/planner/search.ts rename to src/redux/actions/planner/search.ts diff --git a/src/actions/timetable/lectureFocus.ts b/src/redux/actions/timetable/lectureFocus.ts similarity index 100% rename from src/actions/timetable/lectureFocus.ts rename to src/redux/actions/timetable/lectureFocus.ts diff --git a/src/actions/timetable/list.ts b/src/redux/actions/timetable/list.ts similarity index 100% rename from src/actions/timetable/list.ts rename to src/redux/actions/timetable/list.ts diff --git a/src/actions/timetable/search.ts b/src/redux/actions/timetable/search.ts similarity index 100% rename from src/actions/timetable/search.ts rename to src/redux/actions/timetable/search.ts diff --git a/src/actions/timetable/semester.ts b/src/redux/actions/timetable/semester.ts similarity index 100% rename from src/actions/timetable/semester.ts rename to src/redux/actions/timetable/semester.ts diff --git a/src/actions/timetable/timetable.ts b/src/redux/actions/timetable/timetable.ts similarity index 100% rename from src/actions/timetable/timetable.ts rename to src/redux/actions/timetable/timetable.ts diff --git a/src/actions/write-reviews/latestReviews.ts b/src/redux/actions/write-reviews/latestReviews.ts similarity index 100% rename from src/actions/write-reviews/latestReviews.ts rename to src/redux/actions/write-reviews/latestReviews.ts diff --git a/src/actions/write-reviews/likedReviews.ts b/src/redux/actions/write-reviews/likedReviews.ts similarity index 100% rename from src/actions/write-reviews/likedReviews.ts rename to src/redux/actions/write-reviews/likedReviews.ts diff --git a/src/actions/write-reviews/rankedReviews.ts b/src/redux/actions/write-reviews/rankedReviews.ts similarity index 100% rename from src/actions/write-reviews/rankedReviews.ts rename to src/redux/actions/write-reviews/rankedReviews.ts diff --git a/src/actions/write-reviews/reviewsFocus.ts b/src/redux/actions/write-reviews/reviewsFocus.ts similarity index 100% rename from src/actions/write-reviews/reviewsFocus.ts rename to src/redux/actions/write-reviews/reviewsFocus.ts diff --git a/src/redux/index.ts b/src/redux/index.ts new file mode 100644 index 0000000..f543ff4 --- /dev/null +++ b/src/redux/index.ts @@ -0,0 +1,18 @@ +import { combineReducers } from 'redux'; + +import dictionaryReducer from '@/redux/reducers/dictionary/index'; +import timetableReducer from '@/redux/reducers/timetable/index'; +import writeReviewsReducer from '@/redux/reducers/write-reviews/index'; +import commonReducer from '@/redux/reducers/common/index'; +import plannerReducer from '@/redux/reducers/planner/index'; + +const rootReducer = combineReducers({ + common: commonReducer, + dictionary: dictionaryReducer, + timetable: timetableReducer, + writeReviews: writeReviewsReducer, + planner: plannerReducer, +}); + +export default rootReducer; +export type RootState = ReturnType; diff --git a/src/reducers/common/index.ts b/src/redux/reducers/common/index.ts similarity index 100% rename from src/reducers/common/index.ts rename to src/redux/reducers/common/index.ts diff --git a/src/reducers/common/media.ts b/src/redux/reducers/common/media.ts similarity index 100% rename from src/reducers/common/media.ts rename to src/redux/reducers/common/media.ts diff --git a/src/reducers/common/semester.ts b/src/redux/reducers/common/semester.ts similarity index 100% rename from src/reducers/common/semester.ts rename to src/redux/reducers/common/semester.ts diff --git a/src/reducers/common/track.ts b/src/redux/reducers/common/track.ts similarity index 100% rename from src/reducers/common/track.ts rename to src/redux/reducers/common/track.ts diff --git a/src/reducers/common/user.ts b/src/redux/reducers/common/user.ts similarity index 100% rename from src/reducers/common/user.ts rename to src/redux/reducers/common/user.ts diff --git a/src/reducers/dictionary/courseFocus.ts b/src/redux/reducers/dictionary/courseFocus.ts similarity index 97% rename from src/reducers/dictionary/courseFocus.ts rename to src/redux/reducers/dictionary/courseFocus.ts index 4695e07..93df2ba 100644 --- a/src/reducers/dictionary/courseFocus.ts +++ b/src/redux/reducers/dictionary/courseFocus.ts @@ -7,7 +7,7 @@ import { UPDATE_REVIEW, SET_LECTURES, DictionaryAction, -} from '@/actions/dictionary/courseFocus'; +} from '@/redux/actions/dictionary/courseFocus'; import Lecture from '@/shapes/model/subject/Lecture'; import Review from '@/shapes/model/review/Review'; diff --git a/src/reducers/dictionary/index.ts b/src/redux/reducers/dictionary/index.ts similarity index 100% rename from src/reducers/dictionary/index.ts rename to src/redux/reducers/dictionary/index.ts diff --git a/src/reducers/dictionary/list.ts b/src/redux/reducers/dictionary/list.ts similarity index 97% rename from src/reducers/dictionary/list.ts rename to src/redux/reducers/dictionary/list.ts index fb4ebdd..ad3d4a8 100644 --- a/src/reducers/dictionary/list.ts +++ b/src/redux/reducers/dictionary/list.ts @@ -5,7 +5,7 @@ import { CLEAR_SEARCH_LIST_COURSES, ADD_COURSE_READ, DictionaryAction, -} from '@/actions/dictionary/list'; +} from '@/redux/actions/dictionary/list'; import { CourseListCode } from '@/shapes/enum'; import Course from '@/shapes/model/subject/Course'; diff --git a/src/reducers/dictionary/search.ts b/src/redux/reducers/dictionary/search.ts similarity index 94% rename from src/reducers/dictionary/search.ts rename to src/redux/reducers/dictionary/search.ts index d88a37d..ee241aa 100644 --- a/src/reducers/dictionary/search.ts +++ b/src/redux/reducers/dictionary/search.ts @@ -4,7 +4,7 @@ import { CLOSE_SEARCH, SET_LAST_SEARCH_OPTION, CourseAction, -} from '@/actions/dictionary/search'; +} from '@/redux/actions/dictionary/search'; import CourseLastSearchOption from '@/shapes/state/dictionary/CourseLastSearchOption'; interface SearchState { diff --git a/src/reducers/planner/index.ts b/src/redux/reducers/planner/index.ts similarity index 100% rename from src/reducers/planner/index.ts rename to src/redux/reducers/planner/index.ts diff --git a/src/reducers/planner/itemFocus.ts b/src/redux/reducers/planner/itemFocus.ts similarity index 98% rename from src/reducers/planner/itemFocus.ts rename to src/redux/reducers/planner/itemFocus.ts index 55810fe..dade792 100644 --- a/src/reducers/planner/itemFocus.ts +++ b/src/redux/reducers/planner/itemFocus.ts @@ -7,7 +7,7 @@ import { SET_REVIEWS, SET_LECTURES, ItemFocusAction, -} from '@/actions/planner/itemFocus'; +} from '@/redux/actions/planner/itemFocus'; import { ItemFocusFrom } from '@/shapes/enum'; import ItemFocus, { AddingItem, diff --git a/src/reducers/planner/list.ts b/src/redux/reducers/planner/list.ts similarity index 100% rename from src/reducers/planner/list.ts rename to src/redux/reducers/planner/list.ts diff --git a/src/reducers/planner/planner.ts b/src/redux/reducers/planner/planner.ts similarity index 99% rename from src/reducers/planner/planner.ts rename to src/redux/reducers/planner/planner.ts index c5adc56..cf85caf 100644 --- a/src/reducers/planner/planner.ts +++ b/src/redux/reducers/planner/planner.ts @@ -13,7 +13,7 @@ import { UPDATE_CELL_SIZE, SET_IS_TRACK_SETTINGS_SECTION_OPEN, PlannerAction, -} from '@/actions/planner/planner'; +} from '@/redux/actions/planner/planner'; import Planner from '@/shapes/model/planner/Planner'; import { PlannerItemType } from '@/shapes/enum'; diff --git a/src/reducers/planner/search.ts b/src/redux/reducers/planner/search.ts similarity index 95% rename from src/reducers/planner/search.ts rename to src/redux/reducers/planner/search.ts index e8d6585..d7084e9 100644 --- a/src/reducers/planner/search.ts +++ b/src/redux/reducers/planner/search.ts @@ -4,7 +4,7 @@ import { CLOSE_SEARCH, SET_LAST_SEARCH_OPTION, SearchAction, -} from '@/actions/planner/search'; +} from '@/redux/actions/planner/search'; import LectureLastSearchOption from '@/shapes/state/timetable/LectureLastSearchOption'; interface SearchState { diff --git a/src/reducers/timetable/index.ts b/src/redux/reducers/timetable/index.ts similarity index 100% rename from src/reducers/timetable/index.ts rename to src/redux/reducers/timetable/index.ts diff --git a/src/reducers/timetable/lectureFocus.ts b/src/redux/reducers/timetable/lectureFocus.ts similarity index 100% rename from src/reducers/timetable/lectureFocus.ts rename to src/redux/reducers/timetable/lectureFocus.ts diff --git a/src/reducers/timetable/list.ts b/src/redux/reducers/timetable/list.ts similarity index 99% rename from src/reducers/timetable/list.ts rename to src/redux/reducers/timetable/list.ts index 06988d6..5d5b58f 100644 --- a/src/reducers/timetable/list.ts +++ b/src/redux/reducers/timetable/list.ts @@ -8,7 +8,7 @@ import { DELETE_LECTURE_FROM_CART, SET_MOBILE_IS_LECTURE_LIST_OPEN, LectureListAction, -} from '@/actions/timetable/list'; +} from '@/redux/actions/timetable/list'; import { unique } from '@/utils/commonUtils'; import { LectureListCode } from '@/shapes/enum'; diff --git a/src/reducers/timetable/search.ts b/src/redux/reducers/timetable/search.ts similarity index 97% rename from src/reducers/timetable/search.ts rename to src/redux/reducers/timetable/search.ts index a392a96..82205e6 100644 --- a/src/reducers/timetable/search.ts +++ b/src/redux/reducers/timetable/search.ts @@ -6,7 +6,7 @@ import { SET_CLASSTIME_OPTIONS, CLEAR_CLASSTIME_OPTIONS, SearchAction, -} from '@/actions/timetable/search'; +} from '@/redux/actions/timetable/search'; import { Day } from '@/shapes/enum'; import LectureLastSearchOption from '@/shapes/state/timetable/LectureLastSearchOption'; diff --git a/src/reducers/timetable/semester.ts b/src/redux/reducers/timetable/semester.ts similarity index 86% rename from src/reducers/timetable/semester.ts rename to src/redux/reducers/timetable/semester.ts index ddf1bb9..5646c97 100644 --- a/src/reducers/timetable/semester.ts +++ b/src/redux/reducers/timetable/semester.ts @@ -1,4 +1,4 @@ -import { RESET, SET_SEMESTER, SemesterAction } from '@/actions/timetable/semester'; +import { RESET, SET_SEMESTER, SemesterAction } from '@/redux/actions/timetable/semester'; import { SemesterType } from '@/shapes/enum'; interface SemesterState { diff --git a/src/reducers/timetable/timetable.ts b/src/redux/reducers/timetable/timetable.ts similarity index 100% rename from src/reducers/timetable/timetable.ts rename to src/redux/reducers/timetable/timetable.ts diff --git a/src/reducers/write-reviews/index.ts b/src/redux/reducers/write-reviews/index.ts similarity index 100% rename from src/reducers/write-reviews/index.ts rename to src/redux/reducers/write-reviews/index.ts diff --git a/src/reducers/write-reviews/latestReviews.ts b/src/redux/reducers/write-reviews/latestReviews.ts similarity index 96% rename from src/reducers/write-reviews/latestReviews.ts rename to src/redux/reducers/write-reviews/latestReviews.ts index d980a42..294798d 100644 --- a/src/reducers/write-reviews/latestReviews.ts +++ b/src/redux/reducers/write-reviews/latestReviews.ts @@ -3,7 +3,7 @@ import { ADD_REVIEWS, UPDATE_REVIEW, LatestReviewsAction, -} from '@/actions/write-reviews/latestReviews'; +} from '@/redux/actions/write-reviews/latestReviews'; import Review from '@/shapes/model/review/Review'; interface LatestReviewsState { diff --git a/src/reducers/write-reviews/likedReviews.ts b/src/redux/reducers/write-reviews/likedReviews.ts similarity index 83% rename from src/reducers/write-reviews/likedReviews.ts rename to src/redux/reducers/write-reviews/likedReviews.ts index 702aed7..d25ec6a 100644 --- a/src/reducers/write-reviews/likedReviews.ts +++ b/src/redux/reducers/write-reviews/likedReviews.ts @@ -1,4 +1,4 @@ -import { LikedReviewsAction, RESET, SET_REVIEWS } from '@/actions/write-reviews/likedReviews'; +import { LikedReviewsAction, RESET, SET_REVIEWS } from '@/redux/actions/write-reviews/likedReviews'; import Review from '@/shapes/model/review/Review'; interface LikedReviewsState { reviews: Review[] | null; diff --git a/src/reducers/write-reviews/rankedReviews.ts b/src/redux/reducers/write-reviews/rankedReviews.ts similarity index 95% rename from src/reducers/write-reviews/rankedReviews.ts rename to src/redux/reducers/write-reviews/rankedReviews.ts index 76e8c28..e30bc32 100644 --- a/src/reducers/write-reviews/rankedReviews.ts +++ b/src/redux/reducers/write-reviews/rankedReviews.ts @@ -3,7 +3,7 @@ import { ADD_SEMESTER_REVIEWS, SET_SEMESTER_REVIEW_COUNT, RankedReviewsAction, -} from '@/actions/write-reviews/rankedReviews'; +} from '@/redux/actions/write-reviews/rankedReviews'; import Review from '@/shapes/model/review/Review'; interface RankedReviewState { diff --git a/src/reducers/write-reviews/reviewsFocus.ts b/src/redux/reducers/write-reviews/reviewsFocus.ts similarity index 95% rename from src/reducers/write-reviews/reviewsFocus.ts rename to src/redux/reducers/write-reviews/reviewsFocus.ts index 8dfcfb6..255f6ad 100644 --- a/src/reducers/write-reviews/reviewsFocus.ts +++ b/src/redux/reducers/write-reviews/reviewsFocus.ts @@ -4,7 +4,7 @@ import { CLEAR_REVIEWS_FOCUS, SET_REVIEWS, ReviewsFocusAction, -} from '@/actions/write-reviews/reviewsFocus'; +} from '@/redux/actions/write-reviews/reviewsFocus'; import { ReviewsFocusFrom } from '@/shapes/enum'; import Review from '@/shapes/model/review/Review'; From 38166429fd22f227665c3a8f0770067ef6c366cc Mon Sep 17 00:00:00 2001 From: Yumin Cho Date: Sun, 19 May 2024 20:25:32 +0900 Subject: [PATCH 4/5] refactor: convert App to TypeScript --- src/App.jsx | 263 ------------------------------ src/App.tsx | 135 +++++++++++++++ src/const.ts | 4 + src/index.tsx | 167 ++++++++++++------- src/redux/actions/common/index.ts | 4 + src/redux/actions/common/user.ts | 2 +- 6 files changed, 250 insertions(+), 325 deletions(-) delete mode 100644 src/App.jsx create mode 100644 src/App.tsx create mode 100644 src/redux/actions/common/index.ts diff --git a/src/App.jsx b/src/App.jsx deleted file mode 100644 index 955f7bc..0000000 --- a/src/App.jsx +++ /dev/null @@ -1,263 +0,0 @@ -import React, { Component } from 'react'; -import { Routes, Route, Navigate, useLocation } from 'react-router-dom'; -import { createStore, combineReducers } from 'redux'; -import { Provider } from 'react-redux'; -import axios from 'axios'; -import qs from 'qs'; - -import Header from './common/guideline/components/Header'; -import DictionaryPage from './pages/DictionaryPage'; -import PlannerPage from './pages/PlannerPage'; -import TimetablePage from './pages/TimetablePage'; -import WriteReviewsPage from './pages/WriteReviewsPage'; -import SyllabusPage from './pages/SyllabusPage'; -import MainPage from './pages/MainPage'; -import AccountPage from './pages/AccountPage'; -import CreditPage from './pages/CreditPage'; -import LicensePage from './pages/LicensePage'; -import PrivacyPage from './pages/PrivacyPage'; -import TestPage from './pages/TestPage'; -import ErrorPage from './pages/ErrorPage'; - -import dictionaryReducer from './redux/reducers/dictionary/index'; -import timetableReducer from './redux/reducers/timetable/index'; -import writeReviewsReducer from './redux/reducers/write-reviews/index'; -import commonReducer from './redux/reducers/common/index'; -import plannerReducer from './redux/reducers/planner/index'; - -import { setUser } from './redux/actions/common/user'; -import { setSemesters } from './redux/actions/common/semester'; -import { setTracks } from './redux/actions/common/track'; -import { setIsPortrait } from './redux/actions/common/media'; - -import BannerPopup from '@/common/components/popup/bannerPopup/BannerPopup'; -import CampaignPopupImage from '@/features/campaign/components/popup/CampaignPopupImage'; -import PopupMenu from './features/campaign/components/popup/PopupMenu'; -import EventBannerPage from './pages/EventBannerPage'; - -import ReactGA from 'react-ga4'; - -const trackingId = 'G-8NSY19J0T3'; -ReactGA.initialize([ - { - trackingId, - gaOptions: { - siteSpeedSampleRate: 100, - }, - }, -]); - -const store = createStore( - combineReducers({ - common: commonReducer, - dictionary: dictionaryReducer, - timetable: timetableReducer, - writeReviews: writeReviewsReducer, - planner: plannerReducer, - }), - process.env.NODE_ENV === 'development' - ? window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() - : null, -); - -class App extends Component { - portraitMediaQuery = window.matchMedia('(max-aspect-ratio: 4/3)'); - - STORAGE_KEY = 'otl-banner-key'; - CAMPAIGN_KEY = 'CMPGN-2023-08-24-v1'; - - constructor(props) { - super(props); - - let showPopup = false; - - const key = localStorage.getItem(this.STORAGE_KEY); - if (key !== this.CAMPAIGN_KEY) { - showPopup = true; - } - - this.state = { - doNotShowAgain: !showPopup, - popupOpen: showPopup, - }; - } - - componentDidMount() { - this._fetchUser(); - - this._fetchSemesters(); - - this._updateSizeProperty(); - window.addEventListener('resize', this._updateSizeProperty); - - this._updateIsPortrait(); - this.portraitMediaQuery.addEventListener('change', this._updateIsPortrait); - } - - componentWillUnmount() { - window.removeEventListener('resize', this._updateSizeProperty); - - this.portraitMediaQuery.removeEventListener('change', this._updateIsPortrait); - } - - _fetchUser = () => { - axios - .get('/session/info', { - metadata: { - gaCategory: 'User', - gaVariable: 'Get / Instance', - }, - }) - .then((response) => { - store.dispatch(setUser(response.data)); - }) - .catch((error) => { - if (error.response && error.response.status === 401) { - store.dispatch(setUser(null)); - } - }); - }; - - _fetchSemesters = () => { - axios - .get('/api/semesters', { - params: { - order: ['year', 'semester'], - }, - metadata: { - gaCategory: 'Semester', - gaVariable: 'GET / List', - }, - }) - .then((response) => { - store.dispatch(setSemesters(response.data)); - }) - .catch((error) => {}); - - axios - .get('/api/tracks', { - params: {}, - metadata: { - gaCategory: 'Track', - gaVariable: 'GET / List', - }, - }) - .then((response) => { - store.dispatch(setTracks(response.data)); - }) - .catch((error) => {}); - }; - - _updateSizeProperty = () => { - document.documentElement.style.setProperty('--window-inner-height', `${window.innerHeight}px`); - }; - - _updateIsPortrait = () => { - store.dispatch(setIsPortrait(this.portraitMediaQuery.matches)); - }; - - _setDoNotShow = (state) => { - if (state === true) { - this.setState({ doNotShowAgain: true }); - localStorage.setItem(this.STORAGE_KEY, this.CAMPAIGN_KEY); - } else { - this.setState({ doNotShowAgain: false }); - localStorage.removeItem(this.STORAGE_KEY); - } - }; - - render() { - const { popupOpen, doNotShowAgain } = this.state; - - const parseObject = (object) => { - if (typeof object === 'object') { - return Object.entries(object) - .map(([k, v]) => [k, parseObject(v)]) - .reduce((acc, val) => Object.assign({}, acc, { [val[0]]: val[1] }), {}); - } - - if (/^-?[0-9]+$/.test(object)) { - return parseInt(object, 10); - } - - const keywords = { - true: true, - false: false, - null: null, - undefined: undefined, - }; - if (object in keywords) { - return keywords[object]; - } - - return object; - }; - - const parseQueryString = (search) => { - const qsParsed = qs.parse(search, { ignoreQueryPrefix: true }); - - return parseObject(qsParsed); - }; - - return ( - - <> -
- - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - {/* Temporary test page for axiom */} - } /> - } /> - } /> - } /> - - -
- this.setState({ popupOpen: state })}> - this.setState({ popupOpen: false })} /> - { - ReactGA.event({ - category: 'Campaign', - action: 'popup-close', - }); - this.setState({ popupOpen: false }); - }} - onDoNotShow={() => { - ReactGA.event({ - category: 'Campaign', - action: 'popup-do-not-show', - }); - this._setDoNotShow(true); - this.setState({ popupOpen: false }); - }} - /> - -
- - ); - } -} - -const AppFC = () => { - const location = useLocation(); - - React.useEffect(() => { - ReactGA.send({ hitType: 'pageview', page: location.pathname }); - }, [location]); - - return ; -}; - -export default AppFC; diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..e30b461 --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,135 @@ +import axios from 'axios'; +import React, { useEffect } from 'react'; +import ReactGA from 'react-ga4'; +import { useDispatch } from 'react-redux'; +import { useLocation, Outlet } from 'react-router-dom'; + +import { CAMPAIGN_KEY, STORAGE_KEY } from '@/const'; +import Header from '@/common/guideline/components/Header'; +import BannerPopup from '@/common/components/popup/bannerPopup/BannerPopup'; +import CampaignPopupImage from '@/features/campaign/components/popup/CampaignPopupImage'; +import PopupMenu from '@/features/campaign/components/popup/PopupMenu'; +import { setIsPortrait, setSemesters, setTracks, setUser } from '@/redux/actions/common'; + +const App: React.FC = () => { + const dispatch = useDispatch(); + const location = useLocation(); + const [popupOpen, setPopupOpen] = React.useState( + localStorage.getItem(STORAGE_KEY) !== CAMPAIGN_KEY, + ); + const portraitMediaQuery = window.matchMedia('(max-aspect-ratio: 4/3)'); + + useEffect(() => { + ReactGA.send({ hitType: 'pageview', page: location.pathname }); + }, [location]); + + useEffect(() => { + fetchUser(); + fetchSemesters(); + updateSizeProperty(); + window.addEventListener('resize', updateSizeProperty); + updateIsPortrait(); + portraitMediaQuery.addEventListener('change', updateIsPortrait); + return () => { + window.removeEventListener('resize', updateSizeProperty); + portraitMediaQuery.removeEventListener('change', updateIsPortrait); + }; + }, []); + + const fetchUser = () => { + axios + .get('/session/info', { + metadata: { + gaCategory: 'User', + gaVariable: 'Get / Instance', + }, + }) + .then((response) => { + dispatch(setUser(response.data)); + }) + .catch((error) => { + if (error.response && error.response.status === 401) { + dispatch(setUser(null)); + } + }); + }; + + const fetchSemesters = () => { + axios + .get('/api/semesters', { + params: { + order: ['year', 'semester'], + }, + metadata: { + gaCategory: 'Semester', + gaVariable: 'GET / List', + }, + }) + .then((response) => { + dispatch(setSemesters(response.data)); + }) + .catch(() => {}); + + axios + .get('/api/tracks', { + params: {}, + metadata: { + gaCategory: 'Track', + gaVariable: 'GET / List', + }, + }) + .then((response) => { + dispatch(setTracks(response.data)); + }) + .catch(() => {}); + }; + + const updateSizeProperty = () => { + document.documentElement.style.setProperty('--window-inner-height', `${window.innerHeight}px`); + }; + + const updateIsPortrait = () => { + dispatch(setIsPortrait(portraitMediaQuery.matches)); + }; + + const setDoNotShow = (state: boolean) => { + if (state) { + // setDoNotShowAgain(true); + localStorage.setItem(STORAGE_KEY, CAMPAIGN_KEY); + } else { + // setDoNotShowAgain(false); + localStorage.removeItem(STORAGE_KEY); + } + }; + + return ( + <> +
+ +
+ setPopupOpen(state)}> + setPopupOpen(false)} /> + { + ReactGA.event({ + category: 'Campaign', + action: 'popup-close', + }); + setPopupOpen(false); + }} + onDoNotShow={() => { + ReactGA.event({ + category: 'Campaign', + action: 'popup-do-not-show', + }); + setDoNotShow(true); + setPopupOpen(false); + }} + /> + +
+ + ); +}; + +export default App; diff --git a/src/const.ts b/src/const.ts index 8018cc1..c267266 100644 --- a/src/const.ts +++ b/src/const.ts @@ -1 +1,5 @@ export const API_URL = process.env.NODE_ENV === 'production' ? '' : 'http://localhost:58000'; + +export const TRACKING_ID = 'G-8NSY19J0T3'; +export const STORAGE_KEY = 'otl-banner-key'; +export const CAMPAIGN_KEY = 'CMPGN-2023-08-24-v1'; diff --git a/src/index.tsx b/src/index.tsx index afc2e9a..5e6c628 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,49 +1,44 @@ +import axios from 'axios'; import i18n from 'i18next'; -import { initReactI18next } from 'react-i18next'; -import Backend from 'i18next-xhr-backend'; import LanguageDetector from 'i18next-browser-languagedetector'; +import Backend from 'i18next-xhr-backend'; import moment from 'moment'; +import Qs from 'qs'; +import { createRoot } from 'react-dom/client'; +import ReactGA from 'react-ga4'; +import { initReactI18next } from 'react-i18next'; +import { Provider as ReduxProvider } from 'react-redux'; +import { createBrowserRouter, Navigate, RouterProvider } from 'react-router-dom'; +import { compose, legacy_createStore as createStore } from 'redux'; + +import App from '@/App'; +import { API_URL, TRACKING_ID } from '@/const'; +import DictionaryPage from '@/pages/DictionaryPage'; +import PlannerPage from '@/pages/PlannerPage'; +import TimetablePage from '@/pages/TimetablePage'; +import WriteReviewsPage from '@/pages/WriteReviewsPage'; +import SyllabusPage from '@/pages/SyllabusPage'; +import MainPage from '@/pages/MainPage'; +import AccountPage from '@/pages/AccountPage'; +import EventBannerPage from '@/pages/EventBannerPage'; +import CreditPage from '@/pages/CreditPage'; +import LicensePage from '@/pages/LicensePage'; +import PrivacyPage from '@/pages/PrivacyPage'; +import TestPage from '@/pages/TestPage'; +import ErrorPage from '@/pages/ErrorPage'; +import rootReducer from '@/redux'; +import registerServiceWorker from '@/registerServiceWorker'; +import en from '@/translations/translation.en.json'; +import ko from '@/translations/translation.ko.json'; -import en from './translations/translation.en.json'; -import ko from './translations/translation.ko.json'; - -// Import css files import 'slick-carousel/slick/slick.css'; import 'slick-carousel/slick/slick-theme.css'; -i18n - .use(Backend) - .use(LanguageDetector) - .use(initReactI18next) - .init({ - resources: { - en: { - translation: en, - }, - ko: { - translation: ko, - }, - }, - fallbackLng: ['ko', 'en'], - debug: false, - react: { - useSuspense: false, - }, - interpolation: { - escapeValue: false, - formatSeparator: ',', - format: (value, formatting, lng) => { - if (value instanceof Date) { - return moment(value) - .locale(lng ?? 'ko') - .format(formatting); - } - return value.toString(); - }, - }, - }); - -import axios from 'axios'; +declare global { + interface Window { + __REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: typeof compose; + } +} declare module 'axios' { export interface AxiosRequestConfig { @@ -57,17 +52,11 @@ declare module 'axios' { } } -import Qs from 'qs'; -import { API_URL } from './const'; - axios.defaults.xsrfHeaderName = 'X-CSRFToken'; axios.defaults.xsrfCookieName = 'csrftoken'; - axios.defaults.baseURL = API_URL; axios.defaults.withCredentials = true; - axios.defaults.paramsSerializer = (params) => Qs.stringify(params, { arrayFormat: 'repeat' }); - axios.interceptors.request.use( (config) => { config.metadata = { @@ -76,12 +65,10 @@ axios.interceptors.request.use( }; return config; }, - // eslint-disable-next-line arrow-body-style (error) => { return Promise.reject(error); }, ); - axios.interceptors.response.use( (response) => { response.config.metadata.endTime = new Date(); @@ -97,24 +84,82 @@ axios.interceptors.response.use( }, ); -import { BrowserRouter } from 'react-router-dom'; -import ReactDOM from 'react-dom/client'; -import App from './App'; +i18n + .use(Backend) + .use(LanguageDetector) + .use(initReactI18next) + .init({ + resources: { + en: { + translation: en, + }, + ko: { + translation: ko, + }, + }, + fallbackLng: ['ko', 'en'], + debug: false, + react: { + useSuspense: false, + }, + interpolation: { + escapeValue: false, + formatSeparator: ',', + format: (value, formatting, lng) => { + if (value instanceof Date) { + return moment(value) + .locale(lng ?? 'ko') + .format(formatting); + } + return value.toString(); + }, + }, + }); -const container = document.getElementById('root'); +ReactGA.initialize([ + { + trackingId: TRACKING_ID, + gaOptions: { + siteSpeedSampleRate: 100, + }, + }, +]); -if (!container) { - throw new Error('There must be root element'); -} +const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose; -const root = ReactDOM.createRoot(container); // createRoot(container!) if you use TypeScript -root.render( - - - , -); +const reduxStore = createStore(rootReducer, composeEnhancers()); -import registerServiceWorker from './registerServiceWorker'; +const router = createBrowserRouter([ + { + path: '/', + element: , + children: [ + { index: true, element: }, + { + path: 'dictionary', + element: , + }, + { path: 'timetable', element: }, + { path: 'timetable/syllabus', element: }, + { path: 'write-reviews', element: }, + { path: 'planner', element: }, + { path: 'account', element: }, + { path: 'eventBanner', element: }, + { path: 'credits', element: }, + { path: 'licenses', element: }, + { path: 'privacy', element: }, + { path: 'test', element: }, + { path: 'error/:message', element: }, + { path: '*', element: }, + ], + }, +]); + +createRoot(document.getElementById('root')!).render( + + + , +); try { registerServiceWorker(); diff --git a/src/redux/actions/common/index.ts b/src/redux/actions/common/index.ts new file mode 100644 index 0000000..9ff3325 --- /dev/null +++ b/src/redux/actions/common/index.ts @@ -0,0 +1,4 @@ +export * from './media'; +export * from './semester'; +export * from './track'; +export * from './user'; diff --git a/src/redux/actions/common/user.ts b/src/redux/actions/common/user.ts index 831d756..405e90f 100644 --- a/src/redux/actions/common/user.ts +++ b/src/redux/actions/common/user.ts @@ -6,7 +6,7 @@ export const UPDATE_USER_REVIEW = `${BASE_STRING}UPDATE_USER_REVIEW` as const; import User from '@/shapes/model/session/User'; import Review from '@/shapes/model/review/Review'; -export function setUser(user: User) { +export function setUser(user: User | null) { return { type: SET_USER, user: user, From 54b4f9cecc08735e038500f9f4f4454998a38045 Mon Sep 17 00:00:00 2001 From: Yumin Cho Date: Mon, 27 May 2024 16:25:34 +0900 Subject: [PATCH 5/5] chore: simplify codes --- src/App.tsx | 8 +++----- src/redux/index.ts | 10 +++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index e30b461..3389d7b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,5 @@ import axios from 'axios'; -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import ReactGA from 'react-ga4'; import { useDispatch } from 'react-redux'; import { useLocation, Outlet } from 'react-router-dom'; @@ -14,9 +14,7 @@ import { setIsPortrait, setSemesters, setTracks, setUser } from '@/redux/actions const App: React.FC = () => { const dispatch = useDispatch(); const location = useLocation(); - const [popupOpen, setPopupOpen] = React.useState( - localStorage.getItem(STORAGE_KEY) !== CAMPAIGN_KEY, - ); + const [popupOpen, setPopupOpen] = useState(localStorage.getItem(STORAGE_KEY) !== CAMPAIGN_KEY); const portraitMediaQuery = window.matchMedia('(max-aspect-ratio: 4/3)'); useEffect(() => { @@ -107,7 +105,7 @@ const App: React.FC = () => {
- setPopupOpen(state)}> + setPopupOpen(false)} /> { diff --git a/src/redux/index.ts b/src/redux/index.ts index f543ff4..17c52e8 100644 --- a/src/redux/index.ts +++ b/src/redux/index.ts @@ -1,10 +1,10 @@ import { combineReducers } from 'redux'; -import dictionaryReducer from '@/redux/reducers/dictionary/index'; -import timetableReducer from '@/redux/reducers/timetable/index'; -import writeReviewsReducer from '@/redux/reducers/write-reviews/index'; -import commonReducer from '@/redux/reducers/common/index'; -import plannerReducer from '@/redux/reducers/planner/index'; +import dictionaryReducer from '@/redux/reducers/dictionary'; +import timetableReducer from '@/redux/reducers/timetable'; +import writeReviewsReducer from '@/redux/reducers/write-reviews'; +import commonReducer from '@/redux/reducers/common'; +import plannerReducer from '@/redux/reducers/planner'; const rootReducer = combineReducers({ common: commonReducer,