mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
fine tuning tooltip
This commit is contained in:
1
run.sh
1
run.sh
@@ -12,6 +12,7 @@ docker run -it --rm \
|
|||||||
-v ~/projects/faculty/4850_AdvancedFE/2024-fall-alex/modules:/app/storage/advanced_frontend \
|
-v ~/projects/faculty/4850_AdvancedFE/2024-fall-alex/modules:/app/storage/advanced_frontend \
|
||||||
-v ~/projects/faculty/1810/2025-spring-alex/online:/app/storage/intro_to_web_online \
|
-v ~/projects/faculty/1810/2025-spring-alex/online:/app/storage/intro_to_web_online \
|
||||||
-v ~/projects/faculty/1400/2025_spring_alex/modules:/app/storage/1400 \
|
-v ~/projects/faculty/1400/2025_spring_alex/modules:/app/storage/1400 \
|
||||||
|
-v ~/projects/faculty/3840_Telemetry/2025_spring_alex/modules:/app/storage/telemetry \
|
||||||
node \
|
node \
|
||||||
sh -c "
|
sh -c "
|
||||||
mkdir -p ~/.npm-global && \
|
mkdir -p ~/.npm-global && \
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ import { DraggableItem } from "../../context/drag/draggingContext";
|
|||||||
import { useDragStyleContext } from "../../context/drag/dragStyleContext";
|
import { useDragStyleContext } from "../../context/drag/dragStyleContext";
|
||||||
import { getLectureForDay } from "@/models/local/utils/lectureUtils";
|
import { getLectureForDay } from "@/models/local/utils/lectureUtils";
|
||||||
import { useLecturesSuspenseQuery } from "@/hooks/localCourse/lectureHooks";
|
import { useLecturesSuspenseQuery } from "@/hooks/localCourse/lectureHooks";
|
||||||
|
import ClientOnly from "@/components/ClientOnly";
|
||||||
|
import { Tooltip } from "@/components/Tooltip";
|
||||||
|
import { useRef, useState } from "react";
|
||||||
|
|
||||||
export function DayTitle({ day, dayAsDate }: { day: string; dayAsDate: Date }) {
|
export function DayTitle({ day, dayAsDate }: { day: string; dayAsDate: Date }) {
|
||||||
const { courseName } = useCourseContext();
|
const { courseName } = useCourseContext();
|
||||||
@@ -14,6 +17,8 @@ export function DayTitle({ day, dayAsDate }: { day: string; dayAsDate: Date }) {
|
|||||||
const { setIsDragging } = useDragStyleContext();
|
const { setIsDragging } = useDragStyleContext();
|
||||||
const todaysLecture = getLectureForDay(weeks, dayAsDate);
|
const todaysLecture = getLectureForDay(weeks, dayAsDate);
|
||||||
const modal = useModal();
|
const modal = useModal();
|
||||||
|
const linkRef = useRef<HTMLAnchorElement>(null);
|
||||||
|
const [tooltipVisible, setTooltipVisible] = useState(false);
|
||||||
|
|
||||||
const lectureName = todaysLecture && (todaysLecture.name || "lecture");
|
const lectureName = todaysLecture && (todaysLecture.name || "lecture");
|
||||||
|
|
||||||
@@ -38,9 +43,21 @@ export function DayTitle({ day, dayAsDate }: { day: string; dayAsDate: Date }) {
|
|||||||
setIsDragging(true);
|
setIsDragging(true);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
ref={linkRef}
|
||||||
|
onMouseEnter={() => setTooltipVisible(true)}
|
||||||
|
onMouseLeave={() => setTooltipVisible(false)}
|
||||||
>
|
>
|
||||||
{dayAsDate.getDate()} {lectureName}
|
{dayAsDate.getDate()} {lectureName}
|
||||||
</Link>
|
</Link>
|
||||||
|
<ClientOnly>
|
||||||
|
{(lectureName?.length ?? 0) > 0 && (
|
||||||
|
<Tooltip
|
||||||
|
message={lectureName}
|
||||||
|
targetRef={linkRef}
|
||||||
|
visible={tooltipVisible}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</ClientOnly>
|
||||||
<Modal
|
<Modal
|
||||||
modalControl={modal}
|
modalControl={modal}
|
||||||
buttonText="+"
|
buttonText="+"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useCourseContext } from "../../context/courseContext";
|
|||||||
import { DraggableItem } from "../../context/drag/draggingContext";
|
import { DraggableItem } from "../../context/drag/draggingContext";
|
||||||
import ClientOnly from "@/components/ClientOnly";
|
import ClientOnly from "@/components/ClientOnly";
|
||||||
import { useDragStyleContext } from "../../context/drag/dragStyleContext";
|
import { useDragStyleContext } from "../../context/drag/dragStyleContext";
|
||||||
import { DayItemTooltip } from "./DayItemTooltip";
|
import { Tooltip } from "../../../../../components/Tooltip";
|
||||||
|
|
||||||
export function ItemInDay({
|
export function ItemInDay({
|
||||||
type,
|
type,
|
||||||
@@ -59,7 +59,7 @@ export function ItemInDay({
|
|||||||
{item.name}
|
{item.name}
|
||||||
</Link>
|
</Link>
|
||||||
<ClientOnly>
|
<ClientOnly>
|
||||||
<DayItemTooltip
|
<Tooltip
|
||||||
message={message}
|
message={message}
|
||||||
targetRef={linkRef}
|
targetRef={linkRef}
|
||||||
visible={tooltipVisible && status === "incomplete"}
|
visible={tooltipVisible && status === "incomplete"}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
|
|
||||||
export const DayItemTooltip: React.FC<{
|
export const Tooltip: React.FC<{
|
||||||
message: ReactNode;
|
message: ReactNode;
|
||||||
targetRef: React.RefObject<HTMLAnchorElement | null>;
|
targetRef: React.RefObject<HTMLAnchorElement | null>;
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
@@ -16,10 +16,10 @@ export const DayItemTooltip: React.FC<{
|
|||||||
}}
|
}}
|
||||||
className={
|
className={
|
||||||
" absolute -translate-x-1/2 " +
|
" absolute -translate-x-1/2 " +
|
||||||
" bg-gray-800 text-white text-sm " +
|
" bg-gray-900 text-slate-200 text-sm " +
|
||||||
" rounded py-1 px-2 " +
|
" rounded-md py-1 px-2 " +
|
||||||
" transition-all duration-400 " +
|
" transition-all duration-400 " +
|
||||||
" border border-slate-700 shadow-[0_0px_10px_0px] shadow-slate-500/50 " +
|
" border border-slate-700 shadow-[0px_0px_10px_5px] shadow-slate-500/20 " +
|
||||||
(visible ? " " : " hidden -z-50 ")
|
(visible ? " " : " hidden -z-50 ")
|
||||||
}
|
}
|
||||||
role="tooltip"
|
role="tooltip"
|
||||||
Reference in New Issue
Block a user