import ConfirmationModal from '@components/StyledElements/ConfirmationModal/ConfirmationModal'; import { Activity, Hexagon, MoreHorizontal, MoreVertical, Pencil, Save, Sparkles, X } from 'lucide-react'; import React from 'react' import ActivitiyElement from './ActivityElement'; import { Draggable, Droppable } from 'react-beautiful-dnd'; import ActivityElement from './ActivityElement'; import NewActivity from '../Buttons/NewActivityButton'; import NewActivityButton from '../Buttons/NewActivityButton'; import { deleteChapter } from '@services/courses/chapters'; import { revalidateTags } from '@services/utils/ts/requests'; import { useRouter } from 'next/navigation'; import { getAPIUrl } from '@services/config/config'; import { mutate } from 'swr'; type ChapterElementProps = { chapter: any, chapterIndex: number, orgslug: string course_uuid: string } function ChapterElement(props: ChapterElementProps) { const activities = props.chapter.activities || []; const router = useRouter(); const deleteChapterUI = async () => { await deleteChapter(props.chapter.id); mutate(`${getAPIUrl()}courses/${props.course_uuid}/meta`); await revalidateTags(['courses'], props.orgslug); router.refresh(); }; return ( {(provided, snapshot) => (

{props.chapter.name}

Delete Chapter

} functionToExecute={() => deleteChapterUI()} status='warning' >
{(provided) => (
{activities.map((activity: any, index: any) => { return (
) })} {provided.placeholder}
)}
)}
) } export default ChapterElement