mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
standardizing settings styles
This commit is contained in:
@@ -3,15 +3,14 @@
|
|||||||
import Modal, { useModal } from "@/components/Modal";
|
import Modal, { useModal } from "@/components/Modal";
|
||||||
import { Spinner } from "@/components/Spinner";
|
import { Spinner } from "@/components/Spinner";
|
||||||
import { getCourseUrl } from "@/services/urlUtils";
|
import { getCourseUrl } from "@/services/urlUtils";
|
||||||
import { useQueryClient } from "@tanstack/react-query";
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useCourseContext } from "../../context/courseContext";
|
import { useCourseContext } from "../../context/courseContext";
|
||||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||||
import { useDeleteLectureMutation } from "@/hooks/localCourse/lectureHooks";
|
import { useDeleteLectureMutation } from "@/hooks/localCourse/lectureHooks";
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
export default function LectureButtons({ lectureDay }: { lectureDay: string }) {
|
export default function LectureButtons({ lectureDay }: { lectureDay: string }) {
|
||||||
const queryClient = useQueryClient();
|
|
||||||
const { courseName } = useCourseContext();
|
const { courseName } = useCourseContext();
|
||||||
const [settings] = useLocalCourseSettingsQuery();
|
const [settings] = useLocalCourseSettingsQuery();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -58,8 +57,11 @@ export default function LectureButtons({ lectureDay }: { lectureDay: string }) {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Modal>
|
</Modal>
|
||||||
{isLoading && <Spinner />}
|
|
||||||
</div>
|
</div>
|
||||||
|
<Link className="btn" href={getCourseUrl(courseName)} shallow={true}>
|
||||||
|
Go Back
|
||||||
|
</Link>
|
||||||
|
{isLoading && <Spinner />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,12 @@ import { LocalAssignmentGroup } from "@/models/local/assignment/localAssignmentG
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import TextInput from "../../../../components/form/TextInput";
|
import TextInput from "../../../../components/form/TextInput";
|
||||||
import { useSetAssignmentGroupsMutation } from "@/hooks/canvas/canvasCourseHooks";
|
import { useSetAssignmentGroupsMutation } from "@/hooks/canvas/canvasCourseHooks";
|
||||||
|
import { settingsBox } from "./sharedSettings";
|
||||||
|
|
||||||
export default function AssignmentGroupManagement() {
|
export default function AssignmentGroupManagement() {
|
||||||
const [settings] = useLocalCourseSettingsQuery();
|
const [settings] = useLocalCourseSettingsQuery();
|
||||||
const updateSettings = useUpdateLocalCourseSettingsMutation();
|
const updateSettings = useUpdateLocalCourseSettingsMutation();
|
||||||
// const applyInCanvas = useSetAssignmentGroupsMutation(settings.canvasId); // untested
|
const applyInCanvas = useSetAssignmentGroupsMutation(settings.canvasId); // untested
|
||||||
|
|
||||||
const [assignmentGroups, setAssignmentGroups] = useState<
|
const [assignmentGroups, setAssignmentGroups] = useState<
|
||||||
LocalAssignmentGroup[]
|
LocalAssignmentGroup[]
|
||||||
@@ -39,7 +40,7 @@ export default function AssignmentGroupManagement() {
|
|||||||
}, [assignmentGroups, settings, updateSettings]);
|
}, [assignmentGroups, settings, updateSettings]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className={settingsBox}>
|
||||||
{assignmentGroups.map((group) => (
|
{assignmentGroups.map((group) => (
|
||||||
<div key={group.id} className="flex flex-row gap-3">
|
<div key={group.id} className="flex flex-row gap-3">
|
||||||
<TextInput
|
<TextInput
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
import { TimePicker } from "../../../../components/TimePicker";
|
import { TimePicker } from "../../../../components/TimePicker";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import DefaultLockOffset from "./DefaultLockOffset";
|
import DefaultLockOffset from "./DefaultLockOffset";
|
||||||
|
import { settingsBox } from "./sharedSettings";
|
||||||
|
|
||||||
export default function DefaultDueTime() {
|
export default function DefaultDueTime() {
|
||||||
const [settings] = useLocalCourseSettingsQuery();
|
const [settings] = useLocalCourseSettingsQuery();
|
||||||
@@ -15,7 +16,7 @@ export default function DefaultDueTime() {
|
|||||||
!!settings.defaultLockHoursOffset
|
!!settings.defaultLockHoursOffset
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<div className="border w-fit p-3 m-3 rounded-md">
|
<div className={settingsBox}>
|
||||||
<div className="text-center">Default Assignment Due Time</div>
|
<div className="text-center">Default Assignment Due Time</div>
|
||||||
<hr className="m-1 p-0" />
|
<hr className="m-1 p-0" />
|
||||||
<TimePicker
|
<TimePicker
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
useUpdateLocalCourseSettingsMutation,
|
useUpdateLocalCourseSettingsMutation,
|
||||||
} from "@/hooks/localCourse/localCoursesHooks";
|
} from "@/hooks/localCourse/localCoursesHooks";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
|
import { settingsBox } from "./sharedSettings";
|
||||||
|
|
||||||
export default function DefaultFileUploadTypes() {
|
export default function DefaultFileUploadTypes() {
|
||||||
const [settings] = useLocalCourseSettingsQuery();
|
const [settings] = useLocalCourseSettingsQuery();
|
||||||
@@ -31,7 +32,7 @@ export default function DefaultFileUploadTypes() {
|
|||||||
}, [defaultFileUploadTypes, settings, updateSettings]);
|
}, [defaultFileUploadTypes, settings, updateSettings]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="border w-fit p-3 m-3 rounded-md">
|
<div className={settingsBox}>
|
||||||
<div className="text-center">Default File Upload Types</div>
|
<div className="text-center">Default File Upload Types</div>
|
||||||
|
|
||||||
{defaultFileUploadTypes.map((type, index) => (
|
{defaultFileUploadTypes.map((type, index) => (
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
holidaysToString,
|
holidaysToString,
|
||||||
parseHolidays,
|
parseHolidays,
|
||||||
} from "../../../../models/local/settingsUtils";
|
} from "../../../../models/local/settingsUtils";
|
||||||
|
import { settingsBox } from "./sharedSettings";
|
||||||
|
|
||||||
const exampleString = `springBreak:
|
const exampleString = `springBreak:
|
||||||
- 10/12/2024
|
- 10/12/2024
|
||||||
@@ -89,7 +90,7 @@ function InnerHolidayConfig() {
|
|||||||
}, [rawText, settings.holidays, settings, updateSettings]);
|
}, [rawText, settings.holidays, settings, updateSettings]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className=" border w-fit p-3 m-3 rounded-md">
|
<div className={settingsBox}>
|
||||||
<div className="flex flex-row gap-3">
|
<div className="flex flex-row gap-3">
|
||||||
<TextInput
|
<TextInput
|
||||||
value={rawText}
|
value={rawText}
|
||||||
|
|||||||
@@ -2,15 +2,16 @@
|
|||||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||||
import { getDateOnlyMarkdownString } from "@/models/local/timeUtils";
|
import { getDateOnlyMarkdownString } from "@/models/local/timeUtils";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { settingsBox } from "./sharedSettings";
|
||||||
|
|
||||||
export default function StartAndEndDate() {
|
export default function StartAndEndDate() {
|
||||||
const [settings] = useLocalCourseSettingsQuery();
|
const [settings] = useLocalCourseSettingsQuery();
|
||||||
const startDate = new Date(settings.startDate);
|
const startDate = new Date(settings.startDate);
|
||||||
const endDate = new Date(settings.endDate);
|
const endDate = new Date(settings.endDate);
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className={settingsBox}>
|
||||||
<div>Start: {getDateOnlyMarkdownString(startDate)}</div>
|
<div>Semester Start: {getDateOnlyMarkdownString(startDate)}</div>
|
||||||
<div>End: {getDateOnlyMarkdownString(endDate)}</div>
|
<div>Semester End: {getDateOnlyMarkdownString(endDate)}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
AssignmentSubmissionTypeList,
|
AssignmentSubmissionTypeList,
|
||||||
} from "@/models/local/assignment/assignmentSubmissionType";
|
} from "@/models/local/assignment/assignmentSubmissionType";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { settingsBox } from "./sharedSettings";
|
||||||
|
|
||||||
export default function SubmissionDefaults() {
|
export default function SubmissionDefaults() {
|
||||||
const [settings] = useLocalCourseSettingsQuery();
|
const [settings] = useLocalCourseSettingsQuery();
|
||||||
@@ -32,7 +33,7 @@ export default function SubmissionDefaults() {
|
|||||||
}, [defaultSubmissionTypes, settings, updateSettings]);
|
}, [defaultSubmissionTypes, settings, updateSettings]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="border w-fit p-3 m-3 rounded-md">
|
<div className={settingsBox}>
|
||||||
<div className="text-center">Default Assignment Submission Type</div>
|
<div className="text-center">Default Assignment Submission Type</div>
|
||||||
|
|
||||||
{defaultSubmissionTypes.map((type, index) => (
|
{defaultSubmissionTypes.map((type, index) => (
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export const settingsBox = "border w-full p-3 m-3 rounded-md border-slate-500"
|
||||||
@@ -26,7 +26,7 @@ const sampleCompose = `services:
|
|||||||
image: alexmickelson/canvas_management:2 # pull this image regularly
|
image: alexmickelson/canvas_management:2 # pull this image regularly
|
||||||
user: 1000:1000 # userid:groupid that matches file ownership on host system
|
user: 1000:1000 # userid:groupid that matches file ownership on host system
|
||||||
ports:
|
ports:
|
||||||
- 8080:8080 # hostPort:containerPort - you can change the first one if you like
|
- 8080:3000 # hostPort:containerPort - you can change the first one if you like
|
||||||
env_file:
|
env_file:
|
||||||
- .env # needs to have your CANVAS_TOKEN set
|
- .env # needs to have your CANVAS_TOKEN set
|
||||||
environment:
|
environment:
|
||||||
@@ -196,9 +196,9 @@ function OtherSettings({
|
|||||||
getOptionName={(d) => d}
|
getOptionName={(d) => d}
|
||||||
emptyOptionText="--- add a new folder to your docker compose to add more folders ---"
|
emptyOptionText="--- add a new folder to your docker compose to add more folders ---"
|
||||||
/>
|
/>
|
||||||
<div>
|
<div className="px-5">
|
||||||
New folders will not be created automatically, you are expected to mount
|
New folders will not be created automatically, you are expected to mount
|
||||||
a docker volume for each coures.
|
a docker volume for each courses.
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div className="flex justify-center">
|
<div className="flex justify-center">
|
||||||
@@ -222,6 +222,13 @@ function OtherSettings({
|
|||||||
options={allSettings}
|
options={allSettings}
|
||||||
getOptionName={(c) => c.name}
|
getOptionName={(c) => c.name}
|
||||||
/>
|
/>
|
||||||
|
<div className="px-5">
|
||||||
|
Assignments, Quizzes, Pages, and Lectures will have their due dates
|
||||||
|
moved based on how far they are from the start of the semester.
|
||||||
|
<br />
|
||||||
|
You will still need to go through and re-order the course content, but
|
||||||
|
things will be within a few days of where they should be.
|
||||||
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user