Open an agent profile card by clicking them on the floor

Canvas clicks hit-test against the exact positions the renderer draws -
frontmost person wins - and select the agent: a floating card in the app's
design language shows their name, title, department, level, live status, and
current task, with a selection ring under their feet. Escape, the close
button, or clicking empty floor dismisses it; hovering a person shows a
pointer cursor. The floor now seats only lifecycle-active agents, matching
how the backend wakes and assigns work. Covered by a hit-test unit test and
a dedicated office e2e that clicks the CEO through the real floor-plan math.
This commit is contained in:
ZacharyZhang-NY committed 2026-07-06 21:58:35 -04:00
1 parent 8e0716021f
commit e8c8414613
6 files changed
+233 -6

No files matched your search

@@ -94,6 +94,18 @@ describe("office simulation", () => {
expect(diagonal).toBeGreaterThan(straight * 0.7);
});
test("clicks hit the agent drawn at that spot, frontmost first", () => {
const sim = new OfficeSimulation();
sim.sync([agentInput("a"), agentInput("b")]);
const first = sim.agents[0];
expect(sim.hitTest({ x: first.x, y: first.y - 10 })!.input.id).toBe("a");
expect(sim.hitTest({ x: first.x - 60, y: first.y - 10 })).toBeNull();
const second = sim.agents[1];
second.x = first.x;
second.y = first.y + 6;
expect(sim.hitTest({ x: first.x, y: first.y })!.input.id).toBe("b");
});
test("camera follows the player and clamps at world edges", () => {
const sim = new OfficeSimulation();
sim.sync(Array.from({ length: 30 }, (_, i) => agentInput(`a${i}`)));