|
1 | | -import { Show } from "solid-js" |
| 1 | +import { Match, Show, Switch, createMemo } from "solid-js" |
2 | 2 | import { TextAttributes } from "@opentui/core" |
| 3 | +import { useTerminalDimensions } from "@opentui/solid" |
3 | 4 | import { useTheme } from "../context/theme" |
4 | 5 | import { Logo } from "./logo" |
5 | 6 | import { InstallationVersion } from "@opencode-ai/core/installation/version" |
6 | 7 | import { useReady } from "./altimate-onboarding" |
| 8 | +import { welcomePanelVariant } from "./welcome-panel-utils" |
7 | 9 |
|
8 | | -// altimate_change — Claude-Code-style full-width boot box: big block wordmark on |
9 | | -// the left and a single "What is Altimate Code" section on the right. Shared |
10 | | -// between the home route and the session view so the header stays consistent |
11 | | -// when a command (e.g. /discover) starts a session. zIndex keeps it above |
12 | | -// transient top toasts (update/MCP) that would otherwise blank its top rows. |
13 | | -export function WelcomePanel() { |
| 10 | +const CONNECT_CTA = "Connect your AI model to start." |
| 11 | + |
| 12 | +// altimate_change — Claude-Code-style boot box: "What is Altimate Code" plus the |
| 13 | +// readiness-aware CTA. Shared between the home route and the session view so the |
| 14 | +// header stays consistent when a command (e.g. /discover) starts a session. |
| 15 | +// zIndex keeps it above transient top toasts (update/MCP) that would otherwise |
| 16 | +// blank its top rows. |
| 17 | +// |
| 18 | +// Responsive (issue #1067): the full two-column boot box is a ~13-row bordered |
| 19 | +// box that ate ~40% of the screen. It now scales down by AVAILABLE size, |
| 20 | +// following the repo's breakpoint idiom (createMemo over useTerminalDimensions, |
| 21 | +// cf. routes/session/permission.tsx:450, component/upgrade-indicator.tsx:14): |
| 22 | +// full — wordmark + full description (large windows only) |
| 23 | +// medium — title + one condensed line, no wordmark (the common case) |
| 24 | +// compact — a short line; the border title already carries the version |
| 25 | +// |
| 26 | +// `availableWidth` / `availableHeight` are the space the panel actually gets, not |
| 27 | +// the whole terminal — the caller subtracts its padding, any sibling sidebar |
| 28 | +// (session's contentWidth), and the fixed prompt/footer chrome |
| 29 | +// (PANEL_VERTICAL_RESERVE). Using the raw terminal would keep `full` selected in |
| 30 | +// a sidebar-narrowed column or a short window and swell the panel back up — the |
| 31 | +// bug #1067 is about. Both fall back to the terminal dimension when omitted. |
| 32 | +export function WelcomePanel(props: { availableWidth?: number; availableHeight?: number }) { |
14 | 33 | const { theme } = useTheme() |
15 | 34 | const ready = useReady() |
| 35 | + const dimensions = useTerminalDimensions() |
| 36 | + |
| 37 | + const variant = createMemo(() => |
| 38 | + welcomePanelVariant(props.availableWidth ?? dimensions().width, props.availableHeight ?? dimensions().height), |
| 39 | + ) |
| 40 | + |
| 41 | + const title = InstallationVersion === "local" ? " Altimate Code " : ` Altimate Code v${InstallationVersion} ` |
| 42 | + |
16 | 43 | return ( |
17 | 44 | <box |
18 | 45 | border |
19 | 46 | borderStyle="rounded" |
20 | 47 | borderColor={theme.border} |
21 | | - title={InstallationVersion === "local" ? " Altimate Code " : ` Altimate Code v${InstallationVersion} `} |
| 48 | + title={title} |
22 | 49 | titleAlignment="left" |
23 | 50 | flexShrink={0} |
24 | 51 | width="100%" |
25 | 52 | zIndex={2000} |
26 | 53 | backgroundColor={theme.background} |
27 | | - flexDirection="row" |
| 54 | + flexDirection="column" |
28 | 55 | > |
29 | | - {/* left column — the block-letter wordmark (59 cols wide) */} |
30 | | - <box |
31 | | - width={65} |
32 | | - flexShrink={0} |
33 | | - alignItems="center" |
34 | | - justifyContent="center" |
35 | | - gap={1} |
36 | | - paddingTop={1} |
37 | | - paddingBottom={1} |
38 | | - paddingLeft={1} |
39 | | - > |
40 | | - <text fg={theme.text} attributes={TextAttributes.BOLD}> |
41 | | - Welcome to Altimate Code |
42 | | - </text> |
43 | | - <Logo /> |
44 | | - </box> |
45 | | - {/* right column — tips + what-is sections */} |
46 | | - <box |
47 | | - flexGrow={1} |
48 | | - border={["left"]} |
49 | | - borderColor={theme.border} |
50 | | - paddingLeft={2} |
51 | | - paddingRight={2} |
52 | | - paddingTop={1} |
53 | | - paddingBottom={1} |
54 | | - gap={1} |
55 | | - > |
56 | | - <box gap={0}> |
57 | | - <text fg={theme.accent} attributes={TextAttributes.BOLD}> |
58 | | - What is Altimate Code |
59 | | - </text> |
60 | | - <text fg={theme.text} wrapMode="word" width="100%"> |
61 | | - Altimate Code is a specialized data engineering harness that sits between any LLM and your entire data |
62 | | - stack. |
63 | | - </text> |
64 | | - <text fg={theme.text} wrapMode="word" width="100%"> |
65 | | - It gives your AI real context — column-level lineage, SQL analysis, dbt, and live warehouse metadata — so it |
66 | | - reasons about your data instead of guessing. |
67 | | - </text> |
68 | | - {/* CTA only until a model is connected — stale afterwards */} |
69 | | - <Show when={!ready()}> |
70 | | - <text fg={theme.primary} wrapMode="word" width="100%"> |
71 | | - Connect your AI model to start. |
| 56 | + <Switch> |
| 57 | + {/* compact — a short line; the border title already carries the version. |
| 58 | + wrapMode keeps it readable if the terminal is extremely narrow. */} |
| 59 | + <Match when={variant() === "compact"}> |
| 60 | + <box paddingLeft={2} paddingRight={2} width="100%"> |
| 61 | + <text fg={ready() ? theme.text : theme.primary} wrapMode="word" width="100%"> |
| 62 | + {ready() ? "Your data-aware AI harness." : CONNECT_CTA} |
72 | 63 | </text> |
73 | | - </Show> |
74 | | - </box> |
75 | | - </box> |
| 64 | + </box> |
| 65 | + </Match> |
| 66 | + |
| 67 | + {/* medium — title + one condensed description + CTA, no block wordmark */} |
| 68 | + <Match when={variant() === "medium"}> |
| 69 | + <box paddingLeft={2} paddingRight={2} paddingTop={1} paddingBottom={1} gap={0} width="100%"> |
| 70 | + <text fg={theme.text} attributes={TextAttributes.BOLD}> |
| 71 | + Welcome to Altimate Code |
| 72 | + </text> |
| 73 | + <text fg={theme.text} wrapMode="word" width="100%"> |
| 74 | + Gives your AI real context on your data stack — lineage, SQL, dbt, and live warehouse metadata. |
| 75 | + </text> |
| 76 | + <Show when={!ready()}> |
| 77 | + <text fg={theme.primary} wrapMode="word" width="100%"> |
| 78 | + {CONNECT_CTA} |
| 79 | + </text> |
| 80 | + </Show> |
| 81 | + </box> |
| 82 | + </Match> |
| 83 | + |
| 84 | + {/* full — the original two-column boot box */} |
| 85 | + <Match when={variant() === "full"}> |
| 86 | + <box flexDirection="row" width="100%"> |
| 87 | + {/* left column — the block-letter wordmark (logo is ~50 cols) */} |
| 88 | + <box |
| 89 | + width={54} |
| 90 | + flexShrink={0} |
| 91 | + alignItems="center" |
| 92 | + justifyContent="center" |
| 93 | + gap={1} |
| 94 | + paddingTop={1} |
| 95 | + paddingBottom={1} |
| 96 | + paddingLeft={1} |
| 97 | + > |
| 98 | + <text fg={theme.text} attributes={TextAttributes.BOLD}> |
| 99 | + Welcome to Altimate Code |
| 100 | + </text> |
| 101 | + <Logo /> |
| 102 | + </box> |
| 103 | + {/* right column — what-is section */} |
| 104 | + <box |
| 105 | + flexGrow={1} |
| 106 | + border={["left"]} |
| 107 | + borderColor={theme.border} |
| 108 | + paddingLeft={2} |
| 109 | + paddingRight={2} |
| 110 | + paddingTop={1} |
| 111 | + paddingBottom={1} |
| 112 | + gap={1} |
| 113 | + > |
| 114 | + <box gap={0}> |
| 115 | + <text fg={theme.accent} attributes={TextAttributes.BOLD}> |
| 116 | + What is Altimate Code |
| 117 | + </text> |
| 118 | + <text fg={theme.text} wrapMode="word" width="100%"> |
| 119 | + Altimate Code is a specialized data engineering harness that sits between any LLM and your entire data |
| 120 | + stack. |
| 121 | + </text> |
| 122 | + <text fg={theme.text} wrapMode="word" width="100%"> |
| 123 | + It gives your AI real context — column-level lineage, SQL analysis, dbt, and live warehouse metadata — |
| 124 | + so it reasons about your data instead of guessing. |
| 125 | + </text> |
| 126 | + {/* CTA only until a model is connected — stale afterwards */} |
| 127 | + <Show when={!ready()}> |
| 128 | + <text fg={theme.primary} wrapMode="word" width="100%"> |
| 129 | + {CONNECT_CTA} |
| 130 | + </text> |
| 131 | + </Show> |
| 132 | + </box> |
| 133 | + </box> |
| 134 | + </box> |
| 135 | + </Match> |
| 136 | + </Switch> |
76 | 137 | </box> |
77 | 138 | ) |
78 | 139 | } |
0 commit comments