Skip to content

Commit

Permalink
Removed Debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Maawan committed Mar 13, 2024
1 parent 8bdda89 commit 967a598
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ export function Sidebar({
const pathArray = findPathToContent(fullCourseContent, contentId);
if (pathArray) {
const path = `/courses/${courseId}/${pathArray.join('/')}`;
console.log(`Path is this ${path}`);

router.push(path);
}
};
Expand Down Expand Up @@ -255,7 +253,7 @@ function Check({ content , pathCheck } : { content: any , pathCheck : any}) {
<>
<input
checked={markAsComplete.isValid && markAsComplete?.path === pathCheck(content.id) ? markAsComplete.isCompleted : completed}
onClick={async (e) => {
onChange={async (e) => {
setCompleted(!completed);
handleMarkAsCompleted(!completed, content.id);
setMarkAsComplete({
Expand Down
18 changes: 14 additions & 4 deletions src/components/admin/ContentRendererClient.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
'use client';
import { useSearchParams, useRouter } from 'next/navigation';
import { useSearchParams, useRouter, usePathname } from 'next/navigation';
// import { QualitySelector } from '../QualitySelector';
import { VideoPlayerSegment } from '@/components/VideoPlayerSegment';
import VideoContentChapters from '../VideoContentChapters';
import { useState } from 'react';
import { useEffect, useState } from 'react';
import { handleMarkAsCompleted } from '@/lib/utils';
import { useRecoilState } from 'recoil';
import { markAsCompleteAtom } from '@/store/atoms/markAsComplete';

export const ContentRendererClient = ({
metadata,
Expand Down Expand Up @@ -70,7 +72,10 @@ export const ContentRendererClient = ({
type: 'video/mp4',
};
}
const [currentPath] = useState(usePathname());
const [markAsComplete , setMarkAsComplete] = useRecoilState(markAsCompleteAtom);


const toggleShowChapters = () => {
setShowChapters((prev) => !prev);
};
Expand All @@ -86,8 +91,12 @@ export const ContentRendererClient = ({
setContentCompleted((prev) => !prev);
}
setLoadingMarkAs(false);
setMarkAsComplete({
isValid : true,
path : currentPath,
isCompleted : contentCompleted
})
};

return (
<div className="flex gap-2 items-start flex-col lg:flex-row">
<div className="flex-1 w-full">
Expand Down Expand Up @@ -130,7 +139,8 @@ export const ContentRendererClient = ({
disabled={loadingMarkAs}
onClick={handleMarkCompleted}
>
{contentCompleted ? 'Mark as Incomplete' : 'Mark as completed'}
{markAsComplete.isValid && markAsComplete?.path === currentPath ? (markAsComplete?.isCompleted ? "Mark as Incomplete" : "Mark as completed") : (contentCompleted ? "Mark as Incomplete" : "Mark as completed")}
{/* {contentCompleted ? 'Mark as Incomplete' : 'Mark as completed'} */}
</button>
</div>

Expand Down

0 comments on commit 967a598

Please sign in to comment.