diff --git a/web/app/(workspace)/learning/mastery/[pathId]/page.tsx b/web/app/(workspace)/learning/mastery/[pathId]/page.tsx index d6ff6eb05..dbc71ee9f 100644 --- a/web/app/(workspace)/learning/mastery/[pathId]/page.tsx +++ b/web/app/(workspace)/learning/mastery/[pathId]/page.tsx @@ -598,7 +598,7 @@ export default function MasteryTopicPage() { )} -
+
{needsRouteRepair ? ( // A goal starts without an outline: the first session is where the // tutor asks about the learner and designs one with them. Writing @@ -637,7 +637,7 @@ export default function MasteryTopicPage() { ) : ( -
+
{/* The three things a mastery goal owns — outline, review plan, sessions — are named the same way and sit at the same level, so the page reads as one goal's assets rather than a map with @@ -681,7 +681,13 @@ export default function MasteryTopicPage() {
{/* The outline is the tall thing on this page, so it is the one that scrolls. Everything else keeps its place. */} -
+
{topicView === "outline" ? (
)} -
+
void; }) { const { t } = useTranslation(); + const scrollport = useRef(null); + const columns = useRef(null); + const [scrollRange, setScrollRange] = useState(0); + const [scrollPosition, setScrollPosition] = useState(0); + + useEffect(() => { + const viewport = scrollport.current; + const content = columns.current; + if (!viewport || !content) return; + + const measure = () => { + setScrollRange(Math.max(0, viewport.scrollWidth - viewport.clientWidth)); + setScrollPosition(Math.max(0, viewport.scrollLeft)); + }; + const observer = new ResizeObserver(measure); + observer.observe(viewport); + observer.observe(content); + measure(); + return () => observer.disconnect(); + }, []); const [openId, setOpenId] = useState(null); const [report, setReport] = useState(null); const [reportError, setReportError] = useState(false); @@ -81,83 +101,108 @@ export function LearningBoard({ }, []); return ( -
- {modules.map((module) => ( -
-
-

- {module.name} -

- - {module.mastered}/{module.total} - -
+
+
setScrollPosition(Math.max(0, event.currentTarget.scrollLeft))} + tabIndex={0} + role="region" + aria-label={t("Board")} + className="max-h-[65vh] min-h-0 min-w-0 overflow-auto pb-2 [scrollbar-color:var(--muted-foreground)_var(--muted)] lg:max-h-none" + > +
+ {modules.map((module) => ( +
+
+

+ {module.name} +

+ + {module.mastered}/{module.total} + +
- {module.cards.map((card) => { - const open = openId === card.id; - return ( -
- + {module.cards.map((card) => { + const open = openId === card.id; + return ( +
+ - {open && ( -
- {loaded && report ? ( - <> - - - - ) : reportError ? ( -

- {t("Evidence could not be loaded")} -

- ) : ( -
- + {open && ( +
+ {loaded && report ? ( + <> + + + + ) : reportError ? ( +

+ {t("Evidence could not be loaded")} +

+ ) : ( +
+ +
+ )}
)}
- )} -
- ); - })} + ); + })} +
+ ))}
- ))} +
+ {scrollRange > 0 && ( + { + const viewport = scrollport.current; + if (viewport) viewport.scrollLeft = event.currentTarget.valueAsNumber; + }} + /> + )}
); }