Skip to content

Commit d774148

Browse files
author
Rajat
committed
CodeQL fixes
1 parent 149d460 commit d774148

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

  • apps/web/app/(with-contexts)/dashboard/(sidebar)/product/[id]

apps/web/app/(with-contexts)/dashboard/(sidebar)/product/[id]/content/section/[section]/lesson/page.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import { Input } from "@/components/ui/input";
1919
import { Label } from "@/components/ui/label";
2020
import { Switch } from "@/components/ui/switch";
2121
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
22-
const { permissions } = UIConstants;
23-
2422
import {
2523
Dialog,
2624
DialogContent,
@@ -30,7 +28,6 @@ import {
3028
DialogTitle,
3129
DialogTrigger,
3230
} from "@/components/ui/dialog";
33-
3431
import {
3532
APP_MESSAGE_LESSON_DELETED,
3633
BUTTON_NEW_LESSON_TEXT,
@@ -49,6 +46,7 @@ import {
4946
Lesson,
5047
LessonType,
5148
Media,
49+
Profile,
5250
Quiz,
5351
TextEditorContent,
5452
UIConstants,
@@ -70,6 +68,8 @@ import { isTextEditorNonEmpty, truncate } from "@ui-lib/utils";
7068
import { Skeleton } from "@/components/ui/skeleton";
7169
import { Separator } from "@components/ui/separator";
7270

71+
const { permissions } = UIConstants;
72+
7373
const lessonTypes = [
7474
{ value: Constants.LessonType.TEXT, label: "Text", icon: FileText },
7575
{ value: Constants.LessonType.VIDEO, label: "Video", icon: Video },
@@ -273,7 +273,7 @@ export default function LessonPage() {
273273
<div className="aspect-video">
274274
<iframe
275275
className="w-full h-full rounded-lg"
276-
src={`https://www.youtube.com/embed/${content.value.match(UIConstants.YOUTUBE_REGEX)[1]}`}
276+
src={`https://www.youtube.com/embed/${content.value.match(UIConstants.YOUTUBE_REGEX)?.[1] ?? ""}`}
277277
title="YouTube video player"
278278
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
279279
allowFullScreen
@@ -558,7 +558,7 @@ export default function LessonPage() {
558558
: undefined
559559
}
560560
strings={{}}
561-
profile={profile}
561+
profile={profile as Profile}
562562
address={address}
563563
mediaId={lesson?.media?.mediaId}
564564
onRemove={() => {
@@ -979,7 +979,7 @@ export default function LessonPage() {
979979
};
980980

981981
const formatContentForSending = () => {
982-
switch (lesson?.type.toLowerCase()) {
982+
switch (lesson?.type?.toLowerCase()) {
983983
case Constants.LessonType.TEXT:
984984
return JSON.stringify(textContent);
985985
case Constants.LessonType.QUIZ:
@@ -1137,7 +1137,7 @@ export default function LessonPage() {
11371137
{lesson.type ===
11381138
Constants.LessonType.EMBED
11391139
? "Embed URL"
1140-
: `${lesson.type.charAt(0).toUpperCase() + lesson.type.slice(1)} Content`}
1140+
: `${lesson.type ? lesson.type.charAt(0).toUpperCase() + lesson.type.slice(1) : ""} Content`}
11411141
</Label>
11421142
{renderLessonContent()}
11431143
</>

apps/web/app/(with-contexts)/dashboard/(sidebar)/product/[id]/manage/components/payment-plans.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@
33
import { Label } from "@/components/ui/label";
44
import { Separator } from "@/components/ui/separator";
55
import { useToast } from "@courselit/components-library";
6-
import { PaymentPlanType, Constants } from "@courselit/common-models";
6+
import { PaymentPlanType } from "@courselit/common-models";
77
import PaymentPlanList from "@components/admin/payments/payment-plan-list";
88
import { TOAST_TITLE_ERROR } from "@ui-config/strings";
99

10-
const { MembershipEntityType } = Constants;
11-
1210
interface PaymentPlansProps {
1311
productId: string;
1412
paymentPlans: any[];

0 commit comments

Comments
 (0)