Added campus map - #871
Conversation
…cations, and define new groups for dormitories and faculty residences
|
@SJieNg123 is attempting to deploy a commit to the Chew Tzi Hwee's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@copilot resolve the merge conflicts in this pull request |
There was a problem hiding this comment.
🟡 Changes recommended
Four unresolved moderate issues remain in refetch handling, asset caching, and unmapped navigation.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds an OSM-backed 3D NTHU campus map with generated data, shared utilities, localized UI, and timetable/venue integrations.
Changes:
- Adds OSM data generation, curation, and campus geometry utilities.
- Adds Three.js map rendering, search, selection, labels, and navigation.
- Integrates the map into routes, translations, venues, timetable entries, and builds.
File summaries
| File | Summary |
|---|---|
tools/map-data/src/osmEnvironment.ts |
OSM geometry and environment processing. |
tools/map-data/src/osmEnvironment.test.ts |
Tests for OSM environment processing. |
tools/map-data/src/generate-campus-data.ts |
Campus data generation pipeline. |
tools/map-data/src/curation.ts |
Map curation and label logic. |
tools/map-data/src/curation.test.ts |
Curation behavior tests. |
tools/map-data/README.md |
Map-data pipeline documentation. |
tools/map-data/package.json |
Map-data tooling scripts and dependencies. |
tools/map-data/campus-map-curation.json |
Curated campus labels and metadata. |
README.md |
Project setup and map documentation. |
packages/shared/src/index.ts |
Shared campus API exports. |
packages/shared/src/campus/types.ts |
Shared campus data models. |
packages/shared/src/campus/index.ts |
Campus module exports. |
packages/shared/src/campus/geo.ts |
Geographic conversion utilities. |
packages/shared/src/campus/geo.test.ts |
Geographic utility tests. |
packages/shared/src/campus/buildings.ts |
Building identity and lookup utilities. |
packages/shared/src/campus/buildings.test.ts |
Building utility tests. |
packages/shared/package.json |
Shared package configuration and scripts. |
package.json |
Repository map-generation scripts. |
apps/web/vite.config.ts |
Vite map chunk and PWA configuration. |
apps/web/tsconfig.test.json |
Test TypeScript configuration. |
apps/web/tsconfig.json |
Web TypeScript configuration. |
apps/web/src/router.tsx |
Campus map route registration. |
apps/web/src/features/campusMap/sceneLogic.ts |
Scene state and interaction logic. |
apps/web/src/features/campusMap/sceneLogic.test.ts |
Scene logic tests. |
apps/web/src/features/campusMap/sceneGeometry.ts |
Scene geometry construction. |
apps/web/src/features/campusMap/sceneGeometry.test.ts |
Scene geometry tests. |
apps/web/src/features/campusMap/navigation.ts |
Building and venue navigation resolution. |
apps/web/src/features/campusMap/navigation.test.ts |
Navigation tests. |
apps/web/src/features/campusMap/MapSearch.tsx |
Map search interface. |
apps/web/src/features/campusMap/MapLegend.tsx |
Map legend interface. |
apps/web/src/features/campusMap/index.ts |
Campus-map feature exports. |
apps/web/src/features/campusMap/data.ts |
Campus dataset loading and query behavior. |
apps/web/src/features/campusMap/data.test.ts |
Campus data loading tests. |
apps/web/src/features/campusMap/CampusTrees.tsx |
Campus tree rendering. |
apps/web/src/features/campusMap/CampusScene.tsx |
Three.js campus scene. |
apps/web/src/features/campusMap/CampusMapPage.tsx |
Campus map page and loading UI. |
apps/web/src/features/campusMap/campusData.test.ts |
Committed campus data consistency tests. |
apps/web/src/features/campusMap/CampusCamera.tsx |
Map camera controls and focus. |
apps/web/src/features/campusMap/BuildingMesh.tsx |
Building mesh rendering. |
apps/web/src/features/campusMap/BuildingInfoPanel.tsx |
Building information panel. |
apps/web/src/dictionaries/zh.json |
Chinese map translations. |
apps/web/src/dictionaries/en.json |
English map translations. |
apps/web/src/const/apps.ts |
Campus map app catalog entry. |
apps/web/src/components/Timetable/TimetableItemDrawer.tsx |
Timetable-to-map integration. |
apps/web/src/app/[lang]/(mods-pages)/map/page.tsx |
Campus map page route. |
apps/web/src/app/[lang]/(mods-pages)/(venues)/venues/page.tsx |
Venue-to-map integration. |
apps/web/package.json |
Three.js and map test dependencies/scripts. |
Review details
Suppressed comments (2)
apps/web/src/features/campusMap/CampusMapPage.tsx:153
- This condition treats a background refetch failure as an initial load failure. TanStack Query retains the previous
datawhile settingerrorfor a failed focus/mount refetch, so a temporary network failure will replace an otherwise usable map with the load-error screen. Render the error only when no data is available, or handle refetch errors separately.
if (error || !data) {
apps/web/src/features/campusMap/CampusMapPage.tsx:73
- These settings make every window-focus and route-mount event refetch the full static campus dataset, and each response replaces the data object so the Three.js scene and camera focus are rebuilt unnecessarily. Since the query key already includes
CAMPUS_MAP_DATA_CACHE_VERSION, keep the loaded version fresh for the session and only refetch when that key changes.
staleTime: 0,
refetchOnMount: "always",
refetchOnWindowFocus: "always",
- Files reviewed: 47/49 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| export async function loadCampusMapData( | ||
| signal?: AbortSignal, | ||
| ): Promise<CampusMapData> { | ||
| const response = await fetch(CAMPUS_DATA_URL, { signal, cache: "no-store" }); |
| const identity = venues | ||
| ?.map((venue) => resolveVenueToCampusIdentity(venue)) | ||
| .find((candidate) => candidate !== undefined); |
|
|
Reviewed this with two independent passes (a Two logistics notes first:
Conflict resolutions worth knowing about
Issues fixed in #872Campus data re-downloaded on every window focus. Roads and paths vanish when
Overpass 200 with no
Left for a follow-upThe "Course Location" button can lead nowhere.
Verification
Closing in favour of #872. |
…871) (#872) * fix: improve local web development setup * feat(web): add interactive 3D campus map * chore(web): rename interactive campus map app * feat(map): label campus lakes * feat(map): make all campus labels interactive * fix(map): migrate cached water locations * fix(map): filter features to NTHU campus boundary * feat(map): number campus location labels * fix(map): curate campus building coverage * revert(map): restore uncropped campus data * feat(map): add editable campus curation config * feat(map): hardcode stable label numbers * fix(map): refresh curated campus data * Update campus map curation data: expand excluded list, add renamed locations, and define new groups for dormitories and faculty residences * fix(map): harden production geometry checks * feat(map): add campus environment layer * feat(web): enhance campus map and curation * feat(web): link timetable courses to campus map * fix(map): address review findings on the campus map update Follow-up fixes on top of #871, found by code review: - Restore `staleTime: Infinity` and drop `cache: "no-store"` on the campus data query. The asset is already versioned through CAMPUS_MAP_DATA_CACHE_VERSION, so `staleTime: 0` + `refetchOnWindowFocus: "always"` + `no-store` re-downloaded and re-parsed 218 KB on every window focus and rebuilt every building geometry and the camera tween with it. - Only stencil-clip roads and paths when a boundary mask is actually drawn. With `clipToCampus` hardcoded on, map data without a `boundary` enabled the stencil test against an all-zero buffer and every road and path fragment was discarded. - Treat 宿舍 as a dormitory alongside 齋 so the 15 西院宿舍 parts match the legend's dormitory swatch instead of rendering as generic buildings. - Validate that an Overpass 200 response actually carries an `elements` array before accepting it, so a malformed reply falls through to the next mirror instead of crashing generation with a TypeError. - Keep `type-check` as plain `tsc --noEmit`. Chaining the new `type-check:test` project made the command fail on pre-existing errors in timetableReconcile.test.ts and syncedStorage.test.ts; the project stays available as an opt-in script. Conflict resolution against main also kept main's `bun test src` scripts (reverting them to single-path globs would have undone #865) and reused the existing course/date/remove dictionary keys instead of the duplicates the branch added under timetable.course_actions. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GvM2uNLLbgPyrp1HEHobtb * fix(map): satisfy the SonarCloud reliability gate Three bare `.sort()` calls on string arrays in the curation pipeline (typescript:S2871) dropped New Code reliability to D. Give each an explicit `localeCompare` comparator so the curation JSON serializes deterministically. Also use `RegExp.test` instead of `String.match` for the dormitory name check, since the result is only used as a boolean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GvM2uNLLbgPyrp1HEHobtb --------- Co-authored-by: sj <shijie.jh@gmail.com> Co-authored-by: Shi Jie Ng <142388278+SJieNg123@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
Merged as #872 (commit ef14dc7) — your commits are in the history. Closing this one since the branch itself could not be merged (it predates #838, which already put the first version of the map on Thanks for the work on this — the curation pipeline and the environment layer are a good addition. The two follow-ups from the review are still open if you want to pick them up: curating |




No description provided.