@re-venue/ui-core-react 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +9 -1
- package/dist/ui-core-react.css +1 -1
- package/dist/ui-core-react.js +2185 -2092
- package/dist/ui-core-react.umd.cjs +14 -14
- package/package.json +1 -1
- package/src/components/AppShell.tsx +208 -55
- package/src/styles/shell.css +73 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useMemo, useState, useEffect } from 'react'
|
|
2
|
-
import type { ReactNode } from 'react'
|
|
1
|
+
import { useMemo, useRef, useState, useEffect } from 'react'
|
|
2
|
+
import type { FocusEvent, MouseEvent, ReactNode } from 'react'
|
|
3
3
|
import { ConfirmModal } from './ConfirmModal'
|
|
4
4
|
import { useTheme } from '../hooks/useTheme'
|
|
5
5
|
import type { AuthUser, SidebarNavItem, Venue } from '../types'
|
|
@@ -20,6 +20,14 @@ interface Props {
|
|
|
20
20
|
headerActions?: ReactNode
|
|
21
21
|
sidebarPanel?: ReactNode
|
|
22
22
|
scrollable?: boolean
|
|
23
|
+
/**
|
|
24
|
+
* When the consumer updates the active venue inline (reactively, from
|
|
25
|
+
* `onSwitchVenue`) the AppShell skips the otherwise-redundant full-page reload
|
|
26
|
+
* that would just refresh the app you're already on. Apps that re-route on a
|
|
27
|
+
* reload (rather than reactively) should leave this off.
|
|
28
|
+
*/
|
|
29
|
+
inlineVenueSwitch?: boolean
|
|
30
|
+
onBeforeNavigate?: (proceed: () => void) => void
|
|
23
31
|
children: ReactNode
|
|
24
32
|
}
|
|
25
33
|
|
|
@@ -73,6 +81,8 @@ export function AppShell({
|
|
|
73
81
|
headerActions,
|
|
74
82
|
sidebarPanel,
|
|
75
83
|
scrollable = true,
|
|
84
|
+
inlineVenueSwitch,
|
|
85
|
+
onBeforeNavigate,
|
|
76
86
|
children,
|
|
77
87
|
}: Props) {
|
|
78
88
|
const { theme, toggleTheme } = useTheme()
|
|
@@ -81,6 +91,16 @@ export function AppShell({
|
|
|
81
91
|
const [currentHref, setCurrentHref] = useState(() => window.location.href)
|
|
82
92
|
const [expanded, setExpanded] = useState<Set<string>>(() => new Set())
|
|
83
93
|
|
|
94
|
+
// When collapsed, the sidebar is a thin icon rail. Hovering (or focusing into) the
|
|
95
|
+
// nav reveals the full sidebar as an overlay drawer floating over the page content —
|
|
96
|
+
// so navigation stays usable without permanently reflowing the page. `railMode` is
|
|
97
|
+
// the visual "mini rail" state: collapsed AND the drawer is not currently revealed.
|
|
98
|
+
const [flyoutOpen, setFlyoutOpen] = useState(false)
|
|
99
|
+
const railMode = collapsed && !flyoutOpen
|
|
100
|
+
const asideRef = useRef<HTMLElement>(null)
|
|
101
|
+
const openTimer = useRef<ReturnType<typeof setTimeout>>()
|
|
102
|
+
const closeTimer = useRef<ReturnType<typeof setTimeout>>()
|
|
103
|
+
|
|
84
104
|
useEffect(() => {
|
|
85
105
|
ensureHistoryPatched()
|
|
86
106
|
function onLocationChange() { setCurrentHref(window.location.href) }
|
|
@@ -92,10 +112,54 @@ export function AppShell({
|
|
|
92
112
|
}
|
|
93
113
|
}, [])
|
|
94
114
|
|
|
115
|
+
function clearFlyoutTimers() {
|
|
116
|
+
if (openTimer.current) clearTimeout(openTimer.current)
|
|
117
|
+
if (closeTimer.current) clearTimeout(closeTimer.current)
|
|
118
|
+
openTimer.current = undefined
|
|
119
|
+
closeTimer.current = undefined
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
useEffect(() => clearFlyoutTimers, [])
|
|
123
|
+
|
|
124
|
+
const FLYOUT_DELAY = 150
|
|
125
|
+
|
|
126
|
+
function scheduleOpen() {
|
|
127
|
+
if (!collapsed) return
|
|
128
|
+
clearFlyoutTimers()
|
|
129
|
+
openTimer.current = setTimeout(() => setFlyoutOpen(true), FLYOUT_DELAY)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function scheduleClose() {
|
|
133
|
+
clearFlyoutTimers()
|
|
134
|
+
closeTimer.current = setTimeout(() => setFlyoutOpen(false), FLYOUT_DELAY)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function closeFlyoutNow() {
|
|
138
|
+
clearFlyoutTimers()
|
|
139
|
+
setFlyoutOpen(false)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function openFlyout() {
|
|
143
|
+
if (!collapsed) return
|
|
144
|
+
clearFlyoutTimers()
|
|
145
|
+
setFlyoutOpen(true)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function onFocusIn() {
|
|
149
|
+
openFlyout()
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function onFocusOut(event: FocusEvent<HTMLElement>) {
|
|
153
|
+
const next = event.relatedTarget as Node | null
|
|
154
|
+
if (next && asideRef.current?.contains(next)) return
|
|
155
|
+
closeFlyoutNow()
|
|
156
|
+
}
|
|
157
|
+
|
|
95
158
|
function toggleCollapse() {
|
|
96
159
|
const next = !collapsed
|
|
97
160
|
setCollapsed(next)
|
|
98
161
|
writeSidebarCookie(next, cookieDomain)
|
|
162
|
+
closeFlyoutNow()
|
|
99
163
|
}
|
|
100
164
|
|
|
101
165
|
const activeVenue = useMemo(() => venues.find((v) => v.id === activeVenueId), [venues, activeVenueId])
|
|
@@ -147,13 +211,15 @@ export function AppShell({
|
|
|
147
211
|
return groups
|
|
148
212
|
}, [venues])
|
|
149
213
|
|
|
150
|
-
const
|
|
214
|
+
const activeNavItem = useMemo(() => {
|
|
151
215
|
const matches = navItems
|
|
152
216
|
.filter(item => item.url && currentHref.startsWith(item.url))
|
|
153
217
|
.sort((a, b) => b.url.length - a.url.length)
|
|
154
|
-
return matches[0]
|
|
218
|
+
return matches[0] ?? null
|
|
155
219
|
}, [navItems, currentHref])
|
|
156
220
|
|
|
221
|
+
const activeNavUrl = activeNavItem?.url ?? null
|
|
222
|
+
|
|
157
223
|
function toggleWorkspace(id: string) {
|
|
158
224
|
setExpanded((prev) => {
|
|
159
225
|
const next = new Set(prev)
|
|
@@ -162,30 +228,80 @@ export function AppShell({
|
|
|
162
228
|
})
|
|
163
229
|
}
|
|
164
230
|
|
|
231
|
+
function guardNavigation(navigate: () => void) {
|
|
232
|
+
if (onBeforeNavigate) {
|
|
233
|
+
onBeforeNavigate(navigate)
|
|
234
|
+
return
|
|
235
|
+
}
|
|
236
|
+
navigate()
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function onLinkClick(event: MouseEvent<HTMLAnchorElement>, url: string) {
|
|
240
|
+
if (!onBeforeNavigate) {
|
|
241
|
+
return
|
|
242
|
+
}
|
|
243
|
+
const isModified = event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey
|
|
244
|
+
if (isModified || event.currentTarget.target) {
|
|
245
|
+
return
|
|
246
|
+
}
|
|
247
|
+
event.preventDefault()
|
|
248
|
+
onBeforeNavigate(() => window.location.assign(url))
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function onGuardedLogoutConfirm() {
|
|
252
|
+
setShowLogoutConfirm(false)
|
|
253
|
+
guardNavigation(onLogout)
|
|
254
|
+
}
|
|
255
|
+
|
|
165
256
|
function onWorkspaceTitleClick(workspaceId: string) {
|
|
166
|
-
onSwitchWorkspace?.(workspaceId)
|
|
167
257
|
const url = workspaceNavItem?.url
|
|
168
|
-
if (url) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
258
|
+
if (!url) {
|
|
259
|
+
onSwitchWorkspace?.(workspaceId)
|
|
260
|
+
if (!expanded.has(workspaceId)) {
|
|
261
|
+
toggleWorkspace(workspaceId)
|
|
262
|
+
}
|
|
263
|
+
return
|
|
172
264
|
}
|
|
265
|
+
guardNavigation(() => {
|
|
266
|
+
onSwitchWorkspace?.(workspaceId)
|
|
267
|
+
window.location.assign(url)
|
|
268
|
+
})
|
|
173
269
|
}
|
|
174
270
|
|
|
175
271
|
function onVenueClick(venueId: string) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
272
|
+
// Stay within the current venue/workspace-scoped app (heatmap, flow builder,
|
|
273
|
+
// venue/workspace settings) when switching venue, instead of always jumping to
|
|
274
|
+
// the heatmap. From the navigational hubs (Portfolio/Dashboard) we still drill
|
|
275
|
+
// into the venue's heatmap — the first header tool.
|
|
276
|
+
const stayHere = !!activeNavItem && (placementOf(activeNavItem) === 'header' || placementOf(activeNavItem) === 'settings')
|
|
277
|
+
const url = stayHere ? activeNavItem!.url : firstHeaderItem?.url
|
|
278
|
+
const alreadyOnDestination = url ? currentHref.startsWith(url) : false
|
|
279
|
+
if (venueId === activeVenueId && alreadyOnDestination) return
|
|
280
|
+
guardNavigation(() => {
|
|
281
|
+
if (venueId !== activeVenueId) onSwitchVenue?.(venueId)
|
|
282
|
+
// If the consumer applies the venue switch inline and we'd only be reloading the
|
|
283
|
+
// page we're already on, skip the disruptive full-page reload.
|
|
284
|
+
if (inlineVenueSwitch && alreadyOnDestination) return
|
|
285
|
+
if (url) window.location.assign(url)
|
|
286
|
+
})
|
|
180
287
|
}
|
|
181
288
|
|
|
182
|
-
const showHeader = headerNavItems.length > 0 || settingsNavItems.length > 0 || headerActions !== undefined || headerSlot !== undefined
|
|
289
|
+
const showHeader = headerNavItems.length > 0 || settingsNavItems.length > 0 || headerActions !== undefined || headerSlot !== undefined || (collapsed && !!activeVenue)
|
|
183
290
|
|
|
184
291
|
return (
|
|
185
292
|
<div className="rv-app-shell">
|
|
186
|
-
|
|
293
|
+
{/* Holds the rail's width in the layout flow while the real sidebar floats over the page. */}
|
|
294
|
+
{collapsed && <div className="rv-sidebar-rail-spacer" />}
|
|
295
|
+
<aside
|
|
296
|
+
ref={asideRef}
|
|
297
|
+
className={`rv-sidebar${railMode ? ' rv-collapsed' : ''}${collapsed ? ' rv-floating' : ''}${collapsed && flyoutOpen ? ' rv-flyout' : ''}`}
|
|
298
|
+
onMouseLeave={scheduleClose}
|
|
299
|
+
onFocus={onFocusIn}
|
|
300
|
+
onBlur={onFocusOut}
|
|
301
|
+
onKeyDown={(e) => { if (e.key === 'Escape') closeFlyoutNow() }}
|
|
302
|
+
>
|
|
187
303
|
<div className="rv-sidebar-top">
|
|
188
|
-
{!
|
|
304
|
+
{!railMode && (
|
|
189
305
|
<div className="rv-sidebar-brand">
|
|
190
306
|
<svg
|
|
191
307
|
className="rv-sidebar-logo"
|
|
@@ -231,70 +347,89 @@ export function AppShell({
|
|
|
231
347
|
</button>
|
|
232
348
|
</div>
|
|
233
349
|
|
|
234
|
-
{sidebarPanel && <div className="rv-sidebar-panel">{sidebarPanel}</div>}
|
|
350
|
+
{sidebarPanel && <div className="rv-sidebar-panel" onMouseEnter={scheduleOpen}>{sidebarPanel}</div>}
|
|
235
351
|
|
|
236
352
|
{sidebarNavItems.length > 0 && (
|
|
237
|
-
<nav className="rv-sidebar-top-nav">
|
|
353
|
+
<nav className="rv-sidebar-top-nav" onMouseEnter={scheduleOpen}>
|
|
238
354
|
{sidebarNavItems.map((item) => (
|
|
239
355
|
<a
|
|
240
356
|
key={item.url}
|
|
241
357
|
href={item.url}
|
|
358
|
+
onClick={(event) => onLinkClick(event, item.url)}
|
|
242
359
|
className={`rv-nav-item${item.url === activeNavUrl ? ' rv-active' : ''}`}
|
|
243
|
-
title={
|
|
360
|
+
title={railMode ? item.label : undefined}
|
|
244
361
|
>
|
|
245
362
|
<span className="rv-nav-icon" dangerouslySetInnerHTML={{ __html: item.icon }} />
|
|
246
|
-
{!
|
|
363
|
+
{!railMode && <span className="rv-nav-label">{item.label}</span>}
|
|
247
364
|
</a>
|
|
248
365
|
))}
|
|
249
366
|
</nav>
|
|
250
367
|
)}
|
|
251
368
|
|
|
252
|
-
<div className="rv-sidebar-tree">
|
|
253
|
-
{
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
<div className="rv-tree-ws"
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
264
|
-
<polyline points="6 9 12 15 18 9" />
|
|
265
|
-
</svg>
|
|
266
|
-
</button>
|
|
267
|
-
)}
|
|
268
|
-
<button className="rv-tree-ws-title" onClick={() => onWorkspaceTitleClick(ws.id)}>
|
|
369
|
+
<div className="rv-sidebar-tree" onMouseEnter={scheduleOpen}>
|
|
370
|
+
{railMode ? (
|
|
371
|
+
/* Collapsed rail: a single workspace icon stands in for the whole tree (hover/click reveals it). */
|
|
372
|
+
tree.length > 0 && (
|
|
373
|
+
<div className="rv-tree-ws">
|
|
374
|
+
<button
|
|
375
|
+
className="rv-tree-ws-title"
|
|
376
|
+
title="Workspaces & venues"
|
|
377
|
+
aria-label="Show workspaces and venues"
|
|
378
|
+
onClick={openFlyout}
|
|
379
|
+
>
|
|
269
380
|
<svg className="rv-tree-ws-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
270
381
|
<path d="M3 21h18" /><path d="M5 21V7l7-4 7 4v14" /><path d="M9 9h.01M15 9h.01M9 13h.01M15 13h.01M9 17h.01M15 17h.01" />
|
|
271
382
|
</svg>
|
|
272
|
-
{!collapsed && <span className="rv-tree-ws-name">{ws.name}</span>}
|
|
273
383
|
</button>
|
|
274
384
|
</div>
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
385
|
+
)
|
|
386
|
+
) : (
|
|
387
|
+
<>
|
|
388
|
+
{tree.length > 0 && <div className="rv-tree-section-label">Workspaces & venues</div>}
|
|
389
|
+
{tree.map((ws) => (
|
|
390
|
+
<div key={ws.id} className="rv-tree-group">
|
|
391
|
+
<div className="rv-tree-ws">
|
|
278
392
|
<button
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
onClick={() =>
|
|
393
|
+
className={`rv-tree-disclosure${expanded.has(ws.id) ? ' rv-open' : ''}`}
|
|
394
|
+
aria-label={expanded.has(ws.id) ? 'Collapse workspace' : 'Expand workspace'}
|
|
395
|
+
onClick={(e) => { e.stopPropagation(); toggleWorkspace(ws.id) }}
|
|
282
396
|
>
|
|
283
397
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
284
|
-
<
|
|
398
|
+
<polyline points="6 9 12 15 18 9" />
|
|
285
399
|
</svg>
|
|
286
|
-
<span className="rv-tree-venue-name">{venue.name}</span>
|
|
287
400
|
</button>
|
|
288
|
-
|
|
401
|
+
<button className="rv-tree-ws-title" onClick={() => onWorkspaceTitleClick(ws.id)}>
|
|
402
|
+
<svg className="rv-tree-ws-icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
403
|
+
<path d="M3 21h18" /><path d="M5 21V7l7-4 7 4v14" /><path d="M9 9h.01M15 9h.01M9 13h.01M15 13h.01M9 17h.01M15 17h.01" />
|
|
404
|
+
</svg>
|
|
405
|
+
<span className="rv-tree-ws-name">{ws.name}</span>
|
|
406
|
+
</button>
|
|
407
|
+
</div>
|
|
408
|
+
{expanded.has(ws.id) && (
|
|
409
|
+
<div className="rv-tree-venues">
|
|
410
|
+
{ws.venues.map((venue) => (
|
|
411
|
+
<button
|
|
412
|
+
key={venue.id}
|
|
413
|
+
className={`rv-tree-venue${venue.id === activeVenueId ? ' rv-active' : ''}`}
|
|
414
|
+
onClick={() => onVenueClick(venue.id)}
|
|
415
|
+
>
|
|
416
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
417
|
+
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z" /><circle cx="12" cy="10" r="3" />
|
|
418
|
+
</svg>
|
|
419
|
+
<span className="rv-tree-venue-name">{venue.name}</span>
|
|
420
|
+
</button>
|
|
421
|
+
))}
|
|
422
|
+
</div>
|
|
423
|
+
)}
|
|
289
424
|
</div>
|
|
290
|
-
)}
|
|
291
|
-
|
|
292
|
-
)
|
|
425
|
+
))}
|
|
426
|
+
</>
|
|
427
|
+
)}
|
|
293
428
|
</div>
|
|
294
429
|
|
|
295
|
-
<div className="rv-sidebar-user">
|
|
430
|
+
<div className="rv-sidebar-user" onMouseEnter={scheduleOpen}>
|
|
296
431
|
<div className="rv-user-avatar">{userInitials}</div>
|
|
297
|
-
{!
|
|
432
|
+
{!railMode && (
|
|
298
433
|
<div className="rv-user-info">
|
|
299
434
|
<span className="rv-user-email" title={user?.email ?? ''}>{user?.email}</span>
|
|
300
435
|
</div>
|
|
@@ -314,14 +449,20 @@ export function AppShell({
|
|
|
314
449
|
)}
|
|
315
450
|
</button>
|
|
316
451
|
)}
|
|
317
|
-
{accountSettingsUrl && (
|
|
318
|
-
<a
|
|
452
|
+
{accountSettingsUrl && !railMode && (
|
|
453
|
+
<a
|
|
454
|
+
className="rv-account-settings-btn"
|
|
455
|
+
href={accountSettingsUrl}
|
|
456
|
+
onClick={(event) => onLinkClick(event, accountSettingsUrl)}
|
|
457
|
+
title="Account settings"
|
|
458
|
+
>
|
|
319
459
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
320
460
|
<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />
|
|
321
461
|
<circle cx="12" cy="12" r="3" />
|
|
322
462
|
</svg>
|
|
323
463
|
</a>
|
|
324
464
|
)}
|
|
465
|
+
{!railMode && (
|
|
325
466
|
<button className="rv-logout-btn" title="Sign out" onClick={() => setShowLogoutConfirm(true)}>
|
|
326
467
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
327
468
|
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
|
|
@@ -329,18 +470,29 @@ export function AppShell({
|
|
|
329
470
|
<line x1="21" y1="12" x2="9" y2="12" />
|
|
330
471
|
</svg>
|
|
331
472
|
</button>
|
|
473
|
+
)}
|
|
332
474
|
</div>
|
|
333
475
|
</aside>
|
|
334
476
|
|
|
335
477
|
<div className="rv-shell-body">
|
|
336
478
|
{showHeader && (
|
|
337
479
|
<header className="rv-shell-header">
|
|
480
|
+
{/* When collapsed the active venue isn't named in the rail, so surface it here. */}
|
|
481
|
+
{collapsed && activeVenue && (
|
|
482
|
+
<div className="rv-header-venue" title={activeVenue.name}>
|
|
483
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
484
|
+
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z" /><circle cx="12" cy="10" r="3" />
|
|
485
|
+
</svg>
|
|
486
|
+
<span className="rv-header-venue-name">{activeVenue.name}</span>
|
|
487
|
+
</div>
|
|
488
|
+
)}
|
|
338
489
|
{headerNavItems.length > 0 && (
|
|
339
490
|
<nav className="rv-header-nav">
|
|
340
491
|
{headerNavItems.map((item) => (
|
|
341
492
|
<a
|
|
342
493
|
key={item.url}
|
|
343
494
|
href={item.url}
|
|
495
|
+
onClick={(event) => onLinkClick(event, item.url)}
|
|
344
496
|
className={`rv-header-nav-item${item.url === activeNavUrl ? ' rv-active' : ''}`}
|
|
345
497
|
>
|
|
346
498
|
<span className="rv-nav-icon" dangerouslySetInnerHTML={{ __html: item.icon }} />
|
|
@@ -359,6 +511,7 @@ export function AppShell({
|
|
|
359
511
|
<a
|
|
360
512
|
key={item.url}
|
|
361
513
|
href={item.url}
|
|
514
|
+
onClick={(event) => onLinkClick(event, item.url)}
|
|
362
515
|
className={`rv-header-action${item.url === activeNavUrl ? ' rv-active' : ''}`}
|
|
363
516
|
>
|
|
364
517
|
<span className="rv-header-action-icon" dangerouslySetInnerHTML={{ __html: item.icon }} />
|
|
@@ -381,7 +534,7 @@ export function AppShell({
|
|
|
381
534
|
title="Sign out"
|
|
382
535
|
message="Are you sure you want to sign out?"
|
|
383
536
|
confirmLabel="Sign out"
|
|
384
|
-
onConfirm={onLogout}
|
|
537
|
+
onConfirm={onBeforeNavigate ? onGuardedLogoutConfirm : onLogout}
|
|
385
538
|
onCancel={() => setShowLogoutConfirm(false)}
|
|
386
539
|
/>
|
|
387
540
|
</div>
|
package/src/styles/shell.css
CHANGED
|
@@ -2,9 +2,16 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100dvh;
|
|
4
4
|
overflow: hidden;
|
|
5
|
+
position: relative;
|
|
5
6
|
font-family: 'Host Grotesk', system-ui, sans-serif;
|
|
6
7
|
}
|
|
7
8
|
|
|
9
|
+
/* Reserves the collapsed rail's width in the flex flow while the real sidebar floats over the content. */
|
|
10
|
+
.rv-sidebar-rail-spacer {
|
|
11
|
+
width: 56px;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
8
15
|
.rv-sidebar {
|
|
9
16
|
width: 280px;
|
|
10
17
|
flex-shrink: 0;
|
|
@@ -12,7 +19,7 @@
|
|
|
12
19
|
flex-direction: column;
|
|
13
20
|
background: var(--color-bg-panel, #ffffff);
|
|
14
21
|
border-right: 1px solid var(--color-border-subtle, #d1d5db);
|
|
15
|
-
transition: width var(--transition-slow, 0.25s ease);
|
|
22
|
+
transition: width var(--transition-slow, 0.25s ease), box-shadow var(--transition-fast, 0.1s ease);
|
|
16
23
|
overflow: hidden;
|
|
17
24
|
}
|
|
18
25
|
|
|
@@ -20,6 +27,22 @@
|
|
|
20
27
|
width: 56px;
|
|
21
28
|
}
|
|
22
29
|
|
|
30
|
+
/* Collapsed: lift out of flow and float over the page (the spacer holds the layout width). */
|
|
31
|
+
.rv-sidebar.rv-floating {
|
|
32
|
+
position: absolute;
|
|
33
|
+
top: 0;
|
|
34
|
+
left: 0;
|
|
35
|
+
bottom: 0;
|
|
36
|
+
z-index: 50;
|
|
37
|
+
width: 56px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Hover/focus reveal: expand the floating panel over the content without reflowing it. */
|
|
41
|
+
.rv-sidebar.rv-floating.rv-flyout {
|
|
42
|
+
width: 280px;
|
|
43
|
+
box-shadow: 4px 0 24px rgba(0, 0, 0, 0.16);
|
|
44
|
+
}
|
|
45
|
+
|
|
23
46
|
.rv-sidebar.rv-collapsed .rv-sidebar-top {
|
|
24
47
|
justify-content: center;
|
|
25
48
|
padding: 0;
|
|
@@ -314,6 +337,10 @@
|
|
|
314
337
|
text-transform: uppercase;
|
|
315
338
|
color: var(--color-text-muted, #777777);
|
|
316
339
|
padding: 0.375rem 0.625rem 0.25rem;
|
|
340
|
+
/* Keep on one line so it clips (rather than wraps + reflows) while the width animates. */
|
|
341
|
+
white-space: nowrap;
|
|
342
|
+
overflow: hidden;
|
|
343
|
+
text-overflow: ellipsis;
|
|
317
344
|
}
|
|
318
345
|
|
|
319
346
|
.rv-tree-group {
|
|
@@ -450,6 +477,51 @@
|
|
|
450
477
|
white-space: nowrap;
|
|
451
478
|
}
|
|
452
479
|
|
|
480
|
+
/* Active venue label (shown in the header when the sidebar is collapsed) */
|
|
481
|
+
.rv-header-venue {
|
|
482
|
+
display: flex;
|
|
483
|
+
align-items: center;
|
|
484
|
+
gap: 0.4375rem;
|
|
485
|
+
padding-right: 1.75rem;
|
|
486
|
+
margin-right: 0.5rem;
|
|
487
|
+
border-right: 1px solid var(--color-border-subtle, #d1d5db);
|
|
488
|
+
font-size: 0.875rem;
|
|
489
|
+
font-weight: 600;
|
|
490
|
+
color: var(--color-text-primary, #111111);
|
|
491
|
+
white-space: nowrap;
|
|
492
|
+
min-width: 0;
|
|
493
|
+
/* Plays on mount, i.e. when the sidebar collapses and the label appears. */
|
|
494
|
+
animation: rv-header-venue-in var(--transition-slow, 0.25s) ease both;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
@keyframes rv-header-venue-in {
|
|
498
|
+
from {
|
|
499
|
+
opacity: 0;
|
|
500
|
+
transform: translateX(-10px);
|
|
501
|
+
}
|
|
502
|
+
to {
|
|
503
|
+
opacity: 1;
|
|
504
|
+
transform: translateX(0);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
@media (prefers-reduced-motion: reduce) {
|
|
509
|
+
.rv-header-venue {
|
|
510
|
+
animation: none;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.rv-header-venue svg {
|
|
515
|
+
flex-shrink: 0;
|
|
516
|
+
color: var(--color-text-muted, #777777);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.rv-header-venue-name {
|
|
520
|
+
overflow: hidden;
|
|
521
|
+
text-overflow: ellipsis;
|
|
522
|
+
max-width: 220px;
|
|
523
|
+
}
|
|
524
|
+
|
|
453
525
|
/* Header nav (top-bar tool buttons) */
|
|
454
526
|
.rv-header-nav {
|
|
455
527
|
display: flex;
|