mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
updates
This commit is contained in:
@@ -8,13 +8,11 @@ export default function CourseList() {
|
||||
return (
|
||||
<div>
|
||||
{allSettings.map((settings) => (
|
||||
<Link
|
||||
href={getCourseUrl(settings.name)}
|
||||
key={settings.name}
|
||||
shallow={true}
|
||||
>
|
||||
{settings.name}
|
||||
</Link>
|
||||
<div key={settings.name}>
|
||||
<Link href={getCourseUrl(settings.name)} shallow={true}>
|
||||
{settings.name}
|
||||
</Link>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
||||
21
nextjs/src/app/course/[courseName]/CourseNavigation.tsx
Normal file
21
nextjs/src/app/course/[courseName]/CourseNavigation.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
"use client";
|
||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import Link from "next/link";
|
||||
|
||||
export function CourseNavigation() {
|
||||
const { data: settings } = useLocalCourseSettingsQuery();
|
||||
return (
|
||||
<div className="pb-1 ps-5 flex flex-row gap-3">
|
||||
<Link href={"/"} className="btn">
|
||||
Back to Course List
|
||||
</Link>
|
||||
<a
|
||||
href={`https://snow.instructure.com/courses/${settings.canvasId}`}
|
||||
className="btn"
|
||||
target="_blank"
|
||||
>
|
||||
View in Canvas
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -122,10 +122,13 @@ function DraggableListItem({
|
||||
}) {
|
||||
const { courseName } = useCourseContext();
|
||||
return (
|
||||
<div
|
||||
<Link
|
||||
href={getModuleItemUrl(courseName, moduleName, type, item.name)}
|
||||
shallow={true}
|
||||
className={
|
||||
" border rounded-sm px-1 mx-1 break-all " +
|
||||
" border-slate-600 bg-slate-800 "
|
||||
" border-slate-600 bg-slate-800 " +
|
||||
" block "
|
||||
}
|
||||
role="button"
|
||||
draggable="true"
|
||||
@@ -140,12 +143,7 @@ function DraggableListItem({
|
||||
);
|
||||
}}
|
||||
>
|
||||
<Link
|
||||
href={getModuleItemUrl(courseName, moduleName, type, item.name)}
|
||||
shallow={true}
|
||||
>
|
||||
{item.name}
|
||||
</Link>
|
||||
</div>
|
||||
{item.name}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@ export default function DraggingContextProvider({
|
||||
|
||||
const itemDrop = useCallback(
|
||||
(e: DragEvent<HTMLDivElement>, day: string | undefined) => {
|
||||
const itemBeingDragged = JSON.parse(
|
||||
e.dataTransfer.getData("draggableItem")
|
||||
);
|
||||
const rawData = e.dataTransfer.getData("draggableItem");
|
||||
// console.log(rawData);
|
||||
const itemBeingDragged = JSON.parse(rawData);
|
||||
|
||||
if (itemBeingDragged && day) {
|
||||
const dayAsDate = getDateFromStringOrThrow(day, "in drop callback");
|
||||
|
||||
@@ -26,22 +26,23 @@ export default function EditAssignment({
|
||||
useEffect(() => {
|
||||
const delay = 500;
|
||||
const handler = setTimeout(() => {
|
||||
const updatedAssignment =
|
||||
localAssignmentMarkdown.parseMarkdown(assignmentText);
|
||||
if (
|
||||
localAssignmentMarkdown.toMarkdown(assignment) !==
|
||||
localAssignmentMarkdown.toMarkdown(updatedAssignment)
|
||||
) {
|
||||
console.log("updating assignment");
|
||||
try {
|
||||
try {
|
||||
const updatedAssignment =
|
||||
localAssignmentMarkdown.parseMarkdown(assignmentText);
|
||||
if (
|
||||
localAssignmentMarkdown.toMarkdown(assignment) !==
|
||||
localAssignmentMarkdown.toMarkdown(updatedAssignment)
|
||||
) {
|
||||
console.log("updating assignment");
|
||||
updateAssignment.mutate({
|
||||
assignment: updatedAssignment,
|
||||
moduleName,
|
||||
assignmentName,
|
||||
});
|
||||
} catch (e: any) {
|
||||
setError(e.toString());
|
||||
}
|
||||
setError("");
|
||||
} catch (e: any) {
|
||||
setError(e.toString());
|
||||
}
|
||||
}, delay);
|
||||
|
||||
@@ -55,7 +56,7 @@ export default function EditAssignment({
|
||||
moduleName,
|
||||
updateAssignment,
|
||||
]);
|
||||
|
||||
|
||||
return (
|
||||
<div className="h-full flex flex-col">
|
||||
<div className="columns-2 min-h-0 flex-1">
|
||||
@@ -68,9 +69,7 @@ export default function EditAssignment({
|
||||
</div>
|
||||
</div>
|
||||
<div className="p-5">
|
||||
<button>
|
||||
Add to canvas....
|
||||
</button>
|
||||
<button>Add to canvas....</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -35,21 +35,22 @@ export default function EditPage({
|
||||
useEffect(() => {
|
||||
const delay = 500;
|
||||
const handler = setTimeout(() => {
|
||||
const updatedPage = localPageMarkdownUtils.parseMarkdown(pageText);
|
||||
if (
|
||||
localPageMarkdownUtils.toMarkdown(page) !==
|
||||
localPageMarkdownUtils.toMarkdown(updatedPage)
|
||||
) {
|
||||
console.log("updating assignment");
|
||||
try {
|
||||
try {
|
||||
const updatedPage = localPageMarkdownUtils.parseMarkdown(pageText);
|
||||
if (
|
||||
localPageMarkdownUtils.toMarkdown(page) !==
|
||||
localPageMarkdownUtils.toMarkdown(updatedPage)
|
||||
) {
|
||||
console.log("updating page");
|
||||
updatePage.mutate({
|
||||
page: updatedPage,
|
||||
moduleName,
|
||||
pageName,
|
||||
});
|
||||
} catch (e: any) {
|
||||
setError(e.toString());
|
||||
}
|
||||
setError("");
|
||||
} catch (e: any) {
|
||||
setError(e.toString());
|
||||
}
|
||||
}, delay);
|
||||
|
||||
|
||||
@@ -23,20 +23,23 @@ export default function EditQuiz({
|
||||
useEffect(() => {
|
||||
const delay = 500;
|
||||
const handler = setTimeout(() => {
|
||||
if (
|
||||
quizMarkdownUtils.toMarkdown(quiz) !==
|
||||
quizMarkdownUtils.toMarkdown(quizMarkdownUtils.parseMarkdown(quizText))
|
||||
) {
|
||||
try {
|
||||
try {
|
||||
if (
|
||||
quizMarkdownUtils.toMarkdown(quiz) !==
|
||||
quizMarkdownUtils.toMarkdown(
|
||||
quizMarkdownUtils.parseMarkdown(quizText)
|
||||
)
|
||||
) {
|
||||
const updatedQuiz = quizMarkdownUtils.parseMarkdown(quizText);
|
||||
updateQuizMutation.mutate({
|
||||
quiz: updatedQuiz,
|
||||
moduleName,
|
||||
quizName,
|
||||
});
|
||||
} catch (e: any) {
|
||||
setError(e.toString());
|
||||
}
|
||||
setError("");
|
||||
} catch (e: any) {
|
||||
setError(e.toString());
|
||||
}
|
||||
}, delay);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import ModuleList from "./modules/ModuleList";
|
||||
import DraggingContextProvider from "./context/DraggingContextProvider";
|
||||
import Link from "next/link";
|
||||
import CourseTitle from "./CourseTitle";
|
||||
import { CourseNavigation } from "./CourseNavigation";
|
||||
|
||||
export default async function CoursePage({}: {}) {
|
||||
return (
|
||||
@@ -13,12 +14,7 @@ export default async function CoursePage({}: {}) {
|
||||
<div className="flex flex-row min-h-0">
|
||||
<DraggingContextProvider>
|
||||
<div className="flex-1 min-h-0">
|
||||
<div className="pb-1 ps-5">
|
||||
<Link href={"/"} className="btn">
|
||||
Back to Course List
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<CourseNavigation />
|
||||
<CourseCalendar />
|
||||
</div>
|
||||
<div className="w-96 p-3">
|
||||
|
||||
Reference in New Issue
Block a user