diff --git a/apps/web/components/Dashboard/Course/EditCourseStructure/DraggableElements/ActivityElement.tsx b/apps/web/components/Dashboard/Course/EditCourseStructure/DraggableElements/ActivityElement.tsx
index 81374057..54624707 100644
--- a/apps/web/components/Dashboard/Course/EditCourseStructure/DraggableElements/ActivityElement.tsx
+++ b/apps/web/components/Dashboard/Course/EditCourseStructure/DraggableElements/ActivityElement.tsx
@@ -88,7 +88,7 @@ function ActivityElement(props: ActivitiyElementProps) {
modifiedActivity?.activityId === activityId &&
selectedActivity !== undefined
) {
- setSelectedActivity(undefined)
+
let modifiedActivityCopy = {
...props.activity,
name: modifiedActivity.activityName,
@@ -99,6 +99,7 @@ function ActivityElement(props: ActivitiyElementProps) {
await revalidateTags(['courses'], props.orgslug)
router.refresh()
}
+ setSelectedActivity(undefined)
}
return (
@@ -109,7 +110,7 @@ function ActivityElement(props: ActivitiyElementProps) {
>
{(provided, snapshot) => (
updateActivityName(props.activity.id)}
+ size={12}
/>
@@ -153,68 +153,69 @@ function ActivityElement(props: ActivitiyElementProps) {
)}
setSelectedActivity(props.activity.id)}
- size={12}
- className="text-neutral-400 hover:cursor-pointer"
+ className="text-neutral-400 hover:cursor-pointer size-3 min-w-3"
/>
{/* Edit and View Button */}
-
-
- {/* Publishing */}
-
changePublicStatus()}
- >
- {!props.activity.published ? (
-
- ) : (
-
- )}
-
{!props.activity.published ? 'Publish' : 'Unpublish'}
+
+
+
+ {/* Publishing */}
+
changePublicStatus()}
+ >
+ {!props.activity.published ? (
+
+ ) : (
+
+ )}
+ {!props.activity.published ? 'Publish' : 'Unpublish'}
+
+
+
+
Preview
+
+
+ {/* Delete Button */}
+
+
+
+
+
+ }
+ functionToExecute={() => deleteActivityUI()}
+ status="warning"
+ >
-
-
-
Preview
-
-
- {/* Delete Button */}
-
-
-
-
-
- }
- functionToExecute={() => deleteActivityUI()}
- status="warning"
- >
)}
@@ -222,53 +223,36 @@ function ActivityElement(props: ActivitiyElementProps) {
)
}
-const ActivityTypeIndicator = (props: { activityType: string }) => {
+const ACTIVITIES = {
+ 'TYPE_VIDEO': {
+ displayName: 'Video',
+ Icon: Video
+ },
+ 'TYPE_DOCUMENT': {
+ displayName: 'Document',
+ Icon: File
+ },
+ 'TYPE_ASSIGNMENT': {
+ displayName: 'Assignment',
+ Icon: Backpack
+ },
+ 'TYPE_DYNAMIC': {
+ displayName: 'Dynamic',
+ Icon: Sparkles
+ }
+}
+
+const ActivityTypeIndicator = ({activityType} : { activityType: keyof typeof ACTIVITIES}) => {
+ const {displayName, Icon} = ACTIVITIES[activityType]
+
return (
-
- {props.activityType === 'TYPE_VIDEO' && (
- <>
-
-
{' '}
+
+
+
{' '}
- Video
+ {displayName}
{' '}
- >
- )}
- {props.activityType === 'TYPE_DOCUMENT' && (
- <>
-
-
- {' '}
-
-
- Document
-
{' '}
-
- >
- )}
- {props.activityType === 'TYPE_ASSIGNMENT' && (
- <>
-
-
- {' '}
-
-
- Assignment
-
{' '}
-
- >
- )}
- {props.activityType === 'TYPE_DYNAMIC' && (
- <>
-
-
{' '}
-
- Dynamic
-
{' '}
-
- >
- )}
)
}
@@ -280,7 +264,7 @@ const ActivityElementOptions = ({ activity }: any) => {
const session = useLHSession() as any;
const access_token = session?.data?.tokens?.access_token;
- async function getAssignmentUUIDFromActivityUUID(activityUUID: string) {
+ async function getAssignmentUUIDFromActivityUUID(activityUUID: string): Promise
{
const activity = await getAssignmentFromActivityUUID(activityUUID, access_token);
if (activity) {
return activity.data.assignment_uuid;
@@ -290,7 +274,8 @@ const ActivityElementOptions = ({ activity }: any) => {
const fetchAssignmentUUID = async () => {
if (activity.activity_type === 'TYPE_ASSIGNMENT') {
const assignment_uuid = await getAssignmentUUIDFromActivityUUID(activity.activity_uuid);
- setAssignmentUUID(assignment_uuid.replace('assignment_', ''));
+ if(assignment_uuid)
+ setAssignmentUUID(assignment_uuid.replace('assignment_', ''));
}
};
@@ -323,7 +308,7 @@ const ActivityElementOptions = ({ activity }: any) => {
>
)}
- {activity.activity_type === 'TYPE_ASSIGNMENT' && assignmentUUID && (
+ {activity.activity_type === 'TYPE_ASSIGNMENT' && (
<>
{
>
)}
- >
+ >
);
};
diff --git a/apps/web/components/Dashboard/Course/EditCourseStructure/DraggableElements/ChapterElement.tsx b/apps/web/components/Dashboard/Course/EditCourseStructure/DraggableElements/ChapterElement.tsx
index 092dd5e7..57aab3ec 100644
--- a/apps/web/components/Dashboard/Course/EditCourseStructure/DraggableElements/ChapterElement.tsx
+++ b/apps/web/components/Dashboard/Course/EditCourseStructure/DraggableElements/ChapterElement.tsx
@@ -52,7 +52,6 @@ function ChapterElement(props: ChapterElementProps) {
async function updateChapterName(chapterId: string) {
if (modifiedChapter?.chapterId === chapterId) {
- setSelectedChapter(undefined)
let modifiedChapterCopy = {
name: modifiedChapter.chapterName,
}
@@ -61,6 +60,7 @@ function ChapterElement(props: ChapterElementProps) {
await revalidateTags(['courses'], props.orgslug)
router.refresh()
}
+ setSelectedChapter(undefined)
}
return (
@@ -155,7 +155,7 @@ function ChapterElement(props: ChapterElementProps) {
{activities.map((activity: any, index: any) => {
return (
-