From bff65dd4bc6a50dc4a9a8852a9c31b322f2fc3ea Mon Sep 17 00:00:00 2001 From: Miguel Reese Date: Tue, 27 Oct 2026 21:59:57 -0700 Subject: [PATCH] Make every screen work on phones and tablets, and page long lists Layout: - At 900px and below, the sidebar becomes a top bar with a Menu button (it holds the subsystems, the role switcher and the signed-in user), and side panels open as full-screen sheets. - At 640px and below, table rows become stacked cards: ID and title on the first line, the other cells lined up below, and column headers hidden. Unit counts and prerequisites get a short label there. Summary tiles go two per row, Help opens as a bottom sheet, inputs use 16px text so iOS doesn't zoom, and button rows, headers and print options wrap. - At every width, page headers wrap their actions under the title instead of pushing the page wider. Major Outline stacks its two columns below 1440px so its table fits. Long emails and addresses wrap. - Fixed a bug where the role menu sat under its tap-to-close layer on small screens, so choosing a role just closed it. Long lists (course search, grade sheets, authorized users, faculty and course matches) show 20-25 rows and load the next batch as the end scrolls into view, with a Show more button for keyboard and screen-reader users. Printing still includes every row. Checked in a local build at 320, 375, 414, 768, 1024, 1280, 1440 and 1920px: no screen is wider than the window and no table cells overlap. Also went through registering, dropping, the waiver request, grade drafts with cancel and save, and every edit panel at phone size. Co-Authored-By: Claude Opus 5.5 --- src/components/Shell.tsx | 15 ++++--- src/components/icons.tsx | 1 + src/components/progressive.tsx | 45 +++++++++++++++++++ src/screens/AuthorizedUsers.tsx | 7 ++- src/screens/CourseSearch.tsx | 7 ++- src/screens/FacultyCourses.tsx | 12 +++-- src/screens/GradeEntry.tsx | 5 ++- src/screens/MajorOutline.tsx | 2 +- src/screens/StudentRecord.tsx | 6 +-- src/styles/global.css | 79 +++++++++++++++++++++++++++++++-- 10 files changed, 157 insertions(+), 22 deletions(-) create mode 100644 src/components/progressive.tsx diff --git a/src/components/Shell.tsx b/src/components/Shell.tsx index 3c82825..0ddf669 100644 --- a/src/components/Shell.tsx +++ b/src/components/Shell.tsx @@ -1,11 +1,11 @@ import { createContext, useContext, useEffect, useState, type ReactNode } from 'react'; -import { NavLink, Link } from 'react-router-dom'; +import { NavLink, Link, useLocation } from 'react-router-dom'; import { RoleSwitcher, ViewingBanner } from './RoleSwitcher'; import { useStore } from '../data/store'; import { MODULES } from '../modules'; import { FloatingWindow, openInNewWindow } from './FloatingWindow'; import { HELP } from './help'; -import { Help, NewWindow, Print, SignOut, UserIcon, X } from './icons'; +import { Help, Menu, NewWindow, Print, SignOut, UserIcon, X } from './icons'; import { Banner } from './ui'; import { useEscapeToCancel } from './draft'; import { saveTimeLabel } from '../lib/performance'; @@ -18,7 +18,11 @@ export function Shell({ children, panel, helpKey, screen }: { children: ReactNod const { db, user, signOut, mode, syncError, dismissSyncError, lastSaveMs } = useStore(); const [help, setHelp] = useState(false); const [toast, setToast] = useState(null); + const [menu, setMenu] = useState(false); // phones and tablets: the subsystem menu folds into the top bar + const { pathname } = useLocation(); + useEffect(() => { setMenu(false); }, [pathname]); useEscapeToCancel(help, () => setHelp(false)); + useEscapeToCancel(menu, () => setMenu(false)); useEffect(() => { if (!toast) return; @@ -32,9 +36,10 @@ export function Shell({ children, panel, helpKey, screen }: { children: ReactNod return (
-
)} diff --git a/src/screens/FacultyCourses.tsx b/src/screens/FacultyCourses.tsx index 38ee1bf..28ed1dd 100644 --- a/src/screens/FacultyCourses.tsx +++ b/src/screens/FacultyCourses.tsx @@ -4,6 +4,7 @@ import { Shell, PageHeader, useToast } from '../components/Shell'; import { Banner, Empty } from '../components/ui'; import { Print, Search, X } from '../components/icons'; import { useEscapeToCancel, useWarnBeforeLeaving } from '../components/draft'; +import { useProgressive } from '../components/progressive'; import type { Course, Db, Faculty } from '../data/types'; import { canMaintainCatalog, type CourseField, type CourseIssue } from '../lib/catalog'; import type { FacultyEntry, FacultyField, FacultyIssue } from '../lib/faculty'; @@ -25,6 +26,8 @@ export default function FacultyCourses() { const facultyMode = mode === 'facultyName' || mode === 'facultyId'; const facultyMatches = useMemo(() => db.faculty.filter((f) => (!dept || f.deptId === dept || f.teachesIn.includes(dept)) && wildcardMatch(q, mode === 'facultyId' ? f.id : f.name)), [db.faculty, q, dept, mode]); const courseMatches = useMemo(() => db.courses.filter((c) => (!dept || c.deptId === dept) && wildcardMatch(q, mode === 'courseId' ? c.id : c.title)), [db.courses, q, dept, mode]); + const facultyPage = useProgressive(facultyMatches, `${mode}|${q}|${dept}`); + const coursePage = useProgressive(courseMatches, `${mode}|${q}|${dept}`); const faculty = facultyMode ? db.faculty.find((f) => f.id === sel) ?? facultyMatches[0] : undefined; const course = !facultyMode ? db.courses.find((c) => c.id === sel) ?? courseMatches[0] : undefined; @@ -72,13 +75,14 @@ export default function FacultyCourses() {

{(facultyMode ? facultyMatches : courseMatches).length} {(facultyMode ? facultyMatches : courseMatches).length === 1 ? 'match' : 'matches'}

{q || 'all'}
{facultyMode && facultyMatches.length === 0 && No faculty match.} - {facultyMode && facultyMatches.map((f) => ( + {facultyMode && facultyPage.visible.map((f) => (
setSel(f.id)}>{f.name}{f.id} · {deptName(f.deptId)}
))} {!facultyMode && courseMatches.length === 0 && No courses match.} - {!facultyMode && courseMatches.map((c) => ( + {!facultyMode && coursePage.visible.map((c) => (
setSel(c.id)}>{c.id} · {c.title}{c.units} units · {deptName(c.deptId)}
))} + {facultyMode ? facultyPage.more : coursePage.more}
@@ -86,7 +90,7 @@ export default function FacultyCourses() {

{faculty.name}

{faculty.positionTitle} · Faculty ID {faculty.id}
{canMaintain && }
-
+
Department{deptName(faculty.deptId)}Teaches in{faculty.teachesIn.map(deptName).join(', ')}Office{faculty.office}
Office phone{faculty.officePhone}Office hours{faculty.officeHours}Email{faculty.email}
@@ -97,7 +101,7 @@ export default function FacultyCourses() {

Authorized to teach

{list.length} courses · {offered} offered {db.term}
CourseTitleUnitsPrerequisites
- {list.map((c) =>
{c.id}{c.title}{c.units}{c.prereqs.join(', ') || 'None'}
)} + {list.map((c) =>
{c.id}{c.title}{c.units} unitsPrerequisites: {c.prereqs.join(', ') || 'None'}
)}
); })()} diff --git a/src/screens/GradeEntry.tsx b/src/screens/GradeEntry.tsx index 0292295..3b92a13 100644 --- a/src/screens/GradeEntry.tsx +++ b/src/screens/GradeEntry.tsx @@ -9,6 +9,7 @@ import { formatDate, formatDateTime, formatTimeRange } from '../lib/format'; import { fillerName } from '../data/seed'; import { wildcardMatch } from '../lib/wildcard'; import { useEscapeToCancel, useWarnBeforeLeaving } from '../components/draft'; +import { useProgressive } from '../components/progressive'; const COLS = '1.1fr 90px 90px 110px 1.7fr'; @@ -41,6 +42,7 @@ export default function GradeEntry() { const name = s ? `${s.firstName} ${s.lastName}` : fillerName(r.studentId); return { r, name }; }).filter((x) => wildcardMatch(q, x.name) || wildcardMatch(q, x.r.studentId)).sort((a, b) => a.name.localeCompare(b.name)), [regs, db.students, q]); + const page = useProgressive(rows, `${offering?.scheduleNo}|${q}`, 25); if (!offering) return You are not the primary instructor of any course this term.; @@ -99,7 +101,7 @@ export default function GradeEntry() {
StudentIDTypeGradeNote
{rows.length === 0 && No students match.} - {rows.map(({ r, name }) => ( + {page.visible.map(({ r, name }) => (
{name} @@ -123,6 +125,7 @@ export default function GradeEntry() { )}
))} + {page.more}
{pendingCount > 0 && (
diff --git a/src/screens/MajorOutline.tsx b/src/screens/MajorOutline.tsx index 5601c30..2830df0 100644 --- a/src/screens/MajorOutline.tsx +++ b/src/screens/MajorOutline.tsx @@ -84,7 +84,7 @@ export default function MajorOutline() { {block && {block.reason} {block.requirement} Outline changes are blocked until then.} -
+

Major requirements

{major.id}
diff --git a/src/screens/StudentRecord.tsx b/src/screens/StudentRecord.tsx index addb50c..0368021 100644 --- a/src/screens/StudentRecord.tsx +++ b/src/screens/StudentRecord.tsx @@ -116,17 +116,17 @@ export default function StudentRecord() { {tab === 'here' && <>
CourseTitleSemesterUnitsGrade{!isStudent && }
{student.completed.length === 0 && No completed courses on file.} - {student.completed.map((c) =>
{c.courseId}{c.title}{c.term}{c.units}{c.grade}{!isStudent && }
)} + {student.completed.map((c) =>
{c.courseId}{c.title}{c.term}{c.units} units{c.grade}{!isStudent && }
)} } {tab === 'transfer' && <>
CourseTitle · equivalent hereUniversitySemesterUnitsGrade{!isStudent && }
{student.transfer.length === 0 && No transfer courses on file.} - {student.transfer.map((c) =>
{c.courseId}
{c.title}
{c.equivalentCourseId ? `Equivalent to ${c.equivalentCourseId}` : 'No equivalent course'}
{c.university}
{c.location}
{c.term}{c.units}{c.grade}{!isStudent && }
)} + {student.transfer.map((c) =>
{c.courseId}
{c.title}
{c.equivalentCourseId ? `Equivalent to ${c.equivalentCourseId}` : 'No equivalent course'}
{c.university}
{c.location}
{c.term}{c.units} units{c.grade}{!isStudent && }
)} } {tab === 'current' && <>
CourseTitle · instructorDays / timeUnits
{regs.length === 0 && Not registered this term.} - {regs.map((r) => { const o = offeringOf(db, r.scheduleNo)!; const c = courseOf(db, o.courseId)!; const f = db.faculty.find((x) => x.id === o.instructorId); return
{c.id}
{c.title}
{f ? shortName(f.name) : '—'} · {r.type === 'letter' ? 'Letter grade' : r.type === 'crnc' ? 'CR / NC' : 'Audit'}
{o.days} {formatTimeRange(o.start, o.end)}{c.units}
; })} + {regs.map((r) => { const o = offeringOf(db, r.scheduleNo)!; const c = courseOf(db, o.courseId)!; const f = db.faculty.find((x) => x.id === o.instructorId); return
{c.id}
{c.title}
{f ? shortName(f.name) : '—'} · {r.type === 'letter' ? 'Letter grade' : r.type === 'crnc' ? 'CR / NC' : 'Audit'}
{o.days} {formatTimeRange(o.start, o.end)}{c.units} units
; })} }
diff --git a/src/styles/global.css b/src/styles/global.css index 4019947..dc7baca 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -81,8 +81,9 @@ h3 { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: upp .viewing-bar { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--warning-border); background: var(--warning-bg); color: var(--warning); border-radius: var(--radius); font-size: 13px; } .main { flex: 1; display: flex; flex-direction: column; padding: 32px 40px 24px; gap: 24px; min-width: 0; } .main.narrow { padding: 32px 32px 24px; } -.header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; } -.actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; } +.header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px 24px; } +.header > .grow { min-width: min(100%, 280px); } /* when space runs out the actions wrap below the title instead of crushing it */ +.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; min-width: 0; } .meta { color: var(--muted); margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; margin-top: auto; } @@ -92,6 +93,7 @@ h3 { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: upp .card-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; } .card-foot { margin-top: auto; padding: 14px 20px 16px; border-top: 1px solid var(--border); background: var(--bg); border-radius: 0 0 var(--radius) var(--radius); display: flex; flex-direction: column; gap: 10px; } .rows { display: flex; flex-direction: column; } +.load-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; padding: 14px 20px; } .row { display: grid; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--row-border); } .row.head { padding: 10px 20px; color: var(--muted); font-size: 12px; font-weight: 600; background: var(--bg); border-bottom: 1px solid var(--border); } .row.selected { background: var(--primary-bg); } @@ -169,7 +171,8 @@ textarea.input { height: auto; min-height: 72px; padding: 10px 12px; resize: ver .panel-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px 24px 20px; border-top: 1px solid var(--border); } .kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13px; } .kv .k { color: var(--muted); } -.stamp { display: flex; align-items: center; gap: 6px; padding: 12px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; } +.kv > *, .detail { overflow-wrap: anywhere; } /* long emails and addresses break instead of overflowing */ +.stamp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; } .stamp.bare { padding: 10px 0 0; } .tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); } .tile .big { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; } @@ -204,8 +207,76 @@ textarea.input { height: auto; min-height: 72px; padding: 10px 12px; resize: ver body { background: #fff; } } +/* Two-column pages whose wide table needs more room than the right column gets below 1440px */ +@media (max-width: 1440px) { + .grid-2.stack-early { grid-template-columns: 1fr !important; } +} + +/* Phone and tablet layouts. Screens set their column templates inline for desktop; these rules + override them by class so every screen adapts without its own breakpoints. */ +.nav-toggle, .show-small { display: none; } + @media (max-width: 1100px) { .nav { width: 200px; } .main, .main.narrow { padding: 24px; } - .grid-2, .grid-4 { grid-template-columns: 1fr !important; } + .grid-2 { grid-template-columns: 1fr !important; } + .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } +} + +/* Tablets and phones: the sidebar becomes a top bar with a menu, side panels become full-screen sheets. */ +@media (max-width: 900px) { + .shell { flex-direction: column; } + .nav { position: sticky; top: 0; z-index: 20; width: auto; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border); } + .wordmark { padding: 0; font-size: 18px; } + .wordmark small { display: none; } + .nav-toggle { display: inline-flex; margin-left: auto; } + .nav-list, .nav .role-switch, .nav-user { display: none; } + .nav.open { max-height: 100dvh; overflow-y: auto; } + .nav.open .nav-list, .nav.open .role-switch, .nav.open .nav-user { display: flex; flex-basis: 100%; } + .nav.open .nav-list { margin-top: 12px; } + .nav.open .role-switch { margin-top: 12px; display: block; } + .nav.open .role-switch + .nav-user { margin-top: 8px; } + .role-menu { position: relative; left: auto; bottom: auto; width: auto; max-height: none; margin-top: 8px; box-shadow: none; } /* relative, not static, so it stays above the tap-to-close scrim */ + .main, .main.narrow { padding: 20px 16px; gap: 16px; } + .panel { position: fixed; inset: 0; z-index: 30; width: auto; height: 100dvh; border-left: 0; } +} + +/* Phones */ +@media (max-width: 640px) { + h1 { font-size: 22px; } + .header { flex-direction: column; gap: 12px; } + .actions { justify-content: flex-start; width: 100%; } + .actions > .input, .actions > .input-wrap, .actions > .cluster, .actions > select { width: 100% !important; } + .hide-small { display: none !important; } + .cluster { flex-wrap: wrap; } + .cluster > span.grow { min-width: max-content; } /* a label in a button row keeps its words together; buttons wrap below */ + .show-small { display: inline; } + .grid-4 { gap: 10px !important; } + /* 16px text keeps iOS from zooming into a field when it is tapped */ + .input, select.input, textarea.input { font-size: 16px; } + .card-head { flex-wrap: wrap; padding: 14px 16px 12px; } + .card-body, .card-foot { padding-left: 16px; padding-right: 16px; } + .tabs { overflow-x: auto; gap: 18px; padding: 0 16px; } + .tab { white-space: nowrap; } + /* Table rows become stacked cards: the first two cells (ID and title) lead, the rest wrap below. */ + .row.head { display: none !important; } + .row, .row.tight { display: flex !important; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 16px; } + .row > * { flex: 0 1 auto; min-width: 0; } + .row > :nth-child(2) { flex: 1 1 calc(100% - 120px); } /* ID and title share the first line; every other cell lines up below */ + .row > :only-child { flex-basis: 100%; } + .row.lead-first > :first-child { flex-basis: 100%; } /* tables whose first cell is the main one (name · email) */ + .row.lead-first > :nth-child(2) { flex: 0 1 auto; min-width: 0; } + .row .num { text-align: left; } + .row > :last-child:is(.btn, span:has(> .btn)) { margin-left: auto; } + .expand { grid-template-columns: 1fr !important; padding: 14px 16px !important; gap: 14px; } + .kv { grid-template-columns: 110px minmax(0, 1fr); } + .drawer-body dl { grid-template-columns: 1fr; gap: 2px; } + .drawer-body dd { margin-bottom: 8px; } + .window { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto !important; height: 75dvh !important; resize: none; } + .window-bar { cursor: default; } + .viewing-bar { flex-wrap: wrap; } + .foot { flex-direction: column; gap: 4px; } + .toast { left: 16px; right: 16px; transform: none; bottom: 16px; } + .login { padding: 16px; } + .login > .stack { width: 100% !important; max-width: 420px; } }