diff --git a/src/course-unit/context/hooks.tsx b/src/course-unit/context/hooks.tsx
index fcb13041c9..9760c07afc 100644
--- a/src/course-unit/context/hooks.tsx
+++ b/src/course-unit/context/hooks.tsx
@@ -2,10 +2,11 @@ import { useContext } from 'react';
import { IframeContext, IframeContextType } from './iFrameContext';
+// eslint-disable-next-line import/prefer-default-export
export const useIframe = (): IframeContextType => {
- const context = useContext(IframeContext);
- if (!context) {
- throw new Error('useIframe must be used within an IframeProvider');
- }
- return context;
+ const context = useContext(IframeContext);
+ if (!context) {
+ throw new Error('useIframe must be used within an IframeProvider');
+ }
+ return context;
};
diff --git a/src/course-unit/context/iFrameContext.tsx b/src/course-unit/context/iFrameContext.tsx
index 17586a3de8..712dbf09cf 100644
--- a/src/course-unit/context/iFrameContext.tsx
+++ b/src/course-unit/context/iFrameContext.tsx
@@ -16,14 +16,17 @@ export const IframeProvider: React.FC = ({ children }) => {
try {
iframeWindow.postMessage({ type: messageType, payload }, '*');
} catch (error) {
+ // eslint-disable-next-line no-console
console.error('Failed to send message to iframe:', error);
}
} else {
+ // eslint-disable-next-line no-console
console.warn('Iframe is not accessible or loaded yet.');
}
};
return (
+ // eslint-disable-next-line react/jsx-no-constructed-context-values
{children}
diff --git a/src/course-unit/move-modal/constants.ts b/src/course-unit/move-modal/constants.ts
index 397c434900..dddfb46230 100644
--- a/src/course-unit/move-modal/constants.ts
+++ b/src/course-unit/move-modal/constants.ts
@@ -19,7 +19,7 @@ export const CATEGORIES_KEYS = {
component: 'component',
split_test: 'split_test',
group: 'group',
-}
+};
export const CATEGORY_RELATION_MAP = {
course: 'section',
diff --git a/src/course-unit/move-modal/hooks.tsx b/src/course-unit/move-modal/hooks.tsx
index a8004f9bf5..0a6898f005 100644
--- a/src/course-unit/move-modal/hooks.tsx
+++ b/src/course-unit/move-modal/hooks.tsx
@@ -2,6 +2,7 @@ import {
useCallback, useEffect, useState, useMemo,
} from 'react';
import { useDispatch, useSelector } from 'react-redux';
+// eslint-disable-next-line import/no-extraneous-dependencies
import { IntlShape } from 'react-intl';
import { useParams } from 'react-router-dom';
import { useMediaQuery } from 'react-responsive';
@@ -216,26 +217,6 @@ export const useMoveModal = ({
setDisplayedXBlocksCategories, enableMoveOperation,
]);
- console.log(
- state.sourceXBlockInfo,
- {
- isLoading: loadingStatus === RequestStatus.IN_PROGRESS,
- isValidMove: state.isValidMove,
- isExtraSmall,
- parentInfo: state.parentInfo,
- childrenInfo: state.childrenInfo,
- displayName: state.sourceXBlockInfo.current.displayName,
- sourceXBlockId: state.sourceXBlockInfo.current.id,
- categoryText: getCategoryText(),
- breadcrumbs,
- currentXBlockParentIds,
- handleXBlockClick,
- handleBreadcrumbsClick,
- handleCLoseModal,
- handleMoveXBlock,
- }
- );
-
return {
isLoading: loadingStatus === RequestStatus.IN_PROGRESS,
isValidMove: state.isValidMove,
diff --git a/src/course-unit/move-modal/index.scss b/src/course-unit/move-modal/index.scss
index 9105907cbb..ac6dde3bd6 100644
--- a/src/course-unit/move-modal/index.scss
+++ b/src/course-unit/move-modal/index.scss
@@ -62,7 +62,7 @@
border-radius: 0;
width: 100%;
gap: map-get($spacers, 2);
- padding: 0.5625rem $spacer 0.5625rem map-get($spacers, 4);
+ padding: .5625rem $spacer .5625rem map-get($spacers, 4);
}
.btn {
diff --git a/src/course-unit/move-modal/interfaces.ts b/src/course-unit/move-modal/interfaces.ts
index bc94ccd097..dd21e7378d 100644
--- a/src/course-unit/move-modal/interfaces.ts
+++ b/src/course-unit/move-modal/interfaces.ts
@@ -1,95 +1,97 @@
+// eslint-disable-next-line import/export
export interface IXBlockInfo {
- id: string;
- displayName: string;
- child_info?: {
- children?: IXBlockInfo[];
- };
- category?: string;
- has_children?: boolean;
+ id: string;
+ displayName: string;
+ child_info?: {
+ children?: IXBlockInfo[];
+ };
+ category?: string;
+ has_children?: boolean;
}
export interface IUseMoveModalParams {
- isOpenModal: boolean;
- closeModal: () => void;
- openModal: () => void;
- courseId: string;
+ isOpenModal: boolean;
+ closeModal: () => void;
+ openModal: () => void;
+ courseId: string;
}
export interface IUseMoveModalReturn {
- isLoading: boolean;
- isValidMove: boolean;
- isExtraSmall: boolean;
- parentInfo: {
- parent: IXBlockInfo;
- category: string;
- };
- childrenInfo: {
- children: IXBlockInfo[];
- category: string;
- };
- displayName: string;
- sourceXBlockId: string;
- categoryText: string;
- breadcrumbs: string[];
- currentXBlockParentIds: string[];
- handleXBlockClick: (newParentIndex: string|number) => void;
- handleBreadcrumbsClick: (newParentIndex: string|number) => void;
- handleCLoseModal: () => void;
- handleMoveXBlock: () => void;
+ isLoading: boolean;
+ isValidMove: boolean;
+ isExtraSmall: boolean;
+ parentInfo: {
+ parent: IXBlockInfo;
+ category: string;
+ };
+ childrenInfo: {
+ children: IXBlockInfo[];
+ category: string;
+ };
+ displayName: string;
+ sourceXBlockId: string;
+ categoryText: string;
+ breadcrumbs: string[];
+ currentXBlockParentIds: string[];
+ handleXBlockClick: (newParentIndex: string | number) => void;
+ handleBreadcrumbsClick: (newParentIndex: string | number) => void;
+ handleCLoseModal: () => void;
+ handleMoveXBlock: () => void;
}
export interface IState {
- sourceXBlockInfo: {
- current: IXBlockInfo;
- parent: IXBlockInfo;
- };
- childrenInfo: {
- children: IXBlockInfo[];
- category: string;
- };
- parentInfo: {
- parent: IXBlockInfo;
- category: string;
- };
- visitedAncestors: IXBlockInfo[];
- isValidMove: boolean;
+ sourceXBlockInfo: {
+ current: IXBlockInfo;
+ parent: IXBlockInfo;
+ };
+ childrenInfo: {
+ children: IXBlockInfo[];
+ category: string;
+ };
+ parentInfo: {
+ parent: IXBlockInfo;
+ category: string;
+ };
+ visitedAncestors: IXBlockInfo[];
+ isValidMove: boolean;
}
export interface ITreeNode {
- id: string;
- child_info?: {
- children?: ITreeNode[];
- };
+ id: string;
+ child_info?: {
+ children?: ITreeNode[];
+ };
}
+// eslint-disable-next-line import/export
export interface IXBlockInfo {
- category?: string;
- hasChildren?: boolean;
- has_children?: boolean;
+ category?: string;
+ hasChildren?: boolean;
+ has_children?: boolean;
}
export interface IAncestor {
- category?: string;
- display_name?: string;
+ category?: string;
+ display_name?: string;
}
export interface IMoveModalProps {
- isOpenModal: boolean,
- closeModal: () => void,
- openModal: () => void,
- courseId: string,
+ isOpenModal: boolean,
+ closeModal: () => void,
+ openModal: () => void,
+ courseId: string,
}
export interface IXBlockChildInfo {
- category?: string;
- display_name?: string;
- children?: IXBlock[];
+ category?: string;
+ display_name?: string;
+ children?: IXBlock[];
}
export interface IXBlock {
- id: string;
- display_name: string;
- category: string;
- has_children: boolean;
- child_info?: IXBlockChildInfo;
+ id: string;
+ display_name: string;
+ category: string;
+ has_children: boolean;
+ child_info?: IXBlockChildInfo;
}
diff --git a/src/course-unit/move-modal/moveModal.test.tsx b/src/course-unit/move-modal/moveModal.test.tsx
index 0f19f3f267..2512b2c20e 100644
--- a/src/course-unit/move-modal/moveModal.test.tsx
+++ b/src/course-unit/move-modal/moveModal.test.tsx
@@ -1,4 +1,4 @@
-import {render, screen, within} from '@testing-library/react';
+import { render, within } from '@testing-library/react';
import { AppProvider } from '@edx/frontend-platform/react';
import { IntlProvider } from '@edx/frontend-platform/i18n';
import { initializeMockApp } from '@edx/frontend-platform';
diff --git a/src/course-unit/move-modal/utils.ts b/src/course-unit/move-modal/utils.ts
index 4c2e7bb704..21529f7aa3 100644
--- a/src/course-unit/move-modal/utils.ts
+++ b/src/course-unit/move-modal/utils.ts
@@ -1,3 +1,4 @@
+// eslint-disable-next-line import/no-extraneous-dependencies
import { IntlShape } from 'react-intl';
import { BASIC_BLOCK_TYPES, CATEGORIES_KEYS } from './constants';
@@ -37,6 +38,7 @@ export const findParentIds = (
): string[] => {
let path: string[] = [];
+ // eslint-disable-next-line @typescript-eslint/no-shadow
function traverse(node: ITreeNode | undefined, targetId: string, currentPath: string[]): boolean {
if (!node) {
return false;
@@ -73,7 +75,9 @@ export const isValidCategory = (
sourceParentInfo: IXBlockInfo,
targetParentInfo: IXBlockInfo,
): boolean => {
+ // eslint-disable-next-line prefer-const
let { category: sourceParentCategory, hasChildren: sourceParentHasChildren } = sourceParentInfo;
+ // eslint-disable-next-line prefer-const
let { category: targetParentCategory, has_children: targetParentHasChildren } = targetParentInfo;
if (
diff --git a/src/course-unit/xblock-container-iframe/index.tsx b/src/course-unit/xblock-container-iframe/index.tsx
index 39b8705d0d..c6ee3d8b54 100644
--- a/src/course-unit/xblock-container-iframe/index.tsx
+++ b/src/course-unit/xblock-container-iframe/index.tsx
@@ -24,6 +24,7 @@ interface XBlockContainerIframeProps {
blockId: string;
unitXBlockActions: {
handleDelete: (XBlockId: string) => void;
+ handleDuplicate: (XBlockId: string) => void;
};
xblocks: Array<{
name: string;
@@ -74,7 +75,7 @@ const XBlockContainerIframe: FC = ({
const [isConfigureModalOpen, openConfigureModal, closeConfigureModal] = useToggle(false);
const { setIframeRef, sendMessageToIframe } = useIframe();
const [editXblockId, setEditXblockId] = useState(null);
- const [currentXblockData, setCurrentXblockData] = useState>({});
+ const [currentXblockData, setCurrentXblockData] = useState({});
const iframeUrl = `${getConfig().STUDIO_BASE_URL}/container_embed/${blockId}`;
@@ -144,7 +145,6 @@ const XBlockContainerIframe: FC = ({
const handleMessage = (event: MessageEvent) => {
const { type, payload } = event.data || {};
- console.log('MESSAGE FROM IFRAME =================>', { type, payload });
if (type && messageHandlers[type]) {
messageHandlers[type](payload);
}
@@ -199,6 +199,7 @@ const XBlockContainerIframe: FC = ({
onClose={closeConfigureModal}
onConfigureSubmit={onConfigureSubmit}
currentItemData={currentXblockData}
+ isSelfPaced={false}
/>