Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix(web): expose learning navigation and progress hints (#1526)

Bingxi Zhao (Frank)276e16538dad
diff --git a/web/app/(workspace)/learning/books/components/BookLibrary.tsx b/web/app/(workspace)/learning/books/components/BookLibrary.tsx
index a7cebc179..f3ce6fd11 100644
--- a/web/app/(workspace)/learning/books/components/BookLibrary.tsx
+++ b/web/app/(workspace)/learning/books/components/BookLibrary.tsx
@@ -328,15 +328,13 @@ export default function BookLibrary({
{(book.reading?.percent ?? 0) > 0 && (
<span
className="inline-flex items-center gap-1 text-[var(--primary)]"
- title={t('{{visited}} of {{total}} chapters read', {
- visited: book.reading?.visited_pages ?? 0,
- total: book.reading?.total_pages ?? 0,
- })}
>
<BookOpen size={11} />
{t('{{percent}}% read', {
percent: book.reading?.percent ?? 0,
- })}
+ })}{' '}
+ ({book.reading?.visited_pages ?? 0}/
+ {book.reading?.total_pages ?? 0})
</span>
)}
</div>
diff --git a/web/app/(workspace)/learning/books/components/BookSidebar.tsx b/web/app/(workspace)/learning/books/components/BookSidebar.tsx
index 646a679f7..722d65ea5 100644
--- a/web/app/(workspace)/learning/books/components/BookSidebar.tsx
+++ b/web/app/(workspace)/learning/books/components/BookSidebar.tsx
@@ -3,6 +3,7 @@
import { useEffect, useState } from "react";
import {
ArrowLeft,
+ Bookmark,
ChevronLeft,
ChevronRight,
Compass,
@@ -240,9 +241,18 @@ export default function BookSidebar({
{pages.map((page) => {
const active = page.id === selectedPageId;
const isOverview = page.content_type === "overview";
+ const bookmarked = bookmarkedPageIds?.includes(page.id) ?? false;
+ const hint = [
+ page.title || t("Untitled"),
+ t(STATUS_LABEL[page.status] || page.status),
+ bookmarked ? t("Bookmarked") : null,
+ ]
+ .filter(Boolean)
+ .join(" · ");
return (
- <li key={page.id}>
- <button
+ <li key={page.id} className="[&>span]:w-full">
+ <Tooltip label={hint}>
+ <button
onClick={() => onSelectPage?.(page.id)}
className={`flex w-full items-start justify-between gap-2 rounded-md py-1.5 pr-2 text-left text-xs ${
page.parent_page_id ? "pl-5" : "pl-2"
@@ -265,18 +275,15 @@ export default function BookSidebar({
</span>
</span>
<span className="flex shrink-0 items-center gap-1.5">
- {bookmarkedPageIds?.includes(page.id) && (
- <span
- className="h-1.5 w-1.5 rounded-full bg-[var(--primary)]"
- title={t("Bookmarked")}
+ {bookmarked && (
+ <Bookmark
+ className="h-3 w-3 fill-[var(--primary)] text-[var(--primary)]"
+ aria-hidden="true"
/>
)}
- {/* The status word survives as the tooltip:
- available when wanted, not shouted on every row.
- A chapter already read keeps the blue dot but
- dimmed — one mark, two facts. */}
+ {/* The row hint carries status and bookmark details;
+ the mark stays compact in the chapter list. */}
<span
- title={t(STATUS_LABEL[page.status] || page.status)}
className={`inline-flex items-center ${
page.status === "ready" &&
visitedPageIds?.includes(page.id)
@@ -290,7 +297,8 @@ export default function BookSidebar({
/>
</span>
</span>
- </button>
+ </button>
+ </Tooltip>
</li>
);
})}
diff --git a/web/app/(workspace)/learning/books/components/PageOutlineNav.tsx b/web/app/(workspace)/learning/books/components/PageOutlineNav.tsx
index c1ab410fd..406706d4a 100644
--- a/web/app/(workspace)/learning/books/components/PageOutlineNav.tsx
+++ b/web/app/(workspace)/learning/books/components/PageOutlineNav.tsx
@@ -248,8 +248,9 @@ export default function PageOutlineNav({
block.status === "pending" || block.status === "generating";
return (
- <li key={block.id}>
- <button
+ <li key={block.id} className="[&>span]:w-full">
+ <Tooltip label={`${fallbackLabel} · ${label}`}>
+ <button
type="button"
onClick={() => handleJump(block.id)}
className={[
@@ -279,12 +280,7 @@ export default function PageOutlineNav({
<span className="shrink-0 text-[10.5px] tabular-nums text-[var(--muted-foreground)]/70">
{String(idx + 1).padStart(2, "0")}
</span>
- <span
- className="truncate"
- title={`${fallbackLabel} · ${label}`}
- >
- {label}
- </span>
+ <span className="truncate">{label}</span>
</span>
<span
className={[
@@ -292,7 +288,8 @@ export default function PageOutlineNav({
statusDotClass(block.status),
].join(" ")}
/>
- </button>
+ </button>
+ </Tooltip>
</li>
);
})}
diff --git a/web/app/(workspace)/learning/books/components/SpineEditor.tsx b/web/app/(workspace)/learning/books/components/SpineEditor.tsx
index 396c30a22..ae7d1225e 100644
--- a/web/app/(workspace)/learning/books/components/SpineEditor.tsx
+++ b/web/app/(workspace)/learning/books/components/SpineEditor.tsx
@@ -17,6 +17,7 @@ import { useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { bookApi, type EstimateBasis } from "@/lib/book-api";
import type { BookDepth, Chapter, ContentType, Spine } from "@/lib/book-types";
+import Tooltip from "@/shared/ui/Tooltip";
/**
* Each chapter declares a *content type* — a hint to the SectionArchitect
@@ -344,14 +345,19 @@ export default function SpineEditor({
<label className="text-xs text-[var(--muted-foreground)]">
<span className="flex items-center gap-1">
{t("Content type")}
- <span
- className="cursor-help text-[10px] opacity-60"
- title={t(
+ <Tooltip
+ label={t(
"Hint that drives the chapter's block plan (text length, whether to include diagrams / quizzes / code, etc.).",
)}
>
- ⓘ
- </span>
+ <span
+ tabIndex={0}
+ role="note"
+ className="cursor-help text-[10px] opacity-60"
+ >
+ ⓘ
+ </span>
+ </Tooltip>
</span>
<select
value={chapter.content_type}
diff --git a/web/app/(workspace)/learning/books/components/blocks/ConceptGraphBlock.tsx b/web/app/(workspace)/learning/books/components/blocks/ConceptGraphBlock.tsx
index 4fb33ffb1..ae296238e 100644
--- a/web/app/(workspace)/learning/books/components/blocks/ConceptGraphBlock.tsx
+++ b/web/app/(workspace)/learning/books/components/blocks/ConceptGraphBlock.tsx
@@ -134,7 +134,6 @@ export default function ConceptGraphBlock({
<li key={chapter.id}>
<Link
href={bookRoute(bookId, chapter.page_id)}
- title={chapter.title}
className="block rounded-md px-2 py-1.5 hover:bg-[var(--background)]"
>
{label}
@@ -145,7 +144,6 @@ export default function ConceptGraphBlock({
return (
<li
key={chapter.id}
- title={chapter.title}
className="rounded-md px-2 py-1.5 text-[var(--foreground)]"
>
{label}