From 87b7c9d822e0b45b4045fcc43a3c8e19b763f6c1 Mon Sep 17 00:00:00 2001 From: Ty Tremblay Date: Wed, 25 Nov 2026 09:01:42 -0500 Subject: [PATCH] Align site hierarchy, typography, clarity, and colors to FRC 2713 branding --- site/index.html | 2 +- site/package-lock.json | 40 +++ site/package.json | 4 + site/public/brand/2713-red.svg | 22 ++ site/public/brand/2713-white.svg | 22 ++ site/src/App.tsx | 85 ++++++- site/src/components/AppSidebar.tsx | 60 +++-- site/src/components/BlockPlayground.css | 45 ++-- site/src/components/CodeBlock.tsx | 8 +- site/src/components/FlowchartPlayground.css | 47 ++-- site/src/components/FlowchartPlayground.tsx | 21 +- site/src/components/JavaRunner.tsx | 65 +++-- site/src/components/LessonCard.tsx | 31 ++- site/src/components/MazePlayground.tsx | 56 ++--- site/src/components/PageNav.tsx | 69 ++++-- site/src/components/StatePlayground.css | 48 ++-- site/src/index.css | 254 +++++++++++++++----- site/src/lib/editorTheme.ts | 34 ++- site/src/routes/LessonIndex.tsx | 57 +++-- site/src/routes/LessonView.tsx | 140 +++++++---- site/src/styles/brand.css | 100 ++++++++ 21 files changed, 900 insertions(+), 310 deletions(-) create mode 100644 site/public/brand/2713-red.svg create mode 100644 site/public/brand/2713-white.svg create mode 100644 site/src/styles/brand.css diff --git a/site/index.html b/site/index.html index c4b93be..8a1c8f9 100644 --- a/site/index.html +++ b/site/index.html @@ -2,7 +2,7 @@ - + FRC 2713 Software Training diff --git a/site/package-lock.json b/site/package-lock.json index 398ac83..c2c54db 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -10,6 +10,10 @@ "dependencies": { "@codemirror/lang-python": "^6.2.1", "@codemirror/theme-one-dark": "^6.1.3", + "@fontsource/barlow": "^5.3.0", + "@fontsource/barlow-condensed": "^5.3.0", + "@fontsource/open-sans": "^5.3.0", + "@fontsource/roboto-mono": "^5.3.0", "@radix-ui/react-dialog": "^1.1.18", "@radix-ui/react-separator": "^1.1.11", "@radix-ui/react-slot": "^1.3.0", @@ -229,6 +233,42 @@ "integrity": "sha512-RiB/yIh78pcIxl6lLMG0CgBXAZ2Y0eVHqMPYugu+9U0AeT6YBeiJpf7lbdJNIugFP5SIjwNRgo4DhR1Qxi26Gg==", "license": "MIT" }, + "node_modules/@fontsource/barlow": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource/barlow/-/barlow-5.3.0.tgz", + "integrity": "sha512-tGR0y6QObRtKv71MOth44222+mdNFM/ZWFWDV1VLzNbG4oK9PNRlyJzmkck4vHAi9ibHBXgt4SlY51amFP55CA==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, + "node_modules/@fontsource/barlow-condensed": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource/barlow-condensed/-/barlow-condensed-5.3.0.tgz", + "integrity": "sha512-RA7MmIx0v3eQ6Gcf74qLVLOwLB0GpPOzx+eU9iG/AmCnSJGcIWYeU8y6CEMGZ210MGwGg5CZhzLkkvyZdTTk1g==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, + "node_modules/@fontsource/open-sans": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource/open-sans/-/open-sans-5.3.0.tgz", + "integrity": "sha512-V1bdMlGNyZrJwzrdusshMOw2YR0aqYDL7kOo9dkxUEKl8dFv66A9HLckOOXl572sG/7ohhDQrCrTFGSn9LZcSw==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, + "node_modules/@fontsource/roboto-mono": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource/roboto-mono/-/roboto-mono-5.3.0.tgz", + "integrity": "sha512-yhwplHMHW9dCk+1pZuERfcJe+K3rosGVZEoK0XktkxRSqQ9qsipSwwiuW2/8Qmtp9lzu3Ixa/ie4BMH3i8CkZQ==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", diff --git a/site/package.json b/site/package.json index efcef82..73e6324 100644 --- a/site/package.json +++ b/site/package.json @@ -12,6 +12,10 @@ "dependencies": { "@codemirror/lang-python": "^6.2.1", "@codemirror/theme-one-dark": "^6.1.3", + "@fontsource/barlow": "^5.3.0", + "@fontsource/barlow-condensed": "^5.3.0", + "@fontsource/open-sans": "^5.3.0", + "@fontsource/roboto-mono": "^5.3.0", "@radix-ui/react-dialog": "^1.1.18", "@radix-ui/react-separator": "^1.1.11", "@radix-ui/react-slot": "^1.3.0", diff --git a/site/public/brand/2713-red.svg b/site/public/brand/2713-red.svg new file mode 100644 index 0000000..4ef90d3 --- /dev/null +++ b/site/public/brand/2713-red.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/site/public/brand/2713-white.svg b/site/public/brand/2713-white.svg new file mode 100644 index 0000000..fc20d89 --- /dev/null +++ b/site/public/brand/2713-white.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/site/src/App.tsx b/site/src/App.tsx index 4afdd1b..08b586c 100644 --- a/site/src/App.tsx +++ b/site/src/App.tsx @@ -1,20 +1,86 @@ -import { HashRouter, Route, Routes } from 'react-router-dom' +import { HashRouter, Link, Route, Routes, useLocation } from 'react-router-dom' +import { ChevronRight } from 'lucide-react' import { AppSidebar } from './components/AppSidebar' import { SidebarInset, SidebarProvider, SidebarTrigger } from '@/components/ui/sidebar' +import { getLesson, lessonNumber } from '@/lib/lessons' import { ProgressProvider, useProgress } from '@/lib/progress' import { LessonIndex } from './routes/LessonIndex' import { LessonView } from './routes/LessonView' +function HeaderBreadcrumb() { + const { pathname } = useLocation() + const match = /^\/lesson\/([^/]+)(?:\/(\d+))?/.exec(pathname) + + if (!match) { + return ( + All lessons + ) + } + + const slug = match[1] + const lesson = getLesson(slug) + if (!lesson) { + return ( + All lessons + ) + } + + const num = lessonNumber(slug) + const pageCount = lesson.pages.length + const requested = match[2] ? Number(match[2]) : 1 + const currentPage = Number.isFinite(requested) + ? Math.min(Math.max(requested, 1), pageCount) + : 1 + + return ( + + ) +} + function HeaderProgress() { const { user, completedCount, totalLessons, loading } = useProgress() if (loading || !user) return null + const pct = totalLessons > 0 ? Math.round((completedCount / totalLessons) * 100) : 0 + return ( -
- - {completedCount} / {totalLessons} completed +
+
+ + - · - + {user.name}
@@ -28,11 +94,10 @@ function App() { -
+
- - FRC 2713 Software Training - +
diff --git a/site/src/components/AppSidebar.tsx b/site/src/components/AppSidebar.tsx index dc3a939..da5156a 100644 --- a/site/src/components/AppSidebar.tsx +++ b/site/src/components/AppSidebar.tsx @@ -1,4 +1,4 @@ -import { Check } from 'lucide-react' +import { BookOpen, Check } from 'lucide-react' import { NavLink, useLocation } from 'react-router-dom' import { Sidebar, @@ -18,19 +18,46 @@ import { useProgress } from '@/lib/progress' export function AppSidebar() { const { pathname } = useLocation() const { isCompleted, user } = useProgress() + const baseUrl = import.meta.env.BASE_URL return ( - - FRC 2713 Training + + + + + + Red Hawk Robotics 2713 + + + + Software Training + + - - + + - - All lessons + + + + All lessons + @@ -39,11 +66,11 @@ export function AppSidebar() { {lessonSections.map((section) => { const doneInSection = section.lessons.filter((l) => isCompleted(l.slug)).length return ( - - + + {section.title} {user && ( - + {doneInSection}/{section.lessons.length} )} @@ -54,12 +81,17 @@ export function AppSidebar() { const to = `/lesson/${lesson.slug}` const active = pathname === to || pathname.startsWith(`${to}/`) const done = isCompleted(lesson.slug) + const num = lessons.indexOf(lesson) + 1 return ( - - - - {lessons.indexOf(lesson) + 1} + + + + {num} {lesson.title} {done && ( diff --git a/site/src/components/BlockPlayground.css b/site/src/components/BlockPlayground.css index d47459a..fb26587 100644 --- a/site/src/components/BlockPlayground.css +++ b/site/src/components/BlockPlayground.css @@ -22,7 +22,7 @@ .block-toolbar button:hover { border-color: var(--accent-border); - color: var(--accent); + color: var(--accent-text); } .block-canvas { @@ -39,22 +39,27 @@ } .block-run { - border: 1px solid var(--accent-border); - background: var(--accent-bg); - color: var(--accent); + border: 1px solid var(--primary); + background: var(--primary); + color: #ffffff; border-radius: 6px; padding: 8px 16px; font-weight: 600; + transition: opacity 0.15s ease; +} + +.block-run:hover:not(:disabled) { + opacity: 0.9; } .block-run:disabled { - opacity: 0.6; + opacity: 0.55; cursor: default; } .block-reset { border: 1px solid var(--border); - background: none; + background: var(--card-surface); color: var(--text-h); border-radius: 6px; padding: 8px 16px; @@ -121,7 +126,7 @@ .blk-op-result { font-size: 13px; font-weight: 600; - color: var(--accent); + color: var(--accent-text); } .blk-result { @@ -132,17 +137,17 @@ .blk-result-value { font-size: 26px; font-weight: 700; - color: var(--accent); + color: var(--accent-text); } /* A result poisoned by a type-mismatched wire feeding into it somewhere upstream */ .blk-result-error { - border-color: #e5484d; - background: color-mix(in srgb, #e5484d 12%, transparent); + border-color: var(--err); + background: var(--err-bg); } .blk-result-error .blk-result-value { - color: #e5484d; + color: var(--err); } .blk-input-node { @@ -192,7 +197,7 @@ font-family: var(--sans); font-size: 12px; font-weight: 700; - color: var(--accent); + color: var(--accent-text); } .blk-row-label { @@ -248,7 +253,7 @@ font-family: var(--sans); font-size: 12px; font-weight: 700; - color: var(--accent); + color: var(--accent-text); } /* ---- Skipped branch: the road not taken, rendered like code that never ran */ @@ -270,12 +275,12 @@ /* ---- Invalid wire: something that isn't a real MotorIO, wired into declare */ .react-flow__edge.edge-invalid .react-flow__edge-path { - stroke: #e5484d; + stroke: var(--err); stroke-dasharray: 6 4; } .react-flow__edge.edge-invalid .react-flow__edge-text { - fill: #e5484d; + fill: var(--err); font-weight: 700; font-size: 15px; } @@ -332,11 +337,11 @@ } .blk-impl-sim { - border-color: #4c9be8; + border-color: var(--info); } .blk-impl-real { - border-color: #e8974c; + border-color: var(--warn); } .blk-impl-hint { @@ -356,16 +361,16 @@ /* Wired to something that isn't a real MotorIO — a type mismatch, not a missing value, so it reads as an error rather than a faded/skipped block. */ .blk-declare-invalid { - border-color: #e5484d; + border-color: var(--err); } .blk-declare-invalid .blk-declare-value { - color: #e5484d; + color: var(--err); font-weight: 700; } .blk-op-result-error { - color: #e5484d; + color: var(--err); } /* ---- Builder chain: configStart + withStep (lesson 32) -------------------- */ diff --git a/site/src/components/CodeBlock.tsx b/site/src/components/CodeBlock.tsx index d6b79ba..82a0bb8 100644 --- a/site/src/components/CodeBlock.tsx +++ b/site/src/components/CodeBlock.tsx @@ -10,6 +10,7 @@ import { editorTheme, usePrefersDark } from '@/lib/editorTheme' export function CodeBlock({ code, language }: { code: string; language?: string }) { const dark = usePrefersDark() const isPython = language === 'python' + const label = isPython ? 'Python example' : language ? `${language} example` : 'Output' const extensions = useMemo(() => { const ext = [editorTheme, EditorView.lineWrapping] @@ -18,7 +19,12 @@ export function CodeBlock({ code, language }: { code: string; language?: string }, [isPython]) return ( -
+
+
+ + {label} + +
-
+
{config.title}
{config.subtitle}
+
{/* Controls bar */} @@ -838,15 +848,6 @@ export function FlowchartPlayground({ preset }: { preset: string }) { {fast ? '2× speed' : '1× speed'}
- {config.checks && (
-
+ +
-
- +
+ + {output !== null && ( +
+
- {running ? 'Running…' : '▶ Run'} - -
- {output !== null && ( + {ok ? 'Output' : 'Error'} +
             {output}
           
- )} -
- +
+ )} +
) } diff --git a/site/src/components/LessonCard.tsx b/site/src/components/LessonCard.tsx index 923f158..9ed8163 100644 --- a/site/src/components/LessonCard.tsx +++ b/site/src/components/LessonCard.tsx @@ -1,4 +1,4 @@ -import { Check } from 'lucide-react' +import { Check, ChevronRight } from 'lucide-react' import { Link } from 'react-router-dom' import type { Lesson } from '@/lib/lessons' import { Card } from '@/components/ui/card' @@ -14,27 +14,38 @@ export function LessonCard({ completed?: boolean }) { return ( - - + + {completed ? : index + 1}
-

{lesson.title}

-

{lesson.goal}

+

+ {lesson.title} +

+

{lesson.goal}

- {completed && ( - + {completed ? ( + + + ) : ( +
diff --git a/site/src/components/MazePlayground.tsx b/site/src/components/MazePlayground.tsx index d1a0881..b9a2930 100644 --- a/site/src/components/MazePlayground.tsx +++ b/site/src/components/MazePlayground.tsx @@ -1,4 +1,5 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react' +import { Play, RotateCcw, Square } from 'lucide-react' import CodeMirror, { EditorView } from '@uiw/react-codemirror' import { python } from '@codemirror/lang-python' import { oneDark } from '@codemirror/theme-one-dark' @@ -473,12 +474,12 @@ export function MazePlayground({ solver = null }: { solver?: SolverMode | null }

- ■ start   - ■ goal   - ● robot - {solved && — solved! 🎉} + ■ start   + ■ goal   + ● robot + {solved && Solved!} {stuck && !solved && ( - — stuck in a loop 🔁 + Stuck in a loop )}

@@ -494,35 +495,29 @@ export function MazePlayground({ solver = null }: { solver?: SolverMode | null }
{solver && !isEditable && ( - + )} - + {!isEditable && ( - + )}
{isEditable && (
-
+
-
+
{solverOutput !== null && (
                 {solverOutput}
diff --git a/site/src/components/PageNav.tsx b/site/src/components/PageNav.tsx
index d07c8b0..8e502ae 100644
--- a/site/src/components/PageNav.tsx
+++ b/site/src/components/PageNav.tsx
@@ -1,3 +1,4 @@
+import { ArrowLeft, ArrowRight } from 'lucide-react'
 import { Button } from '@/components/ui/button'
 import { cn } from '@/lib/utils'
 
@@ -14,28 +15,58 @@ export function PageNav({
   onNext: () => void
   onJump: (index: number) => void
 }) {
+  const isFirst = index === 0
+  const isLast = index === total - 1
+
   return (
-    
- -
- {Array.from({ length: total }, (_, i) => ( - + ) + })} +
+ + Page {index + 1} of {total} +
- -
+ ) } diff --git a/site/src/components/StatePlayground.css b/site/src/components/StatePlayground.css index 5f4d398..20958db 100644 --- a/site/src/components/StatePlayground.css +++ b/site/src/components/StatePlayground.css @@ -22,7 +22,7 @@ .sm-toolbar button:hover { border-color: var(--accent-border); - color: var(--accent); + color: var(--accent-text); } .sm-event-pick { @@ -37,7 +37,7 @@ padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; - background: var(--bg); + background: var(--card-surface); color: var(--text-h); font: inherit; } @@ -59,20 +59,22 @@ .sm-event { border: 1px solid var(--accent-border); background: var(--accent-bg); - color: var(--accent); + color: var(--accent-text); border-radius: 6px; padding: 8px 16px; font-weight: 600; + transition: background 0.15s ease, color 0.15s ease; } .sm-event:hover { - background: var(--accent); - color: var(--bg); + background: var(--primary); + border-color: var(--primary); + color: #ffffff; } .sm-reset { border: 1px solid var(--border); - background: none; + background: var(--card-surface); color: var(--text-h); border-radius: 6px; padding: 8px 16px; @@ -117,36 +119,36 @@ box-shadow: 0 0 0 3px var(--accent-bg); } -/* Fixed colors for states that represent a literal light, e.g. the traffic - light demo — independent of which state is currently active. */ +/* Semantic colors for states that represent a literal light, e.g. the traffic + light demo — accessible contrast in both light and dark themes. */ .sm-tone-red { - border-color: #ef4444; - background: rgba(239, 68, 68, 0.12); - color: #ef4444; + border-color: var(--err); + background: var(--err-bg); + color: var(--err); } .sm-tone-green { - border-color: #22c55e; - background: rgba(34, 197, 94, 0.12); - color: #22c55e; + border-color: var(--ok); + background: var(--ok-bg); + color: var(--ok); } .sm-tone-yellow { - border-color: #eab308; - background: rgba(234, 179, 8, 0.12); - color: #eab308; + border-color: var(--warn); + background: var(--warn-bg); + color: var(--warn); } .sm-tone-red.sm-active { - box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3); + box-shadow: 0 0 0 3px var(--err-bg); } .sm-tone-green.sm-active { - box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.3); + box-shadow: 0 0 0 3px var(--ok-bg); } .sm-tone-yellow.sm-active { - box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.3); + box-shadow: 0 0 0 3px var(--warn-bg); } .sm-node-label { @@ -173,9 +175,9 @@ transform: translateX(-50%); padding: 1px 8px; border-radius: 999px; - background: var(--accent); - color: var(--bg); - font-family: var(--sans); + background: var(--primary); + color: #ffffff; + font-family: var(--hawk-heading-font); font-size: 10px; font-weight: 700; letter-spacing: 0.05em; diff --git a/site/src/index.css b/site/src/index.css index 14534a0..4afc622 100644 --- a/site/src/index.css +++ b/site/src/index.css @@ -1,76 +1,123 @@ @import 'tailwindcss'; @import 'tw-animate-css'; +@import './styles/brand.css'; @plugin '@tailwindcss/typography'; /* - * Dark mode follows the OS setting — there is no manual toggle — so we don't - * redefine the shadcn `dark` variant (leaving it as Tailwind's default - * prefers-color-scheme media query) and flip every token in the media block - * below. Semantic tokens are layered on top of the legacy FRC palette, which - * BlockPlayground.css and the markdown prose still read directly. + * Dark mode follows the OS setting (prefers-color-scheme), matching the Red Hawk + * Robotics 2713 branding standard. True Red (#BA0C2F) stays the fill for primary + * buttons, badges, rails, and active indicators in both themes. Text-only roles + * use --link (True Red in light, Light Teal in dark) and --emphasis (True Red in + * light, high-contrast red tint in dark). */ :root { - /* Legacy brand palette — single source of truth for the FRC colors. */ - --text: #55535a; - --text-h: #000000; - --bg: #fff; - --border: #dcdad9; - --code-bg: #f2f1f0; - --accent: #ba0c2f; + /* Semantic palette mapped from FRC 2713 brand tokens */ + --bg: var(--hawk-white); + --surface: var(--hawk-light-grey); + --card-surface: var(--hawk-white); + --ink: var(--hawk-black); + --text-h: var(--hawk-charcoal); + --text: #525252; + --border: #d6d5d2; + --border-strong: var(--hawk-grey); + --code-bg: var(--hawk-light-grey); + + /* Brand fill vs text-only accent roles */ + --accent: var(--hawk-red); + --accent-text: var(--hawk-red); --accent-bg: rgba(186, 12, 47, 0.08); --accent-border: rgba(186, 12, 47, 0.45); + --link: var(--hawk-red); + --emphasis: var(--hawk-red); + --teal: var(--hawk-teal); + --teal-bg: rgba(95, 199, 186, 0.14); + + /* Operational status colors (always paired with words or icons) */ --ok: #1a7f37; - --err: #8a1224; + --ok-bg: rgba(26, 127, 55, 0.12); + --err: #ba0c2f; + --err-bg: rgba(186, 12, 47, 0.1); + --warn: #9a6700; + --warn-bg: rgba(154, 103, 0, 0.12); + --info: #1d4ed8; - --sans: system-ui, 'Segoe UI', Roboto, sans-serif; - --mono: ui-monospace, Consolas, monospace; + /* Font aliases kept for playground CSS compatibility */ + --sans: var(--hawk-body-font); + --mono: var(--hawk-figure-font); - /* shadcn semantic tokens, mapped onto the palette above. `--ui-accent` is - shadcn's neutral hover surface — deliberately distinct from the legacy - `--accent` (the brand red) so the two never collide. */ - --radius: 0.625rem; + /* shadcn semantic tokens */ + --radius: 0.5rem; --background: var(--bg); --foreground: var(--text-h); - --card: var(--bg); + --card: var(--card-surface); --card-foreground: var(--text-h); - --popover: var(--bg); + --popover: var(--card-surface); --popover-foreground: var(--text-h); - --primary: var(--accent); - --primary-foreground: #ffffff; - --secondary: var(--code-bg); + --primary: var(--hawk-red); + --primary-foreground: var(--hawk-white); + --secondary: var(--surface); --secondary-foreground: var(--text-h); - --muted: var(--code-bg); + --muted: var(--surface); --muted-foreground: var(--text); - --ui-accent: var(--code-bg); - --ui-accent-foreground: var(--text-h); + --ui-accent: var(--surface); + --ui-accent-foreground: var(--ink); --destructive: var(--err); - --input: var(--border); - --ring: var(--accent); - - --sidebar: var(--bg); - --sidebar-foreground: var(--text); - --sidebar-primary: var(--accent); - --sidebar-primary-foreground: #ffffff; - --sidebar-accent: var(--accent-bg); - --sidebar-accent-foreground: var(--accent); + --input: var(--border-strong); + --ring: var(--hawk-red); + + /* Sidebar uses Light Grey panel in light mode for crisp separation from white page */ + --sidebar: var(--surface); + --sidebar-foreground: var(--text-h); + --sidebar-primary: var(--hawk-red); + --sidebar-primary-foreground: var(--hawk-white); + --sidebar-accent: var(--hawk-white); + --sidebar-accent-foreground: var(--ink); --sidebar-border: var(--border); - --sidebar-ring: var(--accent); + --sidebar-ring: var(--hawk-red); } @media (prefers-color-scheme: dark) { :root { - --text: #a3a19e; - --text-h: #f5f4f3; - --bg: #141414; - --border: #333333; - --code-bg: #1e1e1e; - --accent: #e0475f; - --accent-bg: rgba(224, 71, 95, 0.15); - --accent-border: rgba(224, 71, 95, 0.5); + --bg: var(--hawk-dark-background); + --surface: var(--hawk-dark-card); + --card-surface: var(--hawk-dark-card); + --ink: var(--hawk-white); + --text-h: var(--hawk-light-grey); + --text: var(--hawk-grey); + --border: var(--hawk-charcoal); + --border-strong: #4a4a4a; + --code-bg: var(--hawk-dark-card); + + /* True Red stays the fill; text accents shift to Light Teal / red tint */ + --accent: var(--hawk-red); + --accent-text: var(--hawk-emphasis-dark); + --accent-bg: rgba(186, 12, 47, 0.2); + --accent-border: rgba(242, 92, 116, 0.55); + --link: var(--hawk-teal); + --emphasis: var(--hawk-emphasis-dark); + --teal-bg: rgba(95, 199, 186, 0.16); + --ok: #3fb950; - --err: #f16a6a; + --ok-bg: rgba(63, 185, 80, 0.16); + --err: var(--hawk-emphasis-dark); + --err-bg: rgba(242, 92, 116, 0.16); + --warn: #facc15; + --warn-bg: rgba(250, 204, 21, 0.14); + --info: #60a5fa; + + --secondary: var(--hawk-dark-muted); + --muted: var(--hawk-dark-muted); + --ui-accent: var(--hawk-dark-muted); + --ui-accent-foreground: var(--hawk-white); + --input: #4a4a4a; + --ring: var(--hawk-teal); - --sidebar: #171717; + --sidebar: var(--hawk-dark-card); + --sidebar-foreground: var(--hawk-light-grey); + --sidebar-accent: var(--hawk-dark-muted); + --sidebar-accent-foreground: var(--hawk-white); + --sidebar-border: var(--hawk-charcoal); + --sidebar-ring: var(--hawk-teal); } } @@ -80,8 +127,10 @@ --radius-lg: var(--radius); --radius-xl: calc(var(--radius) + 4px); - --font-sans: var(--sans); - --font-mono: var(--mono); + --font-sans: var(--hawk-body-font); + --font-heading: var(--hawk-heading-font); + --font-display: var(--hawk-display-font); + --font-mono: var(--hawk-figure-font); --color-background: var(--background); --color-foreground: var(--foreground); @@ -102,6 +151,9 @@ --color-border: var(--border); --color-input: var(--input); --color-ring: var(--ring); + --color-link: var(--link); + --color-emphasis: var(--emphasis); + --color-teal: var(--teal); --color-sidebar: var(--sidebar); --color-sidebar-foreground: var(--sidebar-foreground); @@ -120,14 +172,16 @@ html { color-scheme: light dark; + font-family: var(--font-sans); } body { margin: 0; background: var(--color-background); color: var(--color-foreground); - font: 18px / 145% var(--font-sans); - letter-spacing: 0.18px; + font-family: var(--font-sans); + font-size: 16px; + line-height: 1.6; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -137,9 +191,99 @@ min-height: 100svh; } - @media (max-width: 1024px) { - body { - font-size: 16px; - } + a:focus-visible, + button:focus-visible, + select:focus-visible, + input:focus-visible { + outline: 2px solid var(--ring); + outline-offset: 2px; + } + + button:not(:disabled), + [role='button']:not(:disabled) { + cursor: pointer; } } + +/* Lesson prose typography refinements aligned to FRC 2713 branding */ +.lesson-prose { + --tw-prose-body: var(--foreground); + --tw-prose-headings: var(--ink); + --tw-prose-bold: var(--ink); + --tw-prose-links: var(--link); + --tw-prose-bullets: var(--border-strong); + --tw-prose-counters: var(--muted-foreground); + --tw-prose-hr: var(--border); + --tw-prose-quotes: var(--foreground); + --tw-prose-quote-borders: var(--teal); + --tw-prose-th-borders: var(--border-strong); + --tw-prose-td-borders: var(--border); +} + +.lesson-prose h1 { + font-family: var(--hawk-heading-font); + font-weight: 700; + font-style: italic; + text-transform: uppercase; + letter-spacing: 0.015em; + color: var(--ink); + font-size: 1.875rem; + line-height: 1.15; + margin-bottom: 1rem; +} + +.lesson-prose h2 { + font-family: var(--hawk-heading-font); + font-weight: 600; + color: var(--ink); + font-size: 1.35rem; + line-height: 1.25; + margin-top: 1.75rem; + margin-bottom: 0.65rem; +} + +.lesson-prose h3, +.lesson-prose h4, +.lesson-prose th { + font-family: var(--hawk-heading-font); + font-weight: 600; + color: var(--ink); +} + +.lesson-prose a { + color: var(--link); + text-decoration: underline; + text-underline-offset: 3px; + text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent); + transition: text-decoration-color 150ms ease; +} + +.lesson-prose a:hover { + text-decoration-color: var(--link); +} + +.lesson-prose blockquote { + font-style: normal; + background: var(--surface); + border-left: 4px solid var(--teal); + border-radius: 0 var(--radius-md) var(--radius-md) 0; + padding: 12px 14px; +} + +.lesson-prose blockquote p:first-of-type::before, +.lesson-prose blockquote p:last-of-type::after { + content: none; +} + +.lesson-prose table { + border-collapse: collapse; +} + +.lesson-prose thead th { + background: var(--surface); + padding: 0.5rem 0.75rem; +} + +.lesson-prose tbody td { + padding: 0.5rem 0.75rem; +} diff --git a/site/src/lib/editorTheme.ts b/site/src/lib/editorTheme.ts index 00e779b..8510e2c 100644 --- a/site/src/lib/editorTheme.ts +++ b/site/src/lib/editorTheme.ts @@ -2,8 +2,8 @@ import { useEffect, useState } from 'react' import { EditorView } from '@uiw/react-codemirror' // Shared CodeMirror styling + dark-mode detection, used by both the runnable -// playground (JavaRunner) and the read-only prose examples (CodeBlock) so the -// two always look identical. +// playground (JavaRunner) and the read-only prose examples (CodeBlock) so both +// sit cleanly on the 2713 surface tokens without oneDark's blue-grey background. export function usePrefersDark() { const [dark, setDark] = useState( @@ -18,12 +18,32 @@ export function usePrefersDark() { return dark } -// Blend the editor into the surrounding lesson card: transparent background, -// comfortable line height, and a font size that matches the prose. +// Blend the editor into the surrounding lesson surface: transparent background +// overrides oneDark's #282c34 canvas, keeping comfortable line height and mono font. export const editorTheme = EditorView.theme({ - '&': { backgroundColor: 'transparent', fontSize: '15px' }, - '.cm-gutters': { backgroundColor: 'transparent', border: 'none' }, + '&': { + backgroundColor: 'transparent !important', + fontSize: '14.5px', + fontFamily: 'var(--hawk-figure-font)', + }, + '.cm-scroller': { + backgroundColor: 'transparent !important', + fontFamily: 'var(--hawk-figure-font)', + lineHeight: '1.55', + }, + '.cm-gutters': { + backgroundColor: 'transparent !important', + border: 'none', + color: 'var(--muted-foreground)', + }, + '.cm-activeLine': { + backgroundColor: 'color-mix(in srgb, var(--foreground) 5%, transparent) !important', + }, + '.cm-activeLineGutter': { + backgroundColor: 'transparent !important', + color: 'var(--foreground)', + }, '.cm-content': { padding: '12px 0' }, - '.cm-line': { padding: '0 4px' }, + '.cm-line': { padding: '0 8px' }, '&.cm-focused': { outline: 'none' }, }) diff --git a/site/src/routes/LessonIndex.tsx b/site/src/routes/LessonIndex.tsx index f4076b0..04b64c9 100644 --- a/site/src/routes/LessonIndex.tsx +++ b/site/src/routes/LessonIndex.tsx @@ -4,23 +4,40 @@ import { LessonCard } from '@/components/LessonCard' export function LessonIndex() { const { isCompleted, completedCount, totalLessons, user } = useProgress() + const pct = totalLessons > 0 ? Math.round((completedCount / totalLessons) * 100) : 0 return ( -
-
-

FRC 2713 Software Training

-

- Learn the fundamentals of programming, one short lesson at a time. Every lesson is - hands-on — build and run things right in the browser. +

+
+

+ Red Hawk Robotics · Team 2713 +

+

+ Software Training +

+
@@ -28,15 +45,15 @@ export function LessonIndex() { const doneInSection = section.lessons.filter((l) => isCompleted(l.slug)).length return (
-
-

+
+

{section.title}

- {user && ( - - {doneInSection} / {section.lessons.length} - - )} + + {user + ? `${doneInSection} / ${section.lessons.length}` + : `${section.lessons.length} lessons`} +
{section.lessons.map((lesson) => ( diff --git a/site/src/routes/LessonView.tsx b/site/src/routes/LessonView.tsx index 5e1799e..5e627c4 100644 --- a/site/src/routes/LessonView.tsx +++ b/site/src/routes/LessonView.tsx @@ -1,5 +1,5 @@ import type { ReactNode } from 'react' -import { Check, Circle } from 'lucide-react' +import { ArrowRight, Blocks, Check, Circle, Compass, GitBranch } from 'lucide-react' import { Link, Navigate, useNavigate, useParams } from 'react-router-dom' import ReactMarkdown from 'react-markdown' import type { Components } from 'react-markdown' @@ -25,6 +25,7 @@ import { isFlowchartPreset } from '@/lib/flowchartPresets' import { isStatePreset } from '@/lib/statePresets' import { PageNav } from '@/components/PageNav' import { Button } from '@/components/ui/button' +import { cn } from '@/lib/utils' // Fenced code blocks in the prose render read-only through CodeMirror (same // syntax highlighting + line numbers as the playground); the runnable copy of @@ -69,14 +70,12 @@ const markdownComponents: Components = { }, } -// Tailwind Typography, retuned to the FRC palette: brand-red links, no backtick -// pseudo-elements on inline code, and code blocks on the muted surface. +// Tailwind Typography tuned to the FRC 2713 palette & typography rules (paired +// with `.lesson-prose` in src/index.css). const PROSE_CLASSES = [ - 'prose dark:prose-invert max-w-none', - 'prose-headings:font-semibold prose-headings:text-foreground', - 'prose-a:text-primary prose-a:no-underline hover:prose-a:underline', - 'prose-code:rounded prose-code:bg-[var(--code-bg)] prose-code:px-1.5 prose-code:py-0.5', - 'prose-code:font-normal prose-code:text-foreground', + 'prose dark:prose-invert lesson-prose max-w-none', + 'prose-code:rounded prose-code:border prose-code:border-border prose-code:bg-[var(--code-bg)] prose-code:px-1.5 prose-code:py-0.5', + 'prose-code:font-mono prose-code:text-[0.875em] prose-code:font-normal prose-code:text-[var(--ink)]', 'prose-code:before:content-none prose-code:after:content-none', 'prose-pre:border prose-pre:border-border prose-pre:bg-[var(--code-bg)] prose-pre:text-foreground', ].join(' ') @@ -95,6 +94,7 @@ export function LessonView() { void setCompleted(lesson.slug, !completed) } + const num = lessonNumber(lesson.slug) const pageCount = lesson.pages.length const requested = page ? Number(page) - 1 : 0 const pageIndex = Number.isFinite(requested) @@ -114,12 +114,22 @@ export function LessonView() { const next = onLastPage ? nextLesson(lesson.slug) : undefined return ( -
-
-
- - ← All lessons - +
+
+
+
+ + Lesson {num} + + + {lesson.section} + +
{user && (
-

- Goal: {lesson.goal} -

+ +
+
+ Goal +
+

{lesson.goal}

+
-
-
+ +
+
{prose}
{hasPlayground && ( -
+
{maze ? ( <> -

▶ Maze

+

+

) : preset && isStatePreset(preset) ? ( <> -

▶ State machine

+

+

) : preset && isFlowchartPreset(preset) ? ( - <> -

▶ Interactive Flowchart

- - + ) : preset ? ( <> -

▶ Block editor

+

+

) : ( - <> - - + )}
)}
+ goTo(pageIndex + 1)} onJump={goTo} /> + {onLastPage && user && !completed && ( -
-
Finished this lesson?
+
+
Finished this lesson?
)} + {onLastPage && (next ? ( - - Next lesson - - - Lesson {lessonNumber(next.slug)}: {next.title} → - +
+ + Next lesson + + + + {lessonNumber(next.slug)}. + + {next.title} + +
+
diff --git a/site/src/styles/brand.css b/site/src/styles/brand.css new file mode 100644 index 0000000..d3798d7 --- /dev/null +++ b/site/src/styles/brand.css @@ -0,0 +1,100 @@ +/* Self-hosted Fontsource distributions for Red Hawk Robotics 2713. + Apps must render cleanly on a shop LAN without external font CDNs. */ +@import "@fontsource/barlow/400.css"; +@import "@fontsource/barlow/600.css"; +@import "@fontsource/barlow/700.css"; +@import "@fontsource/barlow/700-italic.css"; +@import "@fontsource/barlow-condensed/700-italic.css"; +@import "@fontsource/open-sans/400.css"; +@import "@fontsource/open-sans/600.css"; +@import "@fontsource/open-sans/700.css"; +@import "@fontsource/roboto-mono/400.css"; +@import "@fontsource/roboto-mono/500.css"; +@import "@fontsource/roboto-mono/700.css"; + +:root { + /* Canonical FRC 2713 palette */ + --hawk-red: #ba0c2f; + --hawk-tone-red: #c91f43; + --hawk-charcoal: #333333; + --hawk-black: #000000; + --hawk-grey: #a3a19e; + --hawk-light-grey: #f2f2f2; + --hawk-white: #ffffff; + --hawk-teal: #5fc7ba; + + /* Dark-mode surface ramp */ + --hawk-dark-background: #141414; + --hawk-dark-card: #1e1e1e; + --hawk-dark-muted: #2a2a2a; + --hawk-emphasis-dark: #f25c74; + + /* Canonical font stacks */ + --hawk-body-font: "Open Sans", ui-sans-serif, system-ui, sans-serif; + --hawk-heading-font: "Barlow", ui-sans-serif, system-ui, sans-serif; + --hawk-display-font: "Barlow Condensed", "Barlow", ui-sans-serif, sans-serif; + --hawk-figure-font: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace; +} + +@layer components { + /* Standard 2713 header lockup: 24px-high mark with 12px clear space on a flat field. */ + .brand-mark { + display: inline-flex; + align-items: center; + padding: 12px; + flex-shrink: 0; + } + + .brand-mark img { + display: block; + height: 24px; + width: auto; + } + + /* Numeric figures (lesson numbers, progress fractions, step counters). */ + .brand-figures { + font-family: var(--hawk-figure-font); + font-variant-numeric: tabular-nums; + } + + /* Large display title: Barlow Condensed bold italic. */ + .brand-display { + font-family: var(--hawk-display-font); + font-weight: 700; + font-style: italic; + text-transform: uppercase; + letter-spacing: 0.01em; + } + + /* Major section / page headings: Barlow bold italic capitals. */ + .brand-heading { + font-family: var(--hawk-heading-font); + font-weight: 700; + font-style: italic; + text-transform: uppercase; + letter-spacing: 0.02em; + } + + /* Subsections, card titles, table headers, callout labels: Barlow semibold. */ + .brand-subheading { + font-family: var(--hawk-heading-font); + font-weight: 600; + } + + /* Brand callout: Light Grey (dark card in dark mode), 4px rail, 12/14px padding. */ + .brand-callout { + border-radius: var(--radius-md); + background: var(--surface); + border: 1px solid var(--border); + border-left-width: 4px; + padding: 12px 14px; + } + + .brand-callout-teal { + border-left-color: var(--hawk-teal); + } + + .brand-callout-red { + border-left-color: var(--hawk-red); + } +}