mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 23:58:31 -06:00
running smooth again
This commit is contained in:
@@ -2,26 +2,32 @@
|
||||
import { useModuleNamesQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import DayItemsInModule from "./DayItemsInModule";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/timeUtils";
|
||||
import { useDraggingContext } from "../context/DraggingContext";
|
||||
import { useDraggingContext } from "../context/draggingContext";
|
||||
|
||||
export default function Day({ day, month }: { day: string; month: number }) {
|
||||
const { data: moduleNames } = useModuleNamesQuery();
|
||||
|
||||
const dayAsDate = getDateFromStringOrThrow(day, "calculating same month in day")
|
||||
const isInSameMonth =
|
||||
dayAsDate.getMonth() + 1 !=
|
||||
month;
|
||||
const dayAsDate = getDateFromStringOrThrow(
|
||||
day,
|
||||
"calculating same month in day"
|
||||
);
|
||||
const isInSameMonth = dayAsDate.getMonth() + 1 != month;
|
||||
const backgroundClass = isInSameMonth ? "" : "bg-slate-900";
|
||||
const { itemDrop } = useDraggingContext();
|
||||
|
||||
return (
|
||||
<div
|
||||
className={
|
||||
"border border-slate-600 rounded-lg p-2 pb-4 m-1 " + backgroundClass
|
||||
}
|
||||
onDrop={(e) => {
|
||||
itemDrop(e, day);
|
||||
}}
|
||||
onDragOver={(e) => e.preventDefault()}
|
||||
>
|
||||
{dayAsDate.getDate()}
|
||||
{moduleNames.map((moduleName) => (
|
||||
<ModuleInDay
|
||||
<DayItemsInModule
|
||||
key={"" + day + month + moduleName}
|
||||
moduleName={moduleName}
|
||||
day={day}
|
||||
@@ -30,12 +36,3 @@ export default function Day({ day, month }: { day: string; month: number }) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ModuleInDay({ moduleName, day }: { moduleName: string; day: string }) {
|
||||
const { itemDrop } = useDraggingContext();
|
||||
return (
|
||||
<div onDrop={() => itemDrop(day)} onDragOver={(e) => e.preventDefault()}>
|
||||
<DayItemsInModule day={day} moduleName={moduleName} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user