Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(office): elevator panel and ride that feel like a real elevator

rubenluetke10-beepfd7f1ff751f3
diff --git a/jarvis/ui/web/frontend/src/components/society/office/ElevatorCallButton.tsx b/jarvis/ui/web/frontend/src/components/society/office/ElevatorCallButton.tsx
index 66fbc1f95e..93edc66f3b 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/ElevatorCallButton.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/ElevatorCallButton.tsx
@@ -52,11 +52,13 @@ function arrowTexture(direction: ArrowDirection) {
});
}
-export function ElevatorCallButton({ shaft, floor, near, lit, animate, onPress }: {
+export function ElevatorCallButton({ shaft, floor, near, hint, lit, animate, onPress }: {
shaft: Furniture;
floor: OfficeFloor;
/** The person stands at the elevator: the button invites a press. */
near: boolean;
+ /** Show the pill over the button (not while the floor picker it opens is on screen). */
+ hint: boolean;
/** Pressed: glowing until the ride starts. */
lit: boolean;
animate: boolean;
@@ -106,7 +108,7 @@ export function ElevatorCallButton({ shaft, floor, near, lit, animate, onPress }
<mesh position={[0, 0, 0.0231]} material={arrow} raycast={() => null}>
<planeGeometry args={[BUTTON_RADIUS * 1.6, BUTTON_RADIUS * 1.6]} />
</mesh>
- {near && !lit && (
+ {hint && !lit && (
<Html center position={[0, 0.62, 0.05]} zIndexRange={[24, 0]} pointerEvents="none">
<span className="office-call-pill" data-office-ui>
<b>{t("society.office.elevator_choose")}</b>
diff --git a/jarvis/ui/web/frontend/src/components/society/office/ElevatorPanel.tsx b/jarvis/ui/web/frontend/src/components/society/office/ElevatorPanel.tsx
index 3d1b4ebfba..0fdfa9f9f4 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/ElevatorPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/ElevatorPanel.tsx
@@ -1,18 +1,27 @@
/**
* The elevator's floor picker: pressing the call button (click, or E at the
- * doors) opens this small panel with one button per floor, top floor first
- * like a real elevator panel. The current floor is shown but not pickable.
- * Keys: the floor's number (0, 1, 2) picks it, arrows move between buttons,
- * Escape closes. It is a dialog, so the character stands still while it is
- * open (`ownsKeyboard`).
+ * doors) opens this panel, built like a real elevator's control panel: a
+ * display with the current floor on top, then one round, backlit key per
+ * floor, top floor first. The current floor's key glows but cannot be
+ * picked. A picked key lights up for a moment before the panel closes and
+ * the doors start to move.
+ *
+ * Keys: the floor's number (0, 1, 2) picks it, arrows move between keys,
+ * Escape (or E) closes. It is a dialog, so the character stands still while
+ * it is open (`ownsKeyboard`). Part of the diorama: one steel palette in
+ * light and dark mode.
*/
-import { useEffect, useRef } from "react";
+import { useEffect, useRef, useState } from "react";
+import { useReducedMotion } from "framer-motion";
import { useT } from "@/i18n";
import { floorLevel, OFFICE_FLOORS, type OfficeFloor } from "./officeStore";
/** The floors as the panel lists them: top floor first. */
export const PANEL_FLOORS: readonly OfficeFloor[] = [...OFFICE_FLOORS].reverse();
+/** How long a pressed key stays lit before the panel hands the floor on. */
+export const KEY_PRESS_MS = 260;
+
/** The floor a number key picks ("0" = ground floor), or null. */
export function floorForKey(key: string): OfficeFloor | null {
const level = /^[0-9]$/.test(key) ? Number(key) : -1;
@@ -27,7 +36,21 @@ export function ElevatorPanel({ floor, counts, onPick, onClose }: {
onClose: () => void;
}) {
const t = useT();
+ const reduced = useReducedMotion() ?? false;
const list = useRef<HTMLDivElement>(null);
+ const [pressed, setPressed] = useState<OfficeFloor | null>(null);
+ const pressTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
+ useEffect(() => () => clearTimeout(pressTimer.current), []);
+
+ // Light the key, then hand the floor on; one press per panel.
+ // A ref, so the capture-phase key listener always calls the current press without re-subscribing.
+ const press = useRef<(target: OfficeFloor) => void>(() => undefined);
+ press.current = (target: OfficeFloor) => {
+ if (pressed || target === floor) return;
+ setPressed(target);
+ if (reduced) { onPick(target); return; }
+ pressTimer.current = setTimeout(() => onPick(target), KEY_PRESS_MS);
+ };
// Focus the nearest floor you can go to, and give focus back to the office when the panel closes.
useEffect(() => {
@@ -48,7 +71,7 @@ export function ElevatorPanel({ floor, counts, onPick, onClose }: {
const picked = event.ctrlKey || event.metaKey || event.altKey ? null : floorForKey(event.key);
if (picked) {
event.preventDefault(); event.stopPropagation();
- if (picked !== floor && !event.repeat) onPick(picked);
+ if (!event.repeat) press.current(picked);
return;
}
if (event.key === "ArrowUp" || event.key === "ArrowDown") {
@@ -62,26 +85,36 @@ export function ElevatorPanel({ floor, counts, onPick, onClose }: {
};
document.addEventListener("keydown", onKey, true);
return () => document.removeEventListener("keydown", onKey, true);
- }, [floor, onClose, onPick]);
+ }, [onClose]);
+ const target = pressed ?? floor;
+ const up = floorLevel(target) > floorLevel(floor);
return (
<div className="office-lift-backdrop" data-office-ui onPointerDown={(event) => { if (event.target === event.currentTarget) onClose(); }}>
- <div className="office-card office-lift" role="dialog" data-state="open" aria-modal="true" aria-labelledby="office-lift-title">
- <div className="office-lift-head">
+ <div className="office-lift" role="dialog" data-state="open" aria-modal="true" aria-labelledby="office-lift-title" data-reduced={reduced || undefined}>
+ <div className="office-lift-top">
+ <div className="office-lift-display" aria-hidden>
+ <svg viewBox="0 0 24 24" width="14" height="14" className="office-lift-display-arrow" data-dir={pressed ? (up ? "up" : "down") : "idle"}>
+ <path d="M12 5 L20 15 H4 Z" fill="currentColor" />
+ </svg>
+ <b>{floorLevel(floor)}</b>
+ </div>
<h2 id="office-lift-title">{t("society.office.elevator_choose")}</h2>
- <button type="button" className="office-icon-button" onClick={onClose} aria-label={t("society.office.close")}>×</button>
+ <button type="button" className="office-lift-close" onClick={onClose} aria-label={t("society.office.close")}>×</button>
</div>
<div ref={list} className="office-lift-floors">
- {PANEL_FLOORS.map((target) => {
- const here = target === floor;
- const count = counts[target];
+ {PANEL_FLOORS.map((option) => {
+ const here = option === floor;
+ const count = counts[option];
return (
- <button key={target} type="button" className="office-lift-floor" disabled={here} aria-current={here ? "location" : undefined}
- aria-keyshortcuts={String(floorLevel(target))} data-floor={target} onClick={() => onPick(target)}>
- <span className="office-lift-number" aria-hidden>{floorLevel(target)}</span>
+ <button key={option} type="button" className="office-lift-floor" disabled={here || (pressed !== null && pressed !== option)}
+ aria-current={here ? "location" : undefined} aria-pressed={pressed === option || undefined}
+ aria-keyshortcuts={String(floorLevel(option))} data-floor={option} data-here={here || undefined} data-pressed={pressed === option || undefined}
+ onClick={() => press.current(option)}>
+ <span className="office-lift-key" aria-hidden><span>{floorLevel(option)}</span></span>
<span className="office-lift-text">
- <b>{t(`society.office.floor_name_${target}`)}</b>
- <small>{here ? t("society.office.elevator_here") : count ?? t(`society.office.floor_about_${target}`)}</small>
+ <b>{t(`society.office.floor_name_${option}`)}</b>
+ <small>{here ? t("society.office.elevator_here") : count ?? t(`society.office.floor_about_${option}`)}</small>
</span>
</button>
);
diff --git a/jarvis/ui/web/frontend/src/components/society/office/ElevatorRide.tsx b/jarvis/ui/web/frontend/src/components/society/office/ElevatorRide.tsx
new file mode 100644
index 0000000000..aba92ccfde
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/office/ElevatorRide.tsx
@@ -0,0 +1,72 @@
+/**
+ * The elevator ride over the stage: two brushed-steel doors slide shut, a hall
+ * lantern on the seam counts through the floors with an arrow pointing the
+ * way, light bands sweep past while the car moves, and the doors open on the
+ * new floor. The floor switches behind the closed doors (OfficeStage owns the
+ * timing); this component only draws the phase it is given.
+ *
+ * Part of the diorama, like the call button's pill: it keeps one palette in
+ * light and dark mode. Reduced motion: no sliding, sweeping or counting —
+ * the lantern simply shows the floor being ridden to.
+ */
+import { useEffect, useState } from "react";
+import { useT } from "@/i18n";
+import { floorLevel, OFFICE_FLOORS, type OfficeFloor } from "./officeStore";
+
+export type RidePhase = "closing" | "riding" | "opening";
+
+/** How long the lantern shows each floor while the car moves. */
+export const RIDE_STEP_MS = 420;
+
+/** The floor levels a ride passes, from where it starts to where it stops (both included). */
+export function rideLevels(from: OfficeFloor, to: OfficeFloor): number[] {
+ const a = floorLevel(from), b = floorLevel(to);
+ const step = b >= a ? 1 : -1;
+ const out: number[] = [];
+ for (let level = a; level !== b + step; level += step) out.push(level);
+ return out;
+}
+
+/** How long the car should at least be under way so the lantern can count every floor. */
+export function minRideMs(from: OfficeFloor, to: OfficeFloor): number {
+ return Math.max(1, rideLevels(from, to).length - 1) * RIDE_STEP_MS;
+}
+
+/** A chevron pointing up (or down when `down`). */
+function Arrow({ down }: { down: boolean }) {
+ return (
+ <svg viewBox="0 0 24 24" width="22" height="22" aria-hidden className="office-elevator-arrow" data-down={down || undefined}>
+ <path d="M12 5 L20 15 H4 Z" fill="currentColor" />
+ </svg>
+ );
+}
+
+export function ElevatorRide({ from, to, phase, reduced }: { from: OfficeFloor; to: OfficeFloor; phase: RidePhase; reduced: boolean }) {
+ const t = useT();
+ const levels = rideLevels(from, to);
+ const up = floorLevel(to) > floorLevel(from);
+ // Which of the passed floors the lantern shows: the start while the doors close, one step per RIDE_STEP_MS under way, the stop on arrival.
+ const [step, setStep] = useState(0);
+ useEffect(() => {
+ if (reduced || phase !== "riding") return;
+ const timer = window.setInterval(() => setStep((s) => Math.min(levels.length - 1, s + 1)), RIDE_STEP_MS);
+ return () => window.clearInterval(timer);
+ }, [phase, reduced, levels.length]);
+ const index = reduced || phase === "opening" ? levels.length - 1 : phase === "closing" ? 0 : step;
+ const level = levels[index] ?? floorLevel(to);
+ const shown = OFFICE_FLOORS[level] ?? to;
+ const caption = t(up ? "society.office.riding_up_to" : "society.office.riding_down_to").replace("{0}", t(`society.office.floor_name_${to}`));
+ return (
+ <div className="office-elevator" data-phase={phase} data-direction={up ? "up" : "down"} data-reduced={reduced || undefined}
+ role="status" aria-live="polite" aria-label={caption}>
+ <i className="office-elevator-door" data-side="left" aria-hidden />
+ <i className="office-elevator-door" data-side="right" aria-hidden />
+ <i className="office-elevator-sweep" aria-hidden />
+ <div className="office-elevator-lantern" aria-hidden>
+ <Arrow down={!up} />
+ <b key={level} className="office-elevator-level">{level}</b>
+ <span className="office-elevator-name">{t(`society.office.floor_name_${shown}`)}</span>
+ </div>
+ </div>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
index 5674c8d2a9..5c5f051a52 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeScene.tsx
@@ -97,8 +97,8 @@ export interface OfficeSceneProps {
nearby: Selection | null;
chats: ReadonlyMap<string, DeskChat>;
onOpenScreen: (agentId: string, screen: Point & { y: number }, facing: number) => void;
- /** The elevator's call button: lit after a press, and the press itself. */
- elevatorCall: { lit: boolean; onPress: () => void };
+ /** The elevator's call button: lit after a press, the floor picker open (its pill steps aside), and the press itself. */
+ elevatorCall: { lit: boolean; picking: boolean; onPress: () => void };
}
/** The checkpoints, the elevator's call button and the person: the same on every floor. */
@@ -118,7 +118,7 @@ function SharedFloorParts({ floor, layout, grid, ready, awake, reduced, player,
))}
{shaft && (
<ElevatorCallButton shaft={shaft} floor={floor} lit={elevatorCall.lit} animate={awake && !reduced}
- near={atLift} onPress={elevatorCall.onPress} />
+ near={atLift} hint={atLift && !elevatorCall.picking} onPress={elevatorCall.onPress} />
)}
<FloorArrival floor={floor} layout={layout} grid={grid} ready={ready} />
<OfficePlayer layout={layout} grid={grid} look={player.look} name={player.name} awake={awake} reduced={reduced} />
diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx
index 166e08dfa3..ba2d97bf61 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeStage.tsx
@@ -26,13 +26,13 @@ import { CAMERA_FOV } from "./officeCamera";
import { ZOOM_SECONDS } from "./OfficeCameraRig";
import { useDeskChats } from "./useDeskChats";
import type { Point } from "./officeLayout";
-import { floorLevel, player, switchFloor, useOfficeStore, type OfficeFloor } from "./officeStore";
+import { player, switchFloor, useOfficeStore, type OfficeFloor } from "./officeStore";
import { agentPositions, seatedAtDesk } from "./walkerRegistry";
import { useCodingFloorOccupants, type PaneOccupant } from "./codingFloor";
import { openPaneSession } from "./codingNavigate";
import { useDprBudget } from "./useDprBudget";
import { knownOnFloor, noteArrivals } from "./officeFloors";
-import { atElevator, CALL_PRESS_MS } from "./elevatorCall";
+import { atElevator } from "./elevatorCall";
import { loadProfile, playerLook, saveProfile, type PlayerProfile } from "./playerProfile";
import { AgentPanel, CheckpointPanel, type OfficeActions } from "./OfficePanels";
import { PaneCommandPanel } from "./PaneCommandPanel";
@@ -40,6 +40,7 @@ import type { WalkerContext } from "./OfficeAgents";
import { ownsKeyboard } from "./OfficePlayer";
import { ArcadeCabinet } from "./ArcadeCabinet";
import { ElevatorPanel } from "./ElevatorPanel";
+import { ElevatorRide, minRideMs, type RidePhase } from "./ElevatorRide";
import { buildArcadeLayout } from "../arcade/arcadeFloorLayout";
import { ARCADE_GAMES, gameForCabinet, type RetroGameId } from "../arcade/arcadeGames";
import { useOfficeSettings, useReceptionTab } from "./officeSettings";
@@ -68,9 +69,11 @@ const REFRESH_JITTER_MS = 1500;
const EMPTY_OCCUPANTS: ReadonlyMap<string, PaneOccupant> = new Map();
-/** Elevator doors: closing, the ride (held until the new floor has loaded, capped), opening. */
-const DOORS_MS = 520;
-const RIDE_MAX_MS = 1400;
+/** Elevator doors: closing, the ride (held until the new floor has loaded and the lantern has counted the floors, capped), opening. */
+const DOORS_MS = 620;
+const RIDE_MAX_MS = 2200;
+/** After a key on the floor picker lit up, the call button outside glows this long before the doors move. */
+const PICKED_CALL_MS = 320;
class RenderBoundary extends Component<{ children: ReactNode; fallbackText: string }, { failed: boolean }> {
state = { failed: false };
@@ -233,7 +236,7 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen
// The elevator: doors close, the floor switches behind them, doors open once
// the new floor has loaded (capped). Reduced motion switches at once.
- const [ride, setRide] = useState<{ to: OfficeFloor; up: boolean; phase: "closing" | "riding" | "opening" } | null>(null);
+ const [ride, setRide] = useState<{ from: OfficeFloor; to: OfficeFloor; phase: RidePhase; startedMs: number } | null>(null);
const rideTimer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
useEffect(() => () => clearTimeout(rideTimer.current), []);
const takeElevator = useCallback((to: OfficeFloor) => {
@@ -241,11 +244,10 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen
if (ride || to === from) return;
if (reduced) { switchFloor(to, true); return; }
useOfficeStore.getState().select(null);
- const up = floorLevel(to) > floorLevel(from);
- setRide({ to, up, phase: "closing" });
+ setRide({ from, to, phase: "closing", startedMs: 0 });
rideTimer.current = setTimeout(() => {
switchFloor(to, true);
- setRide({ to, up, phase: "riding" });
+ setRide({ from, to, phase: "riding", startedMs: performance.now() });
rideTimer.current = setTimeout(() => setRide((r) => (r?.phase === "riding" ? { ...r, phase: "opening" } : r)), RIDE_MAX_MS);
}, DOORS_MS);
}, [reduced, ride]);
@@ -271,7 +273,7 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen
setPicking(false);
if (ride || callLit || to === useOfficeStore.getState().floor) return;
setCallLit(true);
- callTimer.current = setTimeout(() => { setCallLit(false); takeElevator(to); }, CALL_PRESS_MS);
+ callTimer.current = setTimeout(() => { setCallLit(false); takeElevator(to); }, PICKED_CALL_MS);
}, [ride, callLit, takeElevator]);
const closePicker = useCallback(() => setPicking(false), []);
// The picker belongs to the floor it was opened on.
@@ -284,8 +286,10 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen
}, [selection, select, pressCall]);
useEffect(() => {
if (ride?.phase === "riding" && floor === ride.to && ready) {
+ // Open once the floor has loaded and the lantern has counted every floor passed.
+ const left = minRideMs(ride.from, ride.to) - (performance.now() - ride.startedMs);
clearTimeout(rideTimer.current);
- rideTimer.current = setTimeout(() => setRide({ ...ride, phase: "opening" }), 160);
+ rideTimer.current = setTimeout(() => setRide({ ...ride, phase: "opening" }), Math.max(160, left));
}
if (ride?.phase === "opening") {
clearTimeout(rideTimer.current);
@@ -404,7 +408,7 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen
<OfficeScene floor={floor} occupants={occupants} ready={ready} layout={layout} grid={grid} walkers={walkers} agents={agents} newcomers={newcomers}
awake={awake} reduced={reduced} overview={overview} player={{ look: playerLook(profile), name: playerName }}
selection={selection} nearby={nearby} chats={chats} onOpenScreen={openScreen}
- elevatorCall={{ lit: callLit, onPress: pressCall }} />
+ elevatorCall={{ lit: callLit, picking, onPress: pressCall }} />
</Canvas>
</Suspense>
</RenderBoundary>
@@ -473,15 +477,7 @@ export function OfficeStage({ onOpenLedger, onSelectAgent, onCreateAgent, onOpen
)}
{!compact && <OfficeCompass layout={layout} agents={agents} selectedId={selection?.kind === "agent" ? selection.id : null} />}
{diving && <div className="office-dive-fade" aria-hidden />}
- {ride && (
- <div className="office-elevator" data-phase={ride.phase} role="status" aria-live="polite">
- <i className="office-elevator-door" data-side="left" aria-hidden />
- <i className="office-elevator-door" data-side="right" aria-hidden />
- <span className="office-elevator-sign">
- {t(ride.up ? "society.office.riding_up_to" : "society.office.riding_down_to").replace("{0}", t(`society.office.floor_name_${ride.to}`))}
- </span>
- </div>
- )}
+ {ride && <ElevatorRide from={ride.from} to={ride.to} phase={ride.phase} reduced={reduced} />}
{!compact && <OfficeMinimap layout={layout} agents={agents} selectedId={selection?.kind === "agent" ? selection.id : null}
onOpenMap={() => setMapOpen(true)} />}
<OfficeFullMap open={mapOpen} onOpen={() => setMapOpen(true)} onClose={() => setMapOpen(false)}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeFloors.css b/jarvis/ui/web/frontend/src/components/society/office/officeFloors.css
index 0f8e153a8e..4e467e6e75 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeFloors.css
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeFloors.css
@@ -1,22 +1,77 @@
/* Floors, the elevator ride and the compact (IDE side panel) HUD. Theme tokens only: light and dark mode both work. */
-/* The elevator: two doors slide shut over the scene, the floor switches behind them, they slide open. */
-.office-elevator { position:absolute; inset:0; z-index:62; pointer-events:none; overflow:hidden; display:flex; align-items:center; justify-content:center; }
-.office-elevator-door { position:absolute; top:0; bottom:0; width:50%; background:linear-gradient(90deg, hsl(var(--secondary)), hsl(var(--muted))); box-shadow:inset 0 0 0 1px hsl(var(--border)); transition:transform 480ms cubic-bezier(.6,0,.3,1); }
-.office-elevator-door[data-side="left"] { left:0; transform:translateX(-100%); }
-.office-elevator-door[data-side="right"] { right:0; transform:translateX(100%); }
+/*
+ * The elevator ride (ElevatorRide): brushed-steel doors slide shut over the scene, a hall lantern on the seam
+ * counts the floors while light bands sweep past, and the doors open on the new floor. Part of the diorama,
+ * like the call button's pill: one palette in light and dark mode.
+ */
+.office-elevator { position:absolute; inset:0; z-index:62; pointer-events:none; overflow:hidden; }
+.office-elevator-door {
+ position:absolute; top:0; bottom:0; width:50%;
+ background:
+ repeating-linear-gradient(90deg, rgb(255 255 255 / .035) 0 1px, transparent 1px 4px),
+ linear-gradient(90deg, #5f656e 0%, #a4aab2 30%, #cdd1d6 50%, #9aa0a8 72%, #686e77 100%);
+ transition:transform 600ms cubic-bezier(.65,0,.25,1);
+}
+/* A recessed panel on each door, catching the light along its top edge. */
+.office-elevator-door::before {
+ content:""; position:absolute; inset:8% 14%; border-radius:8px;
+ background:linear-gradient(180deg, rgb(255 255 255 / .08), rgb(0 0 0 / .06));
+ box-shadow:inset 0 0 0 1px rgb(0 0 0 / .16), inset 0 1px 0 rgb(255 255 255 / .4);
+}
+/* The rubber edge where the doors meet. */
+.office-elevator-door::after { content:""; position:absolute; top:0; bottom:0; width:3px; background:#202227; }
+.office-elevator-door[data-side="left"] { left:0; transform:translateX(-101%); box-shadow:inset -16px 0 24px -12px rgb(0 0 0 / .55); }
+.office-elevator-door[data-side="left"]::after { right:0; }
+.office-elevator-door[data-side="right"] { right:0; transform:translateX(101%); box-shadow:inset 16px 0 24px -12px rgb(0 0 0 / .55); }
+.office-elevator-door[data-side="right"]::after { left:0; }
.office-elevator[data-phase="closing"] .office-elevator-door,
.office-elevator[data-phase="riding"] .office-elevator-door { transform:translateX(0); }
/* A fresh mount starts open, so closing animates from open; opening animates back out. */
-.office-elevator[data-phase="closing"] .office-elevator-door { animation:office-door-close 480ms cubic-bezier(.6,0,.3,1); }
+.office-elevator[data-phase="closing"] .office-elevator-door { animation:office-door-close 600ms cubic-bezier(.65,0,.25,1); }
@keyframes office-door-close { from { transform:translateX(var(--office-door-from, 0)); } }
-.office-elevator[data-phase="closing"] .office-elevator-door[data-side="left"] { --office-door-from:-100%; }
-.office-elevator[data-phase="closing"] .office-elevator-door[data-side="right"] { --office-door-from:100%; }
-.office-elevator-sign { position:relative; padding:6px 14px; border-radius:999px; border:1px solid hsl(var(--border)); background:hsl(var(--popover)); color:hsl(var(--popover-foreground)); font-size:13px; font-weight:600; opacity:0; transition:opacity 200ms ease; }
-.office-elevator[data-phase="riding"] .office-elevator-sign { opacity:1; }
+.office-elevator[data-phase="closing"] .office-elevator-door[data-side="left"] { --office-door-from:-101%; }
+.office-elevator[data-phase="closing"] .office-elevator-door[data-side="right"] { --office-door-from:101%; }
+
+/* Under way: soft light bands slide past the doors, against the direction of travel. */
+.office-elevator-sweep {
+ position:absolute; inset:0; opacity:0;
+ background:repeating-linear-gradient(180deg, transparent 0 150px, rgb(255 255 255 / .2) 170px, transparent 190px 260px);
+ mix-blend-mode:overlay; transition:opacity 260ms ease;
+}
+.office-elevator[data-phase="riding"] .office-elevator-sweep { opacity:1; animation:office-ride-past-down 620ms linear infinite; }
+.office-elevator[data-phase="riding"][data-direction="down"] .office-elevator-sweep { animation-name:office-ride-past-up; }
+@keyframes office-ride-past-down { from { background-position:0 0; } to { background-position:0 260px; } }
+@keyframes office-ride-past-up { from { background-position:0 260px; } to { background-position:0 0; } }
+
+/* The hall lantern: a dark glass display on the seam with the arrow, the floor number and its name. */
+.office-elevator-lantern {
+ position:absolute; left:50%; top:24%; display:flex; flex-direction:column; align-items:center; gap:4px;
+ min-width:150px; padding:12px 22px 11px; border-radius:18px;
+ background:linear-gradient(180deg, #17181d, #0b0c10); border:1px solid rgb(255 255 255 / .1);
+ box-shadow:0 14px 36px rgb(0 0 0 / .45), inset 0 1px 0 rgb(255 255 255 / .07), 0 0 0 6px rgb(18 19 23 / .35);
+ color:#f5b83d; opacity:0; transform:translate(-50%, 10px) scale(.96);
+ transition:opacity 220ms ease, transform 360ms cubic-bezier(.2,.8,.2,1);
+}
+.office-elevator[data-phase="closing"] .office-elevator-lantern { opacity:1; transform:translate(-50%, 0) scale(1); transition-delay:320ms; }
+.office-elevator[data-phase="riding"] .office-elevator-lantern { opacity:1; transform:translate(-50%, 0) scale(1); }
+.office-elevator-arrow { display:block; filter:drop-shadow(0 0 6px rgb(245 184 61 / .75)); }
+.office-elevator-arrow[data-down] { transform:rotate(180deg); }
+.office-elevator[data-phase="riding"] .office-elevator-arrow { animation:office-arrow-up 900ms ease-in-out infinite; }
+.office-elevator[data-phase="riding"] .office-elevator-arrow[data-down] { animation-name:office-arrow-down; }
+@keyframes office-arrow-up { 0% { transform:translateY(4px); opacity:.45; } 50% { opacity:1; } 100% { transform:translateY(-4px); opacity:.45; } }
+@keyframes office-arrow-down { 0% { transform:rotate(180deg) translateY(4px); opacity:.45; } 50% { opacity:1; } 100% { transform:rotate(180deg) translateY(-4px); opacity:.45; } }
+.office-elevator-level {
+ font-family:'JetBrains Mono', ui-monospace, monospace; font-size:56px; line-height:1; font-weight:700; font-variant-numeric:tabular-nums;
+ text-shadow:0 0 16px rgb(245 184 61 / .65); animation:office-level-in 280ms cubic-bezier(.2,.8,.2,1);
+}
+/* A new floor number rolls in from the direction of travel. */
+@keyframes office-level-in { from { transform:translateY(var(--office-level-from, 16px)); opacity:0; } }
+.office-elevator[data-direction="down"] .office-elevator-level { --office-level-from:-16px; }
+.office-elevator-name { font-size:11px; font-weight:700; letter-spacing:.16em; text-transform:uppercase; color:rgb(245 184 61 / .82); white-space:nowrap; }
+.office-elevator[data-reduced] *, .office-elevator[data-reduced] *::before, .office-elevator[data-reduced] *::after { animation:none !important; transition:none !important; }
@media (prefers-reduced-motion: reduce) {
- .office-elevator-door { transition:none; animation:none !important; }
- .office-elevator-sign { transition:none; }
+ .office-elevator *, .office-elevator *::before, .office-elevator *::after { animation:none !important; transition:none !important; }
}
/* The pill over the elevator's call button. Like the name pills it is part of the diorama, which keeps one palette in both modes. */
@@ -41,19 +96,83 @@
.office-stage-compact .office-prompt { bottom:48px; max-width:calc(100% - 16px); font-size:12px; }
.office-stage-compact .office-note { font-size:11px; }
-/* The elevator's floor picker: a small panel in the middle of the stage, top floor first. */
-.office-lift-backdrop { position:absolute; inset:0; z-index:64; display:flex; align-items:center; justify-content:center; padding:16px; background:hsl(var(--background) / .35); }
-.office-lift { width:min(320px, 100%); padding:10px; display:flex; flex-direction:column; gap:8px; }
-.office-lift-head { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:2px 2px 0 4px; }
-.office-lift-head h2 { margin:0; font-size:14px; font-weight:700; }
-.office-lift-floors { display:flex; flex-direction:column; gap:6px; }
-.office-lift-floor { display:flex; align-items:center; gap:10px; width:100%; padding:8px 10px; border:1px solid hsl(var(--border)); border-radius:10px; background:hsl(var(--background) / .6); color:inherit; text-align:left; cursor:pointer; }
-.office-lift-floor:hover:not(:disabled) { background:hsl(var(--accent)); color:hsl(var(--accent-foreground)); }
-.office-lift-floor:focus-visible { outline:2px solid hsl(var(--ring)); outline-offset:2px; }
-.office-lift-floor:disabled { cursor:default; opacity:.7; }
-.office-lift-number { flex:none; display:inline-flex; align-items:center; justify-content:center; width:30px; height:30px; border-radius:999px; border:2px solid hsl(var(--border)); font-weight:700; font-variant-numeric:tabular-nums; }
-.office-lift-floor:disabled .office-lift-number { border-color:#f5b83d; color:#f5b83d; box-shadow:0 0 8px rgb(245 184 61 / .45); }
-.office-lift-text { display:flex; flex-direction:column; min-width:0; }
-.office-lift-text b { font-size:13px; }
-.office-lift-text small { font-size:11px; color:hsl(var(--muted-foreground)); }
-.office-lift-keys { margin:0; padding:0 4px 2px; font-size:10px; color:hsl(var(--muted-foreground)); }
+/*
+ * The elevator's floor picker (ElevatorPanel), built like a real control panel: brushed steel, a display
+ * with the current floor, one round backlit key per floor, top floor first. Each floor has its own accent;
+ * the key of the floor you are on glows amber, a pressed key lights up fully. Part of the diorama: one
+ * palette in light and dark mode.
+ */
+.office-lift-backdrop { position:absolute; inset:0; z-index:64; display:flex; align-items:center; justify-content:center; padding:16px; background:rgb(8 9 12 / .36); }
+.office-lift {
+ width:min(344px, 100%); padding:14px; border-radius:20px; color:#eef0f3;
+ background:
+ repeating-linear-gradient(90deg, rgb(255 255 255 / .02) 0 1px, transparent 1px 3px),
+ linear-gradient(160deg, #3b3f47 0%, #24272d 55%, #1b1d22 100%);
+ border:1px solid rgb(255 255 255 / .1);
+ box-shadow:0 24px 60px rgb(0 0 0 / .5), inset 0 1px 0 rgb(255 255 255 / .12), inset 0 -1px 0 rgb(0 0 0 / .45);
+ animation:office-lift-in 220ms cubic-bezier(.2,.8,.2,1);
+}
+@keyframes office-lift-in { from { opacity:0; transform:translateY(10px) scale(.97); } }
+.office-lift-top { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
+.office-lift-display {
+ display:inline-flex; align-items:center; justify-content:center; gap:6px; min-width:58px; padding:6px 10px; border-radius:10px;
+ background:#0b0c10; border:1px solid rgb(255 255 255 / .08); box-shadow:inset 0 2px 6px rgb(0 0 0 / .65);
+ color:#f5b83d; font-family:'JetBrains Mono', ui-monospace, monospace; font-size:20px; font-weight:700; line-height:1;
+ text-shadow:0 0 10px rgb(245 184 61 / .6);
+}
+.office-lift-display-arrow { transition:opacity 160ms ease, transform 160ms ease; }
+.office-lift-display-arrow[data-dir="idle"] { opacity:.25; }
+.office-lift-display-arrow[data-dir="down"] { transform:rotate(180deg); }
+.office-lift-top h2 { flex:1; min-width:0; margin:0; font-size:14px; font-weight:700; }
+.office-lift-close { flex:none; width:28px; height:28px; border:0; border-radius:8px; background:rgb(255 255 255 / .06); color:#c9ced6; font-size:18px; line-height:1; cursor:pointer; }
+.office-lift-close:hover { background:rgb(255 255 255 / .12); color:#ffffff; }
+.office-lift-close:focus-visible { outline:2px solid #f5b83d; outline-offset:2px; }
+.office-lift-floors { display:flex; flex-direction:column; gap:8px; }
+.office-lift-floor {
+ --lift-accent:#f5b83d;
+ position:relative; display:flex; align-items:center; gap:12px; width:100%; padding:9px 12px 9px 14px; border-radius:14px;
+ border:1px solid rgb(255 255 255 / .07); background:linear-gradient(180deg, rgb(255 255 255 / .055), rgb(255 255 255 / .02));
+ color:inherit; text-align:left; cursor:pointer;
+ transition:background 160ms ease, border-color 160ms ease, opacity 160ms ease, transform 120ms ease;
+}
+.office-lift-floor[data-floor="agents"] { --lift-accent:#9fd8a8; }
+.office-lift-floor[data-floor="coding"] { --lift-accent:#ffb86b; }
+.office-lift-floor[data-floor="arcade"] { --lift-accent:#ff6fb5; }
+/* The floor's colour as a slim bar along the key's edge. */
+.office-lift-floor::before { content:""; position:absolute; left:5px; top:14px; bottom:14px; width:3px; border-radius:3px; background:var(--lift-accent); opacity:.6; }
+.office-lift-floor:hover:not(:disabled), .office-lift-floor:focus-visible { background:linear-gradient(180deg, rgb(255 255 255 / .1), rgb(255 255 255 / .04)); border-color:color-mix(in srgb, var(--lift-accent) 55%, transparent); }
+.office-lift-floor:focus-visible { outline:2px solid var(--lift-accent); outline-offset:2px; }
+.office-lift-floor:active:not(:disabled) { transform:scale(.985); }
+.office-lift-floor:disabled { cursor:default; }
+.office-lift-floor:disabled:not([data-here]):not([data-pressed]) { opacity:.42; }
+.office-lift-floor[data-pressed] { border-color:rgb(245 184 61 / .65); }
+/* The key: a polished steel ring round a dark button with the floor's number. */
+.office-lift-key {
+ flex:none; display:grid; place-items:center; width:42px; height:42px; border-radius:50%;
+ background:radial-gradient(circle at 35% 30%, #f3f5f7, #aab0b8 55%, #686e77);
+ box-shadow:0 2px 4px rgb(0 0 0 / .45), inset 0 -2px 3px rgb(0 0 0 / .25);
+}
+.office-lift-key span {
+ display:grid; place-items:center; width:32px; height:32px; border-radius:50%;
+ background:radial-gradient(circle at 50% 35%, #30333b, #15171c); color:#e8eaee;
+ font-family:'JetBrains Mono', ui-monospace, monospace; font-size:15px; font-weight:700;
+ box-shadow:inset 0 0 0 2px rgb(255 255 255 / .06);
+ transition:color 160ms ease, box-shadow 160ms ease, background 160ms ease;
+}
+.office-lift-floor:hover:not(:disabled) .office-lift-key span, .office-lift-floor:focus-visible .office-lift-key span {
+ color:var(--lift-accent); box-shadow:inset 0 0 0 2px var(--lift-accent), 0 0 12px color-mix(in srgb, var(--lift-accent) 55%, transparent);
+}
+.office-lift-floor[data-here] .office-lift-key span { color:#f5b83d; box-shadow:inset 0 0 0 2px #f5b83d, 0 0 12px rgb(245 184 61 / .5); }
+.office-lift-floor[data-pressed] .office-lift-key span {
+ background:radial-gradient(circle at 50% 40%, #fff6d1, #f5b83d 58%, #b97a1d); color:#2b1900;
+ box-shadow:0 0 0 2px rgb(255 214 120 / .7), 0 0 20px rgb(245 184 61 / .9);
+}
+.office-lift-text { display:flex; flex-direction:column; gap:1px; min-width:0; }
+.office-lift-text b { font-size:14px; font-weight:650; color:#f4f5f7; }
+.office-lift-text small { font-size:11.5px; color:#a7adb7; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
+.office-lift-floor[data-here] .office-lift-text small { color:#f5b83d; }
+.office-lift-keys { margin:12px 2px 0; font-size:10.5px; color:#8d939d; }
+.office-lift[data-reduced], .office-lift[data-reduced] * { animation:none !important; transition:none !important; }
+@media (prefers-reduced-motion: reduce) {
+ .office-lift, .office-lift * { animation:none !important; transition:none !important; }
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeFloors.test.ts b/jarvis/ui/web/frontend/src/components/society/office/officeFloors.test.ts
index 5a4ab41ef3..0d7fd976d6 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeFloors.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeFloors.test.ts
@@ -5,6 +5,7 @@ import { arrivalPose, knownOnFloor, noteArrivals } from "./officeFloors";
import { floorLevel, OFFICE_FLOORS, officeSession, player, switchFloor, useOfficeStore } from "./officeStore";
import { floorForKey, PANEL_FLOORS } from "./ElevatorPanel";
import { callDirection } from "./ElevatorCallButton";
+import { minRideMs, RIDE_STEP_MS, rideLevels } from "./ElevatorRide";
import { buildArcadeLayout } from "../arcade/arcadeFloorLayout";
const AGENTS: OfficeAgentInput[] = [
@@ -32,6 +33,16 @@ describe("floors", () => {
expect(callDirection("arcade")).toBe("down");
});
+ it("counts every floor a ride passes, in the direction of travel", () => {
+ expect(rideLevels("agents", "arcade")).toEqual([0, 1, 2]);
+ expect(rideLevels("arcade", "agents")).toEqual([2, 1, 0]);
+ expect(rideLevels("coding", "arcade")).toEqual([1, 2]);
+ expect(rideLevels("coding", "coding")).toEqual([1]);
+ // The car stays under way long enough to show each passed floor once.
+ expect(minRideMs("agents", "arcade")).toBe(2 * RIDE_STEP_MS);
+ expect(minRideMs("coding", "agents")).toBe(RIDE_STEP_MS);
+ });
+
it("picks a floor by its number key", () => {
expect(floorForKey("0")).toBe("agents");
expect(floorForKey("1")).toBe("coding");