Yuchen Yuan Claude Opus 4.7 commited on
Commit
40c3d2c
·
1 Parent(s): 66222a5

TopBar: fix Papers popover mobile clip, move status chips to left

Browse files

- Papers popover: switch to viewport-anchored positioning on mobile
(fixed right-3 top-14) so the 22rem menu no longer overflows the
viewport regardless of where the button ends up. Desktop keeps the
old absolute-to-button anchoring.
- Status chips (qiskit/torch version, live-IBM) move from the right
cluster to the left cluster, adjacent to the title. They describe
app runtime state and belong next to the app name, not mixed in
with the external-link and theme controls on the right.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Files changed (1) hide show
  1. frontend/src/components/TopBar.tsx +38 -31
frontend/src/components/TopBar.tsx CHANGED
@@ -98,38 +98,40 @@ export function TopBar({
98
  Visual pipeline for noise-aware VQC experiments
99
  </div>
100
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  </div>
102
  <div className="flex items-center gap-1.5 sm:gap-2 text-xs shrink-0">
103
- {/* qiskit/torch version chip — hidden on mobile to save room */}
104
- {!mobile && (
105
- <span className="chip">
106
- <Activity className="w-3 h-3" />
107
- {health
108
- ? `qiskit ${health.qiskit_version} · torch ${health.torch_version}`
109
- : "loading…"}
110
- </span>
111
- )}
112
- <button
113
- type="button"
114
- onClick={() => {
115
- if (serverCanGoLive) setUseLiveIbm(!useLiveIbm);
116
- }}
117
- disabled={!serverCanGoLive}
118
- aria-pressed={effectiveLive}
119
- className={`chip transition-colors ${chipClass}`}
120
- title={chipTitle}
121
- >
122
- {mobile ? chipLabelShort : chipLabel}
123
- </button>
124
  {/* External-links group: JQub lab, papers, developer. Desktop
125
  shows icon+label; mobile collapses to icon-only to keep the
126
  header under ~390px. A subtle vertical divider (desktop only)
127
- separates metadata chips from these links and from the theme
128
- /tour controls that follow. */}
129
- <span
130
- className="hidden sm:inline-block w-px h-5 bg-edge/60 mx-0.5"
131
- aria-hidden="true"
132
- />
133
  <a
134
  href="https://jqub.ece.gmu.edu/"
135
  target="_blank"
@@ -234,12 +236,17 @@ function PapersPopover() {
234
  <span className="hidden sm:inline">Papers</span>
235
  </button>
236
  {open && (
237
- // Viewport-aware width: 22rem (352px) caps the title lines to a
238
- // reasonable length on desktop; on mobile the calc() arm keeps
239
- // the menu inside the right-aligned viewport with a 24px margin.
 
 
 
 
 
240
  <div
241
  role="menu"
242
- className="absolute right-0 top-full mt-1 rounded-lg border border-edge bg-surface shadow-xl z-30 p-2 flex flex-col gap-0.5 w-[min(22rem,calc(100vw-1.5rem))]"
243
  >
244
  {papers.map((p) => (
245
  <a
 
98
  Visual pipeline for noise-aware VQC experiments
99
  </div>
100
  </div>
101
+ {/* Status chips live in the left cluster — they describe the app's
102
+ runtime state (library versions + whether the live-IBM path is
103
+ hot) and belong next to the title, not mixed in with the
104
+ external-link / theme controls on the right. The version chip
105
+ is hidden on mobile to save room; the IBM chip stays since it
106
+ is interactive. */}
107
+ <div className="flex items-center gap-1.5 sm:gap-2 text-xs shrink-0 ml-1 sm:ml-2">
108
+ {!mobile && (
109
+ <span className="chip">
110
+ <Activity className="w-3 h-3" />
111
+ {health
112
+ ? `qiskit ${health.qiskit_version} · torch ${health.torch_version}`
113
+ : "loading…"}
114
+ </span>
115
+ )}
116
+ <button
117
+ type="button"
118
+ onClick={() => {
119
+ if (serverCanGoLive) setUseLiveIbm(!useLiveIbm);
120
+ }}
121
+ disabled={!serverCanGoLive}
122
+ aria-pressed={effectiveLive}
123
+ className={`chip transition-colors ${chipClass}`}
124
+ title={chipTitle}
125
+ >
126
+ {mobile ? chipLabelShort : chipLabel}
127
+ </button>
128
+ </div>
129
  </div>
130
  <div className="flex items-center gap-1.5 sm:gap-2 text-xs shrink-0">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  {/* External-links group: JQub lab, papers, developer. Desktop
132
  shows icon+label; mobile collapses to icon-only to keep the
133
  header under ~390px. A subtle vertical divider (desktop only)
134
+ separates the links from the theme/tour controls that follow. */}
 
 
 
 
 
135
  <a
136
  href="https://jqub.ece.gmu.edu/"
137
  target="_blank"
 
236
  <span className="hidden sm:inline">Papers</span>
237
  </button>
238
  {open && (
239
+ // Mobile: the Papers button sits roughly mid-header, so anchoring
240
+ // the popover to the button's right edge (absolute right-0) would
241
+ // overflow the viewport on either side once the menu is 22rem
242
+ // wide. Switch to `fixed` positioning flush with the viewport's
243
+ // right edge and just below the 56px header, which guarantees it
244
+ // stays on-screen regardless of where the button ends up.
245
+ // Desktop (≥sm): back to absolute right-0 of the button so the
246
+ // menu tracks with the header cluster.
247
  <div
248
  role="menu"
249
+ className="fixed right-3 top-14 sm:absolute sm:right-0 sm:top-full sm:mt-1 rounded-lg border border-edge bg-surface shadow-xl z-30 p-2 flex flex-col gap-0.5 w-[min(22rem,calc(100vw-1.5rem))]"
250
  >
251
  {papers.map((p) => (
252
  <a