mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 13:05:14 +03:00
fix(tui): remove dark gap between execute detail and its footer (#62928)
This commit is contained in:
committed by
GitHub
Unverified
parent
a3352f7be0
commit
a17fab50a1
@@ -123,6 +123,7 @@ export function DialogExecute(props: { part: SessionMessageAssistantTool }) {
|
||||
</DialogHeader>
|
||||
}
|
||||
footer={{ actions: { primary: copyActions() } }}
|
||||
footerGap={0}
|
||||
legacyFooter={
|
||||
<DialogFooter
|
||||
actions={{
|
||||
|
||||
@@ -145,16 +145,22 @@ export function DialogLayout(
|
||||
buttons?: JSX.Element
|
||||
/** Side padding in cells. Defaults to DIALOG_INSET. */
|
||||
inset?: number
|
||||
/** Blank rows between the body and the footer under the "new-designs" experiment. Defaults to 1. */
|
||||
/**
|
||||
* Blank rows between the body and the footer under the "new-designs" experiment. Defaults to 1.
|
||||
* 0 lets a raised `DialogBleed` body meet the footer band.
|
||||
*/
|
||||
footerGap?: number
|
||||
}>,
|
||||
) {
|
||||
const inset = () => props.inset ?? DIALOG_INSET
|
||||
const newDesigns = useNewDesigns()
|
||||
const footerGap = () => (newDesigns() && props.footer && props.buttons === undefined ? (props.footerGap ?? 1) : 1)
|
||||
return (
|
||||
<box id={props.id} paddingLeft={inset()} paddingRight={inset()} paddingBottom={1} gap={1}>
|
||||
{props.header}
|
||||
<box paddingBottom={newDesigns() && props.footer ? (props.footerGap ?? 1) - 1 : 0}>{props.children}</box>
|
||||
<box paddingBottom={Math.max(0, footerGap() - 1)} marginBottom={Math.min(0, footerGap() - 1)}>
|
||||
{props.children}
|
||||
</box>
|
||||
<Show when={props.buttons === undefined} fallback={props.buttons}>
|
||||
<Show when={newDesigns() || props.legacyFooter === undefined} fallback={props.legacyFooter}>
|
||||
<Show when={props.footer}>
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/** @jsxImportSource @opentui/solid */
|
||||
import { testRender } from "@opentui/solid"
|
||||
import { expect, test } from "bun:test"
|
||||
import { ConfigProvider } from "../../src/config"
|
||||
import { Keymap } from "../../src/context/keymap"
|
||||
import { ThemeProvider } from "../../src/context/theme"
|
||||
import { DialogBleed, DialogHeader, DialogLayout, DialogProvider } from "../../src/ui/dialog"
|
||||
import { ToastProvider } from "../../src/ui/toast"
|
||||
import { emptyThemeSource, tmpdir } from "../fixture/fixture"
|
||||
import { TestTuiContexts } from "../fixture/tui-environment"
|
||||
import { createTuiResolvedConfig } from "../fixture/tui-runtime"
|
||||
|
||||
test.each([
|
||||
[undefined, 1],
|
||||
[0, 0],
|
||||
[2, 2],
|
||||
])("footerGap %p leaves %p blank rows between the body and the footer", async (footerGap, blank) => {
|
||||
await using temporary = await tmpdir()
|
||||
const app = await testRender(
|
||||
() => (
|
||||
<TestTuiContexts directory={temporary.path} paths={{ state: temporary.path }}>
|
||||
<ConfigProvider config={createTuiResolvedConfig({ experimental: { "new-designs": true } })}>
|
||||
<ThemeProvider mode="dark" source={emptyThemeSource}>
|
||||
<Keymap.Provider>
|
||||
<ToastProvider>
|
||||
<DialogProvider>
|
||||
<DialogLayout
|
||||
header={<DialogHeader title="Title" />}
|
||||
footer={{ actions: { primary: [{ title: "copy", key: "c" }] } }}
|
||||
footerGap={footerGap}
|
||||
>
|
||||
<DialogBleed>
|
||||
<text>BODY</text>
|
||||
</DialogBleed>
|
||||
</DialogLayout>
|
||||
</DialogProvider>
|
||||
</ToastProvider>
|
||||
</Keymap.Provider>
|
||||
</ThemeProvider>
|
||||
</ConfigProvider>
|
||||
</TestTuiContexts>
|
||||
),
|
||||
{ width: 60, height: 16 },
|
||||
)
|
||||
try {
|
||||
app.renderer.start()
|
||||
await app.waitForFrame((frame) => frame.includes("BODY") && frame.includes("copy c"))
|
||||
const lines = app.captureCharFrame().split("\n")
|
||||
const body = lines.findIndex((line) => line.includes("BODY"))
|
||||
const footer = lines.findIndex((line) => line.includes("copy c"))
|
||||
// The footer band has one row of top padding.
|
||||
expect(footer - body - 2).toBe(blank)
|
||||
} finally {
|
||||
app.renderer.destroy()
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user