Skip to content

Commit

Permalink
refactor: refactoring after review
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed May 7, 2024
1 parent 5b2b33a commit 53c20f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/course-unit/hooks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
import { PUBLISH_TYPES } from './constants';

import { useCopyToClipboard } from '../generic/clipboard';
import { createCorrectInternalRoute } from '../utils';

// eslint-disable-next-line import/prefer-default-export
export const useCourseUnit = ({ courseId, blockId }) => {
Expand Down Expand Up @@ -137,7 +138,8 @@ export const useCourseUnit = ({ courseId, blockId }) => {
};

const handleNavigateToTargetUnit = () => {
navigate(`/course/${courseId}/container/${movedXBlockParams.targetParentLocator}`);
const correctInternalRoute = createCorrectInternalRoute(`/course/${courseId}/container/${movedXBlockParams.targetParentLocator}`);
navigate(correctInternalRoute);
};

useEffect(() => {
Expand Down
6 changes: 6 additions & 0 deletions src/course-unit/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,32 @@ const messages = defineMessages({
alertMoveSuccessTitle: {
id: 'course-authoring.course-unit.alert.xblock.move.success.title',
defaultMessage: 'Success!',
description: 'Title for the success alert when an XBlock is moved successfully',
},
alertMoveSuccessDescription: {
id: 'course-authoring.course-unit.alert.xblock.move.success.description',
defaultMessage: '{title} has been moved.',
description: 'Description for the success alert when an XBlock is moved successfully',
},
alertMoveCancelTitle: {
id: 'course-authoring.course-unit.alert.xblock.move.cancel.title',
defaultMessage: 'Move cancelled.',
description: 'Title for the alert when moving an XBlock is cancelled',
},
alertMoveCancelDescription: {
id: 'course-authoring.course-unit.alert.xblock.move.cancel.description',
defaultMessage: '{title} has been moved back to its original location.',
description: 'Description for the alert when moving an XBlock is cancelled and the XBlock is moved back to its original location',
},
undoMoveButton: {
id: 'course-authoring.course-unit.alert.xblock.move.undo.btn.text',
defaultMessage: 'Undo move',
description: 'Text for the button allowing users to undo a move action of an XBlock',
},
newLocationButton: {
id: 'course-authoring.course-unit.alert.xblock.new.location.btn.text',
defaultMessage: 'Take me to the new location',
description: 'Text for the button allowing users to navigate to the new location after an XBlock has been moved',
},
});

Expand Down

0 comments on commit 53c20f8

Please sign in to comment.