mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
images work kinda
This commit is contained in:
@@ -37,50 +37,50 @@ export const useUpdateImageSettingsForAssignment = ({
|
|||||||
const createCanvasUrlMutation =
|
const createCanvasUrlMutation =
|
||||||
trpc.canvasFile.getCanvasFileUrl.useMutation();
|
trpc.canvasFile.getCanvasFileUrl.useMutation();
|
||||||
|
|
||||||
useEffect(() => {
|
// useEffect(() => {
|
||||||
if (isUpdatingSettings) {
|
// if (isUpdatingSettings) {
|
||||||
console.log("not updating image assets, still loading");
|
// console.log("not updating image assets, still loading");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
setIsUpdatingSettings(true);
|
// setIsUpdatingSettings(true);
|
||||||
const assignmentMarkdown = markdownToHtmlNoImages(assignment.description);
|
// const assignmentMarkdown = markdownToHtmlNoImages(assignment.description);
|
||||||
|
|
||||||
const imageSources = extractImageSources(assignmentMarkdown);
|
// const imageSources = extractImageSources(assignmentMarkdown);
|
||||||
const imagesToUpdate = imageSources.filter((source) =>
|
// const imagesToUpdate = imageSources.filter((source) =>
|
||||||
settings.assets.every((a) => a.sourceUrl !== source)
|
// settings.assets.every((a) => a.sourceUrl !== source)
|
||||||
);
|
// );
|
||||||
console.log("images to update", imagesToUpdate);
|
// console.log("images to update", imagesToUpdate);
|
||||||
|
|
||||||
if (imagesToUpdate.length)
|
// if (imagesToUpdate.length) {
|
||||||
{
|
// Promise.all(
|
||||||
Promise.all(
|
// imagesToUpdate.map(async (source) => {
|
||||||
imagesToUpdate.map(async (source) => {
|
// // todo: get canvas url
|
||||||
// todo: get canvas url
|
// // const canvasUrl = "";
|
||||||
// const canvasUrl = "";
|
// const canvasUrl = await createCanvasUrlMutation.mutateAsync({
|
||||||
const canvasUrl = await createCanvasUrlMutation.mutateAsync({
|
// sourceUrl: source,
|
||||||
sourceUrl: source,
|
// canvasCourseId: settings.canvasId,
|
||||||
canvasCourseId: settings.canvasId,
|
// });
|
||||||
});
|
// console.log("got canvas url", source, canvasUrl);
|
||||||
console.log("got canvas url", source, canvasUrl);
|
// return { sourceUrl: source, canvasUrl };
|
||||||
return { sourceUrl: source, canvasUrl };
|
// })
|
||||||
})
|
// ).then(async (newAssets) => {
|
||||||
).then(async (newAssets) => {
|
// await updateSettings.mutateAsync({
|
||||||
await updateSettings.mutateAsync({
|
// settings: {
|
||||||
settings: {
|
// ...settings,
|
||||||
...settings,
|
// assets: [...settings.assets, ...newAssets],
|
||||||
assets: [...settings.assets, ...newAssets],
|
// },
|
||||||
},
|
// });
|
||||||
});
|
// setIsUpdatingSettings(false);
|
||||||
setIsUpdatingSettings(false);
|
// });
|
||||||
});}
|
// }
|
||||||
}, [
|
// }, [
|
||||||
assignment.description,
|
// assignment.description,
|
||||||
createCanvasUrlMutation,
|
// createCanvasUrlMutation,
|
||||||
isUpdatingSettings,
|
// isUpdatingSettings,
|
||||||
settings,
|
// settings,
|
||||||
settings.assets,
|
// settings.assets,
|
||||||
updateSettings,
|
// updateSettings,
|
||||||
]);
|
// ]);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useAssignmentNamesQuery = (moduleName: string) => {
|
export const useAssignmentNamesQuery = (moduleName: string) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user