From 6cf5d7131b40edcdbf2c1c30172290225cd624d6 Mon Sep 17 00:00:00 2001 From: piexel Date: Wed, 11 Nov 2026 01:00:11 +0100 Subject: [PATCH] Give every studio view an island header that holds its tools --- .../src/renderer/src/components/IdeIcon.tsx | 1 + studio/src/renderer/src/icons/NOTICE.txt | 1 + studio/src/renderer/src/icons/theme.svg | 4 + studio/src/renderer/src/icons/theme_dark.svg | 4 + studio/src/renderer/src/studio/MapStudio.tsx | 40 ++++---- .../src/renderer/src/studio/NoiseStudio.tsx | 50 +++++----- .../src/renderer/src/studio/PatternStudio.tsx | 36 +++---- .../renderer/src/studio/SavedWorldStudio.tsx | 55 ++++++----- .../src/renderer/src/studio/SceneStudio.tsx | 40 ++++---- studio/src/renderer/src/studio/Sidebar.tsx | 51 ++++++++++ .../src/renderer/src/studio/StudioToolbar.tsx | 94 +++++++++---------- studio/src/renderer/src/studio/ViewList.tsx | 2 +- .../src/renderer/src/studio/WorldStudio3D.tsx | 43 ++++----- studio/src/renderer/src/styles.css | 2 +- 14 files changed, 241 insertions(+), 182 deletions(-) create mode 100644 studio/src/renderer/src/icons/theme.svg create mode 100644 studio/src/renderer/src/icons/theme_dark.svg diff --git a/studio/src/renderer/src/components/IdeIcon.tsx b/studio/src/renderer/src/components/IdeIcon.tsx index 58d09f34f..fc48847fe 100644 --- a/studio/src/renderer/src/components/IdeIcon.tsx +++ b/studio/src/renderer/src/components/IdeIcon.tsx @@ -26,6 +26,7 @@ export type IdeIconName = | 'settings' | 'stopWatch' | 'symlink' + | 'theme' | 'undo' | 'user' | 'web' diff --git a/studio/src/renderer/src/icons/NOTICE.txt b/studio/src/renderer/src/icons/NOTICE.txt index 7d720e4a1..ca8a733fd 100644 --- a/studio/src/renderer/src/icons/NOTICE.txt +++ b/studio/src/renderer/src/icons/NOTICE.txt @@ -2,3 +2,4 @@ The icons in this folder and its subfolders come from the IntelliJ Platform (htt platform/icons/src/expui, Copyright 2000-2023 JetBrains s.r.o. and contributors, used under the Apache License 2.0 (LICENSE-APACHE-2.0.txt). memory.svg is profileMemory.svg with its profiling badge removed. +theme.svg is the studio's own, drawn to match. diff --git a/studio/src/renderer/src/icons/theme.svg b/studio/src/renderer/src/icons/theme.svg new file mode 100644 index 000000000..3f4ab8713 --- /dev/null +++ b/studio/src/renderer/src/icons/theme.svg @@ -0,0 +1,4 @@ + + + + diff --git a/studio/src/renderer/src/icons/theme_dark.svg b/studio/src/renderer/src/icons/theme_dark.svg new file mode 100644 index 000000000..375b1b72c --- /dev/null +++ b/studio/src/renderer/src/icons/theme_dark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/studio/src/renderer/src/studio/MapStudio.tsx b/studio/src/renderer/src/studio/MapStudio.tsx index ee7e1d315..ffe7b2d8c 100644 --- a/studio/src/renderer/src/studio/MapStudio.tsx +++ b/studio/src/renderer/src/studio/MapStudio.tsx @@ -18,9 +18,9 @@ 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 { Panel, SidebarPanel, SidebarSlot, ViewIsland } from './Sidebar' import { StatusBar } from './StatusBar' -import { StudioToolbar } from './StudioToolbar' +import { MapTools, StudioToolbar } from './StudioToolbar' import { useBindings } from './useBindings' import { usePickInspection } from './usePickInspection' import { ViewList } from './ViewList' @@ -213,20 +213,7 @@ export function MapStudio({ client, world, theme, onDisconnect }: MapStudioProps return (
- runShortcut('refresh')} - onResetZoom={() => runShortcut('resetZoom')} - onHelp={() => setHelpOpen(true)} - onSettings={() => setSettingsOpen(true)} - onDisconnect={onDisconnect} - /> + setHelpOpen(true)} onSettings={() => setSettingsOpen(true)} onDisconnect={onDisconnect} />
@@ -240,14 +227,25 @@ export function MapStudio({ client, world, theme, onDisconnect }: MapStudioProps ) : patternView !== null ? ( ) : viewId === WORLD_3D.id ? ( - + ) : viewId === SAVED_WORLD.id ? ( - + ) : viewId === NOISE.id ? ( - + ) : ( <> -
+ runShortcut('refresh')} + onResetZoom={() => runShortcut('resetZoom')} + /> + } + >
)} -
+
{inspectsPicks && ( diff --git a/studio/src/renderer/src/studio/NoiseStudio.tsx b/studio/src/renderer/src/studio/NoiseStudio.tsx index fcda4bb5c..641edb1bb 100644 --- a/studio/src/renderer/src/studio/NoiseStudio.tsx +++ b/studio/src/renderer/src/studio/NoiseStudio.tsx @@ -15,7 +15,8 @@ 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 { Separator } from '@/components/ui/separator' +import { HEADER_CHOICE, Panel, SidebarPanel, ViewIsland } from './Sidebar' import { useLongPending, useTerrainStream } from './useTerrainStream' type NoiseDisplay = 'flat' | 'terrain' @@ -30,10 +31,10 @@ const TALLEST_RELIEF_BLOCKS = 4064 const DEFAULT_RELIEF_BLOCKS = 64 const RELIEF_STEPS = 1000 const SWATCH_STEPS = 24 -const TOGGLE_ITEM = 'h-7 px-3 text-[12px] data-[state=on]:bg-selection data-[state=on]:text-foreground' const PILL = 'pointer-events-none absolute rounded-md border border-overlay-border bg-card px-3 py-1.5 text-[12px] text-secondary-text' interface NoiseStudioProps { + title: string client: BridgeClient packRevision: number onSummary(summary: string | null): void @@ -41,7 +42,7 @@ interface NoiseStudioProps { } /** The pack's noise and the built-in styles, from above or as terrain (v3e's noise explorer). */ -export function NoiseStudio({ client, packRevision, onSummary, tell }: NoiseStudioProps): React.JSX.Element { +export function NoiseStudio({ title, client, packRevision, onSummary, tell }: NoiseStudioProps): React.JSX.Element { const sources = useNoiseSources(client, packRevision, tell) const [chosenId, setChosenId] = useState(null) const source = sources.find((candidate) => candidate.id === chosenId) ?? sources[0] ?? null @@ -84,7 +85,28 @@ export function NoiseStudio({ client, packRevision, onSummary, tell }: NoiseStud return ( <> -
+ + {display === 'terrain' && source?.blockRange === null && } + {display === 'flat' && ( + + )} + + value !== '' && showAs(value as NoiseDisplay)}> + + 2D + + + 3D + + + + } + > )} -
- value !== '' && showAs(value as NoiseDisplay)}> - - 2D - - - 3D - - - {display === 'flat' && ( - - )} - {display === 'terrain' && source?.blockRange === null && } -
{display === 'flat' && status !== null && source !== null &&
{readout(status, source)}
} -
+

Noise

@@ -261,7 +267,7 @@ function ReliefControl({ blocks, onChange }: { blocks: number; onChange(blocks: const span = Math.log(TALLEST_RELIEF_BLOCKS) - Math.log(LOWEST_RELIEF_BLOCKS) const step = Math.round(((Math.log(blocks) - Math.log(LOWEST_RELIEF_BLOCKS)) / span) * RELIEF_STEPS) return ( -