Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/VideoPlayer2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const VideoPlayer: FunctionComponent<VideoPlayerProps> = ({
subtitles,
onVideoEnd,
appxVideoId,
appxCourseId
appxCourseId,
}) => {
const videoRef = useRef<HTMLDivElement>(null);
const playerRef = useRef<Player | null>(null);
Expand Down Expand Up @@ -484,7 +484,7 @@ export const VideoPlayer: FunctionComponent<VideoPlayerProps> = ({
return (
<div
data-vjs-player
style={{ maxWidth: '850px', margin: '0 auto', width: '100%' }}
style={{ maxWidth: '1350px', margin: '0 auto', width: '100%' }}
>
<div ref={videoRef} style={{ width: '100%', height: 'auto' }} />
</div>
Expand Down
11 changes: 5 additions & 6 deletions src/components/admin/ContentRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,11 @@ export const ContentRenderer = async ({
};
}) => {
const metadata = await getMetadata(content.id);
const appxCourseId = await getAppxCourseId(content.courseId);
if (!appxCourseId) {
return <div>Loading...</div>;
}
//@ts-ignore
const appxVideoId: string = metadata?.appxVideoJSON[appxCourseId];
const result = await getAppxCourseId(content.courseId);
const appxCourseId = typeof result !== 'string' ? '' : result;

// @ts-ignore
const appxVideoId: string = metadata?.appxVideoJSON?.[appxCourseId] ?? '';

return (
<div>
Expand Down
17 changes: 9 additions & 8 deletions src/utiles/appx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,21 +231,22 @@ export async function getAppxCourseId(courseId: string) {
course: true,
},
orderBy: {
courseId: 'asc'
}
courseId: 'asc',
},
});

const CMS_APPX_COURSE_MAP: Record<string, string[]> = {
13: ["8", "10"],
14: ["8", "9", "11"],
15: ["8", "9", "12"]
13: ['8', '10'],
14: ['8', '9', '11'],
15: ['8', '9', '12'],
};

let appxCourseId: string | null = null;
parentCourses.forEach((pc => {
if (CMS_APPX_COURSE_MAP[courseId].includes(pc.courseId.toString())) {
if (!CMS_APPX_COURSE_MAP[courseId]) return '';
parentCourses.forEach((pc) => {
if (CMS_APPX_COURSE_MAP[courseId]?.includes(pc.courseId.toString())) {
appxCourseId = pc.course.appxCourseId;
}
}));
});
return appxCourseId;
}
Loading