MCPcopy Create free account
hub / github.com/code100x/daily-code / LessonView

Function LessonView

apps/web/components/LessonView.tsx:9–54  ·  view source on GitHub ↗
({
  problem,
  track,
  showAppBar,
  showPagination = false,
  isPdfRequested,
}: {
  problem: Problem & { notionRecordMap: any };
  track: Track & { problems: Problem[] };
  showAppBar?: boolean;
  showPagination?: boolean;
  isPdfRequested?: boolean;
})

Source from the content-addressed store, hash-verified

7import { AppbarClient } from "./AppbarClient";
8
9export const LessonView = async ({
10 problem,
11 track,
12 showAppBar,
13 showPagination = false,
14 isPdfRequested,
15}: {
16 problem: Problem & { notionRecordMap: any };
17 track: Track & { problems: Problem[] };
18 showAppBar?: boolean;
19 showPagination?: boolean;
20 isPdfRequested?: boolean;
21}) => {
22 const session = await getServerSession(authOptions);
23 const problemIndex = track.problems.findIndex((p) => p.id === problem.id);
24
25 // eslint-disable-next-line turbo/no-undeclared-env-vars
26 const isInDevMode = process?.env?.NODE_ENV === "development";
27
28 if (!isInDevMode && problemIndex > 1 && (!session || !session.user)) {
29 return (
30 <div>
31 <AppbarClient />
32 <RedirectToLoginCard />
33 </div>
34 );
35 }
36
37 if (problem.type === "MCQ") {
38 return <MCQRenderer problem={problem} track={track} showAppBar={!!showAppBar} problemIndex={problemIndex} />;
39 }
40
41 if (problem.type === "Blog") {
42 return (
43 <Blog
44 isPdfRequested={isPdfRequested}
45 problem={problem}
46 problemIndex={problemIndex}
47 showAppBar={!!showAppBar}
48 showPagination={showPagination}
49 track={track}
50 />
51 );
52 }
53 return <div>Not found</div>;
54};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected