Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(character): the Character tab stands on the middle axis of the prompt window

purpled30f409abc74
diff --git a/e2e/character-hub.spec.ts b/e2e/character-hub.spec.ts
index cd8997ae..31f03621 100644
--- a/e2e/character-hub.spec.ts
+++ b/e2e/character-hub.spec.ts
@@ -177,6 +177,17 @@ async function expectWindowAt(page: Page, image: { x: number; y: number; width:
expect(Math.abs(now.y + now.height - (image.y + image.height))).toBeLessThanOrEqual(1)
}
+/** Everything of the stage stands on the middle axis of the prompt window:
+ * the row of the characters, the head, the name, the photos. */
+async function expectOnAxis(page: Page, selectors: string[]) {
+ const win = await windowBox(page)
+ const axis = win.x + win.width / 2
+ for (const sel of selectors) {
+ const box = (await page.locator(sel).first().boundingBox())!
+ expect(Math.abs(box.x + box.width / 2 - axis), sel).toBeLessThanOrEqual(2)
+ }
+}
+
/** A tap on the first frame at a share of its width and height. */
async function tapFrame(page: Page, x: number, y: number) {
const frame = page.getByRole('group', { name: /First frame of your video/ })
@@ -220,6 +231,12 @@ test('one pill: the characters as tabs, the stage, and the row over the window s
await expect(page.getByRole('list', { name: 'Photos of Sam' }).locator('img')).toHaveCount(12)
await savePhotoCharacter(page, 'Oma', 'oma.png', 8)
await expect(page.locator('[data-hub-photo-only]')).toBeVisible()
+ // Four characters at this width: the row in full, around the middle, with
+ // New character as its last entry; the head and the photos under it on
+ // the same axis as the prompt window.
+ await expect(page.locator('[data-hub-tabs]')).toHaveAttribute('data-hub-tabs-fit', 'names')
+ await expect(page.locator('[role=tablist] > :last-child')).toHaveAttribute('data-hub-new', /.*/)
+ await expectOnAxis(page, ['[role=tablist][aria-label="My characters"]', '[data-hub-card] .hub-portrait', '[data-hub-card-name]', '[data-hub-card-links]', '.hub-photos'])
await shoot(page, 'a-wer')
// Bean on the stage: Image is the action, and the text field is there.
@@ -438,6 +455,11 @@ test('the training is a page of the area, with the way back to the stage', async
test('phone width: the same stage and the same window, nothing folded away', async ({ page }) => {
await boot(page, { hub: true, width: 375, height: 812 })
await openCharacterHub(page)
+ // No room for names: the row is the round pictures, still in the middle,
+ // and each one says its name.
+ await expect(page.locator('[data-hub-tabs]')).toHaveAttribute('data-hub-tabs-fit', /picked|pictures/)
+ await expect(page.locator('[data-hub-character^="cloud:2222"]')).toHaveAttribute('title', /Mila/)
+ await expectOnAxis(page, ['[role=tablist][aria-label="My characters"]', '[data-hub-card-name]'])
await shoot(page, 'handy-a-wer')
await page.locator('[data-hub-character^="cloud:1111"]').click()
await shoot(page, 'handy-b-was')
@@ -463,6 +485,7 @@ test('no character yet: the three steps, one button and the same window', async
const hub = page.locator('[data-character-hub]')
await expect(hub).toHaveAttribute('data-character-hub', 'who')
await expect(page.locator('[data-hub-empty] ol > li')).toHaveCount(3)
+ await expectOnAxis(page, ['[data-hub-empty] ol', '[data-hub-create]'])
await expect(page.locator('[data-hub-example], [data-hub-empty] svg[viewBox="0 0 120 80"], [data-hub-empty] img')).toHaveCount(0)
await expect(page.locator('[data-hub-empty] h1, [data-hub-empty] h2')).toHaveCount(0)
// The window is there, with its field, and says what it waits for.
@@ -518,6 +541,7 @@ test('no character yet: the three steps, one button and the same window', async
expect(name.height).toBeGreaterThan(15)
expect(links.y).toBeGreaterThanOrEqual(name.y + name.height)
expect(links.y + links.height).toBeLessThanOrEqual(head.y + head.height + 1)
+ await expectOnAxis(page, ['[role=tablist][aria-label="My characters"]', '[data-hub-card-name]', '[data-hub-card-links]', '.hub-photos'])
}
await shoot(page, 'schmal-kopf')
await page.locator('[data-hub-rename]').click()
diff --git a/src/components/create/experimental/CreateExperimental.tsx b/src/components/create/experimental/CreateExperimental.tsx
index 08ecb797..84b281d1 100644
--- a/src/components/create/experimental/CreateExperimental.tsx
+++ b/src/components/create/experimental/CreateExperimental.tsx
@@ -99,6 +99,19 @@ function CreateExperimentalInner() {
// The Character area (3.1.0 part B) takes the place of the stage and the
// prompt window for its four intents; gallery and presets stay beside it.
const hubOpen = isHubIntent(intent)
+ // The Character tab stands on the middle axis of the prompt window: the
+ // room the rails take at the right is kept free at the left as well
+ // (index.css, .lu-hub-row reads --hub-rails).
+ const rails = useRef<HTMLDivElement>(null)
+ const [railsWidth, setRailsWidth] = useState(0)
+ useEffect(() => {
+ const el = rails.current
+ if (!hubOpen || !el || typeof ResizeObserver === 'undefined') return
+ const ro = new ResizeObserver(() => setRailsWidth(el.offsetWidth))
+ ro.observe(el)
+ setRailsWidth(el.offsetWidth)
+ return () => ro.disconnect()
+ }, [hubOpen])
const cloudOpModel = useCreateStore((s) => s.cloudOpModel)
const cloudImageModel = useCreateStore((s) => s.cloudImageModel)
const cloudVideoModel = useCreateStore((s) => s.cloudVideoModel)
@@ -488,7 +501,10 @@ function CreateExperimentalInner() {
viewer AND the composer, so it was taller than the viewer.) */}
{/* The Character tab: its column stands exactly over the prompt window
(index.css, .lu-hub-row), the rails stay at the right. */}
- <div className={hubOpen ? 'lu-hub-row flex-1 min-h-0 overflow-hidden' : 'flex-1 min-h-0 flex overflow-hidden'}>
+ <div
+ className={hubOpen ? 'lu-hub-row flex-1 min-h-0 overflow-hidden' : 'flex-1 min-h-0 flex overflow-hidden'}
+ style={hubOpen ? { ['--hub-rails' as string]: `${Math.max(16, railsWidth)}px` } : undefined}
+ >
{hubOpen ? (
<CharacterHub
stage={{
@@ -517,7 +533,7 @@ function CreateExperimentalInner() {
)}
{/* On a phone-wide window the Character area takes the whole width
(its rails would leave the column 200 px). */}
- <div className={hubOpen ? 'lu-hub-rails max-[520px]:hidden' : 'contents'}>
+ <div ref={rails} className={hubOpen ? 'lu-hub-rails max-[520px]:hidden' : 'contents'}>
<CreatePanel open={panelOpen} onOpenChange={setPanelOpen} activeId={shownId} onSelect={openGalleryItem} />
<PresetShelf
open={presetsOpen}
diff --git a/src/components/create/experimental/__tests__/character-stage.test.tsx b/src/components/create/experimental/__tests__/character-stage.test.tsx
index aabfd859..d0e23246 100644
--- a/src/components/create/experimental/__tests__/character-stage.test.tsx
+++ b/src/components/create/experimental/__tests__/character-stage.test.tsx
@@ -29,7 +29,7 @@ vi.mock('../SpecialIntentControls', () => ({ CharacterMore: () => <span data-tes
import { HubEmpty } from '../hub/HubEmpty'
import { HubNewCharacter } from '../hub/HubNewCharacter'
-import { HubCard, HubPhotos } from '../hub/HubStage'
+import { HubCard, HubPhotos, HubTabs, tabsFit } from '../hub/HubStage'
import { HubActionRow } from '../hub/HubActionRow'
import { useCreateStore } from '../../../../stores/createStore'
import { useCharacterNames } from '../../../../lib/create/character-names'
@@ -184,7 +184,8 @@ const hubCss = () => {
describe('one column, one window', () => {
it('the area is as wide as the prompt window: 660, centred', () => {
const block = hubCss()
- expect(block).toMatch(/\.lu-hub-row \{[^}]*grid-template-columns: minmax\(16px, 1fr\) minmax\(0, 660px\) minmax\(max-content, 1fr\)/)
+ // Both sides equally wide at every width: the left keeps free what the rails take.
+ expect(block).toMatch(/\.lu-hub-row \{[^}]*grid-template-columns: minmax\(var\(--hub-rails, 16px\), 1fr\) minmax\(0, 660px\) minmax\(var\(--hub-rails, 16px\), 1fr\)/)
expect(block).toMatch(/\.lu-hub-row > \.hub-column \{[^}]*grid-column: 2/)
// The stage is a plain column in it, not a grid across the page.
expect(block).toMatch(/\.lu-hub \.hub-stage \{[^}]*flex-direction: column/)
@@ -217,15 +218,66 @@ describe('one column, one window', () => {
})
})
+describe('one middle axis', () => {
+ const names = (n: number) => ['Mira', 'Jonas', 'Aylin', 'Tobias', 'Greta', 'Malik', 'Svenja', 'Ines'].slice(0, n)
+ const chars = (n: number): HubCharacter[] => names(n).map((name, i) => ({ key: `saved:${i}`, kind: 'saved', name, meta: 'Photos · 4', image: null, photos: [] }))
+
+ it('the row of the characters stands around the middle, with New character as its last entry', () => {
+ const block = hubCss()
+ expect(block).toMatch(/\.lu-hub \.hub-tabs \{[^}]*justify-content: center/)
+ expect(block).toMatch(/\.lu-hub \.hub-tablist \{[^}]*justify-content: center/)
+ const { container } = hub(<HubTabs list={chars(3)} loading={false} current="saved:0" photoOnly={false} onPick={() => {}} onPhotoOnly={() => {}} onNew={() => {}} />)
+ const row = container.querySelector('[role=tablist]')!
+ expect(row.lastElementChild!.getAttribute('data-hub-new')).not.toBeNull()
+ expect(container.querySelectorAll('[data-hub-new]')).toHaveLength(1)
+ })
+
+ it('with less room the row gives up names, never the middle: first all but the picked one, then every name', () => {
+ expect(tabsFit(names(1), 'Mira', 660)).toBe('names')
+ expect(tabsFit(names(3), 'Mira', 660)).toBe('names')
+ expect(tabsFit(names(8), 'Mira', 660)).toBe('picked')
+ expect(tabsFit(names(8), 'Mira', 380)).toBe('pictures')
+ expect(tabsFit(names(3), 'Mira', 300)).toBe('pictures')
+ // No width measured yet: the row in full.
+ expect(tabsFit(names(8), 'Mira', 0)).toBe('names')
+ })
+
+ it('a picture without its name still says the name: as its label and its tooltip', () => {
+ const { container } = hub(<HubTabs list={chars(2)} loading={false} current="saved:0" photoOnly={false} onPick={() => {}} onPhotoOnly={() => {}} onNew={() => {}} />)
+ for (const tab of container.querySelectorAll('[data-hub-character]')) {
+ expect(tab.getAttribute('aria-label')).toBeTruthy()
+ expect(tab.getAttribute('title')).toContain(tab.getAttribute('aria-label')!)
+ }
+ // No picture: the initial on grey, not on the accent.
+ const none = container.querySelector('[data-hub-character] span[aria-hidden]')!
+ expect(none.className).toContain('hub-none')
+ expect(none.className).not.toMatch(/hub-acc|hub-soft/)
+ })
+
+ it('the head, the photos and the first page are centred', () => {
+ const block = hubCss()
+ expect(block).toMatch(/\.lu-hub \.hub-photos \{[^}]*justify-content: center/)
+ expect(block).toMatch(/\.lu-hub \.hub-empty \{[^}]*align-items: center;[^}]*justify-content: center/)
+ const c: HubCharacter = { key: 'saved:1', kind: 'saved', name: 'Oma', meta: 'Photos · 2', image: null, photos: [new Blob(['a']), new Blob(['b'])] }
+ const { container } = hub(<HubCard c={c} photo={null} />)
+ expect(container.querySelector('[data-hub-card-links]')!.className).toContain('justify-center')
+ // Nothing in the head is pushed to one side.
+ expect(container.querySelector('.hub-card')!.innerHTML).not.toMatch(/ml-auto|mr-auto|text-left|text-right/)
+ })
+})
+
describe('nothing is lost', () => {
it('the character stands as a head over its photos with all it can do, at every width', () => {
const block = hubCss()
- expect(block).toMatch(/\.lu-hub \.hub-card \{[^}]*padding: 10px 0 10px 68px/)
- expect(block).toMatch(/\.hub-card > \.hub-portrait \{[^}]*width: 56px/)
+ expect(block).toMatch(/\.lu-hub \.hub-card \{[^}]*flex-direction: column;[^}]*align-items: center;[^}]*text-align: center/)
+ expect(block).toMatch(/\.hub-card > \.hub-portrait \{[^}]*width: 64px/)
// Nothing of the area is switched off at any width but the icons of
// the row on a phone-wide window.
const off = [...block.matchAll(/([^{}\n]+)\{[^}]*display: none/g)].map((m) => m[1].trim())
- expect(off).toEqual(['.lu-hub .hub-act-item svg'])
+ // (The first entry is the rails of the gallery on a phone-wide window,
+ // which are not part of the area.)
+ expect(off).toEqual(['@media (max-width: 520px)', '.lu-hub .hub-act-item svg'])
+ expect(block).toMatch(/@media \(max-width: 520px\) \{\s*\.lu-hub-rails \{ display: none; \}/)
// Rename, Train a model and Delete are plain children of the card.
const c: HubCharacter = { key: 'saved:1', kind: 'saved', name: 'Oma', meta: 'Photos · 2', image: null, photos: [new Blob(['a']), new Blob(['b'])] }
const { container } = hub(<HubCard c={c} photo={null} />)
@@ -250,7 +302,7 @@ describe('nothing is lost', () => {
expect(line).toHaveLength(1)
expect(line[0].textContent).toBe(HUB_LOCAL_LINE)
expect(HUB_LOCAL_LINE).toBe('Local runs on your own machine and costs nothing. Cloud prices in credits.')
- expect(line[0].className).not.toMatch(/hidden/)
+ expect(line[0].className + line[0].parentElement!.className).not.toMatch(/hidden/)
// A row, not a bar: no frame around it.
expect(container.querySelector('[data-hub-actions]')!.className).toBe('lu-hub')
})
diff --git a/src/components/create/experimental/hub/CharacterHub.tsx b/src/components/create/experimental/hub/CharacterHub.tsx
index 44d38198..445d20d7 100644
--- a/src/components/create/experimental/hub/CharacterHub.tsx
+++ b/src/components/create/experimental/hub/CharacterHub.tsx
@@ -152,7 +152,7 @@ export function CharacterHub({ stage, onOpenGallery }: Props) {
)
} else if (step === 'who') {
body = loading && !waited
- ? <p className="hub-dim py-6 hub-fs-13" data-hub-step="who">Loading your characters…</p>
+ ? <p className="hub-dim py-6 text-center hub-fs-13" data-hub-step="who">Loading your characters…</p>
: <HubEmpty onCreate={() => setHubStep('new')} />
} else {
body = (
@@ -166,12 +166,15 @@ export function CharacterHub({ stage, onOpenGallery }: Props) {
onPhotoOnly={() => pick(null)}
onNew={() => setHubStep('new')}
/>
+ {/* One scroll for the head and what stands under it, so a low
+ window never squeezes the head. */}
+ <div className="hub-scroll scrollbar-thin">
<HubCard c={current} photo={photos[0] ?? null} />
<StageClip />
{oneClick ? (
<SwapOneClick onChangeCharacter={() => toStage('what')} />
) : (
- <div className="hub-body scrollbar-thin pb-4">
+ <div className="hub-body pb-4">
<div className="pt-3 empty:hidden"><Stage hub {...stage} /></div>
{(action !== 'image' || inRun || !current) && <HubPanel />}
{action === 'image' && fromPhotos && (
@@ -180,6 +183,7 @@ export function CharacterHub({ stage, onOpenGallery }: Props) {
{action === 'image' && <div className="pt-4"><HubPhotos c={current} photos={photos} loading={photosLoading} /></div>}
</div>
)}
+ </div>
</div>
)
}
@@ -266,10 +270,10 @@ function StageClip() {
const setVideoInput = useCreateStore((s) => s.setVideoInput)
if (!videoInput || !(intent === 'swap_character' || intent === 'motion' || intent === 'lipsync')) return null
return (
- <p className="hub-muted hub-line flex min-h-8 shrink-0 items-center gap-1.5 border-b hub-fs-12" data-hub-clip>
+ <p className="hub-muted flex min-h-8 shrink-0 items-center justify-center gap-1.5 hub-fs-12" data-hub-clip>
<Film size={13} className="hub-dim shrink-0" />
<span className="min-w-0 truncate">{videoInput.name}</span>
- <button type="button" onClick={() => setVideoInput(null)} className="hub-dim ml-auto p-0.5" title="Remove the video" aria-label="Remove the video">
+ <button type="button" onClick={() => setVideoInput(null)} className="hub-dim p-0.5" title="Remove the video" aria-label="Remove the video">
<X size={12} />
</button>
</p>
diff --git a/src/components/create/experimental/hub/HubActionRow.tsx b/src/components/create/experimental/hub/HubActionRow.tsx
index 5838ebc3..6c08d640 100644
--- a/src/components/create/experimental/hub/HubActionRow.tsx
+++ b/src/components/create/experimental/hub/HubActionRow.tsx
@@ -1,9 +1,9 @@
// The row above the prompt window of the Character tab: Image, Swap, Motion
// and Talk (David, 16.11.2026). It stands where every tab of Create has its
// own row of controls (LaneControls, ThreeDControls), centred over the
-// window, and it is a row, not a bar: no frame, nothing that moves. Beside
-// the picked action its price or where it runs, under it the one line that
-// says what Local and Cloud mean.
+// window, and it is a row, not a bar: no frame, nothing that moves. Under it
+// one quiet line: the price of the picked action or where it runs, and what
+// Local and Cloud mean.
import type { ReactNode } from 'react'
import { Image as ImageIcon, Mic, PersonStanding, Replace } from 'lucide-react'
@@ -106,7 +106,9 @@ export function HubActionRow() {
// The tokens of the area (.lu-hub) come along: the row stands in the
// Composer, outside the area's own section.
<div className="lu-hub" data-hub-actions>
- <div className="flex flex-wrap items-center justify-center gap-x-3 gap-y-1">
+ {/* The row alone on the middle axis; its price or place and what that
+ means stand under it, as one quiet line. */}
+ <div className="flex justify-center">
<div role="radiogroup" aria-label="Character action" className="hub-act">
{actions.map((a) => (
<button
@@ -124,10 +126,13 @@ export function HubActionRow() {
</button>
))}
</div>
- {on?.meta && <span className="hub-dim whitespace-nowrap hub-fs-125 tabular-nums" data-hub-action-meta>{on.meta}</span>}
</div>
- {/* What the price beside it means. One quiet line, at every width. */}
- {on && <p className="hub-dim pt-1 text-center hub-fs-125" data-hub-local-line>{HUB_LOCAL_LINE}</p>}
+ {on && (
+ <p className="hub-dim pt-1 text-center hub-fs-125">
+ {on.meta && <><span className="hub-muted tabular-nums" data-hub-action-meta>{on.meta}</span>{' · '}</>}
+ <span data-hub-local-line>{HUB_LOCAL_LINE}</span>
+ </p>
+ )}
</div>
)
}
diff --git a/src/components/create/experimental/hub/HubEmpty.tsx b/src/components/create/experimental/hub/HubEmpty.tsx
index 6cd29519..262b1664 100644
--- a/src/components/create/experimental/hub/HubEmpty.tsx
+++ b/src/components/create/experimental/hub/HubEmpty.tsx
@@ -1,5 +1,5 @@
// The Character area with no character yet (David, 16.11.2026): the three
-// steps and the one button, in the column over the prompt window. No
+// steps and the one button, in the middle over the prompt window. No
// pictures and nothing that moves; what a character can do stands in the
// row over the window (Image, Swap, Motion, Talk).
@@ -15,14 +15,11 @@ const STEPS = [
export function HubEmpty({ onCreate }: { onCreate: () => void }) {
return (
<div className="hub-empty scrollbar-thin" data-hub-step="who" data-hub-empty>
- <ol className="hub-line border-t">
+ <ol className="hub-steps">
{STEPS.map((s, i) => (
- <li key={s.title} className="hub-line flex gap-4 border-b py-3">
- <span className="hub-dim w-3 shrink-0 pt-px hub-fs-13 tabular-nums">{i + 1}</span>
- <span className="min-w-0">
- <span className="hub-text block hub-fs-14 font-medium">{s.title}</span>
- <span className="hub-dim mt-0.5 block hub-fs-13">{s.line}</span>
- </span>
+ <li key={s.title} className="hub-line border-b py-3 text-center">
+ <span className="hub-text block hub-fs-14 font-medium"><span className="hub-dim mr-2 font-normal tabular-nums">{i + 1}</span>{s.title}</span>
+ <span className="hub-dim mt-0.5 block hub-fs-13">{s.line}</span>
</li>
))}
</ol>
diff --git a/src/components/create/experimental/hub/HubParts.tsx b/src/components/create/experimental/hub/HubParts.tsx
index 0b576fd9..4c998fd1 100644
--- a/src/components/create/experimental/hub/HubParts.tsx
+++ b/src/components/create/experimental/hub/HubParts.tsx
@@ -17,7 +17,7 @@ export function useHubList(): HubCharacter[] {
return useContext(HubCharactersContext)
}
-/** A round picture, or the initial on the soft accent where there is none. */
+/** A round picture, or the initial on grey where there is none. */
export function HubAvatar({ name, image, size = 26 }: { name: string; image: string | null | undefined; size?: number }) {
if (image) {
return (
@@ -31,7 +31,7 @@ export function HubAvatar({ name, image, size = 26 }: { name: string; image: str
return (
<span
aria-hidden
- className="hub-soft hub-acc inline-flex shrink-0 items-center justify-center rounded-full font-semibold"
+ className="hub-none hub-muted inline-flex shrink-0 items-center justify-center rounded-full font-semibold"
style={{ width: size, height: size, fontSize: Math.round(size * 0.45) }}
>
{hubInitial(name)}
diff --git a/src/components/create/experimental/hub/HubStage.tsx b/src/components/create/experimental/hub/HubStage.tsx
index ff009fb1..d44f4dc3 100644
--- a/src/components/create/experimental/hub/HubStage.tsx
+++ b/src/components/create/experimental/hub/HubStage.tsx
@@ -1,7 +1,7 @@
// The stage of the Character area (3.1.0, David 16.11.2026): the characters
// as text tabs across the top, the picked one as a head under them (a small
// picture, its name, what can be done with it), then its photos. All of it
-// in the one column over the prompt window. Only real things stand here:
+// on one middle axis with the prompt window under it (David, 16.11.2026). Only real things stand here:
// the user's characters and their own pictures. A character without a
// picture shows its initial, one without photos a line that says so.
@@ -19,6 +19,30 @@ import { HubAvatar } from './HubParts'
// ── the tabs ────────────────────────────────────────────────────────────────
+/** How much of each entry the row shows: 'names' (picture and name),
+ * 'picked' (only the character on the stage keeps its name), 'pictures'
+ * (the round pictures alone; the name is the tooltip). */
+export type TabsFit = 'names' | 'picked' | 'pictures'
+
+const NAME_PX = 7.2
+const NAME_MAX = 140
+const PICTURE = 20
+const GAP = 20
+const tabWidth = (name: string) => PICTURE + 7 + Math.min(NAME_MAX, name.length * NAME_PX)
+/** "Just use a photo" and "New character", with their words. */
+const WORDS_PX = 112 + GAP + 118
+
+/** The fullest form of the row that still fits `width` (rendered CSS px).
+ * Without a measured width (0) the row stands in full. */
+export function tabsFit(names: string[], picked: string | null, width: number): TabsFit {
+ if (!(width > 0)) return 'names'
+ const gaps = (names.length + 1) * GAP
+ const full = names.reduce((w, n) => w + tabWidth(n), 0) + gaps + WORDS_PX
+ if (full <= width) return 'names'
+ const one = names.length * PICTURE + (picked ? tabWidth(picked) - PICTURE : 0) + gaps + WORDS_PX
+ return one <= width ? 'picked' : 'pictures'
+}
+
export function HubTabs({ list, loading, current, photoOnly, onPick, onPhotoOnly, onNew }: {
list: HubCharacter[]
loading: boolean
@@ -30,17 +54,35 @@ export function HubTabs({ list, loading, current, photoOnly, onPick, onPhotoOnly
onPhotoOnly: () => void
onNew: () => void
}) {
+ // The row stands in the middle, over the prompt window. With less room it
+ // gives up the names before it gives up the middle: first all but the
+ // picked one, then every name, until only the round pictures stand there.
+ const row = useRef<HTMLDivElement>(null)
+ const [width, setWidth] = useState(0)
+ useEffect(() => {
+ const el = row.current
+ if (!el || typeof ResizeObserver === 'undefined') return
+ const ro = new ResizeObserver(() => setWidth(el.clientWidth))
+ ro.observe(el)
+ setWidth(el.clientWidth)
+ return () => ro.disconnect()
+ }, [])
+ const picked = list.find((c) => c.key === current) ?? null
+ const fit = tabsFit(list.map((c) => c.name), picked?.name ?? null, width)
+ const small = fit === 'pictures'
return (
- <div className="hub-tabs hub-line border-b hub-fs-14" data-hub-tabs>
- <div role="tablist" aria-label="My characters" className="hub-tablist scrollbar-none">
+ <div ref={row} className="hub-tabs hub-line border-b hub-fs-14" data-hub-tabs data-hub-tabs-fit={fit}>
+ <div role="tablist" aria-label="My characters" className="hub-tablist">
{list.map((c) => {
const on = c.key === current
+ const named = fit === 'names' || (fit === 'picked' && on)
return (
<button
key={c.key}
type="button"
role="tab"
aria-selected={on}
+ aria-label={c.name}
onClick={() => onPick(c)}
// The whole name, and the trigger word of a LoRA character,
// where the tab cuts a long name (GitHub discussion #150).
@@ -48,8 +90,8 @@ export function HubTabs({ list, loading, current, photoOnly, onPick, onPhotoOnly
className={cn('hub-tab', on ? 'hub-tab--on hub-text font-medium' : 'hub-muted')}
data-hub-character={c.key}
>
- <HubAvatar name={c.name} image={c.image} size={20} />
- <span className="max-w-[140px] truncate">{c.name}</span>
+ <HubAvatar name={c.name} image={c.image} size={small ? 24 : PICTURE} />
+ {named && <span className="max-w-[140px] truncate">{c.name}</span>}
</button>
)
})}
@@ -58,17 +100,19 @@ export function HubTabs({ list, loading, current, photoOnly, onPick, onPhotoOnly
type="button"
role="tab"
aria-selected={photoOnly}
+ aria-label={HUB_JUST_PHOTO}
onClick={onPhotoOnly}
- title={HUB_JUST_PHOTO_LINE}
+ title={small ? `${HUB_JUST_PHOTO}. ${HUB_JUST_PHOTO_LINE}` : HUB_JUST_PHOTO_LINE}
className={cn('hub-tab hub-fs-13', photoOnly ? 'hub-tab--on hub-text' : 'hub-dim')}
data-hub-photo-only
>
- {HUB_JUST_PHOTO}
+ {small ? <ImagePlus size={16} /> : HUB_JUST_PHOTO}
+ </button>
+ {/* The last entry of the same row, not a button set apart. */}
+ <button type="button" onClick={onNew} aria-label="New character" title="New character" className="hub-tab hub-acc hub-fs-13" data-hub-new>
+ <Plus size={small ? 16 : 14} />{!small && 'New character'}
</button>
</div>
- <button type="button" onClick={onNew} className="hub-acc flex shrink-0 items-center gap-1 hub-fs-13" data-hub-new>
- <Plus size={14} />New character
- </button>
</div>
)
}
@@ -126,19 +170,19 @@ function Card({ c, photo }: { c: HubCharacter | null; photo: string | null }) {
{renaming ? (
<RenameField c={c} onDone={() => setRenaming(false)} />
) : (
- <h2 className="hub-text hub-fs-20 truncate font-semibold" title={c.name} data-hub-card-name>{c.name}</h2>
+ <h2 className="hub-text hub-fs-20 max-w-full truncate font-semibold" title={c.name} data-hub-card-name>{c.name}</h2>
)}
<p className="hub-muted mt-1 hub-fs-13">{c.meta}</p>
{c.ref && <p className="hub-dim mt-0.5 hub-fs-125">Trigger word: {c.ref.triggerWord}</p>}
- <div className="mt-2.5 flex flex-wrap items-center gap-x-3.5 gap-y-1 hub-fs-125" data-hub-card-links>
+ <div className="mt-2 flex flex-wrap items-center justify-center gap-x-3.5 gap-y-1 hub-fs-125" data-hub-card-links>
{!renaming && <button type="button" className="hub-muted hover:underline" onClick={() => { setError(null); setRenaming(true) }} data-hub-rename>Rename</button>}
{saved && c.photos && (
<button type="button" className="hub-muted hover:underline" onClick={() => { sendPhotosToStudio(c.name, c.photos ?? []); useCreateStore.getState().setHubStep('panel') }} data-hub-train>Train a model</button>
)}
- {saved && !asking && <button type="button" className="hub-dim ml-auto hover:underline" onClick={() => setAsking(true)} data-hub-delete>Delete</button>}
+ {saved && !asking && <button type="button" className="hub-dim hover:underline" onClick={() => setAsking(true)} data-hub-delete>Delete</button>}
{saved && asking && (
- <span className="hub-muted ml-auto flex items-center gap-2.5" data-hub-delete-ask>
+ <span className="hub-muted flex items-center gap-2.5" data-hub-delete-ask>
Delete {c.name}?
<button type="button" className="text-red-500 dark:text-red-400" onClick={() => void remove()} data-hub-delete-yes>Delete</button>
<button type="button" className="hub-dim" onClick={() => setAsking(false)}>Keep</button>
@@ -146,7 +190,7 @@ function Card({ c, photo }: { c: HubCharacter | null; photo: string | null }) {
)}
</div>
{/* The file of a LoRA character: download, use on this computer, delete. */}
- {!saved && <div className="hub-card-file -ml-1 mt-1.5"><CharacterMore bare /></div>}
+ {!saved && <div className="hub-card-file mt-1 flex justify-center"><CharacterMore bare /></div>}
{error && <p role="alert" className="mt-1.5 text-red-500 hub-fs-125 dark:text-red-400">{error}</p>}
{c.kind === 'local' && (
<p className="hub-dim mt-1.5 hub-fs-125">In Chat, name it: “a picture of {c.ref?.name ?? c.name} at the beach”.</p>
@@ -172,7 +216,7 @@ function RenameField({ c, onDone }: { c: HubCharacter; onDone: () => void }) {
}
}
return (
- <div data-hub-rename-field>
+ <div className="w-full max-w-[280px]" data-hub-rename-field>
<input
ref={field}
autoFocus
@@ -181,9 +225,9 @@ function RenameField({ c, onDone }: { c: HubCharacter; onDone: () => void }) {
aria-label={`New name for ${c.name}`}
onChange={(e) => setName(e.target.value)}
onKeyDown={(e) => { if (e.key === 'Enter') void save(); if (e.key === 'Escape') onDone() }}
- className="hub-text hub-fs-20 hub-name-field w-full border-b bg-transparent font-semibold outline-none"
+ className="hub-text hub-fs-20 hub-name-field w-full border-b bg-transparent text-center font-semibold outline-none"
/>
- <div className="mt-1.5 flex items-center gap-3 hub-fs-125">
+ <div className="mt-1.5 flex items-center justify-center gap-3 hub-fs-125">
<button type="button" className="hub-acc" onClick={() => void save()} data-hub-rename-save>Save</button>
<button type="button" className="hub-dim" onClick={onDone}>Cancel</button>
{c.ref && <span className="hub-dim">The trigger word stays.</span>}
@@ -201,7 +245,7 @@ export function HubPhotos({ c, photos, loading }: { c: HubCharacter | null; phot
if (!c) {
return (
<div data-hub-step="what" data-hub-photos-of="">
- <p className="hub-dim hub-line border-b py-3 hub-fs-13">Pick Swap or Motion below and add the photo there.</p>
+ <p className="hub-dim py-3 text-center hub-fs-13">Pick Swap or Motion below and add the photo there.</p>
</div>
)
}
@@ -212,16 +256,18 @@ export function HubPhotos({ c, photos, loading }: { c: HubCharacter | null; phot
: `${c.name} has no photos.`
return (
<div data-hub-step="what" data-hub-photos-of={c.key}>
- <div className="mb-2 flex items-baseline justify-between">
- <h2 className="hub-dim hub-fs-10">Photos of {c.name}</h2>
- {photos.length > 1 && <span className="hub-dim hub-fs-12 tabular-nums">{photos.length}</span>}
- </div>
+ {photos.length > 0 && (
+ <div className="mb-2 flex items-baseline justify-center gap-2">
+ <h2 className="hub-dim hub-fs-10">Photos of {c.name}</h2>
+ {photos.length > 1 && <span className="hub-dim hub-fs-12 tabular-nums">{photos.length}</span>}
+ </div>
+ )}
{photos.length > 0 ? (
<ul className="hub-photos" aria-label={`Photos of ${c.name}`}>
{photos.map((src, i) => <li key={i}><img src={src} alt="" loading="lazy" /></li>)}
</ul>
) : (
- <p className="hub-dim hub-line border-y py-3 hub-fs-13" data-hub-no-photos>{loading ? 'Loading the photos…' : none}</p>
+ <p className="hub-dim py-3 text-center hub-fs-13" data-hub-no-photos>{loading ? 'Loading the photos…' : none}</p>
)}
</div>
)
diff --git a/src/components/create/experimental/hub/SwapOneClick.tsx b/src/components/create/experimental/hub/SwapOneClick.tsx
index 10e1f94d..ce9ba70b 100644
--- a/src/components/create/experimental/hub/SwapOneClick.tsx
+++ b/src/components/create/experimental/hub/SwapOneClick.tsx
@@ -337,7 +337,7 @@ export function SwapOneClick({ onChangeCharacter }: {
/** The part of the stage under the character's head (index.css, .hub-body). */
function Body({ children }: { children: ReactNode }) {
- return <div className="hub-body scrollbar-thin pb-4">{children}</div>
+ return <div className="hub-body pb-4">{children}</div>
}
/** "First frame ▾" and "Video ▾": the models of the swap, in the settings of
diff --git a/src/index.css b/src/index.css
index 36c536ce..d2684c41 100644
--- a/src/index.css
+++ b/src/index.css
@@ -3191,6 +3191,8 @@ input[type="range"].neuron-range:disabled { cursor: not-allowed; opacity: 0.5; }
.lu-hub .hub-line { border-color: var(--hub-sep); }
.lu-hub .hub-hover:hover { background-color: var(--hub-hov); }
.lu-hub .hub-soft { background-color: var(--hub-soft); }
+/* No picture: the initial on grey. */
+.lu-hub .hub-none { background-color: var(--hub-edge); }
/* The role of a person in Swap reads as text until it is typed over. */
.lu-hub .hub-role::placeholder { color: var(--hub-text); }
/* The type of the Character area: the sizes of the sketches in rendered
@@ -3210,29 +3212,37 @@ input[type="range"].neuron-range:disabled { cursor: not-allowed; opacity: 0.5; }
/* The area is one column of the prompt window's width (660), centred, over
that window (David, 16.11.2026: the same container in every tab of
Create). The row is a grid of three: the space left of the column, the
- column, and the rails of the gallery and the presets at the right. While
- there is room both sides are equal, so the column stands exactly over the
- window; an open gallery takes its room from the left side first. The stage in it: the tabs, the character as a head (a small
+ column, and the rails of the gallery and the presets at the right. Both
+ sides are always equally wide (the left keeps free what the rails take,
+ --hub-rails), so the column stands exactly over the window at every
+ width; with little room it gets narrower, it never leaves the middle. The stage in it: the tabs, the character as a head (a small
picture, beside it the name and every action it has), then the inputs of
the action and its photos, which scroll. Nothing here moves by itself. */
-.lu-hub-row { display: grid; grid-template-columns: minmax(16px, 1fr) minmax(0, 660px) minmax(max-content, 1fr); grid-template-rows: minmax(0, 1fr); }
-.lu-hub-row > .hub-column { grid-column: 2; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
-.lu-hub-rails { grid-column: 3; display: flex; justify-content: flex-end; min-width: 0; min-height: 0; padding-left: 16px; }
+.lu-hub-row { display: grid; grid-template-columns: minmax(var(--hub-rails, 16px), 1fr) minmax(0, 660px) minmax(var(--hub-rails, 16px), 1fr); grid-template-rows: minmax(0, 1fr); }
+.lu-hub-row > .hub-column { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
+.lu-hub-rails { grid-column: 3; grid-row: 1; justify-self: end; display: flex; min-width: 0; min-height: 0; padding-left: 16px; }
+/* A phone-wide window: the area takes the whole width, as before. */
@media (max-width: 520px) {
- .lu-hub-row { grid-template-columns: 16px minmax(0, 1fr) 16px; }
+ .lu-hub-rails { display: none; }
}
.lu-hub .hub-stage { display: flex; flex-direction: column; flex: 1 1 0%; min-height: 0; }
-.lu-hub .hub-tabs { flex: none; display: flex; align-items: center; gap: 16px; min-height: 38px; }
-.lu-hub .hub-tablist { display: flex; align-items: stretch; align-self: stretch; gap: 20px; flex: 1 1 0%; min-width: 0; overflow-x: auto; }
-.lu-hub .hub-tab { display: inline-flex; align-items: center; gap: 7px; flex: none; white-space: nowrap; margin-bottom: -1px; border-bottom: 1.5px solid transparent; }
+/* Everything stands on the middle axis of the prompt window: the row of
+ the characters around the middle, the head centred over the photos, the
+ photos as a centred grid. */
+.lu-hub .hub-tabs { flex: none; display: flex; justify-content: center; min-height: 38px; }
+.lu-hub .hub-tablist { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center; column-gap: 20px; min-width: 0; }
+.lu-hub .hub-tab { display: inline-flex; align-items: center; gap: 7px; flex: none; min-height: 37px; white-space: nowrap; margin-bottom: -1px; border-bottom: 1.5px solid transparent; }
.lu-hub .hub-tab--on { border-bottom-color: var(--hub-text); }
-.lu-hub .hub-card { flex: none; position: relative; min-width: 0; min-height: 90px; padding: 10px 0 10px 68px; border-bottom: 1px solid var(--hub-sep); }
-.lu-hub .hub-card > .hub-portrait { position: absolute; left: 0; top: 10px; width: 56px; }
-.lu-hub .hub-body { flex: 1 1 0%; min-width: 0; min-height: 0; overflow-y: auto; }
+.lu-hub .hub-tabs[data-hub-tabs-fit="pictures"] .hub-tablist { column-gap: 12px; }
+.lu-hub .hub-scroll { flex: 1 1 0%; min-width: 0; min-height: 0; overflow-y: auto; }
+.lu-hub .hub-card { display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 14px 0 12px; text-align: center; }
+.lu-hub .hub-card > .hub-portrait { width: 64px; margin-bottom: 8px; }
+.lu-hub .hub-body { min-width: 0; }
.lu-hub .hub-portrait { display: block; aspect-ratio: 4 / 5; border-radius: 8px; background-size: cover; background-position: 50% 20%; }
-.lu-hub .hub-portrait--none { display: grid; place-items: center; background: var(--hub-fill); }
-.lu-hub .hub-initial { font-size: calc(24px / var(--ui-scale, 1.15)); font-weight: 600; line-height: 1; }
-.lu-hub .hub-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
+.lu-hub .hub-portrait--none { display: grid; place-items: center; background: var(--hub-edge); }
+.lu-hub .hub-initial { font-size: calc(26px / var(--ui-scale, 1.15)); font-weight: 600; line-height: 1; }
+.lu-hub .hub-photos { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
+.lu-hub .hub-photos li { width: 104px; }
.lu-hub .hub-photos img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
/* The row over the prompt window: Image, Swap, Motion, Talk as text, with
one quiet ground for the one that is picked. */
@@ -3260,7 +3270,8 @@ input[type="range"].neuron-range:disabled { cursor: not-allowed; opacity: 0.5; }
.lu-hub .hub-radio--on { border-color: var(--hub-acc); }
.lu-hub .hub-radio--on::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--hub-acc); }
-/* No character yet: the three steps and the one button. */
-.lu-hub .hub-empty { flex: 1 1 0%; min-height: 0; overflow-y: auto; padding: 16px 0; }
+/* No character yet: the three steps and the one button, in the middle. */
+.lu-hub .hub-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1 1 0%; min-height: 0; overflow-y: auto; padding: 16px 0; }
+.lu-hub .hub-steps { width: 100%; max-width: 420px; border-top: 1px solid var(--hub-sep); }
/* The NEW mark on the Character pill: accent on a faint accent ground. */
.lu-new-mark { font-size: 7px; font-weight: 600; letter-spacing: 0.06em; line-height: 1.4; }