Skip to content

Commit

Permalink
Merge branch 'subtitle-toggle-fix' of https://github.com/asharma991/cms
Browse files Browse the repository at this point in the history
… into subtitle-toggle-fix
  • Loading branch information
asharma991 committed Apr 2, 2024
2 parents bbfcc13 + 865a035 commit b6dcd6a
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 54 deletions.
12 changes: 6 additions & 6 deletions src/components/CourseCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export const CourseCard = ({
<div className="relative">
{course.totalVideos !== undefined &&
course.totalVideosWatched !== undefined && (
<PercentageComplete
percent={Math.ceil(
(course.totalVideosWatched / course.totalVideos) * 100,
)}
/>
)}
<PercentageComplete
percent={Math.ceil(
(course.totalVideosWatched / course.totalVideos) * 100,
)}
/>
)}
</div>
<img src={course.imageUrl} alt={course.title} className="rounded-md" />
<div className="p-2">
Expand Down
12 changes: 6 additions & 6 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,16 @@ export function ToggleButton({
<span
className={`dark:bg-white bg-black block transition-all duration-300 ease-out
h-0.5 w-6 rounded-sm my-0.5 ${
!sidebarOpen ? 'opacity-0' : 'opacity-100'
}`}
!sidebarOpen ? 'opacity-0' : 'opacity-100'
}`}
></span>
<span
className={`dark:bg-white bg-black block transition-all duration-300 ease-out
h-0.5 w-6 rounded-sm ${
!sidebarOpen
? '-rotate-45 -translate-y-1'
: 'translate-y-0.5'
}`}
!sidebarOpen
? '-rotate-45 -translate-y-1'
: 'translate-y-0.5'
}`}
></span>
</button>
);
Expand Down
30 changes: 15 additions & 15 deletions src/components/VideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ export const VideoPlayer = ({
}
const handleKeyPress = (event: any) => {
switch (event.code) {
case 'Space': // Space bar for play/pause
if (player.paused()) {
player.play();
case 'Space': // Space bar for play/pause
if (player.paused()) {
player.play();
event.stopPropagation();
} else {
player.pause();
event.stopPropagation();
}
break;
case 'ArrowRight': // Right arrow for seeking forward 5 seconds
player.currentTime(player.currentTime() + 5);
event.stopPropagation();
} else {
player.pause();
break;
case 'ArrowLeft': // Left arrow for seeking backward 5 seconds
player.currentTime(player.currentTime() - 5);
event.stopPropagation();
}
break;
case 'ArrowRight': // Right arrow for seeking forward 5 seconds
player.currentTime(player.currentTime() + 5);
event.stopPropagation();
break;
case 'ArrowLeft': // Left arrow for seeking backward 5 seconds
player.currentTime(player.currentTime() - 5);
event.stopPropagation();
break;
break;
}
};

Expand Down
12 changes: 6 additions & 6 deletions src/components/bookmark/BookmarkView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ const BookmarkView = ({
{bookmarkData === null ||
'error' in bookmarkData ||
!bookmarkData.length ? (
<div className="flex mt-64">
<div className="m-auto">No bookmark added yet!</div>
</div>
) : (
<BookmarkList bookmarkData={bookmarkData} />
)}
<div className="flex mt-64">
<div className="m-auto">No bookmark added yet!</div>
</div>
) : (
<BookmarkList bookmarkData={bookmarkData} />
)}
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ export const whyUs: TwhyUs = [
tagline: 'Assignments',
headline: 'Learn by doing',
description:
'Harkirat personally creates assignments after every lecture, so it\'s extremely hands on.',
"Harkirat personally creates assignments after every lecture, so it's extremely hands on.",
},
];
18 changes: 9 additions & 9 deletions src/db/course.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function getAllCoursesAndContentHierarchy(): Promise<
contentId: number;
}[];
}[]
> {
> {
const value = await Cache.getInstance().get(
'getAllCoursesAndContentHierarchy',
[],
Expand Down Expand Up @@ -100,7 +100,7 @@ export async function getAllVideos(): Promise<
createdAt: Date;
notionMetadataId: number | null;
}[]
> {
> {
const value = await Cache.getInstance().get('getAllVideos', []);
if (value) {
return value;
Expand Down Expand Up @@ -252,13 +252,13 @@ export const getFullCourseContent = async (courseId: number) => {
videoProgress:
content.type === 'video'
? {
duration: videoProgress.find((x) => x.contentId === content.id)
?.currentTimestamp,
markAsCompleted: videoProgress.find(
(x) => x.contentId === content.id,
)?.markAsCompleted,
videoFullDuration: content.VideoMetadata?.duration,
}
duration: videoProgress.find((x) => x.contentId === content.id)
?.currentTimestamp,
markAsCompleted: videoProgress.find(
(x) => x.contentId === content.id,
)?.markAsCompleted,
videoFullDuration: content.VideoMetadata?.duration,
}
: null,
},
]),
Expand Down
22 changes: 11 additions & 11 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,17 +265,17 @@ export const constructCommentPrismaQuery = (

let orderBy: Prisma.Enumerable<Prisma.CommentOrderByWithRelationInput> = {};
switch (commentfilter) {
case CommentFilter.mu:
orderBy = { upvotes: 'desc' };
break;
case CommentFilter.md:
orderBy = { downvotes: 'desc' };
break;
case CommentFilter.mr:
orderBy = { createdAt: 'desc' };
break;
default:
orderBy = { upvotes: 'desc' };
case CommentFilter.mu:
orderBy = { upvotes: 'desc' };
break;
case CommentFilter.md:
orderBy = { downvotes: 'desc' };
break;
case CommentFilter.mr:
orderBy = { createdAt: 'desc' };
break;
default:
orderBy = { upvotes: 'desc' };
}

const where: Prisma.CommentWhereInput = {};
Expand Down

0 comments on commit b6dcd6a

Please sign in to comment.