Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/content/components/Assignment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export default function Assignment({ courseData }: Props) {
>
<CardHeader className={`flex flex-row items-center justify-between p-5 pb-3`}>
<div className="grid grid-cols-1">
<div className="font-semibold text-2xl mb-1">{course.courseTitle}</div>
<div className="font-light text-lg">{course.title}</div>
<div className="font-semibold text-2xl mb-1 text-ellipsis line-clamp-1">{course.courseTitle}</div>
<div className="font-light text-lg text-ellipsis line-clamp-1">{course.title}</div>
</div>
</CardHeader>
<CardFooter className="flex justify-between items-center px-4 py-2 bg-zinc-50 font-medium ">
Expand Down
4 changes: 2 additions & 2 deletions src/content/components/QuizTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export default function QuizTab({ courseData }: Props) {
>
<CardHeader className={`flex flex-row items-center justify-between p-5 pb-3`}>
<div className="grid grid-cols-1">
<div className="font-semibold text-2xl mb-1">{course.courseTitle}</div>
<div className="font-light text-lg">{course.title}</div>
<div className="font-semibold text-2xl mb-1 text-ellipsis line-clamp-1">{course.courseTitle}</div>
<div className="font-light text-lg text-ellipsis line-clamp-1">{course.title}</div>
</div>
</CardHeader>
<CardFooter className="flex justify-between items-center px-4 py-2 bg-zinc-50 font-medium">
Expand Down
5 changes: 2 additions & 3 deletions src/content/components/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export default function Video({ courseData }: Props) {
className={`cursor-pointer flex flex-row items-center justify-between px-5 pt-5 pb-3 hover:bg-zinc-100 transition-all duration-100 ${isExpanded && 'shadow-2xl shadow-zinc-950'}`}
onClick={() => toggleCard(`${item.title}-${index}`)}
>
{/* subject 같은 애들끼리 묶기 */}
<div className="grid grid-cols-1">
<div className="font-semibold text-2xl mb-1">{item.courseTitle}</div>
<div className="font-light text-lg">{item.subject}</div>
Expand All @@ -99,10 +98,10 @@ export default function Video({ courseData }: Props) {
className="w-full px-4 py-3 bg-[rgb(246,250,255)] hover:bg-[rgb(238,246,255)] cursor-pointer transition-colors duration-300"
onClick={() => window.open(`${vod.url.replace('view', 'viewer')}`, '_blank', 'VodContentWindow')}
>
<div className="font-medium" style={{ fontWeight: 550 }}>
<div className="font-medium text-ellipsis line-clamp-1" style={{ fontWeight: 550 }}>
{vod.title}
</div>
<div className="font-light text-zinc-500" style={{ fontSize: 10 }}>
<div className="font-light text-zinc-500 text-ellipsis line-clamp-1" style={{ fontSize: 10 }}>
{formatDateString(vod.range)}, <span className="font-medium text-amber-500">{vod.length}</span>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/content/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export interface Item {

export interface Filters {
courseTitles: string[];
attendanceStatuses?: string[]; // Vods용
submitStatuses?: boolean[]; // Assigns용
attendanceStatuses?: string[];
submitStatuses?: boolean[];
}

export enum TAB_TYPE {
Expand Down
12 changes: 6 additions & 6 deletions src/hooks/useCourseData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function useCourseData(courses: any[]) {
const result = await requestData(course.courseId);

result.vodDataArray.forEach((vodData) => {
// if (isCurrentDateInRange(vodData.range)) {
if (isCurrentDateInRange(vodData.range)) {
result.vodAttendanceArray.forEach((vodAttendanceData) => {
if (vodAttendanceData.title === vodData.title && vodAttendanceData.week === vodData.week) {
tempVods.push({
Expand All @@ -49,11 +49,11 @@ export function useCourseData(courses: any[]) {
});
}
});
// }
}
});

result.assignDataArray.forEach((assignData) => {
// if (isCurrentDateByDate(assignData.dueDate)) {
if (isCurrentDateByDate(assignData.dueDate)) {
tempAssigns.push({
courseId: course.courseId,
prof: course.prof,
Expand All @@ -64,11 +64,11 @@ export function useCourseData(courses: any[]) {
isSubmit: assignData.isSubmit,
url: assignData.url,
});
// }
}
});

result.quizDataArray.forEach((quizData) => {
// if (isCurrentDateByDate(quizData.dueDate)) {
if (isCurrentDateByDate(quizData.dueDate)) {
tempQuizes.push({
courseId: course.courseId,
prof: course.prof,
Expand All @@ -78,7 +78,7 @@ export function useCourseData(courses: any[]) {
dueDate: quizData.dueDate,
url: quizData.url,
});
// }
}
});
})
);
Expand Down
37 changes: 16 additions & 21 deletions src/hooks/useGetCourse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,22 @@ interface UseCouresResult {
export const useGetCourses = (): UseCouresResult => {
const [courses, setCourses] = useState<CourseBase[]>([]);
useEffect(() => {
// if (!document) return;
// const courseData = Array.from(document.querySelectorAll('.course_box'));
// const data = courseData
// .map((div) => {
// const a = div.querySelector('a');
// const url = new URL((a as HTMLAnchorElement).href);
// const urlParams = new URLSearchParams(url.search);
// const courseId = urlParams.get('id') || '';
// const titleSection = div.querySelector('.course_link .course-name .course-title');
// const prof = titleSection?.querySelector('p')?.textContent?.trim() || '';
// let courseTitle = titleSection?.querySelector('h1, h2, h3')?.textContent?.replace(/new/i, '').trim() || '';
// courseTitle = removeSquareBrackets(courseTitle)
// return { courseId, courseTitle, prof };
// })
// .filter((item) => item.courseId !== '' && item.courseTitle !== '' && item.prof !== '');
// setCourses(data);
setCourses([
{ courseId: '32153', courseTitle: '프로그래밍언어론', prof: '김성동' },
{ courseId: '36786', courseTitle: '운영체제', prof: '황기태' },
{ courseId: '36821', courseTitle: '데이터베이스', prof: '김영웅' },
]);
if (!document) return;
const courseData = Array.from(document.querySelectorAll('.course_box'));
const data = courseData
.map((div) => {
const a = div.querySelector('a');
const url = new URL((a as HTMLAnchorElement).href);
const urlParams = new URLSearchParams(url.search);
const courseId = urlParams.get('id') || '';
const titleSection = div.querySelector('.course_link .course-name .course-title');
const prof = titleSection?.querySelector('p')?.textContent?.trim() || '';
let courseTitle = titleSection?.querySelector('h1, h2, h3')?.textContent?.replace(/new/i, '').trim() || '';
courseTitle = removeSquareBrackets(courseTitle)
return { courseId, courseTitle, prof };
})
.filter((item) => item.courseId !== '' && item.courseTitle !== '' && item.prof !== '');
setCourses(data);
}, []);

return { courses };
Expand Down
23 changes: 0 additions & 23 deletions src/option/components/SidebarItems.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions src/option/components/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import { TYPES } from '@/content/types';
import { Home, NotebookText, Settings, Video, Zap } from 'lucide-react';

export const data = [
// {
// title: 'Home',
// icon: <Home />,
// type: TYPES.vod,
// },
{
title: '강의',
icon: <Video />,
Expand All @@ -22,9 +17,4 @@ export const data = [
icon: <Zap />,
type: TYPES.quiz,
},
// {
// title: 'Settings',
// icon: <Settings />,
// type: TYPES.,
// },
];