Skip to content

Commit

Permalink
Removed linting issues_2
Browse files Browse the repository at this point in the history
  • Loading branch information
Maawan committed Mar 14, 2024
1 parent 8422903 commit 39d2fec
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/components/admin/ContentRendererClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useSearchParams, useRouter, usePathname } from 'next/navigation';
// import { QualitySelector } from '../QualitySelector';
import { VideoPlayerSegment } from '@/components/VideoPlayerSegment';
import VideoContentChapters from '../VideoContentChapters';
import { useEffect, useState } from 'react';
import { useState } from 'react';
import { handleMarkAsCompleted } from '@/lib/utils';
import { useRecoilState } from 'recoil';
import { markAsCompleteAtom } from '@/store/atoms/markAsComplete';
Expand Down Expand Up @@ -74,7 +74,6 @@ export const ContentRendererClient = ({
}
const [currentPath] = useState(usePathname());
const [markAsComplete , setMarkAsComplete] = useRecoilState(markAsCompleteAtom);


const toggleShowChapters = () => {
setShowChapters((prev) => !prev);
Expand All @@ -92,10 +91,10 @@ export const ContentRendererClient = ({
}
setLoadingMarkAs(false);
setMarkAsComplete({
isValid : true,
path : currentPath,
isCompleted : contentCompleted
})
isValid: true,
path: currentPath,
isCompleted: contentCompleted
});
};
return (
<div className="flex gap-2 items-start flex-col lg:flex-row">
Expand Down Expand Up @@ -139,8 +138,10 @@ export const ContentRendererClient = ({
disabled={loadingMarkAs}
onClick={handleMarkCompleted}
>
{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'} */}
{
markAsComplete.isValid && markAsComplete.path === currentPath ? <DisplayMarkAsComplete isCompleted={markAsComplete?.isCompleted} /> : <DisplayMarkAsComplete isCompleted={contentCompleted} />
}

</button>
</div>

Expand Down Expand Up @@ -203,3 +204,8 @@ export const ContentRendererClient = ({
</div>
);
};
export const DisplayMarkAsComplete = ({isCompleted} : {isCompleted : boolean | undefined}) => {
return (
isCompleted ? 'Mark as Incomplete' : 'Mark as Complete'
);
};

0 comments on commit 39d2fec

Please sign in to comment.