fix(ui): tone down InteractPrompt and support empty label

- Smaller boxes (36x36 key + 36px-tall label) instead of the previous
  oversized white pills.
- Dark translucent background (rgba(10, 12, 20, 0.55)) with a 1px
  white outline (rgba(255, 255, 255, 0.7)), no border-radius and
  white text so the prompt blends with the dark UI instead of being a
  bright blob over the 3D scene.
- Key cube now has a 3D keyboard-key effect (inset top highlight +
  inset bottom darkening + small bottom drop) so it reads as a
  physical key.
- Key and label are visually separated (gap: 8px) but share the same
  height for alignment.
- InteractPrompt no longer renders the label box when focused.label is
  empty/whitespace, so callers can show the key prompt alone.
This commit is contained in:
Tom Boullay
2026-06-02 23:27:07 +02:00
parent 4e1ca708b2
commit 931308c92c
2 changed files with 32 additions and 26 deletions
+5 -1
View File
@@ -9,10 +9,14 @@ export function InteractPrompt(): React.JSX.Element | null {
if (cameraMode !== "player") return null;
if (!focused || holding || focused.kind !== "trigger") return null;
const label = focused.label?.trim() ?? "";
return (
<div className="interact-prompt" aria-live="polite">
<kbd className="interact-prompt__key">{INTERACT_KEY.toUpperCase()}</kbd>
<span className="interact-prompt__label">{focused.label}</span>
{label.length > 0 ? (
<span className="interact-prompt__label">{label}</span>
) : null}
</div>
);
}
+27 -25
View File
@@ -813,41 +813,43 @@ canvas {
left: 50%;
transform: translateX(-50%);
display: flex;
align-items: center;
gap: 12px;
align-items: stretch;
gap: 8px;
pointer-events: none;
z-index: 10;
}
.interact-prompt__key {
display: inline-flex;
align-items: center;
justify-content: center;
width: 64px;
height: 64px;
background: rgba(255, 255, 255, 0.92);
border-radius: 12px;
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
font-family: "Inter", sans-serif;
font-size: 32px;
font-weight: 900;
font-style: normal;
color: #0a0a0a;
letter-spacing: 0;
}
.interact-prompt__key,
.interact-prompt__label {
display: inline-flex;
align-items: center;
padding: 16px 24px;
background: rgba(255, 255, 255, 0.92);
border-radius: 12px;
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
justify-content: center;
height: 36px;
background: rgba(10, 12, 20, 0.55);
border: 1px solid rgba(255, 255, 255, 0.7);
font-family: "Inter", sans-serif;
font-size: 22px;
color: #ffffff;
}
.interact-prompt__key {
width: 36px;
font-size: 15px;
font-weight: 900;
color: #0a0a0a;
font-style: normal;
letter-spacing: 0;
/* 3D keyboard key effect: top highlight, bottom inner darkening,
and a thin bottom drop so the key reads as physically pressed-up. */
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.25),
inset 0 -3px 0 rgba(0, 0, 0, 0.45),
0 2px 0 rgba(0, 0, 0, 0.55);
}
.interact-prompt__label {
padding: 0 12px;
font-size: 13px;
font-weight: 700;
letter-spacing: 0.02em;
line-height: 1;
}