Float the studio's left island on top of the map, as v3e did

This commit is contained in:
piexel committed 2026-11-11 00:06:30 +01:00
1 parent 3ac240f936
commit 468802ac14
2 files changed
+10 -4

No files matched your search

+2 -2
View File
@@ -228,8 +228,8 @@ export function MapStudio({ client, world, theme, onDisconnect }: MapStudioProps
onDisconnect={onDisconnect}
/>
<SidebarSlot.Provider value={sidebarSlot}>
<div className="flex min-h-0 flex-1 gap-1.5 p-1.5">
<ViewList views={views} current={viewId} onSelect={selectView} slotRef={setSidebarSlot} />
<div className="relative flex min-h-0 flex-1 gap-1.5 p-1.5">
<ViewList views={views} current={viewId} onSelect={selectView} slotRef={setSidebarSlot} floating={showsMap} />
{viewId === 'regions' && regions.length > 1 && (
<SidebarPanel className="flex-1 overflow-y-auto p-1.5">
<RegionPreviewList regions={regions} current={layer.preview} onSelect={selectPreview} />
+8 -2
View File
@@ -27,13 +27,19 @@ interface ViewListProps {
onSelect(view: string): void
/** Receives the element the shown view fills with its own lists, under the views. */
slotRef(element: HTMLElement | null): void
/** Whether the island lies on top of the map, as in v3e, instead of taking a column of its own. */
floating: boolean
}
const IN_COLUMN = 'bg-card'
const ON_THE_MAP =
'absolute top-3.5 left-3.5 z-10 max-h-[calc(100%-1.75rem)] border border-overlay-border bg-card/90 shadow-lg backdrop-blur-md'
/** The left island: the views the server offers in their groups, then the shown view's own lists. */
export function ViewList({ views, current, onSelect, slotRef }: ViewListProps): React.JSX.Element {
export function ViewList({ views, current, onSelect, slotRef, floating }: ViewListProps): React.JSX.Element {
const groups = [...new Set(views.map((view) => view.groupLabel))]
return (
<div className="flex w-60 shrink-0 flex-col overflow-hidden rounded-lg bg-card">
<div className={cn('flex w-60 shrink-0 flex-col overflow-hidden rounded-lg', floating ? ON_THE_MAP : IN_COLUMN)}>
<nav className="flex shrink-0 flex-col gap-2 overflow-y-auto p-1.5">
{groups.map((group) => (
<section key={group}>