@designa8/vibedesign-v6 1.15.3 → 1.20.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +3232 -1994
- package/dist/index.js +3242 -2004
- package/dist/styles.css +266 -28
- package/package.json +51 -1
- package/src/atoms/AppLayout/AppLayout.tsx +401 -395
- package/src/atoms/AppLayout/preview.tsx +29 -0
- package/src/atoms/AppSidebar/AppSidebar.tsx +182 -94
- package/src/atoms/AppSidebar/preview.tsx +20 -59
- package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +27 -73
- package/src/atoms/AppSidebarMobile/preview.tsx +18 -18
- package/src/atoms/AuthLogin/AuthLogin.tsx +200 -0
- package/src/atoms/AuthLogin/index.ts +2 -0
- package/src/atoms/AuthLogin/preview.tsx +22 -0
- package/src/atoms/AuthScreen/AuthScreen.tsx +7 -7
- package/src/atoms/AuthSignUp/AuthSignUp.tsx +243 -0
- package/src/atoms/AuthSignUp/index.ts +2 -0
- package/src/atoms/AuthSignUp/preview.tsx +22 -0
- package/src/atoms/BillingToggle/BillingToggle.tsx +65 -0
- package/src/atoms/BillingToggle/index.ts +2 -0
- package/src/atoms/BillingToggle/preview.tsx +23 -0
- package/src/atoms/Button/Button.tsx +33 -17
- package/src/atoms/Button/preview.tsx +16 -0
- package/src/atoms/ChatHistorySidebar/ChatHistorySidebar.tsx +370 -0
- package/src/atoms/ChatHistorySidebar/index.ts +2 -0
- package/src/atoms/ChatHistorySidebar/preview.tsx +60 -0
- package/src/atoms/ChatScreen/ChatScreen.tsx +331 -134
- package/src/atoms/ChatScreen/preview.tsx +123 -2
- package/src/atoms/Checkbox/Checkbox.tsx +89 -0
- package/src/atoms/Checkbox/index.ts +2 -0
- package/src/atoms/Checkbox/preview.tsx +60 -0
- package/src/atoms/Dropdown/Dropdown.tsx +195 -0
- package/src/atoms/Dropdown/index.ts +2 -0
- package/src/atoms/Dropdown/preview.tsx +56 -0
- package/src/atoms/FaqAccordionItem/FaqAccordionItem.tsx +60 -0
- package/src/atoms/FaqAccordionItem/index.ts +2 -0
- package/src/atoms/FaqAccordionItem/preview.tsx +26 -0
- package/src/atoms/FilterTabBar/FilterTabBar.tsx +8 -22
- package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +20 -33
- package/src/atoms/HomePageTemplate/preview.tsx +2 -2
- package/src/atoms/Icon/Icon.tsx +7 -5
- package/src/atoms/Icon/icons.data.ts +51 -0
- package/src/atoms/Input/Input.tsx +17 -9
- package/src/atoms/Input/preview.tsx +24 -25
- package/src/atoms/Menu/Menu.tsx +320 -0
- package/src/atoms/Menu/index.ts +2 -0
- package/src/atoms/Menu/preview.tsx +63 -0
- package/src/atoms/Modal/Modal.tsx +43 -37
- package/src/atoms/Modal/preview.tsx +13 -0
- package/src/atoms/NavItem/NavItem.tsx +33 -45
- package/src/atoms/NavItem/preview.tsx +21 -26
- package/src/atoms/PreviewToolbar/PreviewToolbar.tsx +144 -192
- package/src/atoms/PreviewToolbar/preview.tsx +24 -4
- package/src/atoms/PricingCard/PricingCard.tsx +164 -0
- package/src/atoms/PricingCard/index.ts +2 -0
- package/src/atoms/PricingCard/preview.tsx +45 -0
- package/src/atoms/PricingPageTemplate/PricingPageTemplate.tsx +219 -0
- package/src/atoms/PricingPageTemplate/index.ts +2 -0
- package/src/atoms/PricingPageTemplate/preview.tsx +10 -0
- package/src/atoms/PromptInputBar/PromptInputBar.tsx +117 -158
- package/src/atoms/WorkspaceMenu/WorkspaceMenu.tsx +41 -167
- package/src/index.ts +10 -0
- package/src/tokens.css +5 -0
|
@@ -3,8 +3,11 @@ import { TopNavbar, type TopNavbarProps } from "../TopNavbar";
|
|
|
3
3
|
import { ChatScreen, type ChatScreenProps } from "../ChatScreen";
|
|
4
4
|
import { WorkspaceMenu } from "../WorkspaceMenu";
|
|
5
5
|
import { Button } from "../Button";
|
|
6
|
+
import { Icon } from "../Icon";
|
|
6
7
|
import { PromptInputBar } from "../PromptInputBar";
|
|
7
8
|
import type { PromptMode } from "../PromptInputBar";
|
|
9
|
+
import { ChatHistorySidebar, type ChatHistoryItem } from "../ChatHistorySidebar";
|
|
10
|
+
import { Menu, type MenuItem } from "../Menu";
|
|
8
11
|
|
|
9
12
|
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
10
13
|
|
|
@@ -51,6 +54,39 @@ export interface AppLayoutProps {
|
|
|
51
54
|
* against the iframe rather than the browser window.
|
|
52
55
|
*/
|
|
53
56
|
fillViewport?: boolean;
|
|
57
|
+
|
|
58
|
+
// ── Chat history sidebar (opt-in, folded left-edge drawer) ──────────────
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* When true, renders the collapsible chat-history sidebar at the far left
|
|
62
|
+
* edge of the layout (spanning full height, top bar included). The
|
|
63
|
+
* sidebar owns the avatar (rendered first) and the fold/unfold toggle
|
|
64
|
+
* (rendered right below it) — the top bar's own avatar nav is hidden to
|
|
65
|
+
* avoid a duplicate. Defaults to false.
|
|
66
|
+
*/
|
|
67
|
+
showHistorySidebar?: boolean;
|
|
68
|
+
/** Brand label shown in the history sidebar's header when expanded. */
|
|
69
|
+
historySidebarBrandName?: string;
|
|
70
|
+
/** Controlled open state of the history sidebar. */
|
|
71
|
+
historySidebarOpen?: boolean;
|
|
72
|
+
/** Called with the next open state whenever the fold/unfold toggle is used. */
|
|
73
|
+
onHistorySidebarOpenChange?: (open: boolean) => void;
|
|
74
|
+
/** Uncontrolled initial open state of the history sidebar. Defaults to false (folded). */
|
|
75
|
+
defaultHistorySidebarOpen?: boolean;
|
|
76
|
+
/** Recent chat entries rendered under the sidebar's "Recents" heading. Backwards-compatible alias for chatHistoryItems. */
|
|
77
|
+
historyItems?: ChatHistoryItem[];
|
|
78
|
+
/** Recent chat entries rendered under the sidebar's "Recents" heading. */
|
|
79
|
+
chatHistoryItems?: ChatHistoryItem[];
|
|
80
|
+
/** Component history entries rendered under the sidebar's components-history heading. */
|
|
81
|
+
componentHistoryItems?: ChatHistoryItem[];
|
|
82
|
+
/** Design.md request entries rendered under the sidebar's "Design.md requests" heading. Defaults to []. */
|
|
83
|
+
designMdRequestItems?: ChatHistoryItem[];
|
|
84
|
+
/** ID of the currently-active chat in the history sidebar. */
|
|
85
|
+
activeHistoryId?: string;
|
|
86
|
+
/** Called when a recent chat row is selected in the history sidebar. */
|
|
87
|
+
onSelectHistoryItem?: (id: string) => void;
|
|
88
|
+
onNewChat?: () => void;
|
|
89
|
+
|
|
54
90
|
className?: string;
|
|
55
91
|
}
|
|
56
92
|
|
|
@@ -70,53 +106,6 @@ function useIsMobile(): boolean {
|
|
|
70
106
|
return mobile;
|
|
71
107
|
}
|
|
72
108
|
|
|
73
|
-
// ─── Icons ────────────────────────────────────────────────────────────────────
|
|
74
|
-
|
|
75
|
-
const LayoutPanelIcon = () => (
|
|
76
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
77
|
-
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
78
|
-
<rect x="3" y="3" width="18" height="18" rx="2" />
|
|
79
|
-
<path d="M9 3v18" />
|
|
80
|
-
</svg>
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
const ArrowLeftIcon = () => (
|
|
84
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
85
|
-
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
86
|
-
<path d="M19 12H5" /><path d="m12 19-7-7 7-7" />
|
|
87
|
-
</svg>
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
const HomeIcon = () => (
|
|
91
|
-
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
92
|
-
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
93
|
-
<path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
|
|
94
|
-
<polyline points="9 22 9 12 15 12 15 22" />
|
|
95
|
-
</svg>
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
const ChevronDownIcon = () => (
|
|
99
|
-
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
100
|
-
strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
101
|
-
<polyline points="6 9 12 15 18 9" />
|
|
102
|
-
</svg>
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
const ChatIcon = () => (
|
|
106
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
107
|
-
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
108
|
-
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" />
|
|
109
|
-
</svg>
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
const ViewIcon = () => (
|
|
113
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
114
|
-
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
115
|
-
<circle cx="12" cy="12" r="3" />
|
|
116
|
-
<path d="M2 12s4-7 10-7 10 7 10 7-4 7-10 7-10-7-10-7z" />
|
|
117
|
-
</svg>
|
|
118
|
-
);
|
|
119
|
-
|
|
120
109
|
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
121
110
|
|
|
122
111
|
function applyWidth(els: (HTMLElement | null)[], px: number) {
|
|
@@ -133,7 +122,10 @@ function restoreTransition(els: (HTMLElement | null)[], transition: string) {
|
|
|
133
122
|
});
|
|
134
123
|
}
|
|
135
124
|
|
|
136
|
-
// ─── Avatar nav
|
|
125
|
+
// ─── Avatar nav trigger (top-bar variant, used only when the history sidebar is off) ──────
|
|
126
|
+
// Composes the shared Menu molecule in `portal` mode so the item list always
|
|
127
|
+
// paints above the top bar's animated / z-indexed chat column, regardless of
|
|
128
|
+
// overflow or stacking context.
|
|
137
129
|
|
|
138
130
|
interface AvatarNavProps {
|
|
139
131
|
initials: string;
|
|
@@ -142,125 +134,48 @@ interface AvatarNavProps {
|
|
|
142
134
|
}
|
|
143
135
|
|
|
144
136
|
const AvatarNav: React.FC<AvatarNavProps> = ({ initials, onBackToProjects, onHome }) => {
|
|
145
|
-
const [
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (!open) return;
|
|
150
|
-
const handler = (e: MouseEvent) => {
|
|
151
|
-
if (containerRef.current && !containerRef.current.contains(e.target as Node))
|
|
152
|
-
setOpen(false);
|
|
153
|
-
};
|
|
154
|
-
document.addEventListener("mousedown", handler);
|
|
155
|
-
return () => document.removeEventListener("mousedown", handler);
|
|
156
|
-
}, [open]);
|
|
157
|
-
|
|
158
|
-
React.useEffect(() => {
|
|
159
|
-
if (!open) return;
|
|
160
|
-
const handler = (e: KeyboardEvent) => { if (e.key === "Escape") setOpen(false); };
|
|
161
|
-
document.addEventListener("keydown", handler);
|
|
162
|
-
return () => document.removeEventListener("keydown", handler);
|
|
163
|
-
}, [open]);
|
|
137
|
+
const items: MenuItem[] = [
|
|
138
|
+
{ id: "back-to-projects", label: "Back to projects", icon: "arrow-left", onSelect: onBackToProjects },
|
|
139
|
+
{ id: "home", label: "Home", icon: "home", onSelect: onHome },
|
|
140
|
+
];
|
|
164
141
|
|
|
165
142
|
return (
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
className="
|
|
179
|
-
style={{ width: 32, height: 32, fontSize: 13, flexShrink: 0 }}
|
|
180
|
-
>
|
|
181
|
-
{initials}
|
|
182
|
-
</span>
|
|
183
|
-
<span className="text-muted" style={{ lineHeight: 0 }}>
|
|
184
|
-
<ChevronDownIcon />
|
|
185
|
-
</span>
|
|
186
|
-
</Button>
|
|
187
|
-
|
|
188
|
-
{open && (
|
|
189
|
-
<div
|
|
190
|
-
role="menu"
|
|
191
|
-
aria-label="Navigation"
|
|
192
|
-
className="absolute left-0 mt-xs rounded-xl bg-canvas border border-hairline-soft shadow-card py-xs overflow-hidden"
|
|
193
|
-
style={{ minWidth: 200, zIndex: 1000, top: "100%" }}
|
|
143
|
+
<Menu
|
|
144
|
+
items={items}
|
|
145
|
+
align="left"
|
|
146
|
+
portal
|
|
147
|
+
aria-label="Navigation"
|
|
148
|
+
className="flex-shrink-0"
|
|
149
|
+
trigger={
|
|
150
|
+
<Button
|
|
151
|
+
type="button"
|
|
152
|
+
variant="ghost"
|
|
153
|
+
size="sm"
|
|
154
|
+
aria-label="Open navigation menu"
|
|
155
|
+
className="!p-0 !gap-xxs !rounded-xl !bg-transparent !border-0 flex items-center"
|
|
194
156
|
>
|
|
195
|
-
<
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
variant="ghost"
|
|
199
|
-
size="sm"
|
|
200
|
-
onClick={() => { setOpen(false); onBackToProjects?.(); }}
|
|
201
|
-
className="!w-full !justify-start !rounded-none !px-md !gap-md !text-ink"
|
|
202
|
-
>
|
|
203
|
-
<span className="text-muted"><ArrowLeftIcon /></span>
|
|
204
|
-
Back to projects
|
|
205
|
-
</Button>
|
|
206
|
-
<Button
|
|
207
|
-
role="menuitem"
|
|
208
|
-
type="button"
|
|
209
|
-
variant="ghost"
|
|
210
|
-
size="sm"
|
|
211
|
-
onClick={() => { setOpen(false); onHome?.(); }}
|
|
212
|
-
className="!w-full !justify-start !rounded-none !px-md !gap-md !text-ink"
|
|
157
|
+
<span
|
|
158
|
+
className="flex items-center justify-center rounded-full bg-primary text-on-primary select-none font-weight-heading-sm"
|
|
159
|
+
style={{ width: 32, height: 32, fontSize: 13, flexShrink: 0 }}
|
|
213
160
|
>
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
161
|
+
{initials}
|
|
162
|
+
</span>
|
|
163
|
+
<span className="text-muted" style={{ lineHeight: 0 }}>
|
|
164
|
+
<Icon name="chevron-down" size={12} />
|
|
165
|
+
</span>
|
|
166
|
+
</Button>
|
|
167
|
+
}
|
|
168
|
+
/>
|
|
220
169
|
);
|
|
221
170
|
};
|
|
222
171
|
|
|
223
|
-
// ─── Concave corner ornament ──────────────────────────────────────────────────
|
|
224
|
-
|
|
225
|
-
const ConcaveCorner: React.FC = () => (
|
|
226
|
-
<div
|
|
227
|
-
aria-hidden="true"
|
|
228
|
-
style={{
|
|
229
|
-
position: "absolute",
|
|
230
|
-
top: -1,
|
|
231
|
-
left: -1,
|
|
232
|
-
width: CURVE_R + 1,
|
|
233
|
-
height: CURVE_R + 1,
|
|
234
|
-
pointerEvents: "none",
|
|
235
|
-
zIndex: 2,
|
|
236
|
-
overflow: "hidden",
|
|
237
|
-
}}
|
|
238
|
-
>
|
|
239
|
-
<svg
|
|
240
|
-
width={CURVE_R + 1}
|
|
241
|
-
height={CURVE_R + 1}
|
|
242
|
-
viewBox={`0 0 ${CURVE_R + 1} ${CURVE_R + 1}`}
|
|
243
|
-
fill="none"
|
|
244
|
-
>
|
|
245
|
-
<rect width={CURVE_R + 1} height={CURVE_R + 1} fill="var(--color-surface-soft)" />
|
|
246
|
-
<path
|
|
247
|
-
d={`M${CURVE_R + 1} 0 L${CURVE_R + 1} ${CURVE_R + 1} Q0 ${CURVE_R + 1} 0 0 Z`}
|
|
248
|
-
fill="var(--color-canvas)"
|
|
249
|
-
/>
|
|
250
|
-
</svg>
|
|
251
|
-
</div>
|
|
252
|
-
);
|
|
253
|
-
|
|
254
172
|
// ─── Right panel placeholder ──────────────────────────────────────────────────
|
|
255
173
|
|
|
256
174
|
const RightPanelPlaceholder = () => (
|
|
257
175
|
<div className="flex-1 flex flex-col items-center justify-center" style={{ minHeight: "100%" }}>
|
|
258
|
-
<
|
|
259
|
-
<
|
|
260
|
-
|
|
261
|
-
<rect x="38" y="14" width="20" height="20" rx="4" fill="currentColor" opacity="0.1" />
|
|
262
|
-
<rect x="14" y="38" width="44" height="12" rx="4" fill="currentColor" opacity="0.08" />
|
|
263
|
-
</svg>
|
|
176
|
+
<span className="text-hairline-strong mb-lg">
|
|
177
|
+
<Icon name="image-placeholder-dashed-frame" size={64} />
|
|
178
|
+
</span>
|
|
264
179
|
<p className="text-body-sm text-muted-soft">Preview will appear here</p>
|
|
265
180
|
</div>
|
|
266
181
|
);
|
|
@@ -279,6 +194,8 @@ const PromptFooter: React.FC<{ chatProps?: ChatScreenProps }> = ({ chatProps })
|
|
|
279
194
|
models={chatProps?.models}
|
|
280
195
|
selectedModelId={chatProps?.selectedModelId}
|
|
281
196
|
onModelChange={chatProps?.onModelChange}
|
|
197
|
+
suggestDesigns={chatProps?.suggestDesigns}
|
|
198
|
+
onSuggestDesignsChange={chatProps?.onSuggestDesignsChange}
|
|
282
199
|
/>
|
|
283
200
|
</div>
|
|
284
201
|
);
|
|
@@ -314,7 +231,7 @@ const MobileTabBar: React.FC<MobileTabBarProps> = ({ activePanel, onChange }) =>
|
|
|
314
231
|
active ? "!text-primary" : "!text-muted",
|
|
315
232
|
].join(" ")}
|
|
316
233
|
>
|
|
317
|
-
{panel === "chat" ?
|
|
234
|
+
<Icon name={panel === "chat" ? "chat-bubble" : "eye-view"} size={20} />
|
|
318
235
|
<span
|
|
319
236
|
className={["text-caption", active ? "font-weight-heading-sm text-primary" : "text-muted"].join(" ")}
|
|
320
237
|
style={{ textTransform: "capitalize" }}
|
|
@@ -338,6 +255,7 @@ interface MobileTopBarProps {
|
|
|
338
255
|
onBackToProjects?: () => void;
|
|
339
256
|
onHome?: () => void;
|
|
340
257
|
hideProjectName?: boolean;
|
|
258
|
+
showHistorySidebar?: boolean;
|
|
341
259
|
}
|
|
342
260
|
|
|
343
261
|
const MobileTopBar: React.FC<MobileTopBarProps> = ({
|
|
@@ -349,6 +267,7 @@ const MobileTopBar: React.FC<MobileTopBarProps> = ({
|
|
|
349
267
|
onBackToProjects,
|
|
350
268
|
onHome,
|
|
351
269
|
hideProjectName,
|
|
270
|
+
showHistorySidebar,
|
|
352
271
|
}) => (
|
|
353
272
|
<div
|
|
354
273
|
className="w-full flex flex-shrink-0 items-center px-sm gap-sm border-b border-hairline-soft bg-canvas"
|
|
@@ -356,7 +275,7 @@ const MobileTopBar: React.FC<MobileTopBarProps> = ({
|
|
|
356
275
|
>
|
|
357
276
|
{activePanel === "chat" ? (
|
|
358
277
|
<>
|
|
359
|
-
{!hideProjectName && (
|
|
278
|
+
{!hideProjectName && !showHistorySidebar && (
|
|
360
279
|
<AvatarNav
|
|
361
280
|
initials={avatarInitials}
|
|
362
281
|
onBackToProjects={onBackToProjects}
|
|
@@ -414,6 +333,18 @@ export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
|
|
|
414
333
|
defaultMobilePanel = "chat",
|
|
415
334
|
hideProjectName = false,
|
|
416
335
|
fillViewport = true,
|
|
336
|
+
showHistorySidebar = false,
|
|
337
|
+
historySidebarBrandName,
|
|
338
|
+
historySidebarOpen: historySidebarOpenProp,
|
|
339
|
+
onHistorySidebarOpenChange,
|
|
340
|
+
defaultHistorySidebarOpen = false,
|
|
341
|
+
historyItems,
|
|
342
|
+
chatHistoryItems,
|
|
343
|
+
componentHistoryItems,
|
|
344
|
+
designMdRequestItems = [],
|
|
345
|
+
activeHistoryId,
|
|
346
|
+
onSelectHistoryItem,
|
|
347
|
+
onNewChat,
|
|
417
348
|
className,
|
|
418
349
|
},
|
|
419
350
|
ref,
|
|
@@ -426,6 +357,11 @@ export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
|
|
|
426
357
|
const [chatWidth, setChatWidth] = React.useState(defaultChatWidth);
|
|
427
358
|
const [chatCollapsed, setChatCollapsed] = React.useState(false);
|
|
428
359
|
|
|
360
|
+
// History sidebar state (controlled or internal)
|
|
361
|
+
const [internalHistoryOpen, setInternalHistoryOpen] = React.useState(defaultHistorySidebarOpen);
|
|
362
|
+
const isHistoryControlled = historySidebarOpenProp !== undefined;
|
|
363
|
+
const historySidebarOpen = isHistoryControlled ? historySidebarOpenProp : internalHistoryOpen;
|
|
364
|
+
|
|
429
365
|
const topChatColRef = React.useRef<HTMLDivElement>(null);
|
|
430
366
|
const bodyChatColRef = React.useRef<HTMLDivElement>(null);
|
|
431
367
|
const topDividerRef = React.useRef<HTMLDivElement>(null);
|
|
@@ -444,57 +380,116 @@ export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
|
|
|
444
380
|
|
|
445
381
|
React.useEffect(() => { setActiveTab(rightPanelActiveTab); }, [rightPanelActiveTab]);
|
|
446
382
|
|
|
383
|
+
// Keep the drag ref in sync whenever chatWidth changes through any other
|
|
384
|
+
// path (e.g. a future controlled-width prop), so a drag that starts right
|
|
385
|
+
// after such a change measures from the right baseline.
|
|
386
|
+
React.useEffect(() => {
|
|
387
|
+
currentWidth.current = chatWidth;
|
|
388
|
+
}, [chatWidth]);
|
|
389
|
+
|
|
447
390
|
const handleTabChange = (i: number) => {
|
|
448
391
|
setActiveTab(i);
|
|
449
392
|
onRightPanelTabChange?.(i);
|
|
450
393
|
};
|
|
451
394
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
395
|
+
// Drag-to-resize the chat column. Mirrors the width across both the top
|
|
396
|
+
// bar's chat cell and the body row's chat panel (kept in lockstep via
|
|
397
|
+
// refs so the drag reads/writes DOM width directly at 60fps instead of
|
|
398
|
+
// round-tripping through React state on every mousemove), clamping to
|
|
399
|
+
// [MIN_CHAT_WIDTH, MAX_CHAT_WIDTH]. React state (`chatWidth`) is only
|
|
400
|
+
// committed once, on mouseup, so re-renders don't fight the drag.
|
|
401
|
+
const onDividerMouseDown = React.useCallback(
|
|
402
|
+
(e: React.MouseEvent<HTMLDivElement>) => {
|
|
403
|
+
if (chatCollapsed) return;
|
|
404
|
+
e.preventDefault();
|
|
405
|
+
|
|
406
|
+
const cols = [topChatColRef.current, bodyChatColRef.current];
|
|
407
|
+
const dividers = [topDividerRef.current, bodyDividerRef.current];
|
|
408
|
+
|
|
409
|
+
isDragging.current = true;
|
|
410
|
+
startX.current = e.clientX;
|
|
411
|
+
startWidth.current = currentWidth.current;
|
|
412
|
+
|
|
413
|
+
// Disable the collapse transition while dragging so width tracks the
|
|
414
|
+
// pointer 1:1 instead of easing behind it.
|
|
415
|
+
for (const el of [...cols, ...dividers]) {
|
|
416
|
+
if (el) el.style.transition = "none";
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const handleMouseMove = (moveEvent: MouseEvent) => {
|
|
420
|
+
if (!isDragging.current) return;
|
|
421
|
+
const delta = moveEvent.clientX - startX.current;
|
|
422
|
+
const next = Math.min(
|
|
423
|
+
MAX_CHAT_WIDTH,
|
|
424
|
+
Math.max(MIN_CHAT_WIDTH, startWidth.current + delta),
|
|
425
|
+
);
|
|
426
|
+
currentWidth.current = next;
|
|
427
|
+
applyWidth(cols, next);
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
const handleMouseUp = () => {
|
|
431
|
+
if (!isDragging.current) return;
|
|
432
|
+
isDragging.current = false;
|
|
433
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
434
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
435
|
+
restoreTransition([...cols, ...dividers], collapseTransition);
|
|
436
|
+
setChatWidth(currentWidth.current);
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
440
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
441
|
+
},
|
|
442
|
+
[chatCollapsed, collapseTransition],
|
|
443
|
+
);
|
|
459
444
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
445
|
+
// Coordinates the two independent fold states when "New chat" is pressed
|
|
446
|
+
// from inside the history sidebar: fold the history list back to its
|
|
447
|
+
// narrow rail, unfold the chat column if it was collapsed, make sure
|
|
448
|
+
// mobile shows the chat panel (not view/components), then let the
|
|
449
|
+
// consumer's onNewChat run (e.g. navigate to the project root).
|
|
450
|
+
const handleNewChat = React.useCallback(() => {
|
|
451
|
+
// 1. Close the old chat list — fold the history sidebar.
|
|
452
|
+
if (isHistoryControlled) {
|
|
453
|
+
onHistorySidebarOpenChange?.(false);
|
|
454
|
+
} else {
|
|
455
|
+
setInternalHistoryOpen(false);
|
|
464
456
|
}
|
|
465
457
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
currentWidth.current = next;
|
|
476
|
-
applyWidth(colNodes, next);
|
|
477
|
-
applyWidth(divNodes, 6);
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
const onUp = () => {
|
|
481
|
-
if (!isDragging.current) return;
|
|
482
|
-
isDragging.current = false;
|
|
483
|
-
document.body.style.cursor = "";
|
|
484
|
-
document.body.style.userSelect = "";
|
|
485
|
-
window.removeEventListener("mousemove", onMove);
|
|
486
|
-
window.removeEventListener("mouseup", onUp);
|
|
487
|
-
setChatWidth(currentWidth.current);
|
|
488
|
-
restoreTransition([...colNodes, ...divNodes], collapseTransition);
|
|
489
|
-
};
|
|
490
|
-
|
|
491
|
-
window.addEventListener("mousemove", onMove);
|
|
492
|
-
window.addEventListener("mouseup", onUp);
|
|
493
|
-
};
|
|
458
|
+
// 2. Open the chat area — expand the chat column if it was folded.
|
|
459
|
+
setChatCollapsed(false);
|
|
460
|
+
|
|
461
|
+
// 2b. On mobile, make sure the chat panel (not view) is what's shown.
|
|
462
|
+
setMobilePanel("chat");
|
|
463
|
+
|
|
464
|
+
// 3. Let the consumer handle the rest (e.g. navigate to project root).
|
|
465
|
+
onNewChat?.();
|
|
466
|
+
}, [isHistoryControlled, onHistorySidebarOpenChange, onNewChat]);
|
|
494
467
|
|
|
495
468
|
const renderedWidth = chatCollapsed ? COLLAPSED_RAIL_WIDTH : chatWidth;
|
|
496
469
|
const hasTabs = Array.isArray(rightPanelTabs) && rightPanelTabs.length > 0;
|
|
497
470
|
|
|
471
|
+
const historySidebar = showHistorySidebar ? (
|
|
472
|
+
<ChatHistorySidebar
|
|
473
|
+
brandName={historySidebarBrandName}
|
|
474
|
+
collapsed={!historySidebarOpen}
|
|
475
|
+
onCollapsedChange={(collapsed) => {
|
|
476
|
+
const next = !collapsed;
|
|
477
|
+
if (!isHistoryControlled) setInternalHistoryOpen(next);
|
|
478
|
+
onHistorySidebarOpenChange?.(next);
|
|
479
|
+
}}
|
|
480
|
+
historyItems={historyItems}
|
|
481
|
+
chatHistoryItems={chatHistoryItems}
|
|
482
|
+
componentHistoryItems={componentHistoryItems}
|
|
483
|
+
designMdRequestItems={designMdRequestItems}
|
|
484
|
+
activeHistoryId={activeHistoryId}
|
|
485
|
+
onSelectHistoryItem={onSelectHistoryItem}
|
|
486
|
+
onNewChat={handleNewChat}
|
|
487
|
+
avatarInitials={hideProjectName ? undefined : avatarInitials}
|
|
488
|
+
onBackToProjects={onBackToProjects}
|
|
489
|
+
onHome={onHome}
|
|
490
|
+
/>
|
|
491
|
+
) : null;
|
|
492
|
+
|
|
498
493
|
// ══════════════════════════════════════════════════════════════════════
|
|
499
494
|
// MOBILE LAYOUT
|
|
500
495
|
// ══════════════════════════════════════════════════════════════════════
|
|
@@ -502,249 +497,260 @@ export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
|
|
|
502
497
|
return (
|
|
503
498
|
<div
|
|
504
499
|
ref={ref}
|
|
505
|
-
className={["w-full flex
|
|
500
|
+
className={["w-full flex overflow-hidden bg-canvas", className].filter(Boolean).join(" ")}
|
|
506
501
|
style={{ height: rootHeight }}
|
|
507
502
|
>
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
503
|
+
{historySidebar}
|
|
504
|
+
|
|
505
|
+
<div className="flex-1 min-w-0 flex flex-col overflow-hidden">
|
|
506
|
+
<MobileTopBar
|
|
507
|
+
projectName={projectName}
|
|
508
|
+
avatarInitials={avatarInitials}
|
|
509
|
+
activePanel={mobilePanel}
|
|
510
|
+
navbarProps={navbarProps}
|
|
511
|
+
onRenameProject={onRenameProject}
|
|
512
|
+
onBackToProjects={onBackToProjects}
|
|
513
|
+
onHome={onHome}
|
|
514
|
+
hideProjectName={hideProjectName}
|
|
515
|
+
showHistorySidebar={showHistorySidebar}
|
|
516
|
+
/>
|
|
518
517
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
518
|
+
<div className="flex-1 min-h-0 overflow-hidden relative">
|
|
519
|
+
{/* Chat panel */}
|
|
520
|
+
<div
|
|
521
|
+
className="absolute inset-0 flex flex-col"
|
|
522
|
+
style={{
|
|
523
|
+
background: "var(--color-surface-soft)",
|
|
524
|
+
opacity: mobilePanel === "chat" ? 1 : 0,
|
|
525
|
+
pointerEvents: mobilePanel === "chat" ? "auto" : "none",
|
|
526
|
+
transition: "opacity 200ms ease",
|
|
527
|
+
zIndex: mobilePanel === "chat" ? 1 : 0,
|
|
528
|
+
}}
|
|
529
|
+
>
|
|
530
|
+
<ChatScreen
|
|
531
|
+
{...chatProps}
|
|
532
|
+
className="flex-1 min-h-0"
|
|
533
|
+
renderFooter={chatProps?.renderFooter ?? <PromptFooter chatProps={chatProps} />}
|
|
534
|
+
/>
|
|
535
|
+
</div>
|
|
536
|
+
|
|
537
|
+
{/* View panel */}
|
|
538
|
+
<div
|
|
539
|
+
className="absolute inset-0 flex flex-col overflow-auto"
|
|
540
|
+
style={{
|
|
541
|
+
background: "var(--color-canvas)",
|
|
542
|
+
opacity: mobilePanel === "view" ? 1 : 0,
|
|
543
|
+
pointerEvents: mobilePanel === "view" ? "auto" : "none",
|
|
544
|
+
transition: "opacity 200ms ease",
|
|
545
|
+
zIndex: mobilePanel === "view" ? 1 : 0,
|
|
546
|
+
}}
|
|
547
|
+
>
|
|
548
|
+
{rightPanel !== undefined
|
|
549
|
+
? <div className="w-full flex-1">{rightPanel}</div>
|
|
550
|
+
: <RightPanelPlaceholder />
|
|
551
|
+
}
|
|
552
|
+
</div>
|
|
536
553
|
</div>
|
|
537
554
|
|
|
538
|
-
{
|
|
539
|
-
<div
|
|
540
|
-
className="absolute inset-0 flex flex-col overflow-auto"
|
|
541
|
-
style={{
|
|
542
|
-
background: "var(--color-canvas)",
|
|
543
|
-
opacity: mobilePanel === "view" ? 1 : 0,
|
|
544
|
-
pointerEvents: mobilePanel === "view" ? "auto" : "none",
|
|
545
|
-
transition: "opacity 200ms ease",
|
|
546
|
-
zIndex: mobilePanel === "view" ? 1 : 0,
|
|
547
|
-
}}
|
|
548
|
-
>
|
|
549
|
-
{rightPanel !== undefined
|
|
550
|
-
? <div className="w-full flex-1">{rightPanel}</div>
|
|
551
|
-
: <RightPanelPlaceholder />
|
|
552
|
-
}
|
|
553
|
-
</div>
|
|
555
|
+
<MobileTabBar activePanel={mobilePanel} onChange={setMobilePanel} />
|
|
554
556
|
</div>
|
|
555
|
-
|
|
556
|
-
<MobileTabBar activePanel={mobilePanel} onChange={setMobilePanel} />
|
|
557
557
|
</div>
|
|
558
558
|
);
|
|
559
559
|
}
|
|
560
560
|
|
|
561
561
|
// ══════════════════════════════════════════════════════════════════════
|
|
562
|
-
// DESKTOP LAYOUT
|
|
562
|
+
// DESKTOP LAYOUT
|
|
563
563
|
// ══════════════════════════════════════════════════════════════════════
|
|
564
564
|
return (
|
|
565
565
|
<div
|
|
566
566
|
ref={ref}
|
|
567
|
-
className={["w-full flex
|
|
568
|
-
style={{ height: rootHeight
|
|
567
|
+
className={["w-full flex overflow-hidden", className].filter(Boolean).join(" ")}
|
|
568
|
+
style={{ height: rootHeight }}
|
|
569
569
|
>
|
|
570
|
-
{
|
|
570
|
+
{historySidebar}
|
|
571
|
+
|
|
571
572
|
<div
|
|
572
|
-
className="w-
|
|
573
|
-
style={{
|
|
573
|
+
className="flex-1 min-w-0 flex flex-col overflow-hidden"
|
|
574
|
+
style={{ background: "var(--color-surface-soft)" }}
|
|
574
575
|
>
|
|
576
|
+
{/* TOP BAR */}
|
|
575
577
|
<div
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
style={{
|
|
579
|
-
width: renderedWidth,
|
|
580
|
-
minWidth: 0,
|
|
581
|
-
transition: collapseTransition,
|
|
582
|
-
position: "relative",
|
|
583
|
-
zIndex: 500,
|
|
584
|
-
}}
|
|
578
|
+
className="w-full flex flex-shrink-0 items-center"
|
|
579
|
+
style={{ height: TOPBAR_HEIGHT, background: "var(--color-surface-soft)" }}
|
|
585
580
|
>
|
|
586
581
|
<div
|
|
587
|
-
|
|
582
|
+
ref={topChatColRef}
|
|
583
|
+
className="flex-shrink-0 h-full"
|
|
588
584
|
style={{
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
585
|
+
width: renderedWidth,
|
|
586
|
+
minWidth: 0,
|
|
587
|
+
transition: collapseTransition,
|
|
588
|
+
position: "relative",
|
|
589
|
+
zIndex: 500,
|
|
592
590
|
}}
|
|
593
591
|
>
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
<
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
592
|
+
<div
|
|
593
|
+
className="flex items-center px-sm gap-xs h-full"
|
|
594
|
+
style={{
|
|
595
|
+
opacity: chatCollapsed ? 0 : 1,
|
|
596
|
+
transition: opacityTransition,
|
|
597
|
+
pointerEvents: chatCollapsed ? "none" : "auto",
|
|
598
|
+
}}
|
|
599
|
+
>
|
|
600
|
+
{!hideProjectName && !showHistorySidebar && (
|
|
601
|
+
<AvatarNav
|
|
602
|
+
initials={avatarInitials}
|
|
603
|
+
onBackToProjects={onBackToProjects}
|
|
604
|
+
onHome={onHome}
|
|
607
605
|
/>
|
|
608
|
-
|
|
609
|
-
|
|
606
|
+
)}
|
|
607
|
+
{!hideProjectName && (
|
|
608
|
+
<div className="flex-1 min-w-0" style={{ position: "relative", zIndex: 1000 }}>
|
|
609
|
+
<WorkspaceMenu
|
|
610
|
+
workspaceName={projectName}
|
|
611
|
+
onRename={onRenameProject}
|
|
612
|
+
className="w-full"
|
|
613
|
+
/>
|
|
614
|
+
</div>
|
|
615
|
+
)}
|
|
616
|
+
</div>
|
|
610
617
|
</div>
|
|
611
|
-
</div>
|
|
612
618
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
619
|
+
<div
|
|
620
|
+
ref={topDividerRef}
|
|
621
|
+
className="flex-shrink-0"
|
|
622
|
+
style={{
|
|
623
|
+
width: chatCollapsed ? 0 : 6,
|
|
624
|
+
overflow: "hidden",
|
|
625
|
+
transition: collapseTransition,
|
|
626
|
+
}}
|
|
627
|
+
/>
|
|
622
628
|
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
>
|
|
627
|
-
<Button
|
|
628
|
-
variant="ghost"
|
|
629
|
-
size="sm"
|
|
630
|
-
aria-label={chatCollapsed ? "Expand chat panel" : "Collapse chat panel"}
|
|
631
|
-
onClick={() => setChatCollapsed((v) => !v)}
|
|
632
|
-
className="!p-xs !rounded-md flex-shrink-0"
|
|
629
|
+
<div
|
|
630
|
+
className="flex-1 flex items-center px-sm h-full gap-xs overflow-visible"
|
|
631
|
+
style={{ background: "var(--color-surface-soft)" }}
|
|
633
632
|
>
|
|
634
|
-
<
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
633
|
+
<Button
|
|
634
|
+
variant="ghost"
|
|
635
|
+
size="sm"
|
|
636
|
+
aria-label={chatCollapsed ? "Expand chat panel" : "Collapse chat panel"}
|
|
637
|
+
onClick={() => setChatCollapsed((v) => !v)}
|
|
638
|
+
className="!p-xs !rounded-md flex-shrink-0"
|
|
639
|
+
>
|
|
640
|
+
<Icon name="sidebar-panel-toggle" size={16} />
|
|
641
|
+
</Button>
|
|
642
|
+
|
|
643
|
+
{hasTabs && (
|
|
644
|
+
<nav aria-label="Panel tabs" className="flex items-center gap-xs ml-xs overflow-x-auto">
|
|
645
|
+
{rightPanelTabs.map((tab, i) => (
|
|
646
|
+
<Button
|
|
647
|
+
key={tab}
|
|
648
|
+
type="button"
|
|
649
|
+
variant={i === activeTab ? "secondary" : "ghost"}
|
|
650
|
+
size="sm"
|
|
651
|
+
onClick={() => handleTabChange(i)}
|
|
652
|
+
aria-selected={i === activeTab}
|
|
653
|
+
className={
|
|
654
|
+
i === activeTab
|
|
655
|
+
? "!bg-surface-strong !text-ink !border-hairline flex-shrink-0"
|
|
656
|
+
: "!text-muted hover:!text-ink flex-shrink-0"
|
|
657
|
+
}
|
|
658
|
+
>
|
|
659
|
+
{tab}
|
|
660
|
+
</Button>
|
|
661
|
+
))}
|
|
662
|
+
</nav>
|
|
663
|
+
)}
|
|
664
|
+
|
|
665
|
+
<div className="flex-1" />
|
|
666
|
+
|
|
667
|
+
<div className="flex-shrink-0" style={{ minWidth: "fit-content" }}>
|
|
668
|
+
<TopNavbar
|
|
669
|
+
{...navbarProps}
|
|
670
|
+
className="!border-0 !py-0 !px-0 !bg-transparent w-auto"
|
|
671
|
+
/>
|
|
672
|
+
</div>
|
|
666
673
|
</div>
|
|
667
674
|
</div>
|
|
668
|
-
</div>
|
|
669
675
|
|
|
670
|
-
|
|
671
|
-
|
|
676
|
+
{/* BODY ROW */}
|
|
677
|
+
<div className="flex flex-1 min-h-0 overflow-hidden">
|
|
672
678
|
|
|
673
|
-
|
|
674
|
-
<div
|
|
675
|
-
ref={bodyChatColRef}
|
|
676
|
-
className="flex flex-col flex-shrink-0 overflow-hidden"
|
|
677
|
-
style={{
|
|
678
|
-
width: renderedWidth,
|
|
679
|
-
minWidth: 0,
|
|
680
|
-
background: "var(--color-surface-soft)",
|
|
681
|
-
transition: collapseTransition,
|
|
682
|
-
}}
|
|
683
|
-
>
|
|
679
|
+
{/* Chat panel */}
|
|
684
680
|
<div
|
|
685
|
-
|
|
681
|
+
ref={bodyChatColRef}
|
|
682
|
+
className="flex flex-col flex-shrink-0 overflow-hidden"
|
|
686
683
|
style={{
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
684
|
+
width: renderedWidth,
|
|
685
|
+
minWidth: 0,
|
|
686
|
+
background: "var(--color-surface-soft)",
|
|
687
|
+
transition: collapseTransition,
|
|
690
688
|
}}
|
|
691
689
|
>
|
|
692
|
-
<
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
690
|
+
<div
|
|
691
|
+
className="flex flex-col flex-1 min-h-0 overflow-hidden"
|
|
692
|
+
style={{
|
|
693
|
+
opacity: chatCollapsed ? 0 : 1,
|
|
694
|
+
transition: opacityTransition,
|
|
695
|
+
pointerEvents: chatCollapsed ? "none" : "auto",
|
|
696
|
+
}}
|
|
697
|
+
>
|
|
698
|
+
<ChatScreen
|
|
699
|
+
{...chatProps}
|
|
700
|
+
className={["flex-1 min-h-0", chatProps?.className].filter(Boolean).join(" ")}
|
|
701
|
+
renderFooter={chatProps?.renderFooter ?? <PromptFooter chatProps={chatProps} />}
|
|
702
|
+
/>
|
|
703
|
+
</div>
|
|
697
704
|
</div>
|
|
698
|
-
</div>
|
|
699
705
|
|
|
700
|
-
|
|
701
|
-
<div
|
|
702
|
-
ref={bodyDividerRef}
|
|
703
|
-
role="separator"
|
|
704
|
-
aria-label="Resize chat panel"
|
|
705
|
-
aria-orientation="vertical"
|
|
706
|
-
onMouseDown={onDividerMouseDown}
|
|
707
|
-
className="flex-shrink-0 flex items-center justify-center group"
|
|
708
|
-
style={{
|
|
709
|
-
width: chatCollapsed ? 0 : 6,
|
|
710
|
-
cursor: chatCollapsed ? "default" : "col-resize",
|
|
711
|
-
transition: collapseTransition,
|
|
712
|
-
overflow: "hidden",
|
|
713
|
-
position: "relative",
|
|
714
|
-
zIndex: 10,
|
|
715
|
-
background: "transparent",
|
|
716
|
-
}}
|
|
717
|
-
>
|
|
706
|
+
{/* Drag handle */}
|
|
718
707
|
<div
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
708
|
+
ref={bodyDividerRef}
|
|
709
|
+
role="separator"
|
|
710
|
+
aria-label="Resize chat panel"
|
|
711
|
+
aria-orientation="vertical"
|
|
712
|
+
onMouseDown={onDividerMouseDown}
|
|
713
|
+
className="flex-shrink-0 flex items-center justify-center group"
|
|
714
|
+
style={{
|
|
715
|
+
width: chatCollapsed ? 0 : 6,
|
|
716
|
+
cursor: chatCollapsed ? "default" : "col-resize",
|
|
717
|
+
transition: collapseTransition,
|
|
718
|
+
overflow: "hidden",
|
|
719
|
+
position: "relative",
|
|
720
|
+
zIndex: 10,
|
|
721
|
+
background: "transparent",
|
|
722
|
+
}}
|
|
723
|
+
>
|
|
724
|
+
<div
|
|
725
|
+
className="rounded-full bg-hairline-strong group-hover:bg-primary transition-colors duration-150"
|
|
726
|
+
style={{ width: 3, height: 40, opacity: 0.4, flexShrink: 0 }}
|
|
727
|
+
/>
|
|
728
|
+
</div>
|
|
723
729
|
|
|
724
|
-
|
|
725
|
-
<div
|
|
726
|
-
className="flex-1 min-w-0 flex flex-col overflow-hidden"
|
|
727
|
-
style={{
|
|
728
|
-
background: "var(--color-canvas)",
|
|
729
|
-
borderRadius: `${CURVE_R}px ${CURVE_R}px 0 0`,
|
|
730
|
-
marginRight: PANEL_GAP_RIGHT,
|
|
731
|
-
border: "1px solid var(--color-hairline)",
|
|
732
|
-
borderBottom: "none",
|
|
733
|
-
position: "relative",
|
|
734
|
-
}}
|
|
735
|
-
>
|
|
736
|
-
<ConcaveCorner />
|
|
730
|
+
{/* White canvas card */}
|
|
737
731
|
<div
|
|
738
|
-
className="flex-1 min-
|
|
739
|
-
style={{
|
|
732
|
+
className="flex-1 min-w-0 flex flex-col overflow-hidden"
|
|
733
|
+
style={{
|
|
734
|
+
background: "var(--color-canvas)",
|
|
735
|
+
borderRadius: `${CURVE_R}px ${CURVE_R}px 0 0`,
|
|
736
|
+
marginRight: PANEL_GAP_RIGHT,
|
|
737
|
+
border: "1px solid var(--color-hairline)",
|
|
738
|
+
borderBottom: "none",
|
|
739
|
+
position: "relative",
|
|
740
|
+
}}
|
|
740
741
|
>
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
:
|
|
744
|
-
|
|
742
|
+
<div
|
|
743
|
+
className="flex-1 min-h-0 overflow-auto flex flex-col"
|
|
744
|
+
style={{ position: "relative", zIndex: 0 }}
|
|
745
|
+
>
|
|
746
|
+
{rightPanel !== undefined
|
|
747
|
+
? <div className="w-full flex-1">{rightPanel}</div>
|
|
748
|
+
: <RightPanelPlaceholder />
|
|
749
|
+
}
|
|
750
|
+
</div>
|
|
745
751
|
</div>
|
|
746
|
-
</div>
|
|
747
752
|
|
|
753
|
+
</div>
|
|
748
754
|
</div>
|
|
749
755
|
</div>
|
|
750
756
|
);
|