-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
migrate util functions #78
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
import type Lecture from '@/shapes/model/subject/Lecture'; | ||
|
||
interface LectureGroups { | ||
lectureGroups: Lecture[][]; | ||
} | ||
export default interface LectureLists { | ||
search: { | ||
lectureGroups: Lecture[][]; | ||
}; | ||
basic: { | ||
lectureGroups: Lecture[][]; | ||
}; | ||
humanity: { | ||
lectureGroups: Lecture[][]; | ||
}; | ||
cart: { | ||
lectureGroups: Lecture[][]; | ||
}; | ||
search: LectureGroups; | ||
basic: LectureGroups; | ||
humanity: LectureGroups; | ||
cart: LectureGroups; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Course from '@/shapes/model/subject/Course'; | ||
import User from '@/shapes/model/session/User'; | ||
import CourseFocus from '@/shapes/state/dictionary/CourseFocus'; | ||
import { getTranslatedString } from '@/utils/translationUtils'; | ||
|
||
//Dictionary Page 에서 사용되는 유틸들입니다. | ||
|
||
// Dictionary Page 의 Course List Section 에서 포커싱된 Course가 현재 Course이면 True를 반환합니다. | ||
export const isFocused = (course: Course, courseFocus: CourseFocus) => | ||
Boolean(courseFocus.course) && courseFocus.course?.id === course.id; | ||
|
||
// Dictionary Page 의 Course List Section 에서 포커싱된 Course가 있고, 포커싱된 Course가 현재 Course가 아니면 True를 반환합니다. | ||
export const isDimmedCourse = (course: Course, courseFocus: CourseFocus) => | ||
Boolean(courseFocus.course) && courseFocus.course?.id !== course.id; | ||
|
||
// Dictionary Page의 Course List Section에서 이미 수강한 Course 이면 True를 반환합니다. | ||
// isTaken 이 True 이면 리뷰 작성하기 블록이 보여집니다. | ||
export const isTaken = (courseId: number, user: User) => | ||
user.review_writable_lectures.some((l) => l.course === courseId); | ||
|
||
// Dictionary Page의 Course Block 에서 교수님들의 이름 리스트를 가져오기 위해 사용합니다. | ||
export const getProfessorsFullStr = (course: Course) => { | ||
const professors = course.professors.slice().sort((a, b) => (a.name < b.name ? -1 : 1)); | ||
const professorNames = professors.map((p) => getTranslatedString(p, 'name')); | ||
return professorNames.join(', '); | ||
}; | ||
|
||
export const isSpecialLectureCourse = (course: Course) => | ||
course.title.includes('특강') || | ||
course.title_en.includes('Special Lectures') || | ||
course.title_en.includes('Special Topics'); | ||
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Examtime from '@/shapes/model/subject/Examtime'; | ||
import { getTranslatedString } from '@/utils/translationUtils'; | ||
|
||
export const getStr = (examtime: Examtime) => getTranslatedString(examtime, 'str'); | ||
|
||
export const getTimeStr = (examtime: Examtime) => { | ||
const fullStr = getStr(examtime); | ||
return fullStr?.slice(fullStr.indexOf(' ')); | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) Orientation 대신.. direction을 쓰자고 이제 와서 말하면 이후 PR까지 고쳐야 해서 공사가 너무 커지겠군.... 수정하자는 말은 아니고 아쉬워서 말해봅니다 흑흑 😂