MCPcopy Create free account
hub / github.com/code100x/cms / ContentRenderer

Function ContentRenderer

src/components/admin/ContentRenderer.tsx:130–167  ·  view source on GitHub ↗
({
  content,
  nextContent,
}: {
  nextContent: {
    id: number;
    type: string;
    title: string;
  } | null;
  content: {
    type: 'video' | 'appx';
    id: number;
    title: string;
    description: string;
    thumbnail: string;
    slides?: string;
    markAsCompleted: boolean;
    bookmark: Bookmark | null;
    courseId: string;
  };
})

Source from the content-addressed store, hash-verified

128};
129
130export const ContentRenderer = async ({
131 content,
132 nextContent,
133}: {
134 nextContent: {
135 id: number;
136 type: string;
137 title: string;
138 } | null;
139 content: {
140 type: 'video' | 'appx';
141 id: number;
142 title: string;
143 description: string;
144 thumbnail: string;
145 slides?: string;
146 markAsCompleted: boolean;
147 bookmark: Bookmark | null;
148 courseId: string;
149 };
150}) => {
151 const metadata = await getMetadata(content.id);
152 const result = await getAppxCourseId(content.courseId);
153 const appxCourseId = typeof result !== 'string' ? '' : result;
154
155 // @ts-ignore
156 const appxVideoId: string = metadata?.appxVideoJSON?.[appxCourseId] ?? '';
157
158 return (
159 <div>
160 <ContentRendererClient
161 nextContent={nextContent}
162 metadata={metadata}
163 content={{ ...content, appxVideoId, appxCourseId }}
164 />
165 </div>
166 );
167};

Callers

nothing calls this directly

Calls 2

getAppxCourseIdFunction · 0.90
getMetadataFunction · 0.85

Tested by

no test coverage detected