Skip to content

Commit

Permalink
Merge pull request #44 from sparcs-kaist/migration@shapes
Browse files Browse the repository at this point in the history
Migrate remaining shapes, Complete shapes migration
  • Loading branch information
sboh1214 authored Mar 13, 2024
2 parents 0f65744 + 6084410 commit d6c9cf7
Show file tree
Hide file tree
Showing 68 changed files with 471 additions and 233 deletions.
2 changes: 1 addition & 1 deletion src/components/CreditBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { withTranslation } from 'react-i18next';
import PropTypes from 'prop-types';

import { appBoundClassNames as classNames } from '../common/boundClassNames';
import { ItemFocusFrom } from '../reducers/planner/itemFocus';
import { ItemFocusFrom } from '@/shapes/enum';

class CreditBar extends Component {
render() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/blocks/LectureGroupBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { appBoundClassNames as classNames } from '../../common/boundClassNames';

import lecture from '../../shapes/model/subject/lecture';
import lecture from '../../shapes/model/subject/Lecture';

interface lectureGroupBlockProps {
lectureGroup: lecture[];
Expand Down
2 changes: 1 addition & 1 deletion src/components/blocks/LectureGroupBlockRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
import { appBoundClassNames as classNames } from '../../common/boundClassNames';
import { getProfessorsShortStr, getClassroomStr } from '../../utils/lectureUtils';

import lecture from '../../shapes/model/subject/lecture';
import lecture from '../../shapes/model/subject/Lecture';

type lectureVoidFunc = (x: lecture) => void;
interface lectureGroupBlockRowProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/blocks/LectureGroupSimpleBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';

import { appBoundClassNames as classNames } from '../../common/boundClassNames';
import { getProfessorsShortStr } from '../../utils/lectureUtils';
import lecture from '../../shapes/model/subject/lecture';
import lecture from '../../shapes/model/subject/Lecture';

interface lectureGroupSimpleBlockProps {
lectures: lecture[];
Expand Down
2 changes: 1 addition & 1 deletion src/components/blocks/LectureSimpleBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';

import { appBoundClassNames as classNames } from '../../common/boundClassNames';

import lecture from '@/shapes/model/subject/lecture';
import lecture from '@/shapes/model/subject/Lecture';
interface lectureSimpleBlockProps {
lecture: lecture;
isRaised: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/components/sections/main/LatestReviewSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import axios from 'axios';
import { appBoundClassNames as classNames } from '../../../common/boundClassNames';

import ReviewBlock from '../../blocks/ReviewBlock';
import { ReviewsFocusFrom } from '../../../reducers/write-reviews/reviewsFocus';
import { ReviewsFocusFrom } from '@/shapes/enum';

class LatestReviewSection extends Component {
constructor(props) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/sections/main/RankedReviewFeedSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ReviewBlock from '../../blocks/ReviewBlock';

import { getSemesterName } from '../../../utils/semesterUtils';

import { ReviewsFocusFrom } from '../../../reducers/write-reviews/reviewsFocus';
import { ReviewsFocusFrom } from '@/shapes/enum';

import reviewShape from '../../../shapes/model/review/ReviewShape';
import semesterShape from '../../../shapes/model/subject/SemesterShape';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
getLevelOptions,
getTermOptions,
} from '../../../../common/searchOptions';
import { ItemFocusFrom } from '../../../../reducers/planner/itemFocus';
import { ItemFocusFrom } from '@/shapes/enum';

class CourseListSection extends Component {
showSearch = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import SearchFilter from '../../../SearchFilter';
import { getSemesterName } from '../../../../utils/semesterUtils';
import { getCourseOfItem, getSemesterOfItem } from '../../../../utils/itemUtils';

import { ItemFocusFrom } from '../../../../reducers/planner/itemFocus';
import { ItemFocusFrom } from '@/shapes/enum';
import { updateItemInPlanner } from '../../../../actions/planner/planner';
import { setItemFocus } from '../../../../actions/planner/itemFocus';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import CourseReviewsSubSection from './CourseReviewsSubSection';
import { clearItemFocus, setLectures, setReviews } from '../../../../actions/planner/itemFocus';

import itemFocusShape from '../../../../shapes/state/planner/ItemFocusShape';
import { ItemFocusFrom } from '../../../../reducers/planner/itemFocus';
import { ItemFocusFrom } from '@/shapes/enum';
import plannerShape from '../../../../shapes/model/planner/PlannerShape';

class CourseManageSection extends Component {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
updateItemInPlanner,
} from '../../../../actions/planner/planner';

import { ItemFocusFrom } from '../../../../reducers/planner/itemFocus';
import { ItemFocusFrom } from '@/shapes/enum';

import userShape from '../../../../shapes/model/session/UserShape';
import plannerShape from '../../../../shapes/model/planner/PlannerShape';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import CreditBar from '../../../CreditBar';
import CourseStatus from '../../../CourseStatus';
import Scroller from '../../../Scroller';

import { ItemFocusFrom } from '../../../../reducers/planner/itemFocus';
import { ItemFocusFrom } from '@/shapes/enum';

import { getCreditOfItem, getAuOfItem, getCreditAndAuOfItem } from '../../../../utils/itemUtils';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
removeLectureFromTimetable,
} from '../../../../actions/timetable/timetable';

import { LectureFocusFrom } from '../../../../reducers/timetable/lectureFocus';
import { LectureFocusFrom } from '@/shapes/enum';
import { LectureListCode } from '../../../../reducers/timetable/list';

import userShape from '../../../../shapes/model/session/UserShape';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import { openSearch } from '../../../../actions/timetable/search';
import { addLectureToTimetable } from '../../../../actions/timetable/timetable';

import { LectureFocusFrom } from '../../../../reducers/timetable/lectureFocus';
import { LectureFocusFrom } from '@/shapes/enum';
import { LectureListCode } from '../../../../reducers/timetable/list';

import userShape from '../../../../shapes/model/session/UserShape';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
import { setListLectures, clearSearchListLectures } from '../../../../actions/timetable/list';
import { clearLectureFocus } from '../../../../actions/timetable/lectureFocus';

import { LectureFocusFrom } from '../../../../reducers/timetable/lectureFocus';
import { LectureFocusFrom } from '@/shapes/enum';

import lectureFocusShape from '../../../../shapes/state/timetable/LectureFocusShape';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { getOverallLectures, isSingleFocused } from '../../../../utils/lectureUt
import { getTimeStr } from '../../../../utils/examtimeUtils';
import { getDayStr } from '../../../../utils/timeUtils';

import { LectureFocusFrom } from '../../../../reducers/timetable/lectureFocus';
import { LectureFocusFrom } from '@/shapes/enum';

class ExamSubSection extends Component {
constructor(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
import mapImage from '../../../../static/images/timetable/kaist_map.jpg';
import { unique } from '../../../../utils/commonUtils';

import { LectureFocusFrom } from '../../../../reducers/timetable/lectureFocus';
import { LectureFocusFrom } from '@/shapes/enum';

const POSITION_OF_LOCATIONS = new Map([
['E2', { left: 60, top: 81 }],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getAverageScoreLabel } from '../../../../utils/scoreUtils';

import { clearMultipleFocus, setMultipleFocus } from '../../../../actions/timetable/lectureFocus';

import { LectureFocusFrom } from '../../../../reducers/timetable/lectureFocus';
import { LectureFocusFrom } from '@/shapes/enum';

import lectureFocusShape from '../../../../shapes/state/timetable/LectureFocusShape';
import timetableShape, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
removeLectureFromTimetable,
} from '../../../../actions/timetable/timetable';

import { LectureFocusFrom } from '../../../../reducers/timetable/lectureFocus';
import { LectureFocusFrom } from '@/shapes/enum';
import { LectureListCode } from '../../../../reducers/timetable/list';

import userShape from '../../../../shapes/model/session/UserShape';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ReactGA from 'react-ga4';
import { appBoundClassNames as classNames } from '../../../../common/boundClassNames';

import { setReviewsFocus } from '../../../../actions/write-reviews/reviewsFocus';
import { ReviewsFocusFrom } from '../../../../reducers/write-reviews/reviewsFocus';
import { ReviewsFocusFrom } from '@/shapes/enum';

import userShape from '../../../../shapes/model/session/UserShape';
import reviewsFocusShape from '../../../../shapes/state/write-reviews/ReviewsFocusShape';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Scroller from '../../../Scroller';
import LectureSimpleBlock from '../../../blocks/LectureSimpleBlock';

import { setReviewsFocus, clearReviewsFocus } from '../../../../actions/write-reviews/reviewsFocus';
import { ReviewsFocusFrom } from '../../../../reducers/write-reviews/reviewsFocus';
import { ReviewsFocusFrom } from '@/shapes/enum';

import { unique } from '../../../../utils/commonUtils';
import { getSemesterName } from '../../../../utils/semesterUtils';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/WriteReviewsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { reset as resetReviewsFocus, setReviewsFocus } from '../actions/write-re
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 { ReviewsFocusFrom } from '../reducers/write-reviews/reviewsFocus';
import { ReviewsFocusFrom } from '@/shapes/enum';

import reviewsFocusShape from '../shapes/state/write-reviews/ReviewsFocusShape';
import OtlplusPlaceholder from '../components/OtlplusPlaceholder';
Expand Down
10 changes: 1 addition & 9 deletions src/reducers/planner/itemFocus.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@ import {
SET_LECTURES,
} from '../../actions/planner/itemFocus';

export const ItemFocusFrom = {
NONE: 'NONE',
LIST: 'LIST',
ADDING: 'ADDING',
TABLE_TAKEN: 'TABLE_TAKEN',
TABLE_FUTURE: 'TABLE_FUTURE',
TABLE_ARBITRARY: 'TABLE_ARBITRARY',
CATEGORY: 'CATEGORY',
};
import { ItemFocusFrom } from '@/shapes/enum';

const initialState = {
from: ItemFocusFrom.NONE,
Expand Down
7 changes: 1 addition & 6 deletions src/reducers/timetable/lectureFocus.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ import {
CLEAR_MULTIPLE_FOCUS,
} from '../../actions/timetable/lectureFocus';

export const LectureFocusFrom = {
NONE: 'NONE',
LIST: 'LIST',
TABLE: 'TABLE',
MULTIPLE: 'MULTIPLE',
};
import { LectureFocusFrom } from '@/shapes/enum';

const initialState = {
from: LectureFocusFrom.NONE,
Expand Down
9 changes: 1 addition & 8 deletions src/reducers/write-reviews/reviewsFocus.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@ import {
SET_REVIEWS,
} from '../../actions/write-reviews/reviewsFocus';

export const ReviewsFocusFrom = {
NONE: 'NONE',
LECTURE: 'LECTURE',
REVIEWS_LATEST: 'LATEST',
REVIEWS_MY: 'MY',
REVIEWS_LIKED: 'LIKED',
REVIEWS_RANKED: 'RANKED',
};
import { ReviewsFocusFrom } from '@/shapes/enum';

const initialState = {
from: ReviewsFocusFrom.NONE,
Expand Down
10 changes: 10 additions & 0 deletions src/shapes/BlockLink.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
interface DetailedLink {
pathname?: string;
search?: string;
hash?: string;
state?: object;
}

type BlockLink = string | DetailedLink;

export default BlockLink;
45 changes: 45 additions & 0 deletions src/shapes/enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
export enum AdditionalTrackType {
DOUBLE,
MINOR,
ADVANCED,
INTERDISCIPLINARY,
}

export const enum SemesterType {
SPRING = 1,
SUMMER = 2,
FALL = 3,
WINTER = 4,
}

export const enum ItemFocusFrom {
NONE = 'NONE',
LIST = 'LIST',
ADDING = 'ADDING',
TABLE_TAKEN = 'TABLE_TAKEN',
TABLE_FUTURE = 'TABLE_FUTURE',
TABLE_ARBITRARY = 'TABLE_ARBITRARY',
CATEGORY = 'CATEGORY',
}

export const enum LectureFocusFrom {
NONE = 'NONE',
LIST = 'LIST',
TABLE = 'TABLE',
MULTIPLE = 'MULTIPLE',
}

export const enum ReviewsFocusFrom {
NONE = 'NONE',
LECTURE = 'LECTURE',
REVIEWS_LATEST = 'LATEST',
REVIEWS_MY = 'MY',
REVIEWS_LIKED = 'LIKED',
REVIEWS_RANKED = 'RANKED',
}

export const enum PlannerItemType {
TAKEN = 'TAKEN',
FUTURE = 'FUTURE',
ARBITRARY = 'ARBITRARY',
}
12 changes: 12 additions & 0 deletions src/shapes/model/graduation/AdditionalTrack.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type Department from '../subject/Department';
import type { AdditionalTrackType } from '@/shapes/enum';

export default interface AdditionalTrack {
id: number;
start_year: number;
end_year: number;
type: AdditionalTrackType;
department?: Department;
major_required: number;
major_elective: number;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface generalTrack {
export default interface GeneralTrack {
id: number;
start_year: number;
end_year: number;
Expand All @@ -14,5 +14,3 @@ interface generalTrack {
humanities: number;
humanities_doublemajor: number;
}

export default generalTrack;
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import department from '../subject/department';
import type Department from '../subject/Department';

interface majorTrack {
export default interface MajorTrack {
id: number;
start_year: number;
end_year: number;
department: department;
department: Department;
basic_elective_doublemajor: number;
major_required: number;
major_elective: number;
}

export default majorTrack;
20 changes: 0 additions & 20 deletions src/shapes/model/graduation/additionalTrack.tsx

This file was deleted.

15 changes: 15 additions & 0 deletions src/shapes/model/planner/ArbitraryPlannerItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type Department from '../subject/Department';
import type { SemesterType, PlannerItemType } from '@/shapes/enum';

export default interface ArbitraryPlannerItem {
id: number;
item_type: PlannerItemType.ARBITRARY;
is_excluded: boolean;
year: number;
semester: SemesterType;
department?: Department;
type: string;
type_en: string;
credit: number;
credit_au: number;
}
11 changes: 11 additions & 0 deletions src/shapes/model/planner/FuturePlannerItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type Course from '../subject/Course';
import type { SemesterType, PlannerItemType } from '@/shapes/enum';

export default interface FuturePlannerItem {
id: number;
item_type: PlannerItemType.FUTURE;
is_excluded: boolean;
year: number;
semester: SemesterType;
course: Course;
}
Loading

0 comments on commit d6c9cf7

Please sign in to comment.