@@ -19,8 +19,6 @@ import { Input } from "@/components/ui/input";
1919import { Label } from "@/components/ui/label" ;
2020import { Switch } from "@/components/ui/switch" ;
2121import { RadioGroup , RadioGroupItem } from "@/components/ui/radio-group" ;
22- const { permissions } = UIConstants ;
23-
2422import {
2523 Dialog ,
2624 DialogContent ,
@@ -30,7 +28,6 @@ import {
3028 DialogTitle ,
3129 DialogTrigger ,
3230} from "@/components/ui/dialog" ;
33-
3431import {
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";
7068import { Skeleton } from "@/components/ui/skeleton" ;
7169import { Separator } from "@components/ui/separator" ;
7270
71+ const { permissions } = UIConstants ;
72+
7373const 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 </ >
0 commit comments