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

Function Blog

apps/web/components/Blog.tsx:13–61  ·  view source on GitHub ↗
({
  problem,
  track,
  showAppBar,
  showPagination,
  isPdfRequested,
  problemIndex,
}: {
  problem: Problem & { notionRecordMap: any };
  track: Track & { problems: Problem[] };
  showAppBar?: boolean;
  showPagination?: boolean;
  isPdfRequested?: boolean;
  problemIndex: number;
})

Source from the content-addressed store, hash-verified

11import CustomPagination from "./CustomPagination";
12
13export const Blog = ({
14 problem,
15 track,
16 showAppBar,
17 showPagination,
18 isPdfRequested,
19 problemIndex,
20}: {
21 problem: Problem & { notionRecordMap: any };
22 track: Track & { problems: Problem[] };
23 showAppBar?: boolean;
24 showPagination?: boolean;
25 isPdfRequested?: boolean;
26 problemIndex: number;
27}) => {
28 const mounted = useMountStatus();
29 const isLegacyMode = useRecoilValue(isLegacyViewMode);
30
31 if (isPdfRequested == undefined || !isPdfRequested) {
32 if (!mounted) {
33 return null;
34 }
35 }
36
37 const renderBlog = () =>
38 isLegacyMode ? (
39 <div className="break-after-page">
40 {showAppBar && <BlogAppbar problem={problem} track={track} problemIndex={problemIndex} />}
41 <NotionRenderer recordMap={problem.notionRecordMap} />
42 {showPagination && (
43 <div className="justify-center pt-2">
44 <CustomPagination allProblems={track.problems} track={track} problemIndex={problemIndex} />
45 </div>
46 )}
47 </div>
48 ) : (
49 <div>
50 <NotionRenderer recordMap={problem.notionRecordMap} />
51 <div className="fixed top-0 w-full">
52 <BlogAppbar problem={problem} track={track} problemIndex={problemIndex} />
53 </div>
54 <div className="itemsc-center fixed bottom-0 mx-auto w-full justify-center">
55 <TrackTools allProblems={track.problems} track={track} problemIndex={problemIndex} />
56 </div>
57 </div>
58 );
59
60 return renderBlog();
61};

Callers

nothing calls this directly

Calls 2

useMountStatusFunction · 0.85
renderBlogFunction · 0.85

Tested by

no test coverage detected