Skip to content

feat: add public course and instructor catalog pages - #42

Open
jaspermayone wants to merge 3 commits into
mainfrom
jaspermayone/797-public-catalog-pages
Open

jaspermayone wants to merge 3 commits into
mainfrom
jaspermayone/797-public-catalog-pages

Conversation

@jaspermayone

Copy link
Copy Markdown
Member

Part of WITCodingClub/calendar-backend#797. This PR adds public, read-only catalog pages. Nobody needs to sign in.

Path Shows
/catalog Links to the course and instructor pages
/catalog/courses Search by code or title, filter by term, 25 per page
/catalog/courses/[code] Description, prerequisite tree, restrictions, the sections of a term
/catalog/instructors Search by name, filter by term, Rate My Professors summary
/catalog/instructors/[id] Ratings, tags, recent reviews, the sections of a term

The top bar gets a "Catalog" item.

Data

flowchart LR
  P["/catalog pages (SSR)"] -->|"fetch, cf.cacheTtl 300"| W["rproxy Worker"]
  W -->|"/api"| C["Cloudflare cache rule /api/v1/catalog/*"]
  C --> R["Rails public catalog API"]
Loading
  • src/lib/server/catalog.ts reads https://calendar.witcc.dev/api/v1/catalog. That API needs no token, and a zone cache rule keeps it at the edge.
  • src/lib/catalog.ts has the types and the formatting rules. Its tests run with npm test.
  • Rails has no /catalog route, so these pages hide nothing.

Review fixes (commit 4358fce)

  • store.svelte.ts called goto(pathname) on every navigation, which dropped the query string. A shared ?q= link or the Back button lost the search. It now calls goto only for another path. I checked this in a browser: a search survives a reload and the Back button, and the top bar still navigates.
  • An unknown or old term_uid falls back to the default term, not a 404.
  • On an instructor page, a section links to its course page only when the catalog has that course.
  • The term list and the current term load at the same time.

Known limits

  • When the API fails, this site answers 503. The rproxy Worker then asks Rails, so a visitor sees the Rails 404 page, not the "try again" text. The /docs pages work the same way.
  • Not verified: Rack::Attack may count every request from this Worker against one IP bucket (CF-Connecting-IP of the Worker). If a crawler fills it, the pages fail for everyone until the window resets. The edge cache makes this less likely. Check the production logs for user-agent: calendar.witcc.dev before you depend on it.

Checks

  • node --test src/lib/catalog.test.ts: 12 pass.
  • npx eslint src/lib src/routes/catalog: no problems.
  • npm run check: no errors or warnings in the new files. The 19 errors in src/routes/tos and src/routes/privacy, and the warnings in src/routes/guides, were already on main.
  • npm test: 3 failures in guides.test.ts and pages.test.ts (the MCP guide is commented out of GUIDES). They were already on main.
  • npm run build: passes.
  • I rendered every page with vite dev against the live API.

Finals and university events pages come next. They need public endpoints in the backend first.

@jaspermayone
jaspermayone requested a review from Cattn as a code owner November 6, 2026 15:46
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
calendar-home ba0fa6c Commit Preview URL

Branch Preview URL
Nov 10 2026, 08:09 PM

@Cattn

Cattn commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

I don't think we should put this in the topbar, it's getting a bit cluttered 😭 and is cooked on mobile. I'll think of an alternative

@jaspermayone

Copy link
Copy Markdown
Member Author

I don't think we should put this in the topbar, it's getting a bit cluttered 😭 and is cooked on mobile. I'll think of an alternative

k, lmk

@miretskydatwit

Copy link
Copy Markdown
Member

We have a whole section on the course catalog at the bottom of the homepage lol, why not just use that?

image

Like add a link to /catalog at the top of the existing links called something like "Search the course catalog and faculty directory"

@Cattn thoughts?

@Cattn

Cattn commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

That would be better, although we still need to clean up the top bar anyway

@miretskydatwit miretskydatwit mentioned this pull request Nov 10, 2026
@Cattn
Cattn force-pushed the jaspermayone/797-public-catalog-pages branch from 4358fce to ba0fa6c Compare November 10, 2026 20:08
@Cattn

Cattn commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

@jaspermayone can you move the link to this where daniel showed above, and out of the topbar (which should fix your merge conflicts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants