Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat(academy): redesign to docs editorial style + lessons UX

Sidwebworks9cb2d1c3fddc
diff --git a/apps/academy/app/components/AvatarMenu.tsx b/apps/academy/app/components/AvatarMenu.tsx
index 1473883527..ebd11753cd 100644
--- a/apps/academy/app/components/AvatarMenu.tsx
+++ b/apps/academy/app/components/AvatarMenu.tsx
@@ -6,28 +6,19 @@ import {
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
- DropdownMenuTrigger,
- Switch,
- useMode
+ DropdownMenuTrigger
} from "@carbon/react";
-import { useRef, useState } from "react";
-import { LuHouse, LuLogOut, LuMoon, LuSun, LuUser } from "react-icons/lu";
-import { Form, Link, useFetcher } from "react-router";
+import { useState } from "react";
+import { LuHouse, LuLogOut, LuUser } from "react-icons/lu";
+import { Form, Link } from "react-router";
import { Avatar } from "~/components";
import { useUser } from "~/hooks";
-import type { action } from "~/root";
import { path } from "~/utils/path";
const AvatarMenu = ({ className }: { className?: string }) => {
const user = useUser();
const name = `${user.firstName} ${user.lastName}`;
- const mode = useMode();
-
- const nextMode = mode === "dark" ? "light" : "dark";
- const modeSubmitRef = useRef<HTMLButtonElement>(null);
-
- const fetcher = useFetcher<typeof action>();
const [isOpen, setIsOpen] = useState(false);
return (
@@ -57,34 +48,6 @@ const AvatarMenu = ({ className }: { className?: string }) => {
</Link>
</DropdownMenuItem>
<DropdownMenuSeparator />
- <DropdownMenuItem onSelect={(e) => e.preventDefault()}>
- <div className="flex items-center justify-between w-full">
- <div className="flex items-center justify-start">
- <DropdownMenuIcon
- icon={mode === "dark" ? <LuMoon /> : <LuSun />}
- />
- Dark Mode
- </div>
- <div>
- <Switch
- checked={mode === "dark"}
- onCheckedChange={() => modeSubmitRef.current?.click()}
- />
- <fetcher.Form
- action={path.to.root}
- method="post"
- onSubmit={() => {
- document.body.removeAttribute("style");
- }}
- className="sr-only"
- >
- <input type="hidden" name="mode" value={nextMode} />
- <button ref={modeSubmitRef} className="sr-only" type="submit" />
- </fetcher.Form>
- </div>
- </div>
- </DropdownMenuItem>
- <DropdownMenuSeparator />
<DropdownMenuItem onSelect={(e) => e.preventDefault()}>
<Form method="post" action={path.to.logout}>
<button type="submit" className="w-full flex items-center">
diff --git a/apps/academy/app/components/Breadcrumb.tsx b/apps/academy/app/components/Breadcrumb.tsx
new file mode 100644
index 0000000000..cba105a691
--- /dev/null
+++ b/apps/academy/app/components/Breadcrumb.tsx
@@ -0,0 +1,38 @@
+import { Fragment } from "react";
+import { Link } from "react-router";
+
+export type Crumb = { label: string; href?: string };
+
+/**
+ * Slash-separated trail above a page title — surface → section. The current page is
+ * the <h1> beneath it, so the trail stops at the parent. Mono + faint to sit quietly
+ * above the heading, matching the doc eyebrows.
+ */
+export function Breadcrumb({ items }: { items: Crumb[] }) {
+ return (
+ <nav
+ aria-label="Breadcrumb"
+ className="flex flex-wrap items-center font-mono text-ed-12 leading-4"
+ >
+ {items.map((c, i) => (
+ <Fragment key={`${c.label}-${i}`}>
+ {i > 0 && (
+ <span aria-hidden="true" className="px-[7px] text-ed-ink/30">
+ /
+ </span>
+ )}
+ {c.href ? (
+ <Link
+ to={c.href}
+ className="text-ed-ink/50 no-underline transition-colors hover:text-ed-ink"
+ >
+ {c.label}
+ </Link>
+ ) : (
+ <span className="text-ed-ink/72">{c.label}</span>
+ )}
+ </Fragment>
+ ))}
+ </nav>
+ );
+}
diff --git a/apps/academy/app/components/ChapterCard.tsx b/apps/academy/app/components/ChapterCard.tsx
new file mode 100644
index 0000000000..b123a379ea
--- /dev/null
+++ b/apps/academy/app/components/ChapterCard.tsx
@@ -0,0 +1,53 @@
+import { Link } from "react-router";
+
+function FooterChevron({ dir }: { dir: "left" | "right" }) {
+ return (
+ <svg
+ width="13"
+ height="13"
+ viewBox="0 0 14 14"
+ fill="none"
+ aria-hidden="true"
+ className="shrink-0"
+ >
+ <path
+ d={dir === "left" ? "M8.5 3.5L5 7l3.5 3.5" : "M5.5 3.5L9 7l-3.5 3.5"}
+ stroke="rgba(38,35,35,0.55)"
+ strokeWidth="1.5"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
+
+/** Prev/next navigation card — mirrors the docs reader's ChapterCard, as a router Link. */
+export function ChapterCard({
+ dir,
+ title,
+ to
+}: {
+ dir: "prev" | "next";
+ title: string;
+ to: string;
+}) {
+ const next = dir === "next";
+ return (
+ <Link
+ to={to}
+ className={`group flex w-full items-center gap-2.5 rounded-xl border border-ed-hairline bg-ed-paper/60 px-4 py-3 text-left no-underline shadow-[inset_0_1px_0_#fff] transition-colors hover:border-ed-warm-400 hover:bg-white/70 ${
+ next ? "flex-row-reverse text-right" : ""
+ }`}
+ >
+ <FooterChevron dir={next ? "right" : "left"} />
+ <span className="flex min-w-0 flex-1 flex-col">
+ <span className="font-mono text-ed-10 font-semibold uppercase tracking-[0.08em] text-ed-ink/72">
+ {next ? "Next" : "Previous"}
+ </span>
+ <span className="truncate text-ed-15 font-semi text-ink-ui transition-colors group-hover:text-ed-ink">
+ {title}
+ </span>
+ </span>
+ </Link>
+ );
+}
diff --git a/apps/academy/app/components/CourseCard.tsx b/apps/academy/app/components/CourseCard.tsx
new file mode 100644
index 0000000000..b2654dec12
--- /dev/null
+++ b/apps/academy/app/components/CourseCard.tsx
@@ -0,0 +1,59 @@
+import { LuCircleCheck } from "react-icons/lu";
+import { Link } from "react-router";
+import type { modules } from "~/config";
+import { path } from "~/utils/path";
+import type { CourseProgress } from "~/utils/progress";
+
+type Course = (typeof modules)[number]["courses"][number];
+
+/** Overview card for a single course — icon, name, description, and (signed-in)
+ * a slim progress bar with lesson count. Links into the course detail page. */
+export function CourseCard({
+ moduleId,
+ course,
+ progress,
+ showProgress
+}: {
+ moduleId: string;
+ course: Course;
+ progress: CourseProgress;
+ showProgress: boolean;
+}) {
+ return (
+ <Link
+ to={path.to.course(moduleId, course.id)}
+ className="callout-box group flex flex-col gap-3 p-5 no-underline transition-colors hover:border-ed-warm-400 hover:bg-white/70"
+ >
+ <div className="flex items-start gap-3">
+ <span className="mt-0.5 shrink-0 text-xl text-ed-ink/55 transition-colors group-hover:text-ed-brand-ink">
+ {course.icon}
+ </span>
+ <div className="min-w-0 flex-1">
+ <h3 className="text-ed-16 font-demi leading-snug text-ed-ink">
+ {course.name}
+ </h3>
+ </div>
+ {showProgress && progress.complete && (
+ <LuCircleCheck className="mt-0.5 size-4 shrink-0 text-ed-green-strong" />
+ )}
+ </div>
+ <p className="line-clamp-2 text-ed-13 leading-[1.55] text-ed-ink/60">
+ {course.description}
+ </p>
+ {showProgress && progress.lessonsTotal + progress.challengesTotal > 0 && (
+ <div className="mt-auto flex flex-col gap-1.5 pt-1">
+ <div className="h-[3px] w-full overflow-hidden rounded-full bg-ed-hairline">
+ <div
+ className="h-full rounded-full bg-ed-brand transition-[width] duration-500"
+ style={{ width: `${progress.percent}%` }}
+ />
+ </div>
+ <span className="font-mono text-ed-11 text-ed-ink/45">
+ {progress.lessonsDone}/{progress.lessonsTotal} lessons ·{" "}
+ {progress.percent}%
+ </span>
+ </div>
+ )}
+ </Link>
+ );
+}
diff --git a/apps/academy/app/components/CourseSidebar.tsx b/apps/academy/app/components/CourseSidebar.tsx
new file mode 100644
index 0000000000..a7dec615e6
--- /dev/null
+++ b/apps/academy/app/components/CourseSidebar.tsx
@@ -0,0 +1,111 @@
+import { LuCircleCheck } from "react-icons/lu";
+import { NavLink } from "react-router";
+import { modules } from "~/config";
+import { useProgress } from "~/hooks";
+import { useOptionalUser } from "~/hooks/useUser";
+import { path } from "~/utils/path";
+import { getCourseProgress, toProgressSets } from "~/utils/progress";
+
+/** Inner nav list — reused inside the mobile drawer and the desktop sidebar.
+ * `activeCourseId` force-highlights a course when the URL isn't `/course/*`
+ * (e.g. on lesson/challenge pages). */
+export function CourseSidebarNav({
+ activeCourseId
+}: {
+ activeCourseId?: string;
+}) {
+ const { lessonCompletions, challengeAttempts } = useProgress();
+ const isSignedIn = useOptionalUser() !== null;
+ const { completedLessonIds, passedTopicIds } = toProgressSets(
+ lessonCompletions,
+ challengeAttempts
+ );
+
+ let overallDone = 0;
+ let overallTotal = 0;
+ const courseProgress = new Map<
+ string,
+ ReturnType<typeof getCourseProgress>
+ >();
+ for (const module of modules) {
+ for (const course of module.courses) {
+ const p = getCourseProgress(course, completedLessonIds, passedTopicIds);
+ courseProgress.set(course.id, p);
+ overallDone += p.lessonsDone + p.challengesDone;
+ overallTotal += p.lessonsTotal + p.challengesTotal;
+ }
+ }
+ const overall =
+ overallTotal === 0 ? 0 : Math.round((overallDone / overallTotal) * 100);
+
+ return (
+ <div className="flex flex-col gap-7">
+ {isSignedIn && (
+ <div className="flex flex-col gap-2">
+ <div className="flex items-center justify-between font-mono text-ed-11 uppercase tracking-[0.08em]">
+ <span className="text-ed-ink/55">Progress</span>
+ <span className="text-ed-ink/72">{overall}%</span>
+ </div>
+ <div className="h-[3px] w-full overflow-hidden rounded-full bg-ed-hairline">
+ <div
+ className="h-full rounded-full bg-ed-brand transition-[width] duration-500"
+ style={{ width: `${overall}%` }}
+ />
+ </div>
+ </div>
+ )}
+
+ <nav className="flex flex-col gap-6">
+ {modules.map((module) => (
+ <div key={module.id} className="flex flex-col gap-1.5">
+ <p className="px-2.5 font-mono text-ed-11 font-medium uppercase tracking-[0.08em] text-ed-ink/55">
+ {module.name}
+ </p>
+ <div className="flex flex-col gap-0.5">
+ {module.courses.map((course) => {
+ const p = courseProgress.get(course.id);
+ const forcedActive = course.id === activeCourseId;
+ return (
+ <NavLink
+ key={course.id}
+ to={path.to.course(module.id, course.id)}
+ className={({ isActive }) =>
+ [
+ "group flex items-center justify-between gap-2 rounded-md px-2.5 py-1.5 text-ed-14 no-underline transition-colors",
+ isActive || forcedActive
+ ? "bg-ed-accent-fill font-demi text-ed-blue-text"
+ : "font-book text-ed-ink-66 hover:bg-ed-ink/[0.04] hover:text-ed-ink"
+ ].join(" ")
+ }
+ >
+ <span className="min-w-0 truncate">{course.name}</span>
+ {isSignedIn &&
+ p &&
+ p.lessonsTotal + p.challengesTotal > 0 ? (
+ p.complete ? (
+ <LuCircleCheck className="size-3.5 shrink-0 text-ed-green-strong" />
+ ) : p.percent > 0 ? (
+ <span className="shrink-0 font-mono text-ed-11 text-ed-ink/40">
+ {p.percent}%
+ </span>
+ ) : null
+ ) : null}
+ </NavLink>
+ );
+ })}
+ </div>
+ </div>
+ ))}
+ </nav>
+ </div>
+ );
+}
+
+/** Desktop sticky sidebar — hairline-bordered rail matching the docs Reference. */
+export function CourseSidebar({ activeCourseId }: { activeCourseId?: string }) {
+ return (
+ <aside className="nav-scroll-fade sticky top-16 hidden h-[calc(100dvh-64px)] w-70 shrink-0 overflow-y-auto border-r border-ed-hairline px-5 py-8 scrollbar-hidden-until-scroll lg:block">
+ <CourseSidebarNav activeCourseId={activeCourseId} />
+ </aside>
+ );
+}
diff --git a/apps/academy/app/components/GlossaryText.tsx b/apps/academy/app/components/GlossaryText.tsx
new file mode 100644
index 0000000000..377f85d1b8
--- /dev/null
+++ b/apps/academy/app/components/GlossaryText.tsx
@@ -0,0 +1,22 @@
+import { Fragment } from "react";
+import { linkifyGlossary } from "~/utils/glossary";
+import { Term } from "./Term";
+
+/** Renders a plain string with known Carbon glossary terms auto-wrapped in an
+ * inline definition popover. */
+export function GlossaryText({ children }: { children: string }) {
+ const segments = linkifyGlossary(children);
+ return (
+ <>
+ {segments.map((seg, i) =>
+ typeof seg === "string" ? (
+ <Fragment key={i}>{seg}</Fragment>
+ ) : (
+ <Term key={i} id={seg.slug}>
+ {seg.text}
+ </Term>
+ )
+ )}
+ </>
+ );
+}
diff --git a/apps/academy/app/components/Hero.tsx b/apps/academy/app/components/Hero.tsx
deleted file mode 100644
index 5a36cc1605..0000000000
--- a/apps/academy/app/components/Hero.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-export function Hero({ children }: { children: React.ReactNode }) {
- return (
- <div className="w-full bg-[linear-gradient(to_bottom_right,#ffffff_35.67%,#9ebeed_88.95%)] dark:bg-[linear-gradient(to_bottom_right,#0e0338_35.67%,#1b433e_88.95%)]">
- <div className="flex flex-col gap-6 w-full px-4 max-w-5xl mx-auto my-20 mb-28">
- {children}
- </div>
- </div>
- );
-}
diff --git a/apps/academy/app/components/LearnShell.tsx b/apps/academy/app/components/LearnShell.tsx
new file mode 100644
index 0000000000..68f91ea834
--- /dev/null
+++ b/apps/academy/app/components/LearnShell.tsx
@@ -0,0 +1,30 @@
+import type { ReactNode } from "react";
+import { CourseSidebar } from "./CourseSidebar";
+
+/** The learn surface's two-pane shell: sticky course sidebar (lg+) + content.
+ * Shared by the course layout, lesson, and challenge pages so navigation
+ * context is always present. `activeCourseId` highlights the current course
+ * on pages whose URL isn't `/course/*`. */
+export function LearnShell({
+ children,
+ activeCourseId,
+ rail
+}: {
+ children: ReactNode;
+ activeCourseId?: string;
+ rail?: ReactNode;
+}) {
+ return (
+ <div className="mx-auto flex w-full max-w-370">
+ <CourseSidebar activeCourseId={activeCourseId} />
+ <main className="min-w-0 flex-1 px-6 pb-24 pt-10 lg:px-14">
+ {children}
+ </main>
+ {rail ? (
+ <aside className="hidden w-56 shrink-0 py-10 pr-8 xl:block">
+ {rail}
+ </aside>
+ ) : null}
+ </div>
+ );
+}
diff --git a/apps/academy/app/components/LessonThumb.tsx b/apps/academy/app/components/LessonThumb.tsx
new file mode 100644
index 0000000000..682bde7265
--- /dev/null
+++ b/apps/academy/app/components/LessonThumb.tsx
@@ -0,0 +1,29 @@
+import { cn } from "@carbon/react";
+import { LuCircleCheck, LuCirclePlay } from "react-icons/lu";
+
+/** A small 16:9 video slot for lesson lists — a play icon on a warm tile, with a
+ * check badge when completed. (Loom CDN thumbnails don't reliably load, so we
+ * show the icon rather than a broken image.) */
+export function LessonThumb({
+ completed,
+ className
+}: {
+ completed?: boolean;
+ className?: string;
+}) {
+ return (
+ <span
+ className={cn(
+ "relative flex aspect-video shrink-0 items-center justify-center overflow-hidden rounded-md border border-ed-hairline bg-ed-warm-150",
+ className
+ )}
+ >
+ <LuCirclePlay className="size-4 text-ed-ink-45" />
+ {completed && (
+ <span className="absolute right-0.5 top-0.5 flex size-4 items-center justify-center rounded-full bg-white/90 shadow-sm">
+ <LuCircleCheck className="size-3.5 text-ed-green-strong" />
+ </span>
+ )}
+ </span>
+ );
+}
diff --git a/apps/academy/app/components/MobileNav.tsx b/apps/academy/app/components/MobileNav.tsx
new file mode 100644
index 0000000000..c4d7103d49
--- /dev/null
+++ b/apps/academy/app/components/MobileNav.tsx
@@ -0,0 +1,192 @@
+/**
+ * Mobile navigation drawer. Below `lg` the course sidebar is hidden and the header's
+ * link row collapses, so this is the only way to move around on a phone: a hamburger
+ * in the header opens a left drawer carrying the site nav (Courses · About) plus the
+ * course tree passed as `children`. The scrim and Esc close it; a route change closes
+ * it automatically.
+ */
+import {
+ createContext,
+ type ReactNode,
+ useCallback,
+ useContext,
+ useEffect,
+ useState
+} from "react";
+import { createPortal } from "react-dom";
+import { Link, useLocation } from "react-router";
+import { useOptionalUser } from "~/hooks/useUser";
+import { path } from "~/utils/path";
+
+const NAV = [
+ { key: "courses", label: "Lessons", href: path.to.root, external: false },
+ { key: "docs", label: "Docs", href: path.to.docs, external: true },
+ { key: "glossary", label: "Glossary", href: path.to.glossary, external: true }
+] as const;
+
+type Active = (typeof NAV)[number]["key"];
+
+const CloseCtx = createContext<() => void>(() => undefined);
+/** Lets a nested nav dismiss the drawer after selecting an entry. */
+export const useMobileNavClose = () => useContext(CloseCtx);
+
+function HamburgerIcon({ open }: { open: boolean }) {
+ return (
+ <span className="relative block h-[15px] w-[18px]" aria-hidden="true">
+ <span
+ className={`absolute left-0 h-[1.6px] w-full rounded-full bg-current transition-all duration-300 ease-out ${
+ open ? "top-1/2 -translate-y-1/2 rotate-45" : "top-0.5"
+ }`}
+ />
+ <span
+ className={`absolute left-0 top-1/2 h-[1.6px] w-full -translate-y-1/2 rounded-full bg-current transition-opacity duration-200 ${
+ open ? "opacity-0" : "opacity-100"
+ }`}
+ />
+ <span
+ className={`absolute left-0 h-[1.6px] w-full rounded-full bg-current transition-all duration-300 ease-out ${
+ open ? "top-1/2 -translate-y-1/2 -rotate-45" : "bottom-0.5"
+ }`}
+ />
+ </span>
+ );
+}
+
+export function MobileNav({
+ active,
+ children
+}: {
+ active?: Active;
+ children?: ReactNode;
+}) {
+ const [open, setOpen] = useState(false);
+ const [mounted, setMounted] = useState(false);
+ const { pathname } = useLocation();
+ const user = useOptionalUser();
+ const close = useCallback(() => setOpen(false), []);
+
+ useEffect(() => setMounted(true), []);
+
+ // A route change means the drawer's job is done.
+ // biome-ignore lint/correctness/useExhaustiveDependencies: close on every navigation
+ useEffect(() => {
+ setOpen(false);
+ }, [pathname]);
+
+ // While open: Esc closes, and the body underneath is locked so it can't scroll.
+ useEffect(() => {
+ if (!open) return;
+ const onKey = (e: KeyboardEvent) => {
+ if (e.key === "Escape") setOpen(false);
+ };
+ document.addEventListener("keydown", onKey);
+ const prev = document.body.style.overflow;
+ document.body.style.overflow = "hidden";
+ return () => {
+ document.removeEventListener("keydown", onKey);
+ document.body.style.overflow = prev;
+ };
+ }, [open]);
+
+ return (
+ <>
+ <button
+ type="button"
+ onClick={() => setOpen((v) => !v)}
+ aria-label={open ? "Close menu" : "Open menu"}
+ aria-expanded={open}
+ className="inline-flex h-10 w-10 items-center justify-center rounded-lg border border-ed-ink/10 bg-ed-warm-100 text-ink-ui shadow-[0_1px_2px_0_rgba(0,0,0,0.04)] transition-colors hover:bg-ed-hairline/60 lg:hidden"
+ >
+ <HamburgerIcon open={open} />
+ </button>
+
+ {mounted &&
+ createPortal(
+ <div
+ className={`fixed inset-0 z-[58] lg:hidden ${open ? "" : "pointer-events-none"}`}
+ // `inert` isn't in React 18's DOM types yet; spread it so the closed
+ // panel's controls leave the tab order and a11y tree.
+ {...(!open ? ({ inert: "" } as Record<string, string>) : {})}
+ >
+ <button
+ type="button"
+ tabIndex={-1}
+ aria-label="Close menu"
+ onClick={close}
+ className={`absolute inset-0 cursor-default bg-[rgba(20,18,18,0.34)] backdrop-blur-[1px] transition-opacity duration-300 ${
+ open ? "opacity-100" : "opacity-0"
+ }`}
+ />
+
+ <aside
+ role="dialog"
+ aria-modal="true"
+ aria-label="Navigation"
+ className={`absolute bottom-0 left-0 top-16 flex w-[min(86vw,340px)] flex-col overflow-y-auto overscroll-contain border-r border-ed-hairline bg-ed-paper shadow-[8px_0_40px_-12px_rgba(38,35,35,0.28)] transition-transform duration-300 ease-out scrollbar-hidden-until-scroll ${
+ open ? "translate-x-0" : "-translate-x-full"
+ }`}
+ >
+ <div className="flex flex-1 flex-col px-5 pb-6 pt-[22px]">
+ <p className="mb-2 px-1 font-mono text-ed-11 font-semibold uppercase tracking-[0.08em] text-ed-ink/50">
+ Browse
+ </p>
+ <nav className="flex flex-col gap-0.5">
+ {NAV.map((item) => {
+ const cls = `rounded-lg px-3 py-2.5 text-ed-16 leading-[140%] tracking-[0.15px] no-underline transition-colors ${
+ active === item.key
+ ? "bg-ed-brand/10 font-demi text-ed-brand-ink"
+ : "font-book text-ink-ui hover:bg-ed-hairline/55"
+ }`;
+ return item.external ? (
+ <a
+ key={item.key}
+ href={item.href}
+ target="_blank"
+ rel="noopener noreferrer"
+ className={cls}
+ >
+ {item.label}
+ </a>
+ ) : (
+ <Link
+ key={item.key}
+ to={item.href}
+ aria-current={active === item.key ? "page" : undefined}
+ className={cls}
+ >
+ {item.label}
+ </Link>
+ );
+ })}
+ </nav>
+
+ {children ? (
+ <CloseCtx.Provider value={close}>
+ <div className="mt-[22px] border-t border-ed-hairline pt-[22px]">
+ {children}
+ </div>
+ </CloseCtx.Provider>
+ ) : null}
+
+ {!user ? (
+ <Link
+ to={path.to.login}
+ className="group relative mt-[26px] inline-flex h-11 items-center justify-center rounded-lg no-underline"
+ >
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg cta-btn-dark"
+ />
+ <span className="text-on-dark relative z-10 text-ed-15 font-book tracking-[0.15px]">
+ Login
+ </span>
+ </Link>
+ ) : null}
+ </div>
+ </aside>
+ </div>,
+ document.body
+ )}
+ </>
+ );
+}
diff --git a/apps/academy/app/components/OnThisPage.tsx b/apps/academy/app/components/OnThisPage.tsx
new file mode 100644
index 0000000000..eb7b671988
--- /dev/null
+++ b/apps/academy/app/components/OnThisPage.tsx
@@ -0,0 +1,162 @@
+import { type MouseEvent, useEffect, useRef, useState } from "react";
+import { useLocation } from "react-router";
+
+type TocLesson = { id: string; text: string };
+type TocTopic = { id: string; text: string; lessons: TocLesson[] };
+
+/** "On this page" rail — an outline of the article's `section[id]` topics and,
+ * nested under each, its lesson rows (`[data-toc-lesson]`). Scrollspies the
+ * active anchor. Renders nothing when the page has no such sections, so it
+ * self-hides on pages without a topic list. */
+export function OnThisPage() {
+ const { pathname } = useLocation();
+ const [topics, setTopics] = useState<TocTopic[]>([]);
+ const [active, setActive] = useState("");
+ const navRef = useRef<HTMLElement>(null);
+ const activeRef = useRef<HTMLAnchorElement>(null);
+
+ // Keep the active entry visible inside the TOC's own scroll area (like docs) —
+ // scrolls only the nav container, never the page.
+ // biome-ignore lint/correctness/useExhaustiveDependencies: re-run when active changes
+ useEffect(() => {
+ const el = activeRef.current;
+ const scroller = navRef.current;
+ if (!el || !scroller) return;
+ const er = el.getBoundingClientRect();
+ const sr = scroller.getBoundingClientRect();
+ const PAD = 24;
+ if (er.top < sr.top + PAD) {
+ scroller.scrollTo({
+ top: scroller.scrollTop - (sr.top + PAD - er.top),
+ behavior: "smooth"
+ });
+ } else if (er.bottom > sr.bottom - PAD) {
+ scroller.scrollTo({
+ top: scroller.scrollTop + (er.bottom - sr.bottom + PAD),
+ behavior: "smooth"
+ });
+ }
+ }, [active]);
+
+ // biome-ignore lint/correctness/useExhaustiveDependencies: re-scan on route change
+ useEffect(() => {
+ const sections = Array.from(
+ document.querySelectorAll<HTMLElement>("main section[id]")
+ );
+ const items: TocTopic[] = sections
+ .map((section) => ({
+ id: section.id,
+ text: section.querySelector("h2, h3")?.textContent ?? "",
+ lessons: Array.from(
+ section.querySelectorAll<HTMLElement>("[data-toc-lesson]")
+ )
+ .filter((el) => el.id)
+ .map((el) => ({ id: el.id, text: el.dataset.tocTitle ?? "" }))
+ }))
+ .filter((t) => t.text.trim());
+ setTopics(items);
+
+ // Observe every topic + lesson anchor, in document order, for scrollspy.
+ const nodes = sections.flatMap((section) => [
+ section,
+ ...Array.from(section.querySelectorAll<HTMLElement>("[data-toc-lesson]"))
+ ]);
+ if (nodes.length === 0) return;
+
+ // Active = the deepest anchor whose top has scrolled above the fold line.
+ // Iterating in document order means a lesson wins over its parent section
+ // (both are "above the line", the lesson is last).
+ const recompute = () => {
+ const line = 120;
+ let current = nodes[0]?.id ?? "";
+ for (const n of nodes) {
+ if (n.getBoundingClientRect().top <= line) current = n.id;
+ else break;
+ }
+ setActive(current);
+ };
+ recompute();
+
+ const observer = new IntersectionObserver(recompute, {
+ rootMargin: "-110px 0px -60% 0px",
+ threshold: [0, 1]
+ });
+ for (const n of nodes) observer.observe(n);
+ window.addEventListener("scroll", recompute, { passive: true });
+ return () => {
+ observer.disconnect();
+ window.removeEventListener("scroll", recompute);
+ };
+ }, [pathname]);
+
+ // Explicit scroll on click — a bare `#hash` anchor gets swallowed by the SPA's
+ // scroll restoration, so drive it ourselves. scrollIntoView honors the target's
+ // scroll-margin (the fixed-header offset); the hash update lights the :target row.
+ const go = (id: string) => (e: MouseEvent) => {
+ e.preventDefault();
+ setActive(id);
+ document.getElementById(id)?.scrollIntoView({
+ behavior: "smooth",
+ block: "start"
+ });
+ window.history.replaceState(null, "", `#${id}`);
+ };
+
+ if (topics.length === 0) return null;
+
+ return (
+ <nav
+ ref={navRef}
+ className="sticky top-24 max-h-[calc(100dvh-120px)] overflow-y-auto pr-2 scrollbar-hidden-until-scroll"
+ >
+ <p className="mb-3 font-mono text-ed-11 font-semibold uppercase tracking-[0.1em] text-ed-ink/45">
+ On this page
+ </p>
+ <ul className="m-0 flex list-none flex-col border-l border-ed-hairline p-0">
+ {topics.flatMap((topic) => {
+ const topicInFocus =
+ active === topic.id || topic.lessons.some((l) => l.id === active);
+ return [
+ <li key={topic.id} className="-ml-px">
+ <a
+ ref={active === topic.id ? activeRef : undefined}
+ href={`#${topic.id}`}
+ onClick={go(topic.id)}
+ aria-current={active === topic.id ? "location" : undefined}
+ className={`block border-l-2 py-1.5 pl-4 text-ed-13 leading-snug no-underline transition-colors duration-150 ${
+ active === topic.id
+ ? "border-ed-brand-ink font-demi text-ed-brand-ink"
+ : topicInFocus
+ ? "border-transparent font-demi text-ed-ink"
+ : "border-transparent font-demi text-ed-ink/60 hover:text-ed-ink"
+ }`}
+ >
+ {topic.text}
+ </a>
+ </li>,
+ ...topic.lessons.map((lesson) => {
+ const isActive = active === lesson.id;
+ return (
+ <li key={lesson.id} className="-ml-px">
+ <a
+ ref={isActive ? activeRef : undefined}
+ href={`#${lesson.id}`}
+ onClick={go(lesson.id)}
+ aria-current={isActive ? "location" : undefined}
+ className={`block border-l-2 py-1 pl-7 text-ed-12 leading-snug no-underline transition-colors duration-150 ${
+ isActive
+ ? "border-ed-brand-ink font-book text-ed-brand-ink"
+ : "border-transparent font-book text-ed-ink/50 hover:text-ed-ink/80"
+ }`}
+ >
+ {lesson.text}
+ </a>
+ </li>
+ );
+ })
+ ];
+ })}
+ </ul>
+ </nav>
+ );
+}
diff --git a/apps/academy/app/components/SearchCommand.tsx b/apps/academy/app/components/SearchCommand.tsx
new file mode 100644
index 0000000000..597aa1ef4d
--- /dev/null
+++ b/apps/academy/app/components/SearchCommand.tsx
@@ -0,0 +1,139 @@
+import {
+ CommandDialog,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+ Kbd
+} from "@carbon/react";
+import { useEffect, useState } from "react";
+import { LuBookOpen, LuCirclePlay, LuSearch } from "react-icons/lu";
+import { useNavigate } from "react-router";
+import { modules } from "~/config";
+import { path } from "~/utils/path";
+
+type SearchEntry = {
+ type: "course" | "lesson";
+ label: string;
+ sublabel: string;
+ href: string;
+ keywords: string;
+};
+
+// Static index built once from the course catalog — one entry per course + lesson.
+const INDEX: SearchEntry[] = modules.flatMap((module) =>
+ module.courses.flatMap((course) => {
+ const courseEntry: SearchEntry = {
+ type: "course",
+ label: course.name,
+ sublabel: module.name,
+ href: path.to.course(module.id, course.id),
+ keywords: course.description
+ };
+ const lessonEntries: SearchEntry[] = course.topics.flatMap((topic) =>
+ topic.lessons.map((lesson) => ({
+ type: "lesson",
+ label: lesson.name,
+ sublabel: `${course.name} · ${topic.name}`,
+ href: path.to.lesson(lesson.id),
+ keywords: `${module.name} ${topic.name} ${lesson.description}`
+ }))
+ );
+ return [courseEntry, ...lessonEntries];
+ })
+);
+
+const COURSES = INDEX.filter((e) => e.type === "course");
+const LESSONS = INDEX.filter((e) => e.type === "lesson");
+
+/** Global ⌘K command palette over courses + lessons. Renders its own trigger
+ * button (drop it in the header) and dialog; ⌘K / Ctrl+K toggles it. */
+export function SearchCommand() {
+ const navigate = useNavigate();
+ const [open, setOpen] = useState(false);
+ const [query, setQuery] = useState("");
+
+ useEffect(() => {
+ const onKey = (e: KeyboardEvent) => {
+ if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
+ e.preventDefault();
+ setOpen((v) => !v);
+ }
+ };
+ document.addEventListener("keydown", onKey);
+ return () => document.removeEventListener("keydown", onKey);
+ }, []);
+
+ useEffect(() => {
+ if (!open) setQuery("");
+ }, [open]);
+
+ const onSelect = (href: string) => {
+ setOpen(false);
+ navigate(href);
+ };
+
+ const hasQuery = query.trim().length > 0;
+ const renderItem = (entry: SearchEntry) => {
+ const Icon = entry.type === "course" ? LuBookOpen : LuCirclePlay;
+ return (
+ <CommandItem
+ key={entry.href}
+ value={`${entry.label} ${entry.sublabel} ${entry.keywords}`}
+ onSelect={() => onSelect(entry.href)}
+ className="gap-3"
+ >
+ <Icon className="size-4 shrink-0 text-ed-ink/45" />
+ <div className="flex min-w-0 flex-1 flex-col">
+ <span className="truncate text-sm font-medium">{entry.label}</span>
+ <span className="truncate text-[11px] text-muted-foreground">
+ {entry.sublabel}
+ </span>
+ </div>
+ </CommandItem>
+ );
+ };
+
+ return (
+ <>
+ <button
+ type="button"
+ onClick={() => setOpen(true)}
+ aria-label="Search courses and lessons"
+ className="inline-flex h-10 items-center gap-2 rounded-lg border border-ed-ink/10 bg-ed-warm-100 px-3 text-ed-14 font-book text-ink-faint shadow-[0_1px_2px_0_rgba(0,0,0,0.04)] transition-colors hover:bg-ed-hairline/60"
+ >
+ <LuSearch className="size-4" />
+ <span className="hidden sm:inline">Search</span>
+ <Kbd className="hidden sm:inline-flex">⌘K</Kbd>
+ </button>
+
+ <CommandDialog open={open} onOpenChange={setOpen}>
+ <CommandInput
+ placeholder="Search courses and lessons..."
+ value={query}
+ onValueChange={setQuery}
+ />
+ <CommandList className="max-h-[440px]">
+ {hasQuery ? (
+ <>
+ <CommandEmpty className="py-6 text-center text-sm text-muted-foreground">
+ No matches
+ </CommandEmpty>
+ <CommandGroup heading="Courses">
+ {COURSES.map(renderItem)}
+ </CommandGroup>
+ <CommandGroup heading="Lessons">
+ {LESSONS.map(renderItem)}
+ </CommandGroup>
+ </>
+ ) : (
+ <div className="py-6 text-center text-sm text-muted-foreground">
+ Type to search courses and lessons
+ </div>
+ )}
+ </CommandList>
+ </CommandDialog>
+ </>
+ );
+}
diff --git a/apps/academy/app/components/Share.tsx b/apps/academy/app/components/Share.tsx
index 3eac828449..d27bad967c 100644
--- a/apps/academy/app/components/Share.tsx
+++ b/apps/academy/app/components/Share.tsx
@@ -33,8 +33,7 @@ const Share = ({
variant="secondary"
aria-label="Copy"
className={cn(
- "text-white",
- isCopied && "text-emerald-500 hover:text-emerald-500",
+ isCopied && "text-ed-green-strong hover:text-ed-green-strong",
className
)}
rightIcon={
diff --git a/apps/academy/app/components/SiteHeader.tsx b/apps/academy/app/components/SiteHeader.tsx
new file mode 100644
index 0000000000..d741e88f34
--- /dev/null
+++ b/apps/academy/app/components/SiteHeader.tsx
@@ -0,0 +1,108 @@
+import type { ReactNode } from "react";
+import { LuFingerprint } from "react-icons/lu";
+import { Link } from "react-router";
+import { useOptionalUser } from "~/hooks/useUser";
+import { path } from "~/utils/path";
+import AvatarMenu from "./AvatarMenu";
+import { MobileNav } from "./MobileNav";
+import { SearchCommand } from "./SearchCommand";
+
+const NAV = [
+ { key: "courses", label: "Lessons", href: path.to.root, external: false },
+ { key: "docs", label: "Docs", href: path.to.docs, external: true },
+ { key: "glossary", label: "Glossary", href: path.to.glossary, external: true }
+] as const;
+
+const navLinkClass = (isActive: boolean) =>
+ `nav-link rounded-[7px] px-2.5 py-1.5 text-ed-15 leading-normal tracking-[0.15px] no-underline transition-colors ${
+ isActive
+ ? "text-ink-ui font-demi"
+ : "text-ink-faint font-book hover:text-ink-ui hover:bg-ed-hairline/55"
+ }`;
+
+/** Site-wide header — warm-paper, fixed, docs-style. Carbon wordmark · Courses,
+ * with the login CTA / avatar on the right. `mobileNav` is the course tree,
+ * surfaced in the hamburger drawer below `lg`. */
+export function SiteHeader({ mobileNav }: { mobileNav?: ReactNode }) {
+ const user = useOptionalUser();
+ const active = "courses" as const;
+
+ return (
+ <header
+ className="fixed inset-x-0 top-0 z-[60] h-16"
+ style={{
+ background: "#F5F5F2",
+ borderBottom: "1px solid #E8E7E6",
+ boxShadow: "0 1px 0 0 #fff"
+ }}
+ >
+ <div className="mx-auto flex h-full w-full max-w-370 items-center justify-between px-6 md:px-8">
+ <div className="flex items-center gap-[26px]">
+ <Link
+ to={path.to.root}
+ className="flex shrink-0 items-center no-underline"
+ aria-label="Carbon Academy home"
+ >
+ <img
+ src="/carbon-word-light.svg"
+ alt="Carbon"
+ width={99}
+ height={24}
+ className="block"
+ />
+ </Link>
+ <nav className="hidden items-center gap-0.5 lg:flex">
+ {NAV.map((item) =>
+ item.external ? (
+ <a
+ key={item.key}
+ href={item.href}
+ target="_blank"
+ rel="noopener noreferrer"
+ className={navLinkClass(false)}
+ >
+ {item.label}
+ </a>
+ ) : (
+ <Link
+ key={item.key}
+ to={item.href}
+ aria-current={active === item.key ? "page" : undefined}
+ className={navLinkClass(active === item.key)}
+ >
+ {item.label}
+ </Link>
+ )
+ )}
+ </nav>
+ </div>
+
+ <div className="flex items-center gap-2.5">
+ <SearchCommand />
+ {user ? (
+ <AvatarMenu />
+ ) : (
+ <Link
+ to={path.to.login}
+ className="group relative hidden h-10 items-center justify-center rounded-lg px-4 no-underline sm:inline-flex"
+ >
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg cta-btn-dark"
+ />
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg btn-dark-hover opacity-0 transition-opacity duration-200 ease-out group-hover:opacity-100"
+ />
+ <span className="text-on-dark relative z-10 inline-flex items-center gap-1.5 text-ed-14 font-book tracking-[0.15px]">
+ <LuFingerprint className="size-3.5" />
+ Login
+ </span>
+ </Link>
+ )}
+ <MobileNav active={active}>{mobileNav}</MobileNav>
+ </div>
+ </div>
+ </header>
+ );
+}
diff --git a/apps/academy/app/components/Term.tsx b/apps/academy/app/components/Term.tsx
new file mode 100644
index 0000000000..a4b80ead04
--- /dev/null
+++ b/apps/academy/app/components/Term.tsx
@@ -0,0 +1,48 @@
+import {
+ getDefinitionText,
+ getTermText,
+ lookupEntry,
+ termSlug
+} from "@carbon/glossary";
+import { Popover, PopoverContent, PopoverTrigger } from "@carbon/react";
+import type { ReactNode } from "react";
+
+/**
+ * Inline glossary term — dotted blue underline; click opens a popover with the
+ * definition. Reads the source English (academy has no Lingui runtime, like the
+ * docs site). An unknown slug renders the children plainly, so a glossary gap
+ * never breaks prose.
+ */
+export function Term({ id, children }: { id?: string; children: ReactNode }) {
+ const key = id ?? (typeof children === "string" ? termSlug(children) : "");
+ const entry = lookupEntry(key);
+
+ if (!entry) return <>{children}</>;
+
+ return (
+ <Popover>
+ <PopoverTrigger asChild>
+ <button
+ type="button"
+ className="inline cursor-help appearance-none border-0 bg-transparent p-0 align-baseline [font:inherit] text-inherit underline decoration-ed-brand-ink decoration-dotted decoration-[1.5px] underline-offset-[3.5px] transition-colors hover:decoration-ed-blue-text focus:outline-none"
+ >
+ {children}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ side="top"
+ align="start"
+ sideOffset={8}
+ collisionPadding={16}
+ className="w-75 max-w-[calc(100vw-32px)] rounded-[10px] border border-ed-warm-300 bg-white px-[15px] py-3.5 shadow-[0_4px_20px_rgba(38,35,35,0.10)]"
+ >
+ <div className="text-ed-13 font-demi text-ed-ink">
+ {getTermText(entry)}
+ </div>
+ <div className="mt-[5px] text-ed-13 leading-[1.55] text-ed-ink/72">
+ {getDefinitionText(entry)}
+ </div>
+ </PopoverContent>
+ </Popover>
+ );
+}
diff --git a/apps/academy/app/config.tsx b/apps/academy/app/config.tsx
index 0f55ecf550..df7bf31433 100644
--- a/apps/academy/app/config.tsx
+++ b/apps/academy/app/config.tsx
@@ -19,8 +19,6 @@ type Config = Module[];
type Module = {
name: string;
id: string;
- background: string;
- foreground: string;
courses: Course[];
};
@@ -59,8 +57,6 @@ type Lesson = {
export const modules: Config = [
{
name: "Carbon Overview",
- background: "#6041d0",
- foreground: "#fff",
id: "carbon-overview",
courses: [
{
@@ -215,8 +211,6 @@ export const modules: Config = [
},
{
name: "Getting Started",
- background: "#4AA99D",
- foreground: "#fff",
id: "getting-started",
courses: [
{
@@ -353,8 +347,6 @@ export const modules: Config = [
},
{
name: "Parts and Materials",
- background: "#488FB9",
- foreground: "#fff",
id: "parts-materials",
courses: [
{
@@ -634,8 +626,6 @@ export const modules: Config = [
},
{
name: "Selling",
- background: "#3c5ec0",
- foreground: "#fff",
id: "selling",
courses: [
{
@@ -814,8 +804,6 @@ export const modules: Config = [
},
{
name: "Manufacturing",
- background: "#EFB655",
- foreground: "#000000cc",
id: "manufacturing",
courses: [
{
@@ -1041,8 +1029,6 @@ export const modules: Config = [
},
{
name: "Buying",
- background: "#EF8729",
- foreground: "#fff",
id: "buying",
courses: [
{
@@ -1247,8 +1233,6 @@ export const modules: Config = [
},
{
name: "Quality",
- background: "#DD6444",
- foreground: "#fff",
id: "quality",
courses: [
{
@@ -1314,8 +1298,6 @@ export const modules: Config = [
},
{
name: "Developing",
- background: "#10d131",
- foreground: "#000000cc",
id: "developing",
courses: [
{
diff --git a/apps/academy/app/root.tsx b/apps/academy/app/root.tsx
index 185e33e2ff..248b79fbd4 100644
--- a/apps/academy/app/root.tsx
+++ b/apps/academy/app/root.tsx
@@ -1,9 +1,4 @@
-import {
- CONTROLLED_ENVIRONMENT,
- error,
- getBrowserEnv,
- getCarbon
-} from "@carbon/auth";
+import { CONTROLLED_ENVIRONMENT, getBrowserEnv, getCarbon } from "@carbon/auth";
import { flashClientMiddleware } from "@carbon/auth/middleware/flash.client";
import {
flashHeadersContext,
@@ -11,29 +6,18 @@ import {
flashResultContext
} from "@carbon/auth/middleware/flash.server";
import { getOrRefreshAuthSession } from "@carbon/auth/session.server";
-import { validator } from "@carbon/form";
import { requestIdMiddleware } from "@carbon/logger/middleware.server";
import {
- Button,
- cn,
- Heading,
- IconButton,
OperatingSystemContextProvider,
- Progress,
Toaster,
- TooltipProvider,
- useDisclosure,
- useMode
+ TooltipProvider
} from "@carbon/react";
-import { getPreferenceHeaders, modeValidator } from "@carbon/utils";
+import { getPreferenceHeaders } from "@carbon/utils";
import { faviconLinks } from "@carbon/utils/favicon";
import { I18nProvider } from "@react-aria/i18n";
import { Analytics } from "@vercel/analytics/react";
-import { motion } from "framer-motion";
import type React from "react";
-import { LuChevronDown, LuFingerprint, LuMoon, LuSun } from "react-icons/lu";
import type {
- ActionFunctionArgs,
LinksFunction,
LoaderFunctionArgs,
MetaFunction
@@ -41,22 +25,17 @@ import type {
import {
data,
isRouteErrorResponse,
- Link,
Links,
Meta,
- NavLink,
Outlet,
Scripts,
ScrollRestoration,
- useFetcher,
useLoaderData
} from "react-router";
-import { modules } from "~/config";
-import { getMode, setMode } from "~/services/mode.server";
import NProgress from "~/styles/nprogress.css?url";
import Tailwind from "~/styles/tailwind.css?url";
-import AvatarMenu from "./components/AvatarMenu";
-import { useOptionalUser } from "./hooks/useUser";
+import { CourseSidebarNav } from "./components/CourseSidebar";
+import { SiteHeader } from "./components/SiteHeader";
import { path } from "./utils/path";
export const middleware = [requestIdMiddleware, flashMiddleware];
@@ -138,7 +117,6 @@ export async function loader({ request, context }: LoaderFunctionArgs) {
SUPABASE_ANON_KEY
},
lessonCompletions,
- mode: getMode(request),
preferences: getPreferenceHeaders(request),
result: context.get(flashResultContext),
user,
@@ -150,45 +128,15 @@ export async function loader({ request, context }: LoaderFunctionArgs) {
);
}
-export async function action({ request }: ActionFunctionArgs) {
- const contentType = request.headers.get("content-type") ?? "";
- if (
- !contentType.includes("multipart/form-data") &&
- !contentType.includes("application/x-www-form-urlencoded")
- ) {
- return data({ error: "Invalid content type" }, { status: 400 });
- }
-
- const validation = await validator(modeValidator).validate(
- await request.formData()
- );
-
- if (validation.error) {
- return data(error(validation.error, "Invalid mode"), {
- status: 400
- });
- }
-
- return data(
- {},
- {
- headers: { "Set-Cookie": setMode(validation.data.mode) }
- }
- );
-}
-
function Document({
children,
- title = "Carbon",
- mode = "light"
+ title = "Carbon"
}: {
children: React.ReactNode;
title?: string;
- mode?: "light" | "dark";
- theme?: string;
}) {
return (
- <html lang="en" className={`${mode} h-full overflow-x-hidden`}>
+ <html lang="en" className="h-full overflow-x-hidden">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
@@ -211,221 +159,15 @@ export default function App() {
const loaderData = useLoaderData<typeof loader>();
const env = loaderData?.env ?? {};
const prefs = loaderData?.preferences;
- const theme = "zinc";
-
- const challengeAttempts = loaderData?.challengeAttempts ?? [];
-
- const disclosure = useDisclosure();
-
- /* Dark/Light Mode */
- const mode = useMode();
-
- const fetcher = useFetcher<typeof action>();
- const user = useOptionalUser();
-
- // Calculate total challenges from modules config
- const totalChallenges = modules.reduce((total, module) => {
- return (
- total +
- module.courses.reduce((courseTotal, course) => {
- return (
- courseTotal +
- course.topics.reduce((topicTotal, topic) => {
- const hasChallenge = topic.challenge && topic.challenge.length > 0;
- return topicTotal + (hasChallenge ? 1 : 0);
- }, 0)
- );
- }, 0)
- );
- }, 0);
-
- const passedChallenges = challengeAttempts
- .filter((attempt) => attempt.passed)
- .filter(
- (attempt, index, self) =>
- index === self.findIndex((a) => a.topicId === attempt.topicId)
- ).length;
-
- const completionPercentage = Math.round(
- (passedChallenges / totalChallenges) * 100
- );
return (
<OperatingSystemContextProvider platform={prefs.platform}>
<I18nProvider locale={prefs.locale}>
- <Document mode={mode} theme={theme}>
- <header className="flex select-none items-center py-4 pl-5 pr-2 h-[var(--header-height)]">
- <div className="max-w-5xl mx-auto px-4 flex items-center justify-between gap-2 z-logo text-foreground w-full">
- <a
- href="https://carbon.ms"
- target="_blank"
- rel="noopener noreferrer"
- className="cursor-pointer inline-flex flex-row items-end gap-2 flex-shrink-0 font-display"
- >
- <img
- src="/carbon-word-light.svg"
- alt="Carbon"
- className="h-7 w-auto block dark:hidden"
- />
- <img
- src="/carbon-word-dark.svg"
- alt="Carbon"
- className="h-7 w-auto hidden dark:block"
- />
- </a>
- <div className="flex items-center">
- <div className="items-center gap-1 hidden md:flex">
- <Button variant="ghost" asChild>
- <NavLink to={path.to.about}>About</NavLink>
- </Button>
- {user ? (
- <AvatarMenu className="ml-2" />
- ) : (
- <>
- <Button
- variant="ghost"
- className="cursor-pointer"
- rightIcon={<LuFingerprint className="size-4" />}
- asChild
- >
- <NavLink to={path.to.login}>Login</NavLink>
- </Button>
- <fetcher.Form action={path.to.root} method="post">
- <input
- type="hidden"
- name="mode"
- value={mode === "light" ? "dark" : "light"}
- />
- <IconButton
- aria-label="Toggle Light Mode and Dark Mode"
- type="submit"
- variant="ghost"
- icon={mode === "light" ? <LuMoon /> : <LuSun />}
- className="cursor-pointer"
- />
- </fetcher.Form>
- </>
- )}
- </div>
- </div>
- </div>
- </header>
- {user && (
- <div className="w-full bg-primary dark:bg-[#2f31ae]">
- <div className="max-w-5xl mx-auto px-3 py-4 flex gap-8 z-logo items-center text-white w-full">
- <span className="text-xl font-display">
- {/* <span className="hidden lg:inline">Credential</span> */}
- Progress
- </span>
- <div className="flex items-center justify-between gap-2 flex-1">
- <Progress value={completionPercentage} />
- <span className="text-xl font-display">
- {completionPercentage}%
- </span>
- </div>
- <Button
- variant="ghost"
- className="text-white hover:text-white/90"
- rightIcon={
- <LuChevronDown
- className={`transition-transform duration-300 ${
- disclosure.isOpen ? "rotate-180" : ""
- }`}
- />
- }
- onClick={disclosure.onToggle}
- >
- {disclosure.isOpen ? "Less" : "More"}
- </Button>
- </div>
- <motion.div
- className={cn(
- "w-full bg-black/20",
- disclosure.isOpen ? "overflow-visible" : "overflow-hidden"
- )}
- initial={{ height: 0, opacity: 0 }}
- animate={{
- height: disclosure.isOpen ? "auto" : 0,
- opacity: disclosure.isOpen ? 1 : 0
- }}
- transition={{
- height: {
- duration: 0.3,
- ease: "easeInOut"
- },
- opacity: {
- duration: 0.2,
- delay: disclosure.isOpen ? 0.1 : 0,
- ease: "easeInOut"
- }
- }}
- >
- <div className="max-w-5xl mx-auto px-3 py-4 flex gap-8 z-logo items-center text-white w-full">
- <div className="w-full bg-white/10 rounded-lg p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-8">
- {modules.map((module) =>
- module.courses.map((course) => {
- const totalChallenges = course.topics.reduce(
- (acc, topic) =>
- acc +
- (topic.challenge && topic.challenge.length > 0
- ? 1
- : 0),
- 0
- );
-
- const completedChallenges = challengeAttempts.filter(
- (attempt) =>
- attempt.courseId === course.id && attempt.passed
- ).length;
-
- const percentage = Math.min(
- Math.round(
- (completedChallenges / totalChallenges) * 100
- ),
- 100
- );
-
- if (totalChallenges === 0) {
- return null;
- }
-
- return (
- <Link
- to={path.to.course(module.id, course.id)}
- key={course.id}
- className={cn(
- "cursor-pointer flex items-center gap-2",
- percentage === 0 && "opacity-50"
- )}
- >
- <div
- className="size-8 rounded-lg flex items-center justify-center"
- style={{
- backgroundColor: module.background,
- color: module.foreground
- }}
- >
- {course.icon}
- </div>
- <div className="flex-1 text-xs flex flex-col gap-2">
- <div className="flex items-center justify-between gap-2">
- <span className="font-medium">
- {course.name}
- </span>
- <span>{percentage}%</span>
- </div>
- <Progress value={percentage} className="h-2" />
- </div>
- </Link>
- );
- })
- )}
- </div>
- </div>
- </motion.div>
- </div>
- )}
- <Outlet />
+ <Document>
+ <SiteHeader mobileNav={<CourseSidebarNav />} />
+ <div className="pt-16 min-h-screen bg-ed-paper">
+ <Outlet />
+ </div>
<script
dangerouslySetInnerHTML={{
__html: `window.env = ${JSON.stringify(env)}`
@@ -446,24 +188,28 @@ export function ErrorBoundary({ error }: { error: unknown }) {
return (
<Document title="Error!">
- <div className="light">
- <div className="flex flex-col w-full h-screen items-center justify-center space-y-4 ">
- <img
- src="/carbon-mark-light.svg"
- alt="Carbon Logo"
- className="block max-w-[60px] dark:hidden"
- />
- <img
- src="/carbon-mark-dark.svg"
- alt="Carbon Logo"
- className="max-w-[60px] hidden dark:block"
+ <div className="flex flex-col w-full h-screen items-center justify-center gap-5 bg-ed-paper px-6 text-center">
+ <img
+ src="/carbon-mark-light.svg"
+ alt="Carbon"
+ className="block max-w-[56px]"
+ />
+ <h1 className="text-ed-24 font-semi text-ed-ink">
+ Something went wrong
+ </h1>
+ <p className="max-w-xl text-ed-15 text-ed-ink-66">{message}</p>
+ <a
+ href={path.to.root}
+ className="group relative inline-flex h-10 items-center justify-center rounded-lg px-5 no-underline"
+ >
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg cta-btn-dark"
/>
- <Heading size="h1">Something went wrong</Heading>
- <p className="text-muted-foreground max-w-2xl">{message}</p>
- <Button onClick={() => (window.location.href = "/")}>
- Back Home
- </Button>
- </div>
+ <span className="text-on-dark relative z-10 text-ed-14 font-book tracking-[0.15px]">
+ Back home
+ </span>
+ </a>
</div>
</Document>
);
diff --git a/apps/academy/app/routes/_auth+/callback.tsx b/apps/academy/app/routes/_auth+/callback.tsx
index fd3d9b04b2..f75a10eb9b 100644
--- a/apps/academy/app/routes/_auth+/callback.tsx
+++ b/apps/academy/app/routes/_auth+/callback.tsx
@@ -143,16 +143,7 @@ export default function AuthCallback() {
return (
<div className="flex flex-col items-center justify-center">
<div className="flex justify-center mb-8">
- <img
- src="/carbon-mark-light.svg"
- alt="Carbon Logo"
- className="w-24 dark:hidden"
- />
- <img
- src="/carbon-mark-dark.svg"
- alt="Carbon Logo"
- className="w-24 hidden dark:block"
- />
+ <img src="/carbon-mark-light.svg" alt="Carbon Logo" className="w-24" />
</div>
{error ? (
<div className="rounded-lg md:bg-card md:border md:border-border md:shadow-lg p-8 mt-8 w-[380px]">
diff --git a/apps/academy/app/routes/_auth+/login.tsx b/apps/academy/app/routes/_auth+/login.tsx
index 0aa69a5281..ae693ff186 100644
--- a/apps/academy/app/routes/_auth+/login.tsx
+++ b/apps/academy/app/routes/_auth+/login.tsx
@@ -144,16 +144,7 @@ export default function LoginRoute() {
return (
<>
<div className="flex justify-center mb-8">
- <img
- src="/carbon-mark-light.svg"
- alt="Carbon Logo"
- className="w-24 dark:hidden"
- />
- <img
- src="/carbon-mark-dark.svg"
- alt="Carbon Logo"
- className="w-24 hidden dark:block"
- />
+ <img src="/carbon-mark-light.svg" alt="Carbon Logo" className="w-24" />
</div>
<div className="rounded-lg md:bg-card md:border md:border-border md:shadow-lg p-8 w-[380px]">
{fetcher.data?.success === true ? (
diff --git a/apps/academy/app/routes/_auth+/request-access.tsx b/apps/academy/app/routes/_auth+/request-access.tsx
index d81f0918c7..35fd91e29b 100644
--- a/apps/academy/app/routes/_auth+/request-access.tsx
+++ b/apps/academy/app/routes/_auth+/request-access.tsx
@@ -18,11 +18,6 @@ export default function RequestAccessRoute() {
<img
src="/carbon-mark-light.svg"
alt="Carbon Logo"
- className="w-24 mb-3 dark:hidden"
- />
- <img
- src="/carbon-mark-dark.svg"
- alt="Carbon Logo"
className="w-24 mb-3"
/>
diff --git a/apps/academy/app/routes/_index.tsx b/apps/academy/app/routes/_index.tsx
index c3a15f19cc..4615b9786a 100644
--- a/apps/academy/app/routes/_index.tsx
+++ b/apps/academy/app/routes/_index.tsx
@@ -1,12 +1,92 @@
-import type { LoaderFunctionArgs } from "react-router";
-import { redirect } from "react-router";
+import { Link } from "react-router";
+import { CourseCard } from "~/components/CourseCard";
+import { LearnShell } from "~/components/LearnShell";
import { modules } from "~/config";
+import { useProgress } from "~/hooks";
+import { useOptionalUser } from "~/hooks/useUser";
import { path } from "~/utils/path";
-
-export async function loader({ request }: LoaderFunctionArgs) {
- throw redirect(path.to.course(modules[0].id, modules[0].courses[0].id));
-}
+import {
+ getCourseProgress,
+ getResumeLesson,
+ toProgressSets
+} from "~/utils/progress";
export default function IndexRoute() {
- return null;
+ const user = useOptionalUser();
+ const { lessonCompletions, challengeAttempts } = useProgress();
+ const { completedLessonIds, passedTopicIds } = toProgressSets(
+ lessonCompletions,
+ challengeAttempts
+ );
+
+ const isSignedIn = user !== null;
+ const hasHistory = completedLessonIds.size > 0;
+ const resume = getResumeLesson(completedLessonIds);
+ const firstLesson = modules[0].courses[0].topics[0].lessons[0];
+
+ const ctaLessonId = resume?.lesson.id ?? firstLesson.id;
+ const ctaLabel =
+ isSignedIn && hasHistory
+ ? resume
+ ? `Continue: ${resume.lesson.name}`
+ : "Review from the beginning"
+ : "Start your first lesson";
+
+ return (
+ <LearnShell>
+ <div className="border-b border-ed-hairline pb-10">
+ <p className="font-mono text-ed-12 uppercase tracking-[0.08em] text-ed-ink/55">
+ Carbon Academy
+ </p>
+ <h1 className="reference-title mt-3">Learn Carbon, end to end</h1>
+ <p className="reference-desc mt-3 max-w-2xl">
+ Short video lessons and challenges that take you from the basics to
+ running your whole operation. Free, and yours to track.
+ </p>
+ <div className="mt-6 flex flex-wrap items-center gap-2.5">
+ <Link
+ to={path.to.lesson(ctaLessonId)}
+ className="group relative inline-flex h-11 items-center justify-center rounded-lg px-5 no-underline"
+ >
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg cta-btn-dark"
+ />
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg btn-dark-hover opacity-0 transition-opacity duration-200 ease-out group-hover:opacity-100"
+ />
+ <span className="text-on-dark relative z-10 max-w-[70vw] truncate text-ed-15 font-book tracking-[0.15px] sm:max-w-none">
+ {ctaLabel}
+ </span>
+ </Link>
+ </div>
+ </div>
+
+ <div className="mt-12 flex flex-col gap-14">
+ {modules.map((module) => (
+ <section key={module.id} className="flex flex-col gap-5">
+ <p className="font-mono text-ed-11 font-semibold uppercase tracking-[0.1em] text-ed-ink/50">
+ {module.name}
+ </p>
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-3">
+ {module.courses.map((course) => (
+ <CourseCard
+ key={course.id}
+ moduleId={module.id}
+ course={course}
+ progress={getCourseProgress(
+ course,
+ completedLessonIds,
+ passedTopicIds
+ )}
+ showProgress={isSignedIn}
+ />
+ ))}
+ </div>
+ </section>
+ ))}
+ </div>
+ </LearnShell>
+ );
}
diff --git a/apps/academy/app/routes/about.tsx b/apps/academy/app/routes/about.tsx
deleted file mode 100644
index 48e8f247d2..0000000000
--- a/apps/academy/app/routes/about.tsx
+++ /dev/null
@@ -1,121 +0,0 @@
-import { Button, Heading } from "@carbon/react";
-import { LuCirclePlay } from "react-icons/lu";
-import { Link } from "react-router";
-import { Hero } from "~/components/Hero";
-import { modules } from "~/config";
-import { useOptionalUser } from "~/hooks/useUser";
-import { path } from "~/utils/path";
-
-export default function AboutRoute() {
- const user = useOptionalUser();
- return (
- <div className="w-full flex flex-col">
- <Hero>
- <Heading
- size="display"
- className="font-display text-[#121212] dark:text-white max-w-2xl"
- >
- Carbon Academy
- </Heading>
- <p className="text-muted-foreground text-balance text-left font-medium tracking-tighter text-lg max-w-2xl">
- Want to take command of your business? Need a quick answer to a
- problem or onboard a new employee? Test your knowledge and track your
- progress.
- </p>
- <div className="flex items-center gap-2">
- {user ? (
- <Button
- size="lg"
- variant="secondary"
- leftIcon={<LuCirclePlay />}
- asChild
- >
- <Link
- to={path.to.lesson(
- modules[0].courses[0].topics[0].lessons[0].id
- )}
- >
- Begin your first lesson
- </Link>
- </Button>
- ) : (
- <Button
- size="lg"
- variant="secondary"
- leftIcon={<LuCirclePlay />}
- asChild
- >
- <Link to={path.to.login}>Sign up to register</Link>
- </Button>
- )}
- </div>
- </Hero>
- <section className="border-b">
- <div className="flex flex-row gap-8 w-full px-4 max-w-5xl mx-auto my-24">
- <div className="flex flex-col max-w-2xl gap-6">
- <h3 className="text-muted-foreground uppercase text-sm font-display leading-[140%] tracking-tighter">
- How it works
- </h3>
- <Heading
- size="h1"
- className="font-display text-[#121212] dark:text-white max-w-2xl"
- >
- Register and Track Your Progress
- </Heading>
- <p className="text-muted-foreground text-balance text-left font-medium tracking-tighter text-lg">
- Sign up to track your progress. Then join a course! All courses
- are free, and you can earn your credential(s) for free too.
- Courses in Carbon Academy are designed to build off of each other
- as you follow the recommended path. You can also jump around if
- you'd like to skip ahead on anything.
- </p>
- </div>
- </div>
- </section>
- <section>
- <div className="flex flex-row gap-8 w-full px-4 max-w-5xl mx-auto my-24">
- <div className="flex flex-col max-w-2xl gap-6">
- <h3 className="text-muted-foreground uppercase text-sm font-display leading-[140%] tracking-tighter">
- Challenges
- </h3>
- <Heading
- size="h1"
- className="font-display text-[#121212] dark:text-white max-w-2xl"
- >
- Take Challenges
- </Heading>
- <p className="text-muted-foreground text-balance text-left font-medium tracking-tighter text-lg">
- Put your new Carbon knowledge to the test by taking challenges.
- You'll need to score 100% to pass a challenge, but there is no
- limit on the number of attempts.
- </p>
- <div className="flex items-center gap-2">
- <Button
- size="lg"
- variant="secondary"
- leftIcon={<LuCirclePlay />}
- asChild
- >
- <Link
- to={path.to.lesson(
- modules[0].courses[0].topics[0].lessons[0].id
- )}
- >
- Begin your first lesson
- </Link>
- </Button>
- <Button
- size="lg"
- variant="secondary"
- leftIcon={<LuCirclePlay />}
- asChild
- >
- <Link to={path.to.login}>Sign up to take challenges</Link>
- </Button>
- </div>
- </div>
- </div>
- </section>
- </div>
- );
-}
diff --git a/apps/academy/app/routes/challenge+/$id.tsx b/apps/academy/app/routes/challenge+/$id.tsx
index dd69740fe2..0dc07671b9 100644
--- a/apps/academy/app/routes/challenge+/$id.tsx
+++ b/apps/academy/app/routes/challenge+/$id.tsx
@@ -1,17 +1,13 @@
import { requirePermissions } from "@carbon/auth/auth.server";
import { getLogger } from "@carbon/logger";
-import { Alert, AlertDescription, AlertTitle, Button, cn } from "@carbon/react";
+import { cn } from "@carbon/react";
import { useEffect, useMemo, useRef, useState } from "react";
import ConfettiExplosion from "react-confetti-explosion";
-import {
- LuChevronLeft,
- LuCircleCheck,
- LuFlag,
- LuRefreshCcw,
- LuTriangleAlert
-} from "react-icons/lu";
+import { LuFlag, LuRefreshCcw, LuTriangleAlert } from "react-icons/lu";
import type { ActionFunctionArgs } from "react-router";
import { Form, Link, useActionData, useParams, useSubmit } from "react-router";
+import { Breadcrumb } from "~/components/Breadcrumb";
+import { LearnShell } from "~/components/LearnShell";
import { useOptionalUser } from "~/hooks/useUser";
import { path } from "~/utils/path";
import { findTopicContext } from "~/utils/video";
@@ -175,255 +171,240 @@ export default function ChallengeRoute() {
const getAnswerStyles = (status: string | null) => {
switch (status) {
case "correct":
- return "bg-emerald-100 border-emerald-500 text-emerald-800 dark:bg-emerald-900 dark:border-emerald-500 dark:text-emerald-500";
+ return "border-ed-green-border bg-ed-green-bg text-ed-green-text";
case "incorrect":
- return "bg-red-100 border-red-500 text-red-800 dark:bg-red-900 dark:border-red-500 dark:text-red-500";
+ return "border-ed-red-border bg-ed-red-bg text-ed-red";
default:
- return "hover:bg-accent";
+ return "border-ed-hairline bg-ed-paper hover:bg-white/70";
}
};
return (
- <div className="w-full px-4 max-w-5xl mx-auto mt-8 pb-24 flex flex-col gap-8">
- <div className="flex items-center gap-2">
- <Button
- variant="primary"
- leftIcon={<LuChevronLeft />}
- className="mr-2"
- asChild
- >
- <Link to={path.to.course(module.id, course.id)}>Back to course</Link>
- </Button>
-
- <Button
- variant="link"
- className="text-sm text-muted-foreground"
- asChild
- >
- <Link to={path.to.course(module.id, course.id)}>{course.name}</Link>
- </Button>
-
- <span className="text-muted-foreground text-sm">/</span>
-
- <span className="text-muted-foreground text-sm font-bold">
- {topic.name}
- </span>
- </div>
-
- <div className="flex flex-col w-full">
- <div
- className="border rounded-lg rounded-b-none p-4"
- style={{
- backgroundColor: module?.background,
- color: module?.foreground
- }}
- >
- <div className="flex flex-col gap-4">
- <div className="flex items-start gap-4">
- <div
- className="flex-shrink-0 size-12 text-2xl p-3 rounded-full border"
- style={{
- backgroundColor: module?.background,
- borderColor: module?.foreground,
- color: module?.foreground
- }}
- >
- <LuFlag />
- </div>
- <div className="flex flex-col">
- <h1 className="uppercase text-[10px] font-display font-bold">
- Challenge
- </h1>
- <h2 className="text-2xl font-display tracking-tight">
- {topic.name}
- </h2>
- </div>
- </div>
- </div>
- </div>
- <div className="flex flex-col gap-4 border rounded-b-lg border-t-0 px-6 py-4">
- <p className="text-base text-muted-foreground">
- Test your knowledge with these multiple choice questions. You need
- to get at least 100% correct to pass.
- </p>
+ <LearnShell activeCourseId={course.id}>
+ <div className="max-w-190">
+ <Breadcrumb
+ items={[
+ { label: "Courses", href: path.to.root },
+ {
+ label: course.name,
+ href: path.to.course(module.id, course.id)
+ },
+ { label: topic.name }
+ ]}
+ />
+
+ <div className="mt-4 flex items-center gap-2 font-mono text-ed-11 uppercase tracking-[0.08em] text-ed-ink/50">
+ <LuFlag className="size-3.5 text-ed-ink/45" />
+ Challenge
</div>
- </div>
-
- {isSubmitted && actionData && (
- <div className="border rounded-lg px-6 py-10">
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
- <div className="flex flex-col items-center justify-center gap-2">
- <span className="text-sm font-display uppercase">Scoreboard</span>
- <span
- className={cn(
- "text-xl font-display uppercase font-bold tracking-tight",
- actionData.passed ? "text-emerald-500" : "text-red-500"
- )}
- >
- You Scored
- </span>
- <div
- className={cn(
- "text-6xl font-display font-bold",
- actionData.passed ? "text-emerald-500" : "text-red-500"
- )}
- >
- {Math.round(
- (actionData.score / actionData.totalQuestions) * 100
- )}
- %
- </div>
- </div>
- <div className="flex flex-col gap-4">
- <p className="text-base text-muted-foreground">
- You can continue by returning to the course listing or you can
- retry this challenge and try for 100%.
- </p>
- <div className="flex items-center gap-4 w-full justify-between">
- <Button
- size="lg"
- variant="secondary"
- leftIcon={<LuChevronLeft />}
- asChild
+ <h1 className="reference-title mt-1.5">{topic.name}</h1>
+ <p className="reference-desc mt-3">
+ Test your knowledge with these multiple-choice questions. You need to
+ score 100% to pass.
+ </p>
+
+ {isSubmitted && actionData && (
+ <div className="callout-box mt-8 p-8">
+ <div className="grid grid-cols-1 gap-6 md:grid-cols-2">
+ <div className="flex flex-col items-center justify-center gap-1.5">
+ <span className="font-mono text-ed-11 uppercase tracking-[0.08em] text-ed-ink/50">
+ Scoreboard
+ </span>
+ <span
+ className={cn(
+ "text-6xl font-semi",
+ actionData.passed ? "text-ed-green-strong" : "text-ed-red"
+ )}
>
- <Link to={path.to.course(module.id, course.id)}>
- Return to Course Page
- </Link>
- </Button>
- {!actionData?.passed && (
- <Button
- size="lg"
- variant="primary"
- onClick={onTryAgain}
- rightIcon={<LuRefreshCcw />}
+ {Math.round(
+ (actionData.score / actionData.totalQuestions) * 100
+ )}
+ %
+ </span>
+ <span
+ className={cn(
+ "text-ed-13 font-book",
+ actionData.passed ? "text-ed-green-strong" : "text-ed-red"
+ )}
+ >
+ {actionData.passed ? "You passed" : "Not quite"}
+ </span>
+ </div>
+ <div className="flex flex-col justify-center gap-4">
+ <p className="text-ed-15 leading-[1.6] text-ed-ink-78">
+ You can continue by returning to the course, or retry this
+ challenge and aim for 100%.
+ </p>
+ <div className="flex flex-wrap items-center gap-3">
+ <Link
+ to={path.to.course(module.id, course.id)}
+ className="glass-pill inline-flex h-10 items-center justify-center rounded-lg px-4 text-ed-14 font-book text-ink-ui no-underline transition-colors hover:text-ed-ink"
>
- Retry Challenge
- </Button>
- )}
+ Return to course
+ </Link>
+ {!actionData.passed && (
+ <button
+ type="button"
+ onClick={onTryAgain}
+ className="group relative inline-flex h-10 items-center justify-center gap-2 rounded-lg px-4"
+ >
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg cta-btn-dark"
+ />
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg btn-dark-hover opacity-0 transition-opacity duration-200 ease-out group-hover:opacity-100"
+ />
+ <span className="text-on-dark relative z-10 inline-flex items-center gap-2 text-ed-14 font-book tracking-[0.15px]">
+ <LuRefreshCcw className="size-3.5" />
+ Retry challenge
+ </span>
+ </button>
+ )}
+ </div>
</div>
</div>
</div>
- </div>
- )}
-
- {user ? (
- <Form method="post" className="flex flex-col gap-6">
- <input type="hidden" name="topicId" value={id} />
- <input type="hidden" name="answers" value={JSON.stringify(answers)} />
-
- {shuffledQuestions.map((question, questionIndex) => (
- <div key={question.id} className="border rounded-lg p-6">
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
- <div className="flex flex-col gap-2">
- <h3 className="text-lg font-display font-bold">
- Question {questionIndex + 1}:
- </h3>
- <p className="text-base text-muted-foreground">
- {question.question}
- </p>
+ )}
+
+ {user ? (
+ <Form method="post" className="mt-8 flex flex-col gap-5">
+ <input type="hidden" name="topicId" value={id} />
+ <input
+ type="hidden"
+ name="answers"
+ value={JSON.stringify(answers)}
+ />
+
+ {shuffledQuestions.map((question, questionIndex) => (
+ <div key={question.id} className="callout-box p-6">
+ <div className="grid grid-cols-1 gap-5 md:grid-cols-2">
+ <div className="flex flex-col gap-2">
+ <span className="font-mono text-ed-10 font-semibold uppercase tracking-[0.08em] text-ed-ink/50">
+ Question {questionIndex + 1} of {shuffledQuestions.length}
+ </span>
+ <p className="text-ed-16 font-demi leading-[1.5] text-ed-ink">
+ {question.question}
+ </p>
+ </div>
+ <div className="flex flex-col gap-3">
+ {question.options.map((option, optionIndex) => {
+ const answerStatus = getAnswerStatus(
+ questionIndex,
+ optionIndex
+ );
+ const isDisabled = isSubmitted && !!actionData;
+
+ return (
+ <label
+ key={optionIndex}
+ className={`flex items-center gap-3 rounded-lg border px-4 py-3 transition-colors ${
+ isDisabled ? "cursor-default" : "cursor-pointer"
+ } ${getAnswerStyles(answerStatus)}`}
+ >
+ <input
+ type="radio"
+ name={`question-${questionIndex}`}
+ value={optionIndex}
+ checked={answers[questionIndex] === optionIndex}
+ onChange={() =>
+ onAnswerChange(questionIndex, optionIndex)
+ }
+ disabled={isDisabled}
+ className="size-4 accent-ed-brand"
+ />
+ <span className="text-ed-14">{option}</span>
+ {answerStatus && (
+ <span className="ml-auto font-mono text-ed-11 font-medium uppercase">
+ {answerStatus === "correct" && "Correct"}
+ {answerStatus === "incorrect" && "Incorrect"}
+ </span>
+ )}
+ </label>
+ );
+ })}
+ </div>
</div>
- <div className="flex flex-col gap-3">
- {question.options.map((option, optionIndex) => {
- const answerStatus = getAnswerStatus(
- questionIndex,
- optionIndex
- );
- const isDisabled = isSubmitted && !!actionData;
-
- return (
- <label
- key={optionIndex}
- className={`flex items-center gap-3 p-3 border rounded-md cursor-pointer transition-colors ${
- isDisabled ? "cursor-default" : "hover:bg-accent"
- } ${getAnswerStyles(answerStatus)}`}
- >
- <input
- type="radio"
- name={`question-${questionIndex}`}
- value={optionIndex}
- checked={answers[questionIndex] === optionIndex}
- onChange={() =>
- onAnswerChange(questionIndex, optionIndex)
- }
- disabled={isDisabled}
- className="size-4"
- />
- <span className="text-sm">{option}</span>
- {answerStatus && (
- <span className="ml-auto text-xs font-medium">
- {answerStatus === "correct" && "✓ Correct"}
- {answerStatus === "incorrect" && "✗ Incorrect"}
- </span>
- )}
- </label>
- );
- })}
+ </div>
+ ))}
+
+ {!isSubmitted && (
+ <div className="callout-box flex flex-col gap-4 p-6 sm:flex-row-reverse sm:items-center sm:justify-between">
+ <button
+ type="button"
+ onClick={onSubmit}
+ disabled={answers.length !== topic.challenge.length}
+ className={`group relative inline-flex h-11 shrink-0 items-center justify-center rounded-lg px-5 ${
+ answers.length !== topic.challenge.length
+ ? "cursor-not-allowed opacity-50"
+ : ""
+ }`}
+ >
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg cta-btn-dark"
+ />
+ <span className="text-on-dark relative z-10 text-ed-15 font-book tracking-[0.15px]">
+ Submit answers
+ </span>
+ </button>
+ <div className="flex items-start gap-2.5 text-ed-amber-text">
+ <LuTriangleAlert className="mt-0.5 size-4 shrink-0" />
+ <div className="flex flex-col gap-0.5">
+ <p className="text-ed-14 font-demi">
+ Answer every question before submitting
+ </p>
+ <p className="text-ed-13 text-ed-ink/60">
+ You can retake challenges, but they are fully randomized
+ each time.
+ </p>
+ </div>
</div>
</div>
+ )}
+ </Form>
+ ) : (
+ <div className="callout-box mt-8 flex flex-col items-start justify-between gap-4 p-6 sm:flex-row sm:items-center">
+ <div className="flex flex-col gap-1">
+ <h3 className="text-ed-16 font-demi text-ed-ink">
+ Challenge rules
+ </h3>
+ <p className="text-ed-14 text-ed-ink-78">
+ There is no limit on attempts, but retries are randomized.
+ </p>
</div>
- ))}
-
- {!isSubmitted && (
- <div className="rounded-lg border flex flex-row-reverse justify-between p-6 gap-12 items-center">
- <Button
- type="button"
- size="lg"
- variant="primary"
- leftIcon={<LuCircleCheck />}
- onClick={onSubmit}
- disabled={answers.length !== topic.challenge.length}
- className={
- answers.length !== topic.challenge.length
- ? "opacity-50 cursor-not-allowed"
- : ""
- }
- >
- Submit Answers
- </Button>
- <Alert variant="warning" className="border-none">
- <LuTriangleAlert className="h-4 w-4" />
- <AlertTitle>
- Please ensure that all questions are answered correctly
- </AlertTitle>
- <AlertDescription>
- You can retake challenges, but they will be completely
- randomized when a new one is started.
- </AlertDescription>
- </Alert>
- </div>
- )}
- </Form>
- ) : (
- <div className="flex justify-between items-center gap-4 border rounded-lg py-6 px-8">
- <div className="flex flex-col gap-1">
- <h3 className="text-lg font-display font-bold">Challenge Rules</h3>
- <p className="text-base text-muted-foreground">
- There is no limit on attempts, but retries will be randomized.
- </p>
- </div>
- <Button size="lg" variant="primary" asChild>
- <Link to={`${path.to.login}?redirectTo=${path.to.challenge(id)}`}>
- Login to Take Challenge
+ <Link
+ to={`${path.to.login}?redirectTo=${path.to.challenge(id)}`}
+ className="group relative inline-flex h-11 shrink-0 items-center justify-center rounded-lg px-5 no-underline"
+ >
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg cta-btn-dark"
+ />
+ <span className="text-on-dark relative z-10 text-ed-15 font-book tracking-[0.15px]">
+ Login to take challenge
+ </span>
</Link>
- </Button>
- </div>
- )}
-
- {actionData?.passed && (
- <>
- <audio ref={audioRef} preload="auto">
- <source src="/victory.mp3" type="audio/mpeg" />
- </audio>
- <div className="fixed inset-0 flex items-center justify-center pointer-events-none">
- <ConfettiExplosion
- particleCount={200}
- force={1}
- duration={3000}
- width={1600}
- />
</div>
- </>
- )}
- </div>
+ )}
+
+ {actionData?.passed && (
+ <>
+ <audio ref={audioRef} preload="auto">
+ <source src="/victory.mp3" type="audio/mpeg" />
+ </audio>
+ <div className="fixed inset-0 flex items-center justify-center pointer-events-none">
+ <ConfettiExplosion
+ particleCount={200}
+ force={1}
+ duration={3000}
+ width={1600}
+ />
+ </div>
+ </>
+ )}
+ </div>
+ </LearnShell>
);
}
diff --git a/apps/academy/app/routes/course+/$moduleId.$courseId.tsx b/apps/academy/app/routes/course+/$moduleId.$courseId.tsx
index dc2a715871..ad083baf08 100644
--- a/apps/academy/app/routes/course+/$moduleId.$courseId.tsx
+++ b/apps/academy/app/routes/course+/$moduleId.$courseId.tsx
@@ -1,4 +1,3 @@
-import { Button, cn, Progress, VStack } from "@carbon/react";
import {
LuCircleCheck,
LuCirclePlay,
@@ -7,12 +6,21 @@ import {
} from "react-icons/lu";
import type { LoaderFunctionArgs } from "react-router";
import { Link, useParams } from "react-router";
+import { Breadcrumb } from "~/components/Breadcrumb";
+import { GlossaryText } from "~/components/GlossaryText";
+import { LessonThumb } from "~/components/LessonThumb";
import { modules } from "~/config";
import { useProgress } from "~/hooks";
+import { useOptionalUser } from "~/hooks/useUser";
import { path } from "~/utils/path";
+import {
+ getCourseProgress,
+ getNextLessonInCourse,
+ toProgressSets
+} from "~/utils/progress";
import { formatDuration } from "~/utils/video";
-export const loader = async ({ request, params }: LoaderFunctionArgs) => {
+export const loader = async ({ params }: LoaderFunctionArgs) => {
const { courseId } = params;
if (!courseId) {
@@ -24,6 +32,7 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
export default function CourseRoute() {
const { lessonCompletions, challengeAttempts } = useProgress();
+ const isSignedIn = useOptionalUser() !== null;
const { moduleId, courseId } = useParams();
const module = modules.find((module) => module.id === moduleId);
@@ -41,11 +50,10 @@ export default function CourseRoute() {
return acc + (topic.challenge === undefined ? 0 : 1);
}, 0) ?? 0;
- if (!course) {
+ if (!course || !module) {
throw new Error("Course not found");
}
- // Filter data for current course
const completedLessons = lessonCompletions
.filter((completion) => completion.courseId === course.id)
.map((completion) => completion.lessonId);
@@ -65,205 +73,221 @@ export default function CourseRoute() {
return acc;
}, {});
- const completionPercentage = Math.min(
- Math.round((completedChallenges.length / totalChallenges) * 100),
- 100
+ const { completedLessonIds, passedTopicIds } = toProgressSets(
+ lessonCompletions,
+ challengeAttempts
+ );
+ const progress = getCourseProgress(
+ course,
+ completedLessonIds,
+ passedTopicIds
);
+ const nextInCourse = getNextLessonInCourse(course, completedLessonIds);
return (
- <VStack spacing={4} className="w-full">
- <div className="flex flex-col w-full">
- <div
- className="border rounded-lg rounded-b-none px-8 py-3"
- style={{
- backgroundColor: module?.background,
- color: module?.foreground
- }}
- >
- <div className="flex flex-col items-start">
- <span className="text-[10px] uppercase font-display font-bold opacity-80">
- Section
- </span>
- <span className="uppercase text-sm font-display font-bold">
- {module?.name}
- </span>
- </div>
+ <article className="max-w-190">
+ <Breadcrumb
+ items={[
+ { label: "Courses", href: path.to.root },
+ { label: module.name }
+ ]}
+ />
+
+ <div className="mt-4 flex items-start gap-3">
+ <span className="mt-1 shrink-0 text-2xl text-ed-ink/60">
+ {course.icon}
+ </span>
+ <div className="min-w-0">
+ <h1 className="reference-title">{course.name}</h1>
</div>
- <div className="border border-b-0 border-t-0 p-8">
- <div className="flex flex-col gap-4">
- <div className="flex items-start gap-4">
- <div
- className="flex-shrink-0 size-12 text-2xl p-3 rounded-lg"
- style={{
- backgroundColor: module?.background,
- color: module?.foreground
- }}
- >
- {course.icon}
- </div>
- <div className="flex flex-col">
- <h1 className="uppercase text-[10px] font-display font-bold text-muted-foreground">
- Course
- </h1>
- <h2 className="text-2xl font-display tracking-tight">
- {course.name}
- </h2>
- </div>
- </div>
- <p className="text-sm">{course.description}</p>
- </div>
+ </div>
+ <p className="reference-desc mt-3">
+ <GlossaryText>{course.description}</GlossaryText>
+ </p>
+
+ <div className="mt-6 flex flex-wrap items-center gap-x-6 gap-y-3 border-t border-ed-hairline pt-5">
+ <div className="flex items-center gap-5 font-mono text-ed-12 text-ed-ink/50">
+ <span>{formatDuration(totalDuration)}</span>
+ <span>
+ {progress.lessonsTotal} lesson
+ {progress.lessonsTotal === 1 ? "" : "s"}
+ </span>
+ <span>
+ {totalChallenges} challenge{totalChallenges === 1 ? "" : "s"}
+ </span>
</div>
- <div className="border rounded-lg rounded-t-none px-8 py-3">
- <div className="flex items-center justify-between gap-2">
- <div className="flex items-center gap-4 text-xs">
- <div className="flex items-center gap-1">
- <span className="font-bold">Length:</span>
- <span className="text-muted-foreground">
- {formatDuration(totalDuration)}
- </span>
- </div>
- <div className="flex items-center gap-1">
- <span className="font-bold">Challenges:</span>
- <span className="text-muted-foreground">{totalChallenges}</span>
- </div>
- </div>
- <div className="flex items-center gap-1 text-xs">
- <span className="font-bold text-emerald-500">
- {completionPercentage}%
- </span>
- <Progress value={completionPercentage} />
+ {isSignedIn && (
+ <div className="ml-auto flex min-w-[160px] flex-1 items-center gap-3">
+ <div className="h-[3px] flex-1 overflow-hidden rounded-full bg-ed-hairline">
+ <div
+ className="h-full rounded-full bg-ed-brand transition-[width] duration-500"
+ style={{ width: `${progress.percent}%` }}
+ />
</div>
+ <span className="font-mono text-ed-12 text-ed-ink/60">
+ {progress.percent}%
+ </span>
</div>
- </div>
+ )}
</div>
- <div className="flex flex-col w-full">
+ {isSignedIn && !progress.complete && nextInCourse && (
+ <div className="mt-6">
+ <Link
+ to={path.to.lesson(nextInCourse.id)}
+ className="group relative inline-flex h-10 items-center justify-center gap-2 rounded-lg px-4 no-underline"
+ >
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg cta-btn-dark"
+ />
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg btn-dark-hover opacity-0 transition-opacity duration-200 ease-out group-hover:opacity-100"
+ />
+ <span className="text-on-dark relative z-10 inline-flex items-center gap-2 text-ed-14 font-book tracking-[0.15px]">
+ <LuCirclePlay className="size-3.5" />
+ {progress.lessonsDone > 0 ? "Continue course" : "Start course"}
+ </span>
+ </Link>
+ </div>
+ )}
+
+ <div className="mt-4 flex flex-col">
{course.topics.map((topic, index) => {
const hasChallenge = topic.challenge && topic.challenge.length > 0;
const isChallengeCompleted =
hasChallenge && completedChallenges.includes(topic.id);
const isChallengeAttempted =
hasChallenge && attemptsByTopic[topic.id];
- const challengeAttempts = attemptsByTopic[topic.id] ?? 0;
- const isFirst = index === 0;
- const isLast = index === course.topics.length - 1;
+ const challengeAttemptCount = attemptsByTopic[topic.id] ?? 0;
+
return (
- <div
+ <section
key={topic.id}
- className={cn(
- "border p-8 w-full",
- isFirst && "rounded-t-lg",
- isLast && "rounded-b-lg",
- isFirst && !isLast && "rounded-b-none",
- isLast && !isFirst && "border-t-0 rounded-t-none"
- )}
+ id={topic.id}
+ className="mt-8 scroll-mt-24 border-t border-ed-hairline pt-8 first:mt-6"
>
- <div className="grid grid-cols-2 gap-12">
- <div className="flex flex-col gap-1">
- <h3 className="text-[10px] uppercase font-display font-bold text-muted-foreground">
- Topic
- </h3>
- <h2 className="text-xl font-display tracking-tight">
- {topic.name}
- </h2>
- <p className="text-sm">{topic.description}</p>
- </div>
- <div className="flex flex-col gap-4 py-8 w-full text-sm">
- <div className="flex flex-col gap-0">
- {topic.lessons.map((lesson) => {
- const isCompleted = completedLessons.includes(lesson.id);
- return (
- <Link
- key={lesson.id}
- to={path.to.lesson(lesson.id)}
- className="flex items-center justify-between gap-2 w-full rounded-md py-1.5 px-3 hover:bg-accent"
- >
- <div className="flex items-center gap-2">
- {isCompleted ? (
- <LuCircleCheck className="size-4 flex-shrink-0 text-emerald-500" />
- ) : (
- <LuCirclePlay className="size-4 flex-shrink-0 text-muted-foreground" />
- )}
- <span>{lesson.name}</span>
- </div>
- <span className="text-muted-foreground text-xs">
- {formatDuration(lesson.duration)}
- </span>
- </Link>
- );
- })}
+ <p className="font-mono text-ed-10 font-semibold uppercase tracking-[0.08em] text-ed-ink/50">
+ Topic {String(index + 1).padStart(2, "0")}
+ </p>
+ <h2 className="mt-1.5 text-ed-20 font-semi text-ed-ink">
+ {topic.name}
+ </h2>
+ <p className="mt-2 max-w-2xl text-ed-15 leading-[1.6] text-ed-ink-78">
+ <GlossaryText>{topic.description}</GlossaryText>
+ </p>
+
+ <div className="mt-5 flex flex-col gap-0.5">
+ {topic.lessons.map((lesson) => (
+ <LessonRow
+ key={lesson.id}
+ lessonId={lesson.id}
+ name={lesson.name}
+ duration={lesson.duration}
+ completed={completedLessons.includes(lesson.id)}
+ tocAnchor
+ />
+ ))}
+ </div>
+
+ {topic.supplemental && topic.supplemental.length > 0 && (
+ <div className="mt-5">
+ <p className="mb-1.5 px-3 font-mono text-ed-10 font-semibold uppercase tracking-[0.08em] text-ed-ink/45">
+ Supplemental videos
+ </p>
+ <div className="flex flex-col gap-0.5">
+ {topic.supplemental.map((lesson) => (
+ <LessonRow
+ key={lesson.id}
+ lessonId={lesson.id}
+ name={lesson.name}
+ duration={lesson.duration}
+ completed={completedLessons.includes(lesson.id)}
+ />
+ ))}
</div>
- {hasChallenge ? (
- isChallengeCompleted ? (
- <Button
- variant="primary"
- leftIcon={
- <LuCircleCheck className="size-4 flex-shrink-0 text-emerald-500" />
- }
- >
- Topic Challenge Completed
- </Button>
- ) : (
- <Button
- variant="secondary"
- leftIcon={
- isChallengeAttempted ? <LuRotateCcw /> : <LuFlag />
- }
- asChild
- >
- <Link to={path.to.challenge(topic.id)}>
- {isChallengeAttempted ? (
- <span>
- Retake Topic Challenge{" "}
- <span className="text-xs text-muted-foreground italic">
- {challengeAttempts} attempt
- {challengeAttempts === 1 ? "" : "s"} made
- </span>
- </span>
- ) : (
- "Take Topic Challenge"
- )}
- </Link>
- </Button>
- )
- ) : null}
- {topic.supplemental && topic.supplemental.length > 0 && (
- <div className="flex flex-col gap-0">
- <h3 className="text-[10px] uppercase font-display font-bold text-muted-foreground">
- Supplemental Videos
- </h3>
- {topic.supplemental?.map((lesson) => {
- const isCompleted = completedLessons.includes(
- lesson.id
- );
- return (
- <Link
- key={lesson.id}
- to={path.to.lesson(lesson.id)}
- className="flex items-center justify-between gap-2 w-full rounded-md py-1.5 px-3 hover:bg-accent"
- >
- <div className="flex items-center gap-2">
- {isCompleted ? (
- <LuCircleCheck className="size-4 flex-shrink-0 text-emerald-500" />
- ) : (
- <LuCirclePlay className="size-4 flex-shrink-0 text-muted-foreground" />
- )}
- <span>{lesson.name}</span>
- </div>
- <span className="text-muted-foreground text-xs">
- {formatDuration(lesson.duration)}
- </span>
- </Link>
- );
- })}
+ </div>
+ )}
+
+ {hasChallenge ? (
+ <div className="mt-5">
+ {isChallengeCompleted ? (
+ <div className="callout-box inline-flex items-center gap-2 px-4 py-2.5 text-ed-14 font-book text-ed-ink-78">
+ <LuCircleCheck className="size-4 shrink-0 text-ed-green-strong" />
+ Challenge completed
</div>
+ ) : (
+ <Link
+ to={path.to.challenge(topic.id)}
+ className="group relative inline-flex h-10 items-center justify-center gap-2 rounded-lg px-4 no-underline"
+ >
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg cta-btn-dark"
+ />
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg btn-dark-hover opacity-0 transition-opacity duration-200 ease-out group-hover:opacity-100"
+ />
+ <span className="text-on-dark relative z-10 inline-flex items-center gap-2 text-ed-14 font-book tracking-[0.15px]">
+ {isChallengeAttempted ? (
+ <LuRotateCcw className="size-3.5" />
+ ) : (
+ <LuFlag className="size-3.5" />
+ )}
+ {isChallengeAttempted
+ ? "Retake topic challenge"
+ : "Take topic challenge"}
+ {isChallengeAttempted ? (
+ <span className="text-white/55">
+ {challengeAttemptCount} attempt
+ {challengeAttemptCount === 1 ? "" : "s"}
+ </span>
+ ) : null}
+ </span>
+ </Link>
)}
</div>
- </div>
- </div>
+ ) : null}
+ </section>
);
})}
</div>
- </VStack>
+ </article>
+ );
+}
+
+function LessonRow({
+ lessonId,
+ name,
+ duration,
+ completed,
+ tocAnchor
+}: {
+ lessonId: string;
+ name: string;
+ duration: number;
+ completed: boolean;
+ tocAnchor?: boolean;
+}) {
+ return (
+ <Link
+ to={path.to.lesson(lessonId)}
+ id={tocAnchor ? `lesson-${lessonId}` : undefined}
+ data-toc-lesson={tocAnchor ? "" : undefined}
+ data-toc-title={tocAnchor ? name : undefined}
+ className="flex scroll-mt-24 items-center justify-between gap-3 rounded-lg px-2 py-2 no-underline transition-colors hover:bg-ed-ink/[0.03] target:bg-ed-accent-fill target:ring-1 target:ring-ed-blue-border"
+ >
+ <span className="flex min-w-0 items-center gap-3">
+ <LessonThumb completed={completed} className="w-16" />
+ <span className="truncate text-ed-15 font-book text-ed-ink-78">
+ {name}
+ </span>
+ </span>
+ <span className="shrink-0 font-mono text-ed-12 text-ed-ink/45">
+ {formatDuration(duration)}
+ </span>
+ </Link>
);
}
diff --git a/apps/academy/app/routes/course+/_layout.tsx b/apps/academy/app/routes/course+/_layout.tsx
index c160f1c271..0092ecea06 100644
--- a/apps/academy/app/routes/course+/_layout.tsx
+++ b/apps/academy/app/routes/course+/_layout.tsx
@@ -1,99 +1,11 @@
-import { Button, Heading } from "@carbon/react";
-import { LuBookOpen, LuCirclePlay } from "react-icons/lu";
-import { Link, NavLink, Outlet } from "react-router";
-import { Hero } from "~/components/Hero";
-import { modules } from "~/config";
-import { useOptionalUser } from "~/hooks/useUser";
-import { path } from "~/utils/path";
+import { Outlet } from "react-router";
+import { LearnShell } from "~/components/LearnShell";
+import { OnThisPage } from "~/components/OnThisPage";
export default function CourseLayout() {
- const user = useOptionalUser();
return (
- <div className="w-full flex flex-col">
- {user === null && (
- <Hero>
- <Heading
- size="h1"
- className="font-display text-[#121212] dark:text-white max-w-xl"
- >
- Your Journey Starts Here
- </Heading>
- <p className="text-muted-foreground dark:text-foreground text-balance text-left font-medium tracking-tighter text-lg max-w-xl">
- Learn the basics of Carbon and start your journey to becoming an
- expert in Carbon. All for free.
- </p>
- <div className="flex items-center gap-2">
- <Button
- size="lg"
- variant="secondary"
- leftIcon={<LuCirclePlay />}
- asChild
- >
- <Link
- to={path.to.lesson(
- modules[0].courses[0].topics[0].lessons[0].id
- )}
- >
- Begin your first lesson
- </Link>
- </Button>
- <Button
- size="lg"
- variant="secondary"
- leftIcon={<LuBookOpen />}
- asChild
- >
- <Link to={path.to.about}>See how it works</Link>
- </Button>
- </div>
- </Hero>
- )}
- <div className="w-full px-4 max-w-5xl mx-auto my-16">
- <div className="grid grid-cols-1 md:grid-cols-[220px_1fr] gap-6">
- <nav className="space-y-4">
- {modules.map((module) => (
- <div key={module.id} className="space-y-2">
- <h3
- className="font-display font-bold uppercase text-xs"
- style={{ color: module.background }}
- >
- {module.name}
- </h3>
- <div className="space-y-0">
- {module.courses.map((course) => (
- <NavLink
- key={course.id}
- to={path.to.course(module.id, course.id)}
- className={({ isActive }) =>
- [
- "block py-1.5 px-2 text-sm rounded-md border-l-2 transition-all hover:underline",
- isActive
- ? "font-semibold text-foreground"
- : "text-foreground/80 border-l-transparent hover:bg-accent/60 hover:text-foreground"
- ].join(" ")
- }
- style={({ isActive }) =>
- isActive
- ? {
- backgroundColor: `${module.background}2E`,
- borderLeftColor: module.background,
- boxShadow: `inset 0 0 0 1px ${module.background}4D`
- }
- : undefined
- }
- >
- {course.name}
- </NavLink>
- ))}
- </div>
- </div>
- ))}
- </nav>
- <main>
- <Outlet />
- </main>
- </div>
- </div>
- </div>
+ <LearnShell rail={<OnThisPage />}>
+ <Outlet />
+ </LearnShell>
);
}
diff --git a/apps/academy/app/routes/lesson+/$id.tsx b/apps/academy/app/routes/lesson+/$id.tsx
index e46fd833a7..287373c81c 100644
--- a/apps/academy/app/routes/lesson+/$id.tsx
+++ b/apps/academy/app/routes/lesson+/$id.tsx
@@ -1,17 +1,16 @@
import { getCarbon } from "@carbon/auth";
import { getOrRefreshAuthSession } from "@carbon/auth/session.server";
import { getLogger } from "@carbon/logger";
-import { Button, Spinner } from "@carbon/react";
+import { Spinner } from "@carbon/react";
import { useEffect } from "react";
-import {
- LuChevronLeft,
- LuChevronRight,
- LuCircleCheck,
- LuCirclePlay,
- LuFlag
-} from "react-icons/lu";
+import { LuCircleCheck, LuFlag } from "react-icons/lu";
import type { ActionFunctionArgs, LoaderFunctionArgs } from "react-router";
import { data, Link, useFetcher, useParams } from "react-router";
+import { Breadcrumb } from "~/components/Breadcrumb";
+import { ChapterCard } from "~/components/ChapterCard";
+import { GlossaryText } from "~/components/GlossaryText";
+import { LearnShell } from "~/components/LearnShell";
+import { LessonThumb } from "~/components/LessonThumb";
import Share from "~/components/Share";
import { useProgress } from "~/hooks";
import { path } from "~/utils/path";
@@ -24,7 +23,7 @@ import {
const log = getLogger("academy");
-export const loader = async ({ request, params }: LoaderFunctionArgs) => {
+export const loader = async ({ params }: LoaderFunctionArgs) => {
const { id: lessonId } = params;
if (!lessonId) {
@@ -84,6 +83,7 @@ export const action = async ({ request, params }: ActionFunctionArgs) => {
return { success: true };
};
+
export default function LessonRoute() {
const { lessonCompletions, challengeAttempts } = useProgress();
const { id } = useParams();
@@ -104,7 +104,6 @@ export default function LessonRoute() {
const previousLesson = getPreviousLesson(id);
const hasChallenge = topic.challenge && topic.challenge.length > 0;
- // Filter data for current course/topic
const completedLessons = lessonCompletions
.filter((completion) => completion.courseId === course.id)
.map((completion) => completion.lessonId);
@@ -125,7 +124,7 @@ export default function LessonRoute() {
const isChallengeAttempted = hasChallenge && attemptsByTopic[topic.id];
const challengeAttemptCount = attemptsByTopic[topic.id] ?? 0;
- const onComplete = async (lessonId: string) => {
+ const onComplete = () => {
fetcher.submit(null, {
method: "POST",
action: path.to.lesson(id)
@@ -154,7 +153,7 @@ export default function LessonRoute() {
}
if (data.event === "ended" && data.context === "player.js") {
- onComplete(id);
+ onComplete();
}
} catch (error) {
log.error("Error parsing message data", { error });
@@ -169,181 +168,132 @@ export default function LessonRoute() {
}, [id]);
return (
- <div className="w-full px-4 max-w-5xl mx-auto mt-4 pb-24 flex flex-col gap-8">
- <div className="flex items-center gap-2">
- <Button
- variant="primary"
- leftIcon={<LuChevronLeft />}
- className="mr-2"
- asChild
- >
- <Link to={path.to.course(module.id, course.id)}>Back to course</Link>
- </Button>
-
- <Button
- variant="link"
- className="text-sm text-muted-foreground"
- asChild
- >
- <Link to={path.to.course(module.id, course.id)}>{course.name}</Link>
- </Button>
-
- <span className="text-muted-foreground text-sm">/</span>
-
- <span className="text-muted-foreground text-sm font-bold">
- {topic.name}
- </span>
- </div>
+ <LearnShell activeCourseId={course.id}>
+ <div className="grid grid-cols-1 gap-10 xl:grid-cols-[minmax(0,1fr)_300px]">
+ <div className="min-w-0">
+ <Breadcrumb
+ items={[
+ { label: "Courses", href: path.to.root },
+ {
+ label: course.name,
+ href: path.to.course(module.id, course.id)
+ },
+ { label: topic.name }
+ ]}
+ />
- <div className="flex flex-col w-full">
- <div className="w-full aspect-video bg-black rounded-t-lg overflow-hidden">
- <div
- style={{
- position: "relative",
- paddingBottom: "56.25%",
- height: "0"
- }}
- >
- <div className="absolute inset-0 flex items-center justify-center">
- <Spinner className="h-8 w-8" />
- </div>
- <iframe
- key={id}
- id="loom-embed"
- title={lesson.name}
- src={`https://www.loom.com/embed/${
- lesson.loomUrl.split(/(?:share|embed)\//)[1]?.split("?")[0]
- }?hideEmbedTopBar=true`}
- allowFullScreen
+ <div className="mt-4 flex flex-wrap items-center gap-3">
+ <span
+ className="inline-flex items-center justify-center whitespace-nowrap rounded-full px-2 py-1 font-mono text-ed-12 font-medium leading-4 uppercase tracking-[0.06em] text-ed-ink/72"
style={{
- position: "absolute",
- top: 0,
- left: 0,
- width: "100%",
- height: "100%"
+ background:
+ "linear-gradient(180deg, rgba(251, 251, 248, 0.50) 0%, rgba(251, 251, 248, 0.00) 100%)",
+ boxShadow:
+ "0 0 0 1px #FFF inset, 0 0 0 1px rgba(0, 0, 0, 0.12), 0 2px 2px 0 rgba(0, 0, 0, 0.02)"
}}
- />
+ >
+ Lesson — {topic.name}
+ </span>
+ <span className="inline-flex items-center gap-[5px] font-mono text-ed-12 leading-4 text-ed-ink/42">
+ <ClockIcon />
+ {formatDuration(lesson.duration)}
+ </span>
</div>
- </div>
- <div
- className="dark w-full h-12 rounded-b-lg flex items-center justify-end gap-2 px-3"
- style={{
- backgroundColor: module.background
- }}
- >
- <Share
- text={typeof window !== "undefined" ? window.location.href : ""}
- />
- </div>
- </div>
- <div className="grid grid-cols-1 md:grid-cols-[1fr_360px] gap-6">
- <div className="flex flex-col w-full">
- <div
- className="border rounded-lg rounded-b-none p-4"
- style={{
- backgroundColor: module?.background,
- color: module?.foreground
- }}
- >
- <div className="flex flex-col gap-4">
- <div className="flex items-start gap-4">
- <div
- className="flex-shrink-0 size-12 text-2xl p-3 rounded-lg bg-black/20"
- style={{
- color: module?.foreground
- }}
- >
- {course.icon}
- </div>
- <div className="flex flex-col">
- <h1 className="uppercase text-[10px] font-display font-bold">
- Lesson
- </h1>
- <h2 className="text-2xl font-display tracking-tight">
- {lesson.name}
- </h2>
- </div>
+ <h1 className="mt-[18px] text-ed-32 font-normal leading-[112%] text-ink md:text-ed-40">
+ {lesson.name}
+ </h1>
+
+ <div className="mt-6 overflow-hidden rounded-xl border border-ed-hairline bg-black shadow-[inset_0_1px_0_#fff]">
+ <div
+ style={{
+ position: "relative",
+ paddingBottom: "56.25%",
+ height: "0"
+ }}
+ >
+ <div className="absolute inset-0 flex items-center justify-center">
+ <Spinner className="h-8 w-8 text-white/70" />
</div>
+ <iframe
+ key={id}
+ id="loom-embed"
+ title={lesson.name}
+ src={`https://www.loom.com/embed/${
+ lesson.loomUrl.split(/(?:share|embed)\//)[1]?.split("?")[0]
+ }?hideEmbedTopBar=true`}
+ allowFullScreen
+ style={{
+ position: "absolute",
+ top: 0,
+ left: 0,
+ width: "100%",
+ height: "100%"
+ }}
+ />
</div>
</div>
- <div className="flex flex-col gap-4 border rounded-b-lg border-t-0 px-6 py-4">
- <h4 className="text-lg font-display font-bold">Description</h4>
- <p className="text-base text-muted-foreground">
- {lesson.description}
+
+ <div className="mt-3 flex items-center justify-end">
+ <Share
+ text={typeof window !== "undefined" ? window.location.href : ""}
+ />
+ </div>
+
+ <div className="guide-prose mt-8 max-w-2xl">
+ <h2 className="text-ed-16 font-demi text-ed-ink">
+ About this lesson
+ </h2>
+ <p className="mt-2">
+ <GlossaryText>{lesson.description}</GlossaryText>
</p>
</div>
</div>
- {/* Right Sidebar */}
- <div className="flex flex-col gap-4">
- {/* Navigation Buttons */}
- <div className="flex gap-2">
- <Button
- variant="secondary"
- leftIcon={<LuChevronLeft className="size-4" />}
- disabled={!previousLesson}
- asChild={!!previousLesson}
- className={!previousLesson ? "opacity-50 cursor-not-allowed" : ""}
- >
- {previousLesson ? (
- <Link to={path.to.lesson(previousLesson.id)}>
- Previous Lesson
- </Link>
- ) : (
- <span>Previous Lesson</span>
+ {/* Right rail */}
+ <div className="flex flex-col gap-6 xl:sticky xl:top-24 xl:self-start">
+ {(previousLesson || nextLesson) && (
+ <div className="flex flex-col gap-3">
+ {previousLesson && (
+ <ChapterCard
+ dir="prev"
+ title={previousLesson.name}
+ to={path.to.lesson(previousLesson.id)}
+ />
)}
- </Button>
-
- <Button
- variant={!nextLesson ? "secondary" : "primary"}
- rightIcon={<LuChevronRight className="size-4" />}
- disabled={!nextLesson}
- asChild={!!nextLesson}
- className={!nextLesson ? "opacity-50 cursor-not-allowed" : ""}
- >
- {nextLesson ? (
- <Link to={path.to.lesson(nextLesson.id)}>Next Lesson</Link>
- ) : (
- <span>Next Lesson</span>
+ {nextLesson && (
+ <ChapterCard
+ dir="next"
+ title={nextLesson.name}
+ to={path.to.lesson(nextLesson.id)}
+ />
)}
- </Button>
- </div>
+ </div>
+ )}
- {/* Lesson List */}
- <div className="border rounded-lg p-4">
- <h3 className="text-sm font-display font-bold text-muted-foreground mb-3">
+ <div>
+ <p className="mb-2 px-1 font-mono text-ed-11 font-semibold uppercase tracking-[0.08em] text-ed-ink/50">
Lessons in this topic
- </h3>
- <div className="flex flex-col gap-1">
+ </p>
+ <div className="flex flex-col gap-0.5">
{topic.lessons.map((topicLesson) => {
const isCompleted = completedLessons.includes(topicLesson.id);
-
+ const isCurrent = topicLesson.id === lesson.id;
return (
<Link
key={topicLesson.id}
to={path.to.lesson(topicLesson.id)}
- className={`flex items-center justify-between gap-2 w-full rounded-md py-2 px-3 text-sm transition-colors ${
- topicLesson.id === lesson.id
- ? "bg-accent text-accent-foreground"
- : "hover:bg-accent"
+ className={`flex items-center justify-between gap-2 rounded-lg px-2 py-1.5 text-ed-15 no-underline transition-colors ${
+ isCurrent
+ ? "bg-ed-accent-fill font-demi text-ed-blue-text"
+ : "font-book text-ed-ink-78 hover:bg-ed-ink/[0.04]"
}`}
>
- <div className="flex items-center gap-2">
- {isCompleted ? (
- <LuCircleCheck className="size-4 flex-shrink-0 text-emerald-500" />
- ) : (
- <LuCirclePlay className="size-4 flex-shrink-0 text-muted-foreground" />
- )}
- <span
- className={
- topicLesson.id === lesson.id ? "font-medium" : ""
- }
- >
- {topicLesson.name}
- </span>
- </div>
- <span className="text-muted-foreground text-xs">
+ <span className="flex min-w-0 items-center gap-2.5">
+ <LessonThumb completed={isCompleted} className="w-12" />
+ <span className="truncate">{topicLesson.name}</span>
+ </span>
+ <span className="shrink-0 font-mono text-ed-11 text-ed-ink/40">
{formatDuration(topicLesson.duration)}
</span>
</Link>
@@ -351,34 +301,65 @@ export default function LessonRoute() {
})}
</div>
</div>
+
{hasChallenge ? (
isChallengeCompleted ? (
- <Button
- variant="primary"
- leftIcon={
- <LuCircleCheck className="size-4 flex-shrink-0 text-emerald-500" />
- }
- >
- Topic Challenge Completed
- </Button>
+ <div className="callout-box inline-flex items-center gap-2 px-4 py-2.5 text-ed-14 font-book text-ed-ink-78">
+ <LuCircleCheck className="size-4 shrink-0 text-ed-green-strong" />
+ Challenge completed
+ </div>
) : (
- <Button
- variant="secondary"
- leftIcon={<LuFlag className="size-4" />}
- asChild
+ <Link
+ to={path.to.challenge(topic.id)}
+ className="group relative inline-flex h-10 items-center justify-center gap-2 rounded-lg px-4 no-underline"
>
- <Link to={path.to.challenge(topic.id)}>
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg cta-btn-dark"
+ />
+ <span
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 rounded-lg btn-dark-hover opacity-0 transition-opacity duration-200 ease-out group-hover:opacity-100"
+ />
+ <span className="text-on-dark relative z-10 inline-flex items-center gap-2 text-ed-14 font-book tracking-[0.15px]">
+ <LuFlag className="size-3.5" />
{isChallengeAttempted
- ? `Retake Topic Challenge (${challengeAttemptCount} attempt${
- challengeAttemptCount === 1 ? "" : "s"
- })`
- : "Take Topic Challenge"}
- </Link>
- </Button>
+ ? `Retake challenge (${challengeAttemptCount})`
+ : "Take topic challenge"}
+ </span>
+ </Link>
)
) : null}
</div>
</div>
- </div>
+ </LearnShell>
+ );
+}
+
+function ClockIcon() {
+ return (
+ <svg
+ width="12"
+ height="12"
+ viewBox="0 0 14 14"
+ fill="none"
+ aria-hidden="true"
+ className="shrink-0"
+ >
+ <circle
+ cx="7"
+ cy="7"
+ r="5.25"
+ stroke="rgba(38,35,35,0.42)"
+ strokeWidth="1.2"
+ />
+ <path
+ d="M7 4.2V7l1.9 1.15"
+ stroke="rgba(38,35,35,0.42)"
+ strokeWidth="1.2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
);
}
diff --git a/apps/academy/app/services/mode.server.ts b/apps/academy/app/services/mode.server.ts
deleted file mode 100644
index c8b3579151..0000000000
--- a/apps/academy/app/services/mode.server.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { DOMAIN } from "@carbon/auth";
-import type { Mode } from "@carbon/utils";
-import * as cookie from "cookie";
-
-const cookieName = "mode";
-
-export function getMode(request: Request): Mode | null {
- const cookieHeader = request.headers.get("cookie");
- const parsed = cookieHeader
- ? cookie.parse(cookieHeader)[cookieName]
- : "light";
- if (parsed === "light" || parsed === "dark") return parsed;
- return null;
-}
-
-export function setMode(mode: Mode | "system") {
- if (mode === "system") {
- return cookie.serialize(cookieName, "", { path: "/", maxAge: -1 });
- } else {
- const cookieOptions: cookie.SerializeOptions = {
- path: "/",
- maxAge: 31536000
- };
-
- if (DOMAIN && !DOMAIN.startsWith("localhost")) {
- cookieOptions.domain = DOMAIN;
- }
- return cookie.serialize(cookieName, mode, cookieOptions);
- }
-}
diff --git a/apps/academy/app/styles/background.css b/apps/academy/app/styles/background.css
deleted file mode 100644
index 0d626c7625..0000000000
--- a/apps/academy/app/styles/background.css
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Credit: https://cmdk.paco.me/ */
-
-.background {
- width: 100vw;
- min-height: 100vh;
- position: fixed;
- display: flex;
- justify-content: center;
- padding: 120px 24px 160px 24px;
- pointer-events: none;
-}
-
-.background:before {
- background: radial-gradient(circle, rgba(2, 0, 36, 0) 0, #fafafa 100%);
- position: absolute;
- content: "";
- z-index: 2;
- width: 100%;
- height: 100%;
- top: 0;
-}
-
-.dark .background:before {
- background: radial-gradient(circle, rgba(2, 0, 36, 0) 0, #161616 100%);
-}
-
-.background:after {
- content: "";
- background-image: url("/grid.svg");
- z-index: 1;
- position: absolute;
- width: 100%;
- height: 100%;
- top: 0;
- opacity: 0.4;
- filter: invert(1);
-}
-
-.gradient {
- height: fit-content;
- z-index: 3;
- width: 100%;
- max-width: 640px;
- background-image: radial-gradient(
- at 27% 37%,
- hsla(215, 98%, 61%, 1) 0px,
- transparent 0%
- ),
- radial-gradient(at 97% 21%, hsla(125, 60%, 72%, 1) 0px, transparent 55%),
- radial-gradient(at 52% 99%, hsla(354, 40%, 61%, 1) 0px, transparent 55%),
- radial-gradient(at 10% 29%, hsla(256, 50%, 67%, 1) 0px, transparent 55%),
- radial-gradient(at 97% 96%, hsla(38, 40%, 74%, 1) 0px, transparent 55%),
- radial-gradient(at 33% 50%, hsla(222, 60%, 73%, 1) 0px, transparent 55%),
- radial-gradient(at 79% 53%, hsla(343, 20%, 79%, 1) 0px, transparent 55%);
- position: absolute;
- content: "";
- width: 100%;
- height: 100%;
- filter: blur(100px) saturate(150%);
- top: 80px;
- opacity: 0.15;
-}
-
-@media screen and (max-width: 640px) {
- .content {
- display: none;
- }
-}
diff --git a/apps/academy/app/styles/docs.css b/apps/academy/app/styles/docs.css
deleted file mode 100644
index 51739cefb9..0000000000
--- a/apps/academy/app/styles/docs.css
+++ /dev/null
@@ -1,1534 +0,0 @@
-.Code {
- width: 100%;
-}
-
-.Code pre {
- margin: 0;
- padding: 0.5rem 0.75rem;
- background-color: transparent;
- font-size: 0.875rem;
- line-height: 1.25rem;
-}
-
-.Code .codeBlock {
- margin-bottom: 0;
- overflow: hidden;
- overflow-wrap: break-word;
- white-space: pre-wrap;
-}
-
-.Code.codeBlockWrapper {
- position: relative;
-}
-
-.Code.codeBlockWrapper:hover .buttonContainer {
- visibility: visible;
- opacity: 1;
-}
-
-.Code .buttonContainer {
- right: 5px;
- top: 5px;
- opacity: 0;
- position: absolute;
- visibility: hidden;
- transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out,
- bottom 0.2s ease-in-out;
-}
-
-.Code .buttonContainer button {
- border-radius: 0.25rem;
- font-size: 0.75rem;
- line-height: 1rem;
- background: #011627;
- border: 1px solid #d6deeb;
- color: #d6deeb;
- cursor: pointer;
- line-height: 12px;
- outline: none;
- padding: 4px 8px;
-}
-
-.Code.codeBlockWrapper .sbui-btn-container {
- position: absolute;
- top: 2px;
- right: 3px;
- visibility: hidden;
- opacity: 0;
-}
-
-.Code.codeBlockWrapper:hover .sbui-btn-container {
- visibility: visible;
- opacity: 1;
-}
-
-.CustomCodeBlock {
- width: 100%;
-}
-
-.CustomCodeBlock .code-with-header pre {
- border-radius: 0 0 4px 4px;
-}
-
-.CustomCodeBlock .code-with-response pre {
- border-radius: 0;
-}
-
-.CustomCodeBlock .code-header {
- color: #ccc;
- padding: 5px 15px;
- border-radius: 4px 4px 0 0;
- font-size: 0.8rem;
- font-weight: 700;
- border-bottom: 1px solid #444;
-}
-
-.FunctionBlock h4 {
- margin-top: 36px;
- margin-bottom: 12px;
-}
-
-.FunctionBlock p {
- margin-top: 0;
- margin-bottom: 24px;
-}
-
-.Docs--inner-wrapper {
- background: linear-gradient(
- 90deg,
- hsl(var(--background)) 50%,
- hsl(var(--muted)) 50%
- );
- width: 100%;
-}
-
-.dark .Docs--inner-wrapper {
- background: linear-gradient(
- 90deg,
- hsl(var(--background)) 50%,
- hsl(var(--card)) 50%
- );
-}
-
-.Docs .doc-heading {
- font-weight: bold;
- margin-top: 1rem;
- width: 50%;
- padding-left: 1.5rem;
- padding-right: 1.5rem;
- text-transform: capitalize;
- --tw-text-opacity: 1;
-
- -webkit-hyphens: auto;
- hyphens: auto;
- max-width: 50%;
-}
-
-.Docs .doc-module {
- display: flex;
- border-bottom-width: 1px;
- --tw-border-opacity: 1;
- border-color: hsl(var(--border) / var(--tw-border-opacity));
-}
-
-.Docs.Docs--table-editor .doc-module--introduction .text {
- width: 85%;
-}
-
-.Docs.Docs--table-editor .doc-module--client-libraries {
- flex-direction: column;
- margin-bottom: 40px;
-}
-
-.Docs.Docs--table-editor .doc-module--client-libraries .code,
-.Docs.Docs--table-editor .doc-module--client-libraries .text {
- width: 100%;
- max-width: none;
-}
-
-.Docs.Docs--table-editor .doc-module--client-libraries .code {
- margin-bottom: 20px;
-}
-
-.Docs .doc-module article:first-child {
- color: var(--tw-prose-body);
- max-width: 65ch;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(p):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.25em;
- margin-bottom: 1.25em;
- font-weight: 400;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where([class~="lead"]):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- color: var(--tw-prose-lead);
- font-size: 1.25em;
- line-height: 1.6;
- margin-top: 1.2em;
- margin-bottom: 1.2em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(a):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- text-decoration: underline;
- font-weight: 400;
- position: relative;
- transition: all 0.18s ease;
- padding-bottom: 2px;
- opacity: 1;
- text-decoration-line: underline;
- text-decoration-color: hsl(var(--muted-foreground));
- text-decoration-thickness: 1px;
- text-underline-offset: 2px;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: var(--tw-prose-bold);
- font-weight: 600;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(a strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(blockquote strong):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- color: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(thead th strong):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- color: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- list-style-type: none;
- margin-top: 1.25em;
- margin-bottom: 3rem;
- padding-left: 1rem;
- counter-reset: item;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol[type="A"]):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- list-style-type: upper-alpha;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol[type="a"]):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- list-style-type: lower-alpha;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol[type="A s"]):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- list-style-type: upper-alpha;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol[type="a s"]):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- list-style-type: lower-alpha;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol[type="I"]):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- list-style-type: upper-roman;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol[type="i"]):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- list-style-type: lower-roman;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol[type="I s"]):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- list-style-type: upper-roman;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol[type="i s"]):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- list-style-type: lower-roman;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol[type="1"]):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- list-style-type: decimal;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ul):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- list-style-type: none;
- margin-top: 1.25em;
- margin-bottom: 1.25em;
- padding-left: 1rem;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol > li):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- )::marker {
- font-weight: 400;
- color: var(--tw-prose-counters);
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ul > li):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- )::marker {
- color: var(--tw-prose-bullets);
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(dt):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: var(--tw-prose-headings);
- font-weight: 600;
- margin-top: 1.25em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(hr):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- border-color: var(--tw-prose-hr);
- border-top-width: 1px;
- margin-top: 3em;
- margin-bottom: 3em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(blockquote):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-weight: 500;
- font-style: italic;
- color: var(--tw-prose-quotes);
- border-left-width: 0.25rem;
- border-left-color: var(--tw-prose-quote-borders);
- quotes: "\201C""\201D""\2018""\2019";
- margin-top: 1.6em;
- margin-bottom: 1.6em;
- padding-left: 1em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(blockquote p:first-of-type):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ):before {
- content: open-quote;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(blockquote p:last-of-type):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ):after {
- content: close-quote;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h1):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: var(--tw-prose-headings);
- font-weight: 800;
- font-size: 2.25em;
- margin-bottom: 0.8888889em;
- line-height: 1.1111111;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h1 strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-weight: 900;
- color: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h2):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: var(--tw-prose-headings);
- font-weight: 700;
- font-size: 1.5em;
- margin-top: 2em;
- margin-bottom: 1em;
- line-height: 1.3333333;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h2 strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-weight: 800;
- color: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h3):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: var(--tw-prose-headings);
- font-weight: 600;
- font-size: 1.25em;
- margin-top: 1.6em;
- margin-bottom: 0.6em;
- line-height: 1.6;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h3 strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-weight: 700;
- color: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h4):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: var(--tw-prose-headings);
- font-weight: 600;
- margin-top: 1.5em;
- margin-bottom: 0.5em;
- line-height: 1.5;
- font-size: 1.15em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h4 strong):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-weight: 700;
- color: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(img):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 2em;
- margin-bottom: 2em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(picture):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- display: block;
- margin-top: 2em;
- margin-bottom: 2em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(kbd):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-weight: 500;
- font-family: inherit;
- color: var(--tw-prose-kbd);
- box-shadow: 0 0 0 1px rgb(var(--tw-prose-kbd-shadows) / 10%),
- 0 3px 0 rgb(var(--tw-prose-kbd-shadows) / 10%);
- font-size: 0.875em;
- padding: 0.1875em 0.375em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: var(--tw-prose-code);
- font-weight: 400;
- font-size: 0.875em;
- padding: 0.2rem 0.4rem;
- background-color: hsl(var(--muted));
- border: 1px solid hsl(var(--muted));
- border-radius: 0.5rem;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(code):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ):before {
- content: "";
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *)):after {
- content: "";
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(a code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h1 code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h2 code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: inherit;
- font-size: 0.875em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h3 code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: inherit;
- font-size: 0.9em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h4 code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(blockquote code):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- color: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(thead th code):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- color: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(pre):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: var(--tw-prose-pre-code);
- background-color: var(--tw-prose-pre-bg);
- overflow-x: auto;
- font-weight: 400;
- font-size: 0.875em;
- line-height: 1.7142857;
- margin-top: 1.7142857em;
- margin-bottom: 32px;
- border-radius: 0.375rem;
- background: none;
- padding: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(pre code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- background-color: transparent;
- border-width: 0;
- border-radius: 0;
- padding: 0;
- font-weight: inherit;
- color: inherit;
- font-size: inherit;
- font-family: inherit;
- line-height: inherit;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(pre code):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ):before {
- content: none;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(pre code):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ):after {
- content: none;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(table):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- width: 100%;
- table-layout: auto;
- text-align: left;
- margin-top: 2em;
- margin-bottom: 2em;
- font-size: 0.875em;
- line-height: 1.7142857;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(thead):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- border-bottom-width: 1px;
- border-bottom-color: var(--tw-prose-th-borders);
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(thead th):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: var(--tw-prose-headings);
- font-weight: 600;
- vertical-align: bottom;
- padding-right: 0.5714286em;
- padding-bottom: 0.5714286em;
- padding-left: 0.5714286em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(tbody tr):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- border-bottom-width: 1px;
- border-bottom-color: var(--tw-prose-td-borders);
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(tbody tr:last-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- border-bottom-width: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(tbody td):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- vertical-align: baseline;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(tfoot):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- border-top-width: 1px;
- border-top-color: var(--tw-prose-th-borders);
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(tfoot td):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- vertical-align: top;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(figcaption):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: hsl(var(--muted-foreground));
- font-size: 0.875em;
- line-height: 1.4285714;
- margin-top: 0.8571429em;
- font-family: Office Code Pro, monospace;
-}
-
-.Docs .doc-module article:first-child {
- --tw-prose-links: hsl(var(--foreground));
- --tw-prose-kbd: #111827;
- --tw-prose-kbd-shadows: 17 24 39;
- --tw-prose-invert-kbd: #fff;
- --tw-prose-invert-kbd-shadows: 255 255 255;
- --tw-prose-invert-code: #fff;
- --tw-prose-invert-pre-code: #d1d5db;
- --tw-prose-invert-pre-bg: rgba(0, 0, 0, 0.5);
- --tw-prose-invert-th-borders: #4b5563;
- --tw-prose-invert-td-borders: #374151;
- font-size: 1rem;
- line-height: 1.75;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(video):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 2em;
- margin-bottom: 2em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 0.5em;
- margin-bottom: 0.5em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol > li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- padding-left: 0.375em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ul > li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- padding-left: 0.375em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > ul > li p):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 0.75em;
- margin-bottom: 0.75em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > ul > li > :first-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 1.25em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > ul > li > :last-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-bottom: 1.25em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > ol > li > :first-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 1.25em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > ol > li > :last-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-bottom: 1.25em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ul ul, ul ol, ol ul, ol ol):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 0.75em;
- margin-bottom: 0.75em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(dl):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.25em;
- margin-bottom: 1.25em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(dd):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 0.5em;
- padding-left: 1.625em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(tbody td, tfoot td):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- padding: 0.5714286em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(figure):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin: 3rem 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > :first-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > :last-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-bottom: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h5):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- color: var(--colors-scale12);
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h1, h2, h3, h4, h5, h6):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- font-weight: 400;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(article h2, article h3, article h4, article h5, article h6):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 2em;
- margin-bottom: 1em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ul li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- position: relative;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ul li):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ):before {
- position: absolute;
- top: 0.75rem;
- left: -1rem;
- height: 0.125rem;
- width: 0.5rem;
- border-radius: 0.25rem;
- background-color: hsl(var(--border));
- content: "";
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol > li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- display: block;
- position: relative;
- padding-left: 1rem;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol > li):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ):before {
- position: absolute;
- top: 0.25rem;
- left: -1rem;
- height: 1.2rem;
- width: 1.2rem;
- border-radius: 0.25rem;
- background-color: hsl(var(--background));
- border: 1px solid hsl(var(--border));
- content: counter(item) " ";
- counter-increment: item;
- font-size: 12px;
- color: hsl(var(--muted-foreground));
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(p img):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- border: 1px solid hsl(var(--border));
- border-radius: 4px;
- overflow: hidden;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(iframe):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- border: 1px solid hsl(var(--border) / 0.9);
- border-radius: 0.5rem;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(td):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- border-bottom: 1px solid hsl(var(--muted));
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(a:hover):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(figure.quote-figure p:first-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(figure.quote-figure p:last-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-bottom: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(figure img):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin: 0;
-}
-
-.Docs .doc-module article:first-child {
- font-size: 0.875rem;
- line-height: 1.7142857;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(p):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.1428571em;
- margin-bottom: 1.1428571em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where([class~="lead"]):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- font-size: 1.2857143em;
- line-height: 1.5555556;
- margin-top: 0.8888889em;
- margin-bottom: 0.8888889em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(blockquote):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.3333333em;
- margin-bottom: 1.3333333em;
- padding-left: 1.1111111em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h1):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-size: 2.1428571em;
- margin-top: 0;
- margin-bottom: 0.8em;
- line-height: 1.2;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h2):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-size: 1.4285714em;
- margin-top: 1.6em;
- margin-bottom: 0.8em;
- line-height: 1.4;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h3):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-size: 1.2857143em;
- margin-top: 1.5555556em;
- margin-bottom: 0.4444444em;
- line-height: 1.5555556;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h4):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.4285714em;
- margin-bottom: 0.5714286em;
- line-height: 1.4285714;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(img):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.7142857em;
- margin-bottom: 1.7142857em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(picture):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.7142857em;
- margin-bottom: 1.7142857em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(picture > img):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(video):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.7142857em;
- margin-bottom: 1.7142857em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(kbd):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-size: 0.8571429em;
- border-radius: 0.3125rem;
- padding: 0.1428571em 0.3571429em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-size: 0.8571429em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h2 code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-size: 0.9em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h3 code):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-size: 0.8888889em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(pre):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-size: 0.8571429em;
- line-height: 1.6666667;
- margin-top: 1.6666667em;
- margin-bottom: 1.6666667em;
- border-radius: 0.25rem;
- padding: 0.6666667em 1em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.1428571em;
- margin-bottom: 1.1428571em;
- padding-left: 1.5714286em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ul):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.1428571em;
- margin-bottom: 1.1428571em;
- padding-left: 1.5714286em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 0.2857143em;
- margin-bottom: 0.2857143em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ol > li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- padding-left: 0.4285714em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ul > li):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- padding-left: 0.4285714em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > ul > li p):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 0.5714286em;
- margin-bottom: 0.5714286em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > ul > li > :first-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 1.1428571em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > ul > li > :last-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-bottom: 1.1428571em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > ol > li > :first-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 1.1428571em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > ol > li > :last-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-bottom: 1.1428571em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(ul ul, ul ol, ol ul, ol ol):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 0.5714286em;
- margin-bottom: 0.5714286em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(dl):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.1428571em;
- margin-bottom: 1.1428571em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(dt):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.1428571em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(dd):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 0.2857143em;
- padding-left: 1.5714286em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(hr):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 2.8571429em;
- margin-bottom: 2.8571429em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(hr + *):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h2 + *):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h3 + *):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h4 + *):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(table):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-size: 0.8571429em;
- line-height: 1.5;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(thead th):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- padding-right: 1em;
- padding-bottom: 0.6666667em;
- padding-left: 1em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(thead th:first-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- padding-left: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(thead th:last-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- padding-right: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(tbody td, tfoot td):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- padding: 0.6666667em 1em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(tbody td:first-child, tfoot td:first-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- padding-left: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(tbody td:last-child, tfoot td:last-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- padding-right: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(figure):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 1.7142857em;
- margin-bottom: 1.7142857em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(figure > *):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(figcaption):not(:where([class~="not-prose"], [class~="not-prose"] *)) {
- font-size: 0.8571429em;
- line-height: 1.3333333;
- margin-top: 0.6666667em;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > :first-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-top: 0;
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(.prose > :last-child):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- margin-bottom: 0;
-}
-
-.Docs .doc-module article:first-child {
- --tw-prose-body: hsl(var(--foreground));
- --tw-prose-headings: hsl(var(--foreground));
- --tw-prose-lead: hsl(var(--foreground));
- --tw-prose-links: hsl(var(--primary));
- --tw-prose-bold: hsl(var(--foreground));
- --tw-prose-counters: hsl(var(--foreground));
- --tw-prose-bullets: hsl(var(--muted-foreground));
- --tw-prose-hr: hsl(var(--muted));
- --tw-prose-quotes: hsl(var(--foreground));
- --tw-prose-quote-borders: hsl(var(--muted));
- --tw-prose-captions: hsl(var(--border));
- --tw-prose-code: hsl(var(--foreground));
- --tw-prose-pre-code: hsl(var(--muted-foreground));
- --tw-prose-pre-bg: hsl(var(--muted));
- --tw-prose-th-borders: hsl(var(--muted));
- --tw-prose-td-borders: hsl(var(--background-default));
- --tw-prose-invert-body: hsl(var(--background-default));
- --tw-prose-invert-headings: #fff;
- --tw-prose-invert-lead: hsl(var(--muted));
- --tw-prose-invert-links: #fff;
- --tw-prose-invert-bold: #fff;
- --tw-prose-invert-counters: hsl(var(--muted));
- --tw-prose-invert-bullets: hsl(var(--primary));
- --tw-prose-invert-hr: hsl(var(--border));
- --tw-prose-invert-quotes: hsl(var(--background-alternative-default));
- --tw-prose-invert-quote-borders: hsl(var(--border));
- --tw-prose-invert-captions: hsl(var(--muted));
-}
-
-.Docs
- .doc-module
- article:first-child
- :where(h1, h2, h3, h4, h5):not(
- :where([class~="not-prose"], [class~="not-prose"] *)
- ) {
- font-weight: 400;
-}
-
-.Docs .doc-module article:first-child {
- max-width: none;
-}
-
-.Docs.Docs--table-editor .doc-module__table-name {
- margin-top: 1rem;
-}
-
-.Docs .code-column {
- width: 50%;
- padding: 1rem 1.5rem;
- max-width: 50%;
-}
-
-.Docs .code-column a {
- transition-property: color, background-color, border-color,
- text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter,
- -webkit-backdrop-filter;
- transition-property: color, background-color, border-color,
- text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter,
- backdrop-filter;
- transition-property: color, background-color, border-color,
- text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter,
- backdrop-filter, -webkit-backdrop-filter;
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
- transition-duration: 0.15s;
-}
-
-.Docs .code-column a:hover {
- --tw-text-opacity: 1;
- color: hsl(var(--brand-600) / var(--tw-text-opacity));
-}
-
-.Docs .code-column p:last-child {
- padding-bottom: 0;
-}
-
-.Docs .code {
- width: 50%;
- flex: 1 1 0%;
- padding: 0.5rem 1.5rem 1rem;
- max-width: 50%;
-}
-
-.Docs .code h4 {
- margin: 0.25rem;
- padding: 0;
- font-size: 0.875rem;
- line-height: 1.25rem;
- font-weight: 400;
- text-transform: uppercase;
- --tw-text-opacity: 1;
-}
-
-.Docs .code h4:not(:first-child) {
- margin-top: 1.5rem;
-}
-
-.Docs .code code {
- margin: 0.25rem;
- padding: 0;
- background-color: none;
-}
-
-.Docs .code .is-highlighted {
- --tw-text-opacity: 1;
- color: hsl(var(--primary) / var(--tw-text-opacity));
-}
-
-.Docs .codeblock-container + .codeblock-container {
- margin-top: 3rem;
-}
diff --git a/apps/academy/app/styles/editorial-tokens.css b/apps/academy/app/styles/editorial-tokens.css
new file mode 100644
index 0000000000..9b16c2a51f
--- /dev/null
+++ b/apps/academy/app/styles/editorial-tokens.css
@@ -0,0 +1,80 @@
+/* Editorial warm-paper palette — ported from the docs app (docs/app/global.css).
+ * Single source of truth for the hand-built editorial components ported into
+ * academy (SiteHeader, CourseSidebar, ChapterCard, Breadcrumb, reader layout).
+ * Defining them in @theme generates utilities (text-ed-ink, bg-ed-paper,
+ * border-ed-hairline, …) and exposes them as CSS vars for inline styles.
+ * Light-only surface by design — matches the docs Guide/Reference. */
+
+/* Expose --brand (set in tailwind.css :root) as Tailwind color utilities. */
+@theme inline {
+ --color-brand: hsl(var(--brand));
+}
+
+@theme {
+ --color-ed-ink: #262323;
+ --color-ed-ink-78: rgba(38, 35, 35, 0.78);
+ --color-ed-ink-66: rgba(38, 35, 35, 0.66);
+ --color-ed-ink-60: rgba(38, 35, 35, 0.6);
+ --color-ed-ink-45: rgba(38, 35, 35, 0.45);
+ --color-ed-hairline: #e7e7e3;
+ --color-ed-paper: #fbfbf8;
+ --color-ed-svg-line: #d8d7d2;
+ --color-ed-brand: #00b0ff;
+ --color-ed-brand-ink: #1e84b0;
+ --color-ed-accent-fill: #eaf8ff;
+ --color-ed-amber-fill: #fff2d8;
+ --color-ed-amber-stroke: #e6cfa3;
+ --color-ed-amber-text: #9c7136;
+ --color-ed-header: #f1f1ec; /* table header strip */
+ --color-ed-inset: #f6f6f1; /* expanded row panel */
+ --color-ed-row-hover: rgba(38, 35, 35, 0.025); /* row hover */
+
+ /* Warm-gray ramp + status + dark-surface + link families. Light-only. */
+ --color-ed-warm-100: #f5f5f2;
+ --color-ed-warm-150: #ecece7;
+ --color-ed-warm-300: #e3e3df;
+ --color-ed-warm-400: #dadad5;
+ --color-ed-warm-500: #d2d2cc;
+ --color-ed-text-faint: #c9c9c5;
+ --color-ed-text-muted: #9a9a96;
+ --color-ed-graphite: #4b4b4a;
+ --color-ed-dark-bg: #1b1b1a;
+ --color-ed-dark-surface: #262624;
+ --color-ed-dark-line: #2a2a28;
+ --color-ed-dark-line-2: #3a3a38;
+ --color-ed-dark-line-3: #4a4a47;
+ --color-ed-green-bg: #e4f8da;
+ --color-ed-green-border: #a8db91;
+ --color-ed-green-text: #4f9140;
+ --color-ed-green-strong: #3f9142;
+ --color-ed-red-bg: #fce8e6;
+ --color-ed-red-border: #f2c0bc;
+ --color-ed-red: #b3261e;
+ --color-ed-red-bright: #e5484d;
+ --color-ed-blue-bg: #dff5ff;
+ --color-ed-blue-bg-strong: #b2e7ff;
+ --color-ed-blue-border: #a9daf3;
+ --color-ed-blue-text: #0c6e96;
+ --color-ed-blue-mid: #3583a8;
+ --color-ed-blue-deep: #17729b;
+ --color-ed-brown: #a76451;
+
+ /* Editorial DM Sans weights between Tailwind's normal(400)/medium(500)/semibold(600). */
+ --font-weight-book: 460;
+ --font-weight-demi: 530;
+ --font-weight-semi: 560;
+
+ /* Editorial size ramp (font-size only — pairs with explicit leading-*). Named by px. */
+ --text-ed-10: 0.625rem;
+ --text-ed-11: 0.6875rem;
+ --text-ed-12: 0.75rem;
+ --text-ed-13: 0.8125rem;
+ --text-ed-14: 0.875rem;
+ --text-ed-15: 0.9375rem;
+ --text-ed-16: 1rem;
+ --text-ed-18: 1.125rem;
+ --text-ed-20: 1.25rem;
+ --text-ed-24: 1.5rem;
+ --text-ed-32: 2rem;
+ --text-ed-40: 2.5rem;
+}
diff --git a/apps/academy/app/styles/editorial.css b/apps/academy/app/styles/editorial.css
new file mode 100644
index 0000000000..9f203e284d
--- /dev/null
+++ b/apps/academy/app/styles/editorial.css
@@ -0,0 +1,137 @@
+/* Editorial design system — ported from the docs app (docs/app/editorial.css +
+ * reference.css). Warm paper, DM Sans, glass pills, callout boxes, ink text.
+ * Powers the restyled academy surfaces (header, sidebar, reader, challenge).
+ * Loaded AFTER theme.css so its treatments win. Light-only. */
+
+.scrollbar-none {
+ -ms-overflow-style: none;
+ scrollbar-width: none;
+}
+.scrollbar-none::-webkit-scrollbar {
+ display: none;
+}
+
+.glass-pill {
+ border: 1px solid rgba(32, 32, 32, 0.06);
+ background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%),
+ rgba(245, 245, 242, 0.65);
+ box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.06), 0 0 0.357px 1.5px rgba(255, 255, 255, 0.35) inset,
+ 0 2px 0 0 #fff inset;
+ backdrop-filter: blur(12px);
+}
+
+.cta-btn-dark {
+ background: linear-gradient(180deg, #3a3835 0%, #262323 100%);
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.45), 0 0 0 0.5px rgba(255, 255, 255, 0.08) inset,
+ 0 1px 0 0 rgba(255, 255, 255, 0.1) inset;
+}
+
+.btn-dark-hover {
+ background: linear-gradient(180deg, #4a4845 0%, #363333 100%);
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.45), 0 0 0 0.5px rgba(255, 255, 255, 0.12) inset,
+ 0 1px 0 0 rgba(255, 255, 255, 0.15) inset;
+}
+
+.text-ink {
+ color: #262323cc;
+ text-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.2), 0 -0.5px 0 rgba(255, 255, 255, 0.25);
+}
+.text-ink-ui {
+ color: #202020cc;
+}
+.text-ink-faint {
+ color: #262323b3;
+}
+.text-ink-body {
+ color: rgba(38, 35, 35, 0.78);
+}
+.text-on-dark {
+ color: rgba(255, 255, 255, 0.92);
+}
+
+.nav-link {
+ text-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.1), 0 -0.5px 0 rgba(255, 255, 255, 0.15);
+}
+
+.callout-box {
+ border: 1px solid #e7e7e3;
+ background: rgba(251, 251, 248, 0.5);
+ box-shadow: inset 0 1px 0 #fff;
+ border-radius: 12px;
+}
+.callout-box-inner {
+ background: #f7f7f3;
+ box-shadow: inset 0 0 0 1px rgba(38, 35, 35, 0.08), inset 0 1px 0 #fff;
+ border-radius: 10px;
+}
+
+.scrollbar-hidden-until-scroll {
+ scrollbar-width: thin;
+ scrollbar-color: transparent transparent;
+}
+.scrollbar-hidden-until-scroll:hover {
+ scrollbar-color: #26232326 transparent;
+}
+.scrollbar-hidden-until-scroll::-webkit-scrollbar {
+ width: 4px;
+}
+.scrollbar-hidden-until-scroll::-webkit-scrollbar-thumb {
+ background: transparent;
+ border-radius: 2px;
+}
+.scrollbar-hidden-until-scroll:hover::-webkit-scrollbar-thumb {
+ background: #26232326;
+}
+
+/* Fade the top edge of a nav scroller so it's clear there's more above. */
+.nav-scroll-fade {
+ -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
+ mask-image: linear-gradient(to bottom, transparent 0, #000 22px);
+}
+
+.code-inline {
+ display: inline-flex;
+ align-items: center;
+ border-radius: 5px;
+ border: 1.2px solid #e3e3e0;
+ padding: 1px 6px;
+ font-size: 13px;
+ line-height: 140%;
+ letter-spacing: 0.13px;
+ color: #a76451;
+ white-space: nowrap;
+ background: #e7e7e3;
+ box-shadow: 0 0.5px 0.5px 0 rgba(0, 0, 0, 0.1), 0 2px 1px 0 #fff, 0 -1px 1px 0 rgba(0, 0, 0, 0.03);
+}
+
+/* Page/reader title + lead — mirrors the docs Reference (reference.css). */
+.reference-title {
+ font-family: var(--font-sans);
+ font-size: clamp(2rem, 4vw, 2.5rem);
+ line-height: 1.12;
+ letter-spacing: -0.005em;
+ font-weight: 530;
+ color: #262323;
+}
+.reference-desc {
+ font-size: 1.0625rem;
+ line-height: 1.6;
+ color: rgba(38, 35, 35, 0.62);
+}
+
+/* Editorial reading rhythm for prose bodies (lesson description, about copy). */
+.guide-prose p,
+.guide-prose li {
+ font-size: 1.0625rem;
+ line-height: 1.75;
+ color: rgba(38, 35, 35, 0.78);
+}
+
+/* Anchor navigation (the On-this-page TOC) glides; motion-sensitive users jump. */
+@media (prefers-reduced-motion: no-preference) {
+ html {
+ scroll-behavior: smooth;
+ }
+}
diff --git a/apps/academy/app/styles/tailwind.css b/apps/academy/app/styles/tailwind.css
index 511c14c6da..f0db1017b2 100644
--- a/apps/academy/app/styles/tailwind.css
+++ b/apps/academy/app/styles/tailwind.css
@@ -1,41 +1,56 @@
-@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@700&display=swap");
+@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Fira+Code:[email protected]&display=swap");
@import "tailwindcss";
-@import "non.geist";
-@import "non.geist/mono";
@import "../../../../packages/config/tailwind/theme.css";
+@import "./editorial-tokens.css";
+@import "./editorial.css";
+
+/* Swap the site typeface to DM Sans / Fira Code (matches the docs editorial surface).
+ * Overrides theme.css's Geist font utilities site-wide. */
+@theme {
+ --font-sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
+ --font-mono: "Fira Code", ui-monospace, monospace;
+}
@layer base {
:root {
- --background: 0 0% 100%;
- --foreground: 240 10% 3.9%;
- --card: 0 0% 100%;
- --card-foreground: 240 10% 3.9%;
- --popover: 0 0% 100%;
- --popover-foreground: 240 10% 3.9%;
- --active: 240 5.9% 10%;
- --active-foreground: 0 0% 98%;
- --primary: 210 42% 9%;
- --primary-foreground: 0 0% 98%;
- --secondary: 219 93% 56%;
- --secondary-foreground: 219 88% 98%;
- --muted: 240 4.8% 95.9%;
- --muted-foreground: 240 3.8% 37.1%;
- --accent: 240 4.8% 95.9%;
- --accent-foreground: 240 5.9% 10%;
- --destructive: 0 84.2% 60.2%;
+ /* Warm paper editorial palette — matches the docs Guide (#F5F5F2 paper, #262323 ink).
+ * @carbon/react components (dropdowns, toasts, auth forms) read these tokens, so they
+ * pick up the warm surface automatically. Light-only. */
+ --background: 60 11% 95%;
+ --foreground: 0 4% 14%;
+ --card: 60 33% 98%;
+ --card-foreground: 0 4% 14%;
+ --popover: 60 20% 99%;
+ --popover-foreground: 0 4% 14%;
+ --active: 60 8% 90%;
+ --active-foreground: 0 4% 14%;
+ --primary: 0 4% 14%;
+ --primary-foreground: 60 11% 96%;
+ --secondary: 60 9% 93%;
+ --secondary-foreground: 0 4% 14%;
+ --muted: 60 9% 93%;
+ --muted-foreground: 24 4% 44%;
+ --accent: 60 8% 90%;
+ --accent-foreground: 0 4% 14%;
+ --destructive: 0 72% 51%;
--destructive-foreground: 0 0% 98%;
- --border: 240 5.9% 90%;
- --input: 240 5.9% 90%;
- --ring: 240 10% 3.9%;
+ --border: 60 8% 90%;
+ --input: 60 8% 90%;
+ --ring: 0 4% 30%;
+ --success: 142 60% 40%;
+ --success-foreground: 0 0% 98%;
--radius: 0.5rem;
- --sidebar-background: 0 0% 98%;
- --sidebar-foreground: 240 5.3% 26.1%;
- --sidebar-primary: 240 5.9% 10%;
- --sidebar-primary-foreground: 0 0% 98%;
- --sidebar-accent: 240 4.8% 95.9%;
- --sidebar-accent-foreground: 240 5.9% 10%;
- --sidebar-border: 220 13% 91%;
- --sidebar-ring: 217.2 91.2% 59.8%;
+ --sidebar-background: 60 33% 98%;
+ --sidebar-foreground: 0 4% 26%;
+ --sidebar-primary: 0 4% 14%;
+ --sidebar-primary-foreground: 60 11% 96%;
+ --sidebar-accent: 60 8% 90%;
+ --sidebar-accent-foreground: 0 4% 14%;
+ --sidebar-border: 60 8% 90%;
+ --sidebar-ring: 199 100% 50%;
+
+ /* Editorial highlight accent — the docs #00B0FF blue. */
+ --brand: 199 100% 50%;
--base-shadow-color: rgb(0 0 0 / 0.05);
@@ -56,63 +71,6 @@
inset 0px 1px 0px #fff, inset 0px 1px 2px 1px #fff,
inset 0px 1px 2px rgb(0 0 0 / 0.06);
}
-
- .dark {
- --background: 220 14.3% 6.1%;
- --foreground: 0 0% 98%;
- --card: 220 10% 3.9%;
- --card-foreground: 0 0% 98%;
- --popover: 220 10% 3.9%;
- --popover-foreground: 0 0% 98%;
- --primary: 0 0% 98%;
- --primary-foreground: 220 5.9% 10%;
- --active: 0 0% 98%;
- --active-foreground: 220 5.9% 10%;
- --secondary: 163 93% 56%;
- --secondary-foreground: 163 88% 11%;
- --muted: 0 0% 13.6%;
- --muted-foreground: 0 0% 65%;
- --accent: 0 0% 7.6%;
- --accent-foreground: 0 0% 98%;
- --destructive: 0 62.8% 30.6%;
- --destructive-foreground: 0 0% 98%;
- --border: 220 3.7% 15.9%;
- --input: 220 3.7% 15.9%;
- --ring: 220 4.9% 83.9%;
- --sidebar-background: 240 5.9% 10%;
- --sidebar-foreground: 240 4.8% 95.9%;
- --sidebar-primary: 224.3 76.3% 48%;
- --sidebar-primary-foreground: 0 0% 100%;
- --sidebar-accent: 240 3.7% 15.9%;
- --sidebar-accent-foreground: 240 4.8% 95.9%;
- --sidebar-border: 240 3.7% 15.9%;
- --sidebar-ring: 217.2 91.2% 59.8%;
- --chart-1: 220 70% 50%;
- --chart-2: 160 60% 45%;
- --chart-3: 30 80% 55%;
- --chart-4: 280 65% 60%;
- --chart-5: 340 75% 55%;
-
- --button-drop-shadow: rgb(0 0 0 / 0.4);
- --danger-drop-shadow: rgb(127 29 29 / 0.8);
- --button-shadow: 0px -1px 0px 0px rgb(255 255 255 / 0.04),
- 0px 0px 0px 1px rgb(255 255 255 / 0.12), 0px 0px 1px 0px rgb(0 0 0 / 0.04),
- 0px 2px 2px 0px rgb(0 0 0 / 0.04), 0px 4px 2px 0px rgb(0 0 0 / 0.04),
- 0px 6px 3px 0px rgb(0 0 0 / 0.04);
- --popover-shadow: 0px 0px 4px rgba(0, 0, 0, 0.08),
- 0px 0px 10px rgba(0, 0, 0, 0.12), 0px 0px 24px rgba(0, 0, 0, 0.16),
- 0px 0px 80px rgba(0, 0, 0, 0.2);
- --button-base-shadow: 0px 0px 0px 0.5px rgb(0 0 0 / 0.4),
- 0px 1px 1px -1px rgb(0 0 0 / 0.12), 0px 2px 2px -1px rgb(0 0 0 / 0.12),
- inset 0px 0.5px 0px rgb(255 255 255 / 0.06),
- inset 0px 0px 1px 0px rgb(255 255 255 / 0.16),
- inset 0px -6px 12px -4px rgb(0 0 0 / 0.16);
- --button-primary-shadow: 0px 1px 1px -1px rgb(0 0 0 / 0.08),
- 0px 2px 2px -1px rgb(0 0 0 / 0.08), 0px 0px 0px 1px rgb(0 0 0 / 0.06),
- inset 0px 1px 0px #fff, inset 0px 0px 2px 1px #fff,
- inset 0px 1px 2px rgb(0 0 0 / 0.06),
- inset 0px -4px 8px -4px rgb(0 0 0 / 0.06);
- }
}
@layer base {
@@ -124,13 +82,19 @@
font-feature-settings: "rlig" 1, "calt" 1;
font-synthesis-weight: none;
text-rendering: optimizeLegibility;
+ -webkit-font-smoothing: antialiased;
+ }
+
+ /* Site-wide keyboard focus ring in the brand accent (matches docs). */
+ :focus-visible {
+ outline: 2px solid hsl(var(--brand));
+ outline-offset: 2px;
+ }
+ :focus:not(:focus-visible) {
+ outline: none;
}
}
.font-display {
font-family: "DM Sans", sans-serif;
}
-
-a.active {
- font-weight: 600;
-}
diff --git a/apps/academy/app/utils/glossary.ts b/apps/academy/app/utils/glossary.ts
new file mode 100644
index 0000000000..536094f7cf
--- /dev/null
+++ b/apps/academy/app/utils/glossary.ts
@@ -0,0 +1,80 @@
+import { getTermText, listEntries } from "@carbon/glossary";
+
+export type GlossarySegment = string | { text: string; slug: string };
+
+// Phrases that are too generic to auto-link without noise.
+const STOPLIST = new Set(["buy", "make", "new", "job", "part", "cost"]);
+
+type Phrase = { phrase: string; slug: string; re: RegExp };
+
+function escapeRegExp(s: string): string {
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+}
+
+// Build the match list once: for each glossary entry, candidate phrases are the
+// de-parenthesized term, its aliases, and the slug-as-words. Longest first so a
+// specific phrase wins over a shorter substring.
+const PHRASES: Phrase[] = (() => {
+ const seen = new Set<string>();
+ const out: Phrase[] = [];
+ for (const { id, entry } of listEntries()) {
+ const primary = getTermText(entry)
+ .replace(/\s*\([^)]*\)\s*/g, " ")
+ .trim();
+ const candidates = [
+ primary,
+ ...(entry.aliases ?? []),
+ id.replace(/-/g, " ")
+ ];
+ for (const raw of candidates) {
+ const phrase = raw.trim().toLowerCase();
+ if (phrase.length < 3) continue;
+ if (STOPLIST.has(phrase)) continue;
+ if (seen.has(phrase)) continue;
+ seen.add(phrase);
+ out.push({
+ phrase,
+ slug: id,
+ re: new RegExp(`(?<![\\w-])(${escapeRegExp(phrase)})(?![\\w-])`, "i")
+ });
+ }
+ }
+ return out.sort((a, b) => b.phrase.length - a.phrase.length);
+})();
+
+/**
+ * Split `text` into segments, wrapping the first whole-word occurrence of each
+ * known glossary term once (case-insensitive). Only plain-string segments are
+ * scanned, so terms never overlap and each slug links at most once.
+ */
+export function linkifyGlossary(text: string): GlossarySegment[] {
+ let segments: GlossarySegment[] = [text];
+ const usedSlugs = new Set<string>();
+
+ for (const { slug, re } of PHRASES) {
+ if (usedSlugs.has(slug)) continue;
+ const next: GlossarySegment[] = [];
+ let matched = false;
+ for (const seg of segments) {
+ if (matched || typeof seg !== "string") {
+ next.push(seg);
+ continue;
+ }
+ const m = seg.match(re);
+ if (!m || m.index === undefined) {
+ next.push(seg);
+ continue;
+ }
+ const start = m.index;
+ const end = start + m[1].length;
+ if (start > 0) next.push(seg.slice(0, start));
+ next.push({ text: seg.slice(start, end), slug });
+ if (end < seg.length) next.push(seg.slice(end));
+ matched = true;
+ }
+ if (matched) usedSlugs.add(slug);
+ segments = next;
+ }
+
+ return segments;
+}
diff --git a/apps/academy/app/utils/path.ts b/apps/academy/app/utils/path.ts
index dd20574b2e..a861a21a9b 100644
--- a/apps/academy/app/utils/path.ts
+++ b/apps/academy/app/utils/path.ts
@@ -9,11 +9,16 @@ const ERP_URL = SUPABASE_URL?.includes("localhost")
? "http://localhost:3000"
: ERP_URL_CONFIG;
+const DOCS_URL = SUPABASE_URL?.includes("localhost")
+ ? "http://localhost:3002"
+ : "https://docs.carbon.ms";
+
export const path = {
to: {
- about: "/about",
accountSettings: `${ERP_URL}/x/account`,
callback: "/callback",
+ docs: `${DOCS_URL}/docs`,
+ glossary: `${DOCS_URL}/docs/glossary`,
challenge: (topicId: string) => generatePath(`${challenge}/${topicId}`),
course: (moduleId: string, courseId: string) =>
generatePath(`${course}/${moduleId}/${courseId}`),
diff --git a/apps/academy/app/utils/progress.ts b/apps/academy/app/utils/progress.ts
new file mode 100644
index 0000000000..c0344f9f18
--- /dev/null
+++ b/apps/academy/app/utils/progress.ts
@@ -0,0 +1,132 @@
+import { modules } from "~/config";
+
+type Module = (typeof modules)[number];
+type Course = Module["courses"][number];
+type Topic = Course["topics"][number];
+type Lesson = Topic["lessons"][number];
+
+export type CourseProgress = {
+ lessonsDone: number;
+ lessonsTotal: number;
+ challengesDone: number;
+ challengesTotal: number;
+ /** Combined completion across core lessons + challenges, 0–100. */
+ percent: number;
+ complete: boolean;
+};
+
+export type ResumeTarget = {
+ module: Module;
+ course: Course;
+ topic: Topic;
+ lesson: Lesson;
+};
+
+/** Core lessons in a topic (supplemental videos are extra, excluded from the path). */
+function topicChallengeCount(topic: Topic): number {
+ return topic.challenge && topic.challenge.length > 0 ? 1 : 0;
+}
+
+export function getCourseProgress(
+ course: Course,
+ completedLessonIds: Set<string>,
+ passedTopicIds: Set<string>
+): CourseProgress {
+ let lessonsDone = 0;
+ let lessonsTotal = 0;
+ let challengesDone = 0;
+ let challengesTotal = 0;
+
+ for (const topic of course.topics) {
+ for (const lesson of topic.lessons) {
+ lessonsTotal += 1;
+ if (completedLessonIds.has(lesson.id)) lessonsDone += 1;
+ }
+ const hasChallenge = topicChallengeCount(topic) > 0;
+ if (hasChallenge) {
+ challengesTotal += 1;
+ if (passedTopicIds.has(topic.id)) challengesDone += 1;
+ }
+ }
+
+ const total = lessonsTotal + challengesTotal;
+ const done = lessonsDone + challengesDone;
+ const percent = total === 0 ? 0 : Math.round((done / total) * 100);
+
+ return {
+ lessonsDone,
+ lessonsTotal,
+ challengesDone,
+ challengesTotal,
+ percent,
+ complete: total > 0 && done >= total
+ };
+}
+
+export function getOverallProgress(
+ completedLessonIds: Set<string>,
+ passedTopicIds: Set<string>
+): { percent: number; done: number; total: number } {
+ let done = 0;
+ let total = 0;
+ for (const module of modules) {
+ for (const course of module.courses) {
+ const p = getCourseProgress(course, completedLessonIds, passedTopicIds);
+ done += p.lessonsDone + p.challengesDone;
+ total += p.lessonsTotal + p.challengesTotal;
+ }
+ }
+ return {
+ total,
+ done,
+ percent: total === 0 ? 0 : Math.round((done / total) * 100)
+ };
+}
+
+/**
+ * Next core lesson to watch, in recommended order (module → course → topic →
+ * lesson). Returns the first lesson not in `completedLessonIds`, or null when
+ * every core lesson is done.
+ */
+export function getResumeLesson(
+ completedLessonIds: Set<string>
+): ResumeTarget | null {
+ for (const module of modules) {
+ for (const course of module.courses) {
+ for (const topic of course.topics) {
+ for (const lesson of topic.lessons) {
+ if (!completedLessonIds.has(lesson.id)) {
+ return { module, course, topic, lesson };
+ }
+ }
+ }
+ }
+ }
+ return null;
+}
+
+/** Next incomplete lesson within a single course (for a per-course "Continue"). */
+export function getNextLessonInCourse(
+ course: Course,
+ completedLessonIds: Set<string>
+): Lesson | null {
+ for (const topic of course.topics) {
+ for (const lesson of topic.lessons) {
+ if (!completedLessonIds.has(lesson.id)) return lesson;
+ }
+ }
+ return null;
+}
+
+/** Build the completed-lesson + passed-topic sets from raw progress arrays. */
+export function toProgressSets(
+ lessonCompletions: { lessonId: string }[],
+ challengeAttempts: { topicId: string; passed: boolean }[]
+): { completedLessonIds: Set<string>; passedTopicIds: Set<string> } {
+ return {
+ completedLessonIds: new Set(lessonCompletions.map((c) => c.lessonId)),
+ passedTopicIds: new Set(
+ challengeAttempts.filter((a) => a.passed).map((a) => a.topicId)
+ )
+ };
+}
diff --git a/apps/academy/package.json b/apps/academy/package.json
index 5f75df748d..bce4642a29 100644
--- a/apps/academy/package.json
+++ b/apps/academy/package.json
@@ -6,6 +6,7 @@
"@carbon/database": "workspace:*",
"@carbon/documents": "workspace:*",
"@carbon/form": "workspace:*",
+ "@carbon/glossary": "workspace:*",
"@carbon/kv": "workspace:*",
"@carbon/logger": "workspace:*",
"@carbon/react": "workspace:*",
@@ -20,9 +21,7 @@
"@vercel/analytics": "catalog:",
"@vercel/react-router": "catalog:",
"cookie": "catalog:",
- "framer-motion": "catalog:",
"isbot": "catalog:",
- "non.geist": "catalog:",
"react": "catalog:",
"react-confetti-explosion": "3.0.3",
"react-dom": "catalog:",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index cd476a25cd..7ba6fb3617 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -412,6 +412,9 @@ importers:
'@carbon/form':
specifier: workspace:*
version: link:../../packages/form
+ '@carbon/glossary':
+ specifier: workspace:*
+ version: link:../../packages/glossary
'@carbon/kv':
specifier: workspace:*
version: link:../../packages/kv
@@ -454,15 +457,9 @@ importers:
cookie:
specifier: 'catalog:'
version: 1.1.1
- framer-motion:
- specifier: 'catalog:'
isbot:
specifier: 'catalog:'
version: 5.1.37
- non.geist:
- specifier: 'catalog:'
- version: 1.0.4
react:
specifier: 18.3.1
version: 18.3.1
@@ -694,7 +691,7 @@ importers:
'@react-router/remix-routes-option-adapter':
specifier: 'catalog:'
'@react-router/serve':
specifier: 'catalog:'
@@ -739,7 +736,7 @@ importers:
'@vercel/react-router':
specifier: 'catalog:'
'@visx/responsive':
specifier: 2.17.0
version: 2.17.0([email protected])
@@ -784,7 +781,7 @@ importers:
inngest:
specifier: ^3.52.7
intl-parse-accept-language:
specifier: 'catalog:'
version: 1.0.0
@@ -974,16 +971,16 @@ importers:
'@lingui/vite-plugin':
specifier: 'catalog:'
'@react-router/dev':
specifier: 'catalog:'
'@tailwindcss/typography':
specifier: 'catalog:'
version: 0.5.19([email protected])
'@tailwindcss/vite':
specifier: 'catalog:'
'@types/d3':
specifier: 7.4.3
version: 7.4.3
@@ -1043,13 +1040,13 @@ importers:
version: 5.8.3
vite:
specifier: 'catalog:'
vite-plugin-babel-macros:
specifier: 'catalog:'
vitest:
specifier: 'catalog:'
apps/mes:
dependencies:
@@ -1133,7 +1130,7 @@ importers:
'@lingui/vite-plugin':
specifier: 'catalog:'
'@nanostores/react':
specifier: 'catalog:'
@@ -1145,10 +1142,10 @@ importers:
'@react-router/dev':
specifier: 'catalog:'
'@react-router/remix-routes-option-adapter':
specifier: 'catalog:'
'@react-router/serve':
specifier: 'catalog:'
@@ -1169,7 +1166,7 @@ importers:
version: 0.5.19([email protected])
'@tailwindcss/vite':
specifier: 'catalog:'
'@tanstack/react-query':
specifier: 5.97.0
version: 5.97.0([email protected])
@@ -1214,7 +1211,7 @@ importers:
'@vercel/react-router':
specifier: 'catalog:'
'@xyflow/react':
specifier: 12.10.2
@@ -1332,13 +1329,13 @@ importers:
version: 5.8.3
vite:
specifier: 'catalog:'
vite-plugin-babel-macros:
specifier: 'catalog:'
vitest:
specifier: 'catalog:'
wait-on:
specifier: 'catalog:'
version: 7.2.0
@@ -27061,6 +27058,44 @@ snapshots:
+ dependencies:
+ '@bufbuild/protobuf': 2.11.0
+ '@inngest/ai': 0.1.7
+ '@jpwilliams/waitgroup': 2.1.1
+ '@opentelemetry/api': 1.9.0
+ '@opentelemetry/auto-instrumentations-node': 0.72.0(@opentelemetry/[email protected])(@opentelemetry/[email protected](@opentelemetry/[email protected]))
+ '@opentelemetry/context-async-hooks': 2.6.1(@opentelemetry/[email protected])
+ '@opentelemetry/exporter-trace-otlp-http': 0.214.0(@opentelemetry/[email protected])
+ '@opentelemetry/instrumentation': 0.214.0(@opentelemetry/[email protected])
+ '@opentelemetry/resources': 2.6.1(@opentelemetry/[email protected])
+ '@opentelemetry/sdk-trace-base': 2.6.1(@opentelemetry/[email protected])
+ '@standard-schema/spec': 1.1.0
+ '@traceloop/instrumentation-anthropic': 0.20.0
+ '@types/debug': 4.1.13
+ '@types/ms': 2.1.0
+ canonicalize: 1.0.8
+ chalk: 4.1.2
+ cross-fetch: 4.1.0([email protected])
+ debug: 4.4.3([email protected])
+ hash.js: 1.1.7
+ json-stringify-safe: 5.0.1
+ ms: 2.1.3
+ serialize-error-cjs: 0.1.4
+ strip-ansi: 5.2.0
+ temporal-polyfill: 0.2.5
+ ulid: 2.4.0
+ zod: 3.25.76
+ optionalDependencies:
+ express: 4.22.1
+ hono: 4.12.14
+ typescript: 5.8.3
+ transitivePeerDependencies:
+ - '@opentelemetry/core'
+ - encoding
+ - supports-color
+
dependencies:
'@bufbuild/protobuf': 2.11.0