Skip to content

Commit

Permalink
chore: Fix rebase issues and nits
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChV committed Jul 24, 2024
1 parent 1012ef9 commit 5bedf75
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 103 deletions.
1 change: 0 additions & 1 deletion src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
@import "search-modal/SearchModal";
@import "certificates/scss/Certificates";
@import "group-configurations/GroupConfigurations";
@import "library-authoring";

// To apply the glow effect to the selected Section/Subsection, in the Course Outline
div.row:has(> div > div.highlight) {
Expand Down
5 changes: 5 additions & 0 deletions src/library-authoring/LibraryAuthoringPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,18 @@ const libraryData: ContentLibrary = {
numBlocks: 2,
version: 0,
lastPublished: null,
lastDraftCreated: null,
publishedBy: 'staff',
lastDraftCreatedBy: null,
allowLti: false,
allowPublicLearning: false,
allowPublicRead: false,
hasUnpublishedChanges: true,
hasUnpublishedDeletes: false,
canEditLibrary: true,
license: '',
created: null,
updated: null,
};

const RootWrapper = () => (
Expand Down
4 changes: 2 additions & 2 deletions src/library-authoring/data/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export interface ContentLibrary {
hasUnpublishedDeletes: boolean;
canEditLibrary: boolean;
license: string;
created: Date;
updated: Date;
created: Date | null;
updated: Date | null;
}

export interface LibraryBlockType {
Expand Down
98 changes: 0 additions & 98 deletions src/library-authoring/data/apiHook.ts

This file was deleted.

23 changes: 23 additions & 0 deletions src/library-authoring/data/apiHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
getLibraryBlockTypes,
createLibraryBlock,
getContentLibraryV2List,
commitLibraryChanges,
revertLibraryChanges,
} from './api';

export const libraryAuthoringQueryKeys = {
Expand Down Expand Up @@ -130,3 +132,24 @@ export const useContentLibraryV2List = (customParams: GetLibrariesV2CustomParams
keepPreviousData: true,
})
);


export const useCommitLibraryChanges = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: commitLibraryChanges,
onSettled: (_data, _error, libraryId) => {
queryClient.invalidateQueries({ queryKey: libraryAuthoringQueryKeys.contentLibrary(libraryId) });
},
});
};

export const useRevertLibraryChanges = () => {
const queryClient = useQueryClient();
return useMutation({
mutationFn: revertLibraryChanges,
onSettled: (_data, _error, libraryId) => {
queryClient.invalidateQueries({ queryKey: libraryAuthoringQueryKeys.contentLibrary(libraryId) });
},
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@
border-top: 4px solid $info-400;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ContentLibrary } from "../data/api";
import { useIntl } from '@edx/frontend-platform/i18n';
import messages from "./messages";
import classNames from 'classnames';
import { useCommitLibraryChanges, useRevertLibraryChanges } from "../data/apiHook";
import { useCommitLibraryChanges, useRevertLibraryChanges } from "../data/apiHooks";
import { ToastContext } from "../../generic/toast-context";
import { convertToStringFromDateAndFormat } from "../../utils";
import { COMMA_SEPARATED_DATE_FORMAT, TIME_FORMAT } from "../../constants";
Expand Down

0 comments on commit 5bedf75

Please sign in to comment.