Skip to content

Commit

Permalink
fixed markAsComplete,sidebar mobile version & package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Vijay-kumar-bantu committed May 17, 2024
1 parent 79ac4b9 commit 96b59f8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,13 @@
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"autoprefixer": "^10.0.1",

"eslint": "^8.56.0",
"eslint-plugin-storybook": "^0.8.0",
"husky": "^9.0.7",
"postcss": "^8",
"prettier": "^3.2.4",
"prisma": "^5.6.0",
"tailwindcss": "^3.3.0",
"ts-node": "^10.9.2",
"ts-node": "^10.9.2"
}
}
2 changes: 1 addition & 1 deletion src/app/api/course/videoProgress/markAsCompleted/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const requestBodySchema = z.object({
});

export async function POST(req: NextRequest) {
const parseResult = requestBodySchema.safeParse(req.json());
const parseResult = requestBodySchema.safeParse(await req.json());
if (!parseResult.success) {
return NextResponse.json(
{ error: parseResult.error.message },
Expand Down
8 changes: 5 additions & 3 deletions src/components/CourseCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ import PercentageComplete from './PercentageComplete';
import { PrimaryButton } from './buttons/PrimaryButton';
import { SecondaryButton } from './buttons/SecondaryButton';
import { useRouter } from 'next/navigation';
import { Button } from './ui/button';
import { ChevronRight } from 'lucide-react';

export const CourseCard = ({
course,
onClick,
buttonColor,
roundedCardSize,
roundedCardSize = 'lg',
}: {
course: Course;
onClick: () => void;
buttonColor: string;
roundedCardSize: 'lg' | 'xl' | '2xl' | '3xl';
buttonColor?: string;
roundedCardSize?: 'lg' | 'xl' | '2xl' | '3xl';
}) => {
const roundedClassNames = {
lg: 'rounded-lg',
Expand Down
18 changes: 10 additions & 8 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,21 @@ export function Sidebar({
}

return (
<div className="overflow-y-scroll h-sidebar w-[300px] min-w-[300px] bg-gray-50 dark:bg-gray-800 cursor-pointer sticky top-[64px] self-start w-84">
<div className="flex">
{/* <ToggleButton
<div className="fixed z-20 md:sticky md:top-[64px] md:z-0 self-start bg-background/70 w-full md:w-[300px]">
<div className="overflow-y-scroll h-sidebar w-[300px] min-w-[300px] bg-gray-50 dark:bg-gray-800 cursor-pointer w-84">
<div className="flex">
{/* <ToggleButton
onClick={() => {
setSidebarOpen((s) => !s);
}}
/> */}
<GoBackButton />
<GoBackButton />
</div>
<Accordion type="single" collapsible className="w-full">
{/* Render course content */}
{renderContent(fullCourseContent)}
</Accordion>
</div>
<Accordion type="single" collapsible className="w-full">
{/* Render course content */}
{renderContent(fullCourseContent)}
</Accordion>
</div>
);
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/admin/ContentRendererClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ export const ContentRendererClient = ({
sources: [source],
}}
onVideoEnd={() => {
setContentCompleted(true);
if (!contentCompleted) {
handleMarkCompleted();
}
}}
/>
<div className="flex justify-between mb-2">
Expand Down
2 changes: 1 addition & 1 deletion src/store/atoms/courses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type Course = {
openToEveryone: boolean;
totalVideos?: number;
totalVideosWatched?: number;
certIssued: boolean;
certIssued?: boolean;
};

const coursesSelector = selector({
Expand Down

0 comments on commit 96b59f8

Please sign in to comment.