fix(tui): provide location for home mentions
This commit is contained in:
@@ -12,6 +12,8 @@ import { useEditorContext } from "../context/editor"
|
|||||||
import { useTerminalDimensions } from "@opentui/solid"
|
import { useTerminalDimensions } from "@opentui/solid"
|
||||||
import { useTuiConfig } from "../config"
|
import { useTuiConfig } from "../config"
|
||||||
import { HomeSessionDestinationProvider } from "./home/session-destination"
|
import { HomeSessionDestinationProvider } from "./home/session-destination"
|
||||||
|
import { useData } from "../context/data"
|
||||||
|
import { LocationProvider } from "../context/location"
|
||||||
|
|
||||||
let once = false
|
let once = false
|
||||||
const placeholder = {
|
const placeholder = {
|
||||||
@@ -30,6 +32,7 @@ export function Home() {
|
|||||||
const editor = useEditorContext()
|
const editor = useEditorContext()
|
||||||
const dimensions = useTerminalDimensions()
|
const dimensions = useTerminalDimensions()
|
||||||
const tuiConfig = useTuiConfig()
|
const tuiConfig = useTuiConfig()
|
||||||
|
const data = useData()
|
||||||
const promptMaxWidth = createMemo(() => {
|
const promptMaxWidth = createMemo(() => {
|
||||||
const configured = tuiConfig.prompt?.max_width
|
const configured = tuiConfig.prompt?.max_width
|
||||||
if (configured === "auto") return Math.max(75, Math.floor(dimensions().width * 0.7))
|
if (configured === "auto") return Math.max(75, Math.floor(dimensions().width * 0.7))
|
||||||
@@ -68,28 +71,30 @@ export function Home() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HomeSessionDestinationProvider>
|
<LocationProvider location={data.location.default()}>
|
||||||
<box flexGrow={1} alignItems="center" paddingLeft={2} paddingRight={2}>
|
<HomeSessionDestinationProvider>
|
||||||
<box flexGrow={1} minHeight={0} />
|
<box flexGrow={1} alignItems="center" paddingLeft={2} paddingRight={2}>
|
||||||
<box height={4} minHeight={0} flexShrink={1} />
|
<box flexGrow={1} minHeight={0} />
|
||||||
<box flexShrink={0}>
|
<box height={4} minHeight={0} flexShrink={1} />
|
||||||
<pluginRuntime.Slot name="home_logo" mode="replace">
|
<box flexShrink={0}>
|
||||||
<Logo />
|
<pluginRuntime.Slot name="home_logo" mode="replace">
|
||||||
</pluginRuntime.Slot>
|
<Logo />
|
||||||
|
</pluginRuntime.Slot>
|
||||||
|
</box>
|
||||||
|
<box height={1} minHeight={0} flexShrink={1} />
|
||||||
|
<box width="100%" maxWidth={promptMaxWidth()} zIndex={1000} paddingTop={1} flexShrink={0}>
|
||||||
|
<pluginRuntime.Slot name="home_prompt" mode="replace" ref={bind}>
|
||||||
|
<Prompt ref={bind} right={<pluginRuntime.Slot name="home_prompt_right" />} placeholders={placeholder} />
|
||||||
|
</pluginRuntime.Slot>
|
||||||
|
</box>
|
||||||
|
<pluginRuntime.Slot name="home_bottom" />
|
||||||
|
<box flexGrow={1} minHeight={0} />
|
||||||
|
<Toast />
|
||||||
</box>
|
</box>
|
||||||
<box height={1} minHeight={0} flexShrink={1} />
|
<box width="100%" flexShrink={0}>
|
||||||
<box width="100%" maxWidth={promptMaxWidth()} zIndex={1000} paddingTop={1} flexShrink={0}>
|
<pluginRuntime.Slot name="home_footer" mode="single_winner" />
|
||||||
<pluginRuntime.Slot name="home_prompt" mode="replace" ref={bind}>
|
|
||||||
<Prompt ref={bind} right={<pluginRuntime.Slot name="home_prompt_right" />} placeholders={placeholder} />
|
|
||||||
</pluginRuntime.Slot>
|
|
||||||
</box>
|
</box>
|
||||||
<pluginRuntime.Slot name="home_bottom" />
|
</HomeSessionDestinationProvider>
|
||||||
<box flexGrow={1} minHeight={0} />
|
</LocationProvider>
|
||||||
<Toast />
|
|
||||||
</box>
|
|
||||||
<box width="100%" flexShrink={0}>
|
|
||||||
<pluginRuntime.Slot name="home_footer" mode="single_winner" />
|
|
||||||
</box>
|
|
||||||
</HomeSessionDestinationProvider>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user