Skip to content

feat: ✨ room image shown on hover#568

Open
arya-palanivel wants to merge 5 commits into
mainfrom
asp/room-image-tooltip
Open

feat: ✨ room image shown on hover#568
arya-palanivel wants to merge 5 commits into
mainfrom
asp/room-image-tooltip

Conversation

@arya-palanivel

Copy link
Copy Markdown
Contributor

Description

Upgrades the plain text tooltip on study room heatmap cells to a rich card that shows a room photo, name, time range, capacity, and description on hover.

AnteaterAPI doesn't return image URLs. UCI Libraries also doesn't expose a public API for room photos. However, the public booking pages do contain room photos hosted on UCI's S3/CloudFront CDN.

So there is a one-time dev script that:

  1. Queries AnteaterAPI across a window of 7 days back to 30 days forward to discover all unique room IDs
  2. For each room, tries fetching its page from both the library scheduler and the OIT scheduler, then extracts the image URL from the HTML
  3. Writes a static map of roomId → imageUrl

This file is committed to the repo and imported directly into the heatmap component. If UCI adds new rooms or updates photos, we can just re-run the script to regenerate it.

Currently 77 rooms have images. The remaining rooms (Plaza Verde and some MRC rooms) simply have no photo uploaded on UCI's side so they only show the text part rn. The long-term fix would be getting AnteaterAPI to return image URLs but thats it own issue.

Recording/Screenshots

image

Test Plan

  1. Pick today's date and a time range
  2. Hover over any slot cell in the heatmap
  3. Rooms in Science Library, Langson Library, Gateway Study Center, and Anteater Learning Pavilion should show a photo alongside the room name, time, capacity, and description.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 issues found across 4 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/fetch-room-images.ts
Comment thread scripts/fetch-room-images.ts Outdated
Comment thread next.config.mjs Outdated
Comment thread next.config.mjs Outdated
Comment thread scripts/fetch-room-images.ts Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread next.config.mjs

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="scripts/fetch-room-images.ts">

<violation number="1" location="scripts/fetch-room-images.ts:130">
P1: Unconditional file write can clobber committed image data with empty/partial output on transient network failures. Add a guard to fail fast before writing when results are unexpectedly empty.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

].join("\n");

const outPath = path.resolve(__dirname, "../src/lib/rooms/room-images.ts");
await fs.writeFile(outPath, lines, "utf-8");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Unconditional file write can clobber committed image data with empty/partial output on transient network failures. Add a guard to fail fast before writing when results are unexpectedly empty.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/fetch-room-images.ts, line 130:

<comment>Unconditional file write can clobber committed image data with empty/partial output on transient network failures. Add a guard to fail fast before writing when results are unexpectedly empty.</comment>

<file context>
@@ -0,0 +1,137 @@
+	].join("\n");
+
+	const outPath = path.resolve(__dirname, "../src/lib/rooms/room-images.ts");
+	await fs.writeFile(outPath, lines, "utf-8");
+	console.log(`\nWrote ${found} image entries → src/lib/rooms/room-images.ts`);
+}
</file context>

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.

room image tooltip

1 participant