mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +00:00
Fit the studio's toolbar, popups and right panel to its islands
This commit is contained in:
1 parent
9f3da18f2b
commit
4bdac458c0
14 files changed
+49
-50
No files matched your search
@@ -7,7 +7,7 @@ function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
|
||||
className={cn(
|
||||
"pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none",
|
||||
"[&_svg:not([class*='size-'])]:size-3",
|
||||
"[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",
|
||||
"[[data-slot=tooltip-content]_&]:bg-secondary [[data-slot=tooltip-content]_&]:text-secondary-text",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@@ -31,7 +31,7 @@ function TooltipTrigger({
|
||||
|
||||
function TooltipContent({
|
||||
className,
|
||||
sideOffset = 0,
|
||||
sideOffset = 6,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
|
||||
@@ -41,13 +41,12 @@ function TooltipContent({
|
||||
data-slot="tooltip-content"
|
||||
sideOffset={sideOffset}
|
||||
className={cn(
|
||||
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
||||
"z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md border border-overlay-border bg-popover px-2.5 py-1.5 text-xs text-balance text-popover-foreground shadow-md fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
<TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" />
|
||||
</TooltipPrimitive.Content>
|
||||
</TooltipPrimitive.Portal>
|
||||
)
|
||||
|
||||
@@ -52,9 +52,10 @@ export function HoverCard({ hover, point, viewId, previewing, detailed, minY }:
|
||||
return (
|
||||
<div
|
||||
ref={card}
|
||||
className="pointer-events-none absolute z-10 w-80 rounded-[10px] border border-overlay-border bg-popover px-3.5 py-3 text-popover-foreground shadow-xl backdrop-blur-sm"
|
||||
className="pointer-events-none absolute z-10 w-80 overflow-hidden rounded-lg border border-overlay-border bg-popover text-popover-foreground shadow-lg"
|
||||
style={position}
|
||||
>
|
||||
<div className="px-3.5 pt-3 pb-2.5">
|
||||
<Header subject={subject} region={labelsRegions ? null : hover.region} />
|
||||
{parent !== null && <p className="mt-0.5 truncate text-[12px] text-secondary-text">child of {parent}</p>}
|
||||
<p className="mt-0.5 truncate text-[12px] text-secondary-text tabular-nums">{ground(hover, minY)}</p>
|
||||
@@ -72,7 +73,8 @@ export function HoverCard({ hover, point, viewId, previewing, detailed, minY }:
|
||||
</dl>
|
||||
</section>
|
||||
))}
|
||||
<div className="mt-2.5 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground">
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-x-3 gap-y-1 border-t bg-background/40 px-3.5 py-1.5 text-[11px] text-secondary-text">
|
||||
{!detailed && <Hint keyText="Shift" label="More" />}
|
||||
{highlightKey !== '' && <Hint keyText={highlightKey} label="Highlight" />}
|
||||
<Hint keyText="Alt+Click" label="Open file" />
|
||||
|
||||
@@ -27,7 +27,7 @@ export function Legend({ title, shares, selection, emptyText = 'Drawing the map
|
||||
const sharedNames = namesUsedMoreThanOnce(shares)
|
||||
return (
|
||||
<section className={cn('flex min-h-0 flex-col', className)}>
|
||||
<h2 className="px-4 pt-2.5 pb-1.5 text-[11px] font-semibold text-muted-foreground">{title}</h2>
|
||||
<h2 className="truncate px-4 pt-2.5 pb-2 text-[13px] font-semibold">{title}</h2>
|
||||
<ScrollArea className="min-h-0 flex-1">
|
||||
<ul className="px-1.5 pb-1">
|
||||
{shares.length === 0 && <li className="px-2.5 py-1 text-muted-foreground">{emptyText}</li>}
|
||||
|
||||
@@ -228,8 +228,8 @@ export function MapStudio({ client, world, theme, onDisconnect }: MapStudioProps
|
||||
onDisconnect={onDisconnect}
|
||||
/>
|
||||
<SidebarSlot.Provider value={sidebarSlot}>
|
||||
<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} />
|
||||
<div className="flex min-h-0 flex-1 gap-1.5 p-1.5">
|
||||
<ViewList views={views} current={viewId} onSelect={selectView} slotRef={setSidebarSlot} />
|
||||
{viewId === 'regions' && regions.length > 1 && (
|
||||
<SidebarPanel className="flex-1 overflow-y-auto p-1.5">
|
||||
<RegionPreviewList regions={regions} current={layer.preview} onSelect={selectPreview} />
|
||||
@@ -279,21 +279,25 @@ export function MapStudio({ client, world, theme, onDisconnect }: MapStudioProps
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<Panel className="w-[250px]">
|
||||
<div className="flex w-[250px] shrink-0 flex-col gap-1.5">
|
||||
{inspectsPicks && (
|
||||
<PickInspector
|
||||
title={previewName ?? view.label}
|
||||
inspection={inspection}
|
||||
display={{ picksLabel: viewId === 'regions' && layer.preview === null ? 'Regions' : 'Biomes', value: pickDisplay, onChange: setPickDisplay }}
|
||||
/>
|
||||
<Panel className="min-h-0 flex-[7]">
|
||||
<PickInspector
|
||||
title={previewName ?? view.label}
|
||||
inspection={inspection}
|
||||
display={{ picksLabel: viewId === 'regions' && layer.preview === null ? 'Regions' : 'Biomes', value: pickDisplay, onChange: setPickDisplay }}
|
||||
/>
|
||||
</Panel>
|
||||
)}
|
||||
<Legend
|
||||
className={inspectsPicks ? 'flex-[3]' : 'flex-1'}
|
||||
title={legendTitle(layer)}
|
||||
shares={shares}
|
||||
selection={{ highlight, onSelect: (subject) => setHighlight((current) => (sameSubject(current, subject) ? null : subject)) }}
|
||||
/>
|
||||
</Panel>
|
||||
<Panel className="min-h-0 flex-[3]">
|
||||
<Legend
|
||||
className="flex-1"
|
||||
title={legendTitle(layer)}
|
||||
shares={shares}
|
||||
selection={{ highlight, onSelect: (subject) => setHighlight((current) => (sameSubject(current, subject) ? null : subject)) }}
|
||||
/>
|
||||
</Panel>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -31,7 +31,7 @@ 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/90 px-3 py-1.5 text-[12px] text-secondary-text'
|
||||
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 {
|
||||
client: BridgeClient
|
||||
@@ -94,7 +94,7 @@ export function NoiseStudio({ client, packRevision, onSummary, tell }: NoiseStud
|
||||
<NoiseTerrainView client={client} source={source} seed={seed} revision={packRevision} framing={terrainFraming} scale={scale} reliefBlocks={reliefBlocks} tell={tell} />
|
||||
)}
|
||||
<div className="absolute top-3 left-3 flex items-center gap-2">
|
||||
<ToggleGroup type="single" variant="outline" size="sm" className="bg-card/90" value={display} onValueChange={(value) => value !== '' && showAs(value as NoiseDisplay)}>
|
||||
<ToggleGroup type="single" variant="outline" size="sm" className="bg-card" value={display} onValueChange={(value) => value !== '' && showAs(value as NoiseDisplay)}>
|
||||
<ToggleGroupItem value="flat" className={TOGGLE_ITEM} title="The noise from above, coloured by value">
|
||||
2D
|
||||
</ToggleGroupItem>
|
||||
@@ -103,7 +103,7 @@ export function NoiseStudio({ client, packRevision, onSummary, tell }: NoiseStud
|
||||
</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
{display === 'flat' && (
|
||||
<Button variant="outline" size="icon-sm" className="bg-card/90" title="Back to 0, 0" onClick={() => controllerRef.current?.resetView()}>
|
||||
<Button variant="outline" size="icon-sm" className="bg-card" title="Back to 0, 0" onClick={() => controllerRef.current?.resetView()}>
|
||||
<IdeIcon name="reset" />
|
||||
</Button>
|
||||
)}
|
||||
@@ -261,7 +261,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 (
|
||||
<label className="flex h-8 items-center gap-2 rounded-md border bg-card/90 px-3 text-[12px] text-secondary-text" title="How many blocks the highest noise rises above the lowest">
|
||||
<label className="flex h-8 items-center gap-2 rounded-md border bg-card px-3 text-[12px] text-secondary-text" title="How many blocks the highest noise rises above the lowest">
|
||||
Relief
|
||||
<input
|
||||
type="range"
|
||||
|
||||
@@ -25,7 +25,7 @@ interface LegendBlocks {
|
||||
}
|
||||
|
||||
const EMPTY_LEGEND: LegendBlocks = { examples: new Map(), someNone: false }
|
||||
const PILL = 'pointer-events-none absolute rounded-md border border-overlay-border bg-card/90 px-3 py-1.5 text-[12px] text-secondary-text'
|
||||
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 PatternStudioProps {
|
||||
client: BridgeClient
|
||||
@@ -64,7 +64,7 @@ export function PatternStudio({ client, view, packRevision, onSummary, tell }: P
|
||||
<>
|
||||
<div className="relative min-w-0 flex-1 overflow-hidden rounded-lg">
|
||||
<TiledCanvas create={createView} viewRef={viewRef} className="absolute inset-0 size-full cursor-grab active:cursor-grabbing" />
|
||||
<div className="absolute top-3 left-3 flex items-center gap-1 rounded-md border border-overlay-border bg-card/90 p-1 text-[12px] tabular-nums">
|
||||
<div className="absolute top-3 left-3 flex items-center gap-1 rounded-md border border-overlay-border bg-card p-1 text-[12px] tabular-nums">
|
||||
{entry !== null && entry.depths > 1 && (
|
||||
<>
|
||||
<Button variant="ghost" size="icon-sm" title="Higher" onClick={() => chooseDepth(depth - 1)}>
|
||||
|
||||
@@ -32,7 +32,7 @@ interface PickInspectorProps {
|
||||
*/
|
||||
export function PickInspector({ title, inspection, display }: PickInspectorProps): React.JSX.Element {
|
||||
return (
|
||||
<section className="flex min-h-0 flex-[7] flex-col border-b">
|
||||
<section className="flex min-h-0 flex-1 flex-col">
|
||||
<header className="px-4 pt-2.5 pb-2.5">
|
||||
<h2 className="truncate text-[13px] font-semibold">{title}</h2>
|
||||
<p className="truncate text-[11.5px] text-secondary-text">{inspection?.detail ?? 'Measuring what is in view…'}</p>
|
||||
|
||||
@@ -23,7 +23,7 @@ const NUMBER = new Intl.NumberFormat('en-US')
|
||||
// Saved tiles are read at up to 16 blocks a pixel, which is level 4.
|
||||
const COARSEST_SAVED_LEVEL = 4
|
||||
const COLORING_ITEM = 'h-7 px-3 text-[12px] data-[state=on]:bg-selection data-[state=on]:text-foreground'
|
||||
const PILL = 'pointer-events-none absolute top-3 left-1/2 -translate-x-1/2 rounded-md border border-overlay-border bg-card/90 px-3 py-1.5 text-[12px] text-secondary-text'
|
||||
const PILL = 'pointer-events-none absolute top-3 left-1/2 -translate-x-1/2 rounded-md border border-overlay-border bg-card px-3 py-1.5 text-[12px] text-secondary-text'
|
||||
|
||||
interface SavedWorldStudioProps {
|
||||
client: BridgeClient
|
||||
@@ -93,7 +93,7 @@ export function SavedWorldStudio({ client, world, onSummary, onProgress, tell }:
|
||||
type="single"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="bg-card/90"
|
||||
className="bg-card"
|
||||
value={coloring}
|
||||
onValueChange={(value) => value !== '' && setColoring(value as SavedTerrainColoring)}
|
||||
>
|
||||
@@ -107,7 +107,7 @@ export function SavedWorldStudio({ client, world, onSummary, onProgress, tell }:
|
||||
Height
|
||||
</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
<Button variant="outline" size="icon-sm" className="bg-card/90" title="Read again" disabled={reading} onClick={() => setReadings((count) => count + 1)}>
|
||||
<Button variant="outline" size="icon-sm" className="bg-card" title="Read again" disabled={reading} onClick={() => setReadings((count) => count + 1)}>
|
||||
<IdeIcon name="refresh" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -166,7 +166,7 @@ function SceneArea({ entry, variant, shown, status, onVariant, onPick }: SceneAr
|
||||
<div className="relative min-h-0 flex-[11] overflow-hidden rounded-lg">
|
||||
<SceneViewport content={shown?.mesh.content ?? null} framing={shown?.scene} onPick={onPick} />
|
||||
{entry !== null && entry.variants > 1 && (
|
||||
<div className="absolute top-3 left-3 flex items-center gap-1 rounded-md border border-overlay-border bg-card/90 p-1 text-[12px] tabular-nums">
|
||||
<div className="absolute top-3 left-3 flex items-center gap-1 rounded-md border border-overlay-border bg-card p-1 text-[12px] tabular-nums">
|
||||
<Button variant="ghost" size="icon-sm" title="Previous variant" onClick={() => onVariant(variant - 1)}>
|
||||
<IdeIcon name="chevronLeft" />
|
||||
</Button>
|
||||
@@ -179,7 +179,7 @@ function SceneArea({ entry, variant, shown, status, onVariant, onPick }: SceneAr
|
||||
</div>
|
||||
)}
|
||||
{status !== null && (
|
||||
<div className="pointer-events-none absolute top-3 left-1/2 -translate-x-1/2 rounded-md border border-overlay-border bg-card/90 px-3 py-1.5 text-[12px] text-secondary-text">
|
||||
<div className="pointer-events-none absolute top-3 left-1/2 -translate-x-1/2 rounded-md border border-overlay-border bg-card px-3 py-1.5 text-[12px] text-secondary-text">
|
||||
{status}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -49,8 +49,8 @@ export function StudioToolbar(props: StudioToolbarProps): React.JSX.Element {
|
||||
<IdeIcon name="help" />
|
||||
</ToolButton>
|
||||
<IconHint hint="Change the studio's keys">
|
||||
<Button variant="ghost" size="sm" className={TEXT_BUTTON} onClick={props.onSettings}>
|
||||
Settings
|
||||
<Button variant="ghost" size="icon-sm" onClick={props.onSettings}>
|
||||
<IdeIcon name="settings" />
|
||||
</Button>
|
||||
</IconHint>
|
||||
<IconHint hint="Back to the world list">
|
||||
|
||||
@@ -27,19 +27,13 @@ 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, floating }: ViewListProps): React.JSX.Element {
|
||||
export function ViewList({ views, current, onSelect, slotRef }: ViewListProps): React.JSX.Element {
|
||||
const groups = [...new Set(views.map((view) => view.groupLabel))]
|
||||
return (
|
||||
<div className={cn('flex w-60 shrink-0 flex-col overflow-hidden rounded-lg', floating ? ON_THE_MAP : IN_COLUMN)}>
|
||||
<div className="flex w-60 shrink-0 flex-col overflow-hidden rounded-lg bg-card">
|
||||
<nav className="flex shrink-0 flex-col gap-2 overflow-y-auto p-1.5">
|
||||
{groups.map((group) => (
|
||||
<section key={group}>
|
||||
@@ -52,7 +46,7 @@ export function ViewList({ views, current, onSelect, slotRef, floating }: ViewLi
|
||||
</section>
|
||||
))}
|
||||
</nav>
|
||||
<div ref={slotRef} className="flex min-h-0 flex-1 flex-col border-t border-overlay-border/60 empty:hidden" />
|
||||
<div ref={slotRef} className="flex min-h-0 flex-1 flex-col border-t empty:hidden" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ export function WorldStudio3D({ client, world, mapArea, packRevision, onSummary,
|
||||
type="single"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="absolute top-3 left-3 bg-card/90"
|
||||
className="absolute top-3 left-3 bg-card"
|
||||
value={coloring}
|
||||
onValueChange={(value) => value !== '' && setColoring(value as MapTerrainColoring)}
|
||||
>
|
||||
@@ -90,7 +90,7 @@ export function WorldStudio3D({ client, world, mapArea, packRevision, onSummary,
|
||||
</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
{sampling && (
|
||||
<div className="pointer-events-none absolute top-3 left-1/2 -translate-x-1/2 rounded-md border border-overlay-border bg-card/90 px-3 py-1.5 text-[12px] text-secondary-text">
|
||||
<div className="pointer-events-none absolute top-3 left-1/2 -translate-x-1/2 rounded-md border border-overlay-border bg-card px-3 py-1.5 text-[12px] text-secondary-text">
|
||||
Sampling the terrain
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
--foreground: #000000;
|
||||
--card: #f7f8fa;
|
||||
--card-foreground: #000000;
|
||||
--popover: rgb(255 255 255 / 0.94);
|
||||
--popover: #ffffff;
|
||||
--popover-foreground: #000000;
|
||||
--primary: #3574f0;
|
||||
--primary-foreground: #ffffff;
|
||||
@@ -37,7 +37,7 @@
|
||||
--foreground: #dfe1e5;
|
||||
--card: #2b2d30;
|
||||
--card-foreground: #dfe1e5;
|
||||
--popover: rgb(43 45 48 / 0.93);
|
||||
--popover: #2b2d30;
|
||||
--popover-foreground: #dfe1e5;
|
||||
--primary: #3574f0;
|
||||
--primary-foreground: #ffffff;
|
||||
@@ -53,7 +53,7 @@
|
||||
--warning: #f2c55c;
|
||||
--success: #5fb865;
|
||||
--link: #548af7;
|
||||
--border: #1e1f22;
|
||||
--border: #393b40;
|
||||
--input: #4e5157;
|
||||
--ring: #3574f0;
|
||||
--overlay-border: #43454a;
|
||||
|
||||
Reference in new issue
Block a user