diff --git a/studio/src/renderer/src/studio/EntryBrowser.tsx b/studio/src/renderer/src/studio/EntryBrowser.tsx index ce15e0ef7..835c74727 100644 --- a/studio/src/renderer/src/studio/EntryBrowser.tsx +++ b/studio/src/renderer/src/studio/EntryBrowser.tsx @@ -78,7 +78,7 @@ export function EntryBrowser({ title, entries, current, onSelect, fileActions, c ) return ( -
+

{title}

diff --git a/studio/src/renderer/src/studio/MapStudio.tsx b/studio/src/renderer/src/studio/MapStudio.tsx index 99e3f6817..821482f6c 100644 --- a/studio/src/renderer/src/studio/MapStudio.tsx +++ b/studio/src/renderer/src/studio/MapStudio.tsx @@ -18,6 +18,7 @@ import { SceneStudio } from './SceneStudio' import { WorldStudio3D } from './WorldStudio3D' import { isTypingInto, shortcutRows, viewOfShortcutId, windowShortcutFor, type ShortcutAction } from './shortcuts' import { ShortcutSettings } from './ShortcutSettings' +import { Panel, SidebarPanel, SidebarSlot } from './Sidebar' import { StatusBar } from './StatusBar' import { StudioToolbar } from './StudioToolbar' import { useBindings } from './useBindings' @@ -66,6 +67,7 @@ export function MapStudio({ client, world, theme, onDisconnect }: MapStudioProps const [packRevision, setPackRevision] = useState(0) const [sceneSummary, setSceneSummary] = useState(null) const [sceneProgress, setSceneProgress] = useState(null) + const [sidebarSlot, setSidebarSlot] = useState(null) const loadSceneViews = useCallback(() => client.sceneViews(), [client]) const loadPatternViews = useCallback(() => client.patternViews(), [client]) const sceneViews = useModuleViews(loadSceneViews, packRevision) @@ -225,10 +227,14 @@ export function MapStudio({ client, world, theme, onDisconnect }: MapStudioProps onSettings={() => setSettingsOpen(true)} onDisconnect={onDisconnect} /> -
- - {viewId === 'regions' && regions.length > 1 && } - + +
+ + {viewId === 'regions' && regions.length > 1 && ( + + + + )} {sceneView !== null ? ( ) : patternView !== null ? ( @@ -241,7 +247,7 @@ export function MapStudio({ client, world, theme, onDisconnect }: MapStudioProps ) : ( <> -
+
)}
- + )}
+ diff --git a/studio/src/renderer/src/studio/NodePane.tsx b/studio/src/renderer/src/studio/NodePane.tsx index b46bce8e7..87a6456fa 100644 --- a/studio/src/renderer/src/studio/NodePane.tsx +++ b/studio/src/renderer/src/studio/NodePane.tsx @@ -23,7 +23,7 @@ export function NodePane({ editor, entryKey, selected, onSelect }: NodePaneProps useEditorKeys(editor, selected, locked, showAllRef, onSelect) return ( -
+

Nodes

{state?.file ?? entryKey} diff --git a/studio/src/renderer/src/studio/NoiseStudio.tsx b/studio/src/renderer/src/studio/NoiseStudio.tsx index c9670b41e..a7b1abfc8 100644 --- a/studio/src/renderer/src/studio/NoiseStudio.tsx +++ b/studio/src/renderer/src/studio/NoiseStudio.tsx @@ -15,6 +15,7 @@ import { focusAround, type TerrainStyle } from '../scene/terrainStream' import { hexColor } from './colors' import { SceneViewport } from './SceneViewport' import { TiledCanvas } from './TiledCanvas' +import { Panel, SidebarPanel } from './Sidebar' import { useTerrainStream } from './useTerrainStream' type NoiseDisplay = 'flat' | 'terrain' @@ -83,7 +84,7 @@ export function NoiseStudio({ client, packRevision, onSummary, tell }: NoiseStud return ( <> -
+
{display === 'flat' && status !== null && source !== null &&
{readout(status, source)}
}
- + ) } diff --git a/studio/src/renderer/src/studio/PatternStudio.tsx b/studio/src/renderer/src/studio/PatternStudio.tsx index 32b7e2218..3cfb221ea 100644 --- a/studio/src/renderer/src/studio/PatternStudio.tsx +++ b/studio/src/renderer/src/studio/PatternStudio.tsx @@ -11,6 +11,7 @@ import { BlockModels } from '../scene/blockModels' import { BridgeAssets } from '../scene/BridgeAssets' import { hexColor } from './colors' import { EntryBrowser } from './EntryBrowser' +import { Panel, SidebarPanel } from './Sidebar' import { TiledCanvas } from './TiledCanvas' const DEFAULT_NAMESPACE_PREFIX = 'minecraft:' @@ -61,7 +62,7 @@ export function PatternStudio({ client, view, packRevision, onSummary, tell }: P return ( <> -
+
{entry !== null && entry.depths > 1 && ( @@ -83,11 +84,13 @@ export function PatternStudio({ client, view, packRevision, onSummary, tell }: P
{status !== null && entry !== null &&
{readout(status)}
}
- + ) } diff --git a/studio/src/renderer/src/studio/SavedWorldStudio.tsx b/studio/src/renderer/src/studio/SavedWorldStudio.tsx index 4c950e936..729dfaa77 100644 --- a/studio/src/renderer/src/studio/SavedWorldStudio.tsx +++ b/studio/src/renderer/src/studio/SavedWorldStudio.tsx @@ -16,6 +16,7 @@ import { savedTileSource, type SavedLayer } from '../scene/savedTileSource' import { TerrainAtlas } from '../scene/terrainAtlas' import { focusAround, type TerrainStyle } from '../scene/terrainStream' import { SceneViewport } from './SceneViewport' +import { SidebarPanel } from './Sidebar' import { useTerrainStream } from './useTerrainStream' const NUMBER = new Intl.NumberFormat('en-US') @@ -85,7 +86,7 @@ export function SavedWorldStudio({ client, world, onSummary, onProgress, tell }: return ( <> -
+
Reading {chosen.name}
} {!reading && chosen !== null && start === null &&
Nothing finished is saved in {chosen.name}
}
- + ) } diff --git a/studio/src/renderer/src/studio/SceneStudio.tsx b/studio/src/renderer/src/studio/SceneStudio.tsx index bca1da774..3d88cd3a1 100644 --- a/studio/src/renderer/src/studio/SceneStudio.tsx +++ b/studio/src/renderer/src/studio/SceneStudio.tsx @@ -2,7 +2,6 @@ import { ChevronLeft, ChevronRight } from 'lucide-react' import { useEffect, useMemo, useRef, useState } from 'react' import { Button } from '@/components/ui/button' import { ScrollArea } from '@/components/ui/scroll-area' -import { cn } from '@/lib/utils' import type { BridgeClient } from '../bridge/BridgeClient' import { NO_PART, type JsonPath, type SceneEntry, type SceneViewInfo } from '../bridge/types' import { parsedText } from '../editor/jsonValues' @@ -21,6 +20,7 @@ import { EntryBrowser } from './EntryBrowser' import { useEntryFiles } from './EntryFileDialogs' import { NodeInspector } from './NodeInspector' import { NodePane } from './NodePane' +import { Panel, SidebarPanel } from './Sidebar' import { SceneViewport, type PickedSurface } from './SceneViewport' const NUMBER = new Intl.NumberFormat('en-US') @@ -103,7 +103,18 @@ export function SceneStudio({ client, view, packRevision, onSummary, tell }: Sce return ( <> -
+ + setChosen({ key, variant: 0 })} + fileActions={view.creatable ? files.actions : undefined} + /> + {files.dialogs} + +
)}
- + ) } @@ -158,7 +160,7 @@ interface SceneAreaProps { function SceneArea({ entry, variant, shown, status, onVariant, onPick }: SceneAreaProps): React.JSX.Element { return ( -
+
{entry !== null && entry.variants > 1 && (
diff --git a/studio/src/renderer/src/studio/Sidebar.tsx b/studio/src/renderer/src/studio/Sidebar.tsx new file mode 100644 index 000000000..262c11d96 --- /dev/null +++ b/studio/src/renderer/src/studio/Sidebar.tsx @@ -0,0 +1,20 @@ +import { createContext, useContext } from 'react' +import { createPortal } from 'react-dom' +import { cn } from '@/lib/utils' + +/** Where a view puts its own lists: under the views in the left column, as in v3e. */ +export const SidebarSlot = createContext(null) + +/** One card in the left column under the views, filled by the view that is shown. */ +export function SidebarPanel({ className, children }: { className?: string; children: React.ReactNode }): React.JSX.Element | null { + const slot = useContext(SidebarSlot) + if (slot === null) { + return null + } + return createPortal(
{children}
, slot) +} + +/** A card in the shell: the panels sit apart on the window background instead of sharing borders. */ +export function Panel({ className, children }: { className?: string; children: React.ReactNode }): React.JSX.Element { + return +} diff --git a/studio/src/renderer/src/studio/StatusBar.tsx b/studio/src/renderer/src/studio/StatusBar.tsx index 1a6fc0b7b..8c101e4ab 100644 --- a/studio/src/renderer/src/studio/StatusBar.tsx +++ b/studio/src/renderer/src/studio/StatusBar.tsx @@ -20,7 +20,7 @@ const NUMBER = new Intl.NumberFormat('en-US') export function StatusBar({ viewLabel, status, notice, usage, progress }: StatusBarProps): React.JSX.Element { const drawing = status !== null && status.tilesReady < status.tilesTotal return ( -