+
diff --git a/studio/src/renderer/src/studio/SceneStudio.tsx b/studio/src/renderer/src/studio/SceneStudio.tsx
index c8dcc6ddd..cec7a72c2 100644
--- a/studio/src/renderer/src/studio/SceneStudio.tsx
+++ b/studio/src/renderer/src/studio/SceneStudio.tsx
@@ -167,7 +167,7 @@ function SceneArea({ title, entry, variant, shown, status, onVariant, onPick }:
return (
1 && (
diff --git a/studio/src/renderer/src/studio/Sidebar.tsx b/studio/src/renderer/src/studio/Sidebar.tsx
index 7610f5922..2d8e78d9c 100644
--- a/studio/src/renderer/src/studio/Sidebar.tsx
+++ b/studio/src/renderer/src/studio/Sidebar.tsx
@@ -1,6 +1,6 @@
import { createContext, useContext } from 'react'
import { createPortal } from 'react-dom'
-import { IdeIcon } from '@/components/IdeIcon'
+import { IdeIcon, type IdeIconName } from '@/components/IdeIcon'
import { Button } from '@/components/ui/button'
import { cn } from '@/lib/utils'
@@ -52,11 +52,16 @@ interface ViewIslandProps {
children: React.ReactNode
}
-/** The island a view draws in, under a header with the view's name and its tools, as an IntelliJ tool window has. */
+/** The shown view's icon in the stripe, which its island repeats beside its name so the two are learned together. */
+export const ShownViewIcon = createContext(null)
+
+/** The island a view draws in, under a header with the view's icon, its name and its tools, as an IntelliJ tool window has. */
export function ViewIsland({ title, tools, className, children }: ViewIslandProps): React.JSX.Element {
+ const icon = useContext(ShownViewIcon)
return (
+ {icon !== null && }
{title}
{tools}
diff --git a/studio/src/renderer/src/studio/ViewList.tsx b/studio/src/renderer/src/studio/ViewList.tsx
index 9423eb563..65e79c65e 100644
--- a/studio/src/renderer/src/studio/ViewList.tsx
+++ b/studio/src/renderer/src/studio/ViewList.tsx
@@ -1,3 +1,4 @@
+import { DropdownMenu } from 'radix-ui'
import { Fragment } from 'react'
import { IdeIcon, type IdeIconName } from '@/components/IdeIcon'
import { Kbd } from '@/components/ui/kbd'
@@ -23,6 +24,11 @@ const VIEW_ICONS: Record = {
}
const FALLBACK_ICON: IdeIconName = 'views/regions'
+/** The icon a view has in the stripe, which its island's header repeats beside its name. */
+export function viewIcon(viewId: string): IdeIconName {
+ return VIEW_ICONS[viewId] ?? FALLBACK_ICON
+}
+
interface ViewListProps {
views: ViewInfo[]
current: string
@@ -32,30 +38,45 @@ interface ViewListProps {
}
/**
- * The views the server offers, as a stripe of buttons on the window's edge in their groups, and beside it the island
- * the shown view fills with its own lists, which is not there for a view without any (IntelliJ's tool window stripe).
+ * The views the server offers, as a stripe of buttons on the window's edge in their groups with a list of their names
+ * under them, and beside it the island the shown view fills with its own lists, which is not there for a view without
+ * any (IntelliJ's tool window stripe).
*/
export function ViewList({ views, current, onSelect, slotRef }: ViewListProps): React.JSX.Element {
- const groups = [...new Set(views.map((view) => view.groupLabel))]
+ const groups = groupsOf(views)
return (
<>
>
)
}
+interface ViewGroup {
+ label: string
+ views: ViewInfo[]
+}
+
+function groupsOf(views: ViewInfo[]): ViewGroup[] {
+ const labels = [...new Set(views.map((view) => view.groupLabel))]
+ return labels.map((label) => ({ label, views: views.filter((view) => view.groupLabel === label) }))
+}
+
+function StripeLine(): React.JSX.Element {
+ return
+}
+
function ViewButton({ view, selected, onSelect }: { view: ViewInfo; selected: boolean; onSelect(): void }): React.JSX.Element {
const keyText = useKeyText()(viewShortcutId(view.id))
return (
@@ -67,7 +88,7 @@ function ViewButton({ view, selected, onSelect }: { view: ViewInfo; selected: bo
aria-pressed={selected}
className={cn('flex size-8 shrink-0 items-center justify-center rounded-lg', selected ? 'bg-primary [&_img]:brightness-0 [&_img]:invert' : 'hover:bg-selection')}
>
-
+
@@ -80,3 +101,46 @@ function ViewButton({ view, selected, onSelect }: { view: ViewInfo; selected: bo
)
}
+
+/** Every view by name, for when its icon alone does not say which it is (IntelliJ's "more tool windows"). */
+function NamedViews({ groups, current, onSelect }: { groups: ViewGroup[]; current: string; onSelect(view: string): void }): React.JSX.Element {
+ const keyText = useKeyText()
+ return (
+
+
+
+
+
+
+ {groups.map((group) => (
+
+ {group.label}
+ {group.views.map((view) => (
+ onSelect(view.id)}
+ className={cn(
+ 'flex h-[26px] cursor-default items-center gap-2 rounded-md px-2 outline-none data-[highlighted]:bg-accent',
+ view.id === current && 'bg-selection'
+ )}
+ >
+
+ {view.label}
+ {keyText(viewShortcutId(view.id)) !== '' && (
+ {keyText(viewShortcutId(view.id))}
+ )}
+
+ ))}
+
+ ))}
+
+
+
+ )
+}