@designa8/vibedesign-v6 1.6.7
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 +66 -0
- package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
- package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
- package/dist/index.cjs +3231 -0
- package/dist/index.js +3201 -0
- package/dist/styles.css +1810 -0
- package/package.json +109 -0
- package/src/atoms/AppLayout/AppLayout.tsx +537 -0
- package/src/atoms/AppLayout/index.ts +2 -0
- package/src/atoms/AppLayout/preview.tsx +75 -0
- package/src/atoms/AppSidebar/AppSidebar.tsx +399 -0
- package/src/atoms/AppSidebar/index.ts +2 -0
- package/src/atoms/AppSidebar/preview.tsx +214 -0
- package/src/atoms/AuthScreen/AuthScreen.tsx +226 -0
- package/src/atoms/AuthScreen/index.ts +2 -0
- package/src/atoms/AuthScreen/preview.tsx +10 -0
- package/src/atoms/Button/Button.tsx +71 -0
- package/src/atoms/Button/index.ts +2 -0
- package/src/atoms/Button/preview.tsx +71 -0
- package/src/atoms/ChatScreen/ChatScreen.tsx +629 -0
- package/src/atoms/ChatScreen/index.ts +2 -0
- package/src/atoms/ChatScreen/preview.tsx +239 -0
- package/src/atoms/Chip/Chip.tsx +121 -0
- package/src/atoms/Chip/index.ts +2 -0
- package/src/atoms/Chip/preview.tsx +99 -0
- package/src/atoms/FilterTabBar/FilterTabBar.tsx +95 -0
- package/src/atoms/FilterTabBar/index.ts +2 -0
- package/src/atoms/FilterTabBar/preview.tsx +92 -0
- package/src/atoms/Input/Input.tsx +139 -0
- package/src/atoms/Input/index.ts +2 -0
- package/src/atoms/Input/preview.tsx +97 -0
- package/src/atoms/Modal/Modal.tsx +144 -0
- package/src/atoms/Modal/index.ts +2 -0
- package/src/atoms/Modal/preview.tsx +111 -0
- package/src/atoms/NavItem/NavItem.tsx +316 -0
- package/src/atoms/NavItem/index.ts +2 -0
- package/src/atoms/NavItem/preview.tsx +125 -0
- package/src/atoms/PromptInputBar/PromptInputBar.tsx +626 -0
- package/src/atoms/PromptInputBar/index.ts +2 -0
- package/src/atoms/PromptInputBar/preview.tsx +85 -0
- package/src/atoms/TopNavbar/TopNavbar.tsx +400 -0
- package/src/atoms/TopNavbar/index.ts +2 -0
- package/src/atoms/TopNavbar/preview.tsx +117 -0
- package/src/atoms/UpgradeCard/UpgradeCard.tsx +65 -0
- package/src/atoms/UpgradeCard/index.ts +2 -0
- package/src/atoms/UpgradeCard/preview.tsx +25 -0
- package/src/atoms/WorkspaceMenu/WorkspaceMenu.tsx +216 -0
- package/src/atoms/WorkspaceMenu/index.ts +2 -0
- package/src/atoms/WorkspaceMenu/preview.tsx +44 -0
- package/src/index.ts +16 -0
- package/src/tokens.css +165 -0
package/package.json
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@designa8/vibedesign-v6",
|
|
3
|
+
"version": "1.6.7",
|
|
4
|
+
"description": "Design system \"Plasma Design System\" generated by atom-server.",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.cjs",
|
|
12
|
+
"types": "./src/index.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"dist/styles.css"
|
|
17
|
+
],
|
|
18
|
+
"style": "dist/styles.css",
|
|
19
|
+
"files": [
|
|
20
|
+
"src",
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": ">=18.0.0",
|
|
26
|
+
"react-dom": ">=18.0.0"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"design-system",
|
|
30
|
+
"react",
|
|
31
|
+
"atoms",
|
|
32
|
+
"plasma",
|
|
33
|
+
"vibedesign-v6"
|
|
34
|
+
],
|
|
35
|
+
"atomsDesign": {
|
|
36
|
+
"atoms": [
|
|
37
|
+
{
|
|
38
|
+
"name": "AppLayout",
|
|
39
|
+
"kind": "Organism",
|
|
40
|
+
"description": null
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "AppSidebar",
|
|
44
|
+
"kind": "Organism",
|
|
45
|
+
"description": null
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "AuthScreen",
|
|
49
|
+
"kind": "Organism",
|
|
50
|
+
"description": null
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "Button",
|
|
54
|
+
"kind": "Atom",
|
|
55
|
+
"description": null
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "ChatScreen",
|
|
59
|
+
"kind": "Organism",
|
|
60
|
+
"description": null
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "Chip",
|
|
64
|
+
"kind": "Atom",
|
|
65
|
+
"description": null
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "FilterTabBar",
|
|
69
|
+
"kind": "Atom",
|
|
70
|
+
"description": null
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "Input",
|
|
74
|
+
"kind": "Atom",
|
|
75
|
+
"description": null
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "Modal",
|
|
79
|
+
"kind": "Atom",
|
|
80
|
+
"description": null
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "NavItem",
|
|
84
|
+
"kind": "Atom",
|
|
85
|
+
"description": null
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "PromptInputBar",
|
|
89
|
+
"kind": "Molecule",
|
|
90
|
+
"description": null
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "TopNavbar",
|
|
94
|
+
"kind": "Organism",
|
|
95
|
+
"description": null
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "UpgradeCard",
|
|
99
|
+
"kind": "Molecule",
|
|
100
|
+
"description": null
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "WorkspaceMenu",
|
|
104
|
+
"kind": "Atom",
|
|
105
|
+
"description": null
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TopNavbar, type TopNavbarProps } from "../TopNavbar";
|
|
3
|
+
import { ChatScreen, type ChatScreenProps } from "../ChatScreen";
|
|
4
|
+
import { WorkspaceMenu } from "../WorkspaceMenu";
|
|
5
|
+
import { Button } from "../Button";
|
|
6
|
+
import { PromptInputBar } from "../PromptInputBar";
|
|
7
|
+
import type { PromptMode } from "../PromptInputBar";
|
|
8
|
+
|
|
9
|
+
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
const TOPBAR_HEIGHT = 48;
|
|
12
|
+
const CURVE_R = 16;
|
|
13
|
+
const MIN_CHAT_WIDTH = 260;
|
|
14
|
+
const MAX_CHAT_WIDTH = 600;
|
|
15
|
+
const COLLAPSE_DURATION = 250; // ms — used only for the toggle animation
|
|
16
|
+
/** Width of the grey rail visible when chat is fully collapsed */
|
|
17
|
+
const COLLAPSED_RAIL_WIDTH = 12;
|
|
18
|
+
/**
|
|
19
|
+
* The gap between the right panel card's top-right corner and the viewport edge.
|
|
20
|
+
* Matches CURVE_R so both corners feel balanced.
|
|
21
|
+
*/
|
|
22
|
+
const PANEL_GAP_RIGHT = CURVE_R;
|
|
23
|
+
|
|
24
|
+
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
export interface AppLayoutProps {
|
|
27
|
+
navbarProps?: TopNavbarProps;
|
|
28
|
+
chatProps?: ChatScreenProps;
|
|
29
|
+
rightPanel?: React.ReactNode;
|
|
30
|
+
rightPanelTabs?: string[];
|
|
31
|
+
rightPanelActiveTab?: number;
|
|
32
|
+
onRightPanelTabChange?: (index: number) => void;
|
|
33
|
+
defaultChatWidth?: number;
|
|
34
|
+
projectName?: string;
|
|
35
|
+
onRenameProject?: () => void;
|
|
36
|
+
onBackToProjects?: () => void;
|
|
37
|
+
onHome?: () => void;
|
|
38
|
+
avatarInitials?: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ─── Icons ────────────────────────────────────────────────────────────────────
|
|
43
|
+
|
|
44
|
+
const LayoutPanelIcon = () => (
|
|
45
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
46
|
+
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
47
|
+
<rect x="3" y="3" width="18" height="18" rx="2" />
|
|
48
|
+
<path d="M9 3v18" />
|
|
49
|
+
</svg>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const ArrowLeftIcon = () => (
|
|
53
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
54
|
+
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
55
|
+
<path d="M19 12H5" /><path d="m12 19-7-7 7-7" />
|
|
56
|
+
</svg>
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const HomeIcon = () => (
|
|
60
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
61
|
+
strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
62
|
+
<path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
|
|
63
|
+
<polyline points="9 22 9 12 15 12 15 22" />
|
|
64
|
+
</svg>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const ChevronDownIcon = () => (
|
|
68
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
69
|
+
strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
70
|
+
<polyline points="6 9 12 15 18 9" />
|
|
71
|
+
</svg>
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
75
|
+
|
|
76
|
+
function applyWidth(els: (HTMLElement | null)[], px: number) {
|
|
77
|
+
for (const el of els) {
|
|
78
|
+
if (el) el.style.width = `${px}px`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function restoreTransition(els: (HTMLElement | null)[], transition: string) {
|
|
83
|
+
requestAnimationFrame(() => {
|
|
84
|
+
for (const el of els) {
|
|
85
|
+
if (el) el.style.transition = transition;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ─── Avatar nav dropdown ──────────────────────────────────────────────────────
|
|
91
|
+
|
|
92
|
+
interface AvatarNavProps {
|
|
93
|
+
initials: string;
|
|
94
|
+
onBackToProjects?: () => void;
|
|
95
|
+
onHome?: () => void;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const AvatarNav: React.FC<AvatarNavProps> = ({ initials, onBackToProjects, onHome }) => {
|
|
99
|
+
const [open, setOpen] = React.useState(false);
|
|
100
|
+
const containerRef = React.useRef<HTMLDivElement>(null);
|
|
101
|
+
|
|
102
|
+
React.useEffect(() => {
|
|
103
|
+
if (!open) return;
|
|
104
|
+
const handler = (e: MouseEvent) => {
|
|
105
|
+
if (containerRef.current && !containerRef.current.contains(e.target as Node))
|
|
106
|
+
setOpen(false);
|
|
107
|
+
};
|
|
108
|
+
document.addEventListener("mousedown", handler);
|
|
109
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
110
|
+
}, [open]);
|
|
111
|
+
|
|
112
|
+
React.useEffect(() => {
|
|
113
|
+
if (!open) return;
|
|
114
|
+
const handler = (e: KeyboardEvent) => { if (e.key === "Escape") setOpen(false); };
|
|
115
|
+
document.addEventListener("keydown", handler);
|
|
116
|
+
return () => document.removeEventListener("keydown", handler);
|
|
117
|
+
}, [open]);
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<div ref={containerRef} className="relative flex-shrink-0" style={{ zIndex: 1000 }}>
|
|
121
|
+
<Button
|
|
122
|
+
type="button"
|
|
123
|
+
variant="ghost"
|
|
124
|
+
size="sm"
|
|
125
|
+
aria-label="Open navigation menu"
|
|
126
|
+
aria-haspopup="menu"
|
|
127
|
+
aria-expanded={open}
|
|
128
|
+
onClick={() => setOpen((v) => !v)}
|
|
129
|
+
className="!p-0 !gap-xxs !rounded-xl !bg-transparent !border-0 flex items-center"
|
|
130
|
+
>
|
|
131
|
+
<span
|
|
132
|
+
className="flex items-center justify-center rounded-full bg-primary text-on-primary select-none font-weight-heading-sm"
|
|
133
|
+
style={{ width: 32, height: 32, fontSize: 13, flexShrink: 0 }}
|
|
134
|
+
>
|
|
135
|
+
{initials}
|
|
136
|
+
</span>
|
|
137
|
+
<span className="text-muted" style={{ lineHeight: 0 }}>
|
|
138
|
+
<ChevronDownIcon />
|
|
139
|
+
</span>
|
|
140
|
+
</Button>
|
|
141
|
+
|
|
142
|
+
{open && (
|
|
143
|
+
<div
|
|
144
|
+
role="menu"
|
|
145
|
+
aria-label="Navigation"
|
|
146
|
+
className="absolute left-0 mt-xs rounded-xl bg-canvas border border-hairline-soft shadow-card py-xs"
|
|
147
|
+
style={{ minWidth: 200, zIndex: 1000, top: "100%" }}
|
|
148
|
+
>
|
|
149
|
+
<Button
|
|
150
|
+
role="menuitem"
|
|
151
|
+
type="button"
|
|
152
|
+
variant="ghost"
|
|
153
|
+
size="sm"
|
|
154
|
+
onClick={() => { setOpen(false); onBackToProjects?.(); }}
|
|
155
|
+
className="!w-full !justify-start !rounded-none !px-md !gap-md !text-ink"
|
|
156
|
+
>
|
|
157
|
+
<span className="text-muted"><ArrowLeftIcon /></span>
|
|
158
|
+
Back to projects
|
|
159
|
+
</Button>
|
|
160
|
+
<Button
|
|
161
|
+
role="menuitem"
|
|
162
|
+
type="button"
|
|
163
|
+
variant="ghost"
|
|
164
|
+
size="sm"
|
|
165
|
+
onClick={() => { setOpen(false); onHome?.(); }}
|
|
166
|
+
className="!w-full !justify-start !rounded-none !px-md !gap-md !text-ink"
|
|
167
|
+
>
|
|
168
|
+
<span className="text-muted"><HomeIcon /></span>
|
|
169
|
+
Home
|
|
170
|
+
</Button>
|
|
171
|
+
</div>
|
|
172
|
+
)}
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// ─── Concave corner ornament ──────────────────────────────────────────────────
|
|
178
|
+
//
|
|
179
|
+
// Sits over the top-left join between the surface-soft background and the
|
|
180
|
+
// white canvas card. It paints surface-soft first, then carves the quarter-
|
|
181
|
+
// circle out in canvas white — so the card's border-t / border-l are hidden
|
|
182
|
+
// exactly at the corner, giving a seamless concave notch.
|
|
183
|
+
|
|
184
|
+
const ConcaveCorner: React.FC = () => (
|
|
185
|
+
<div
|
|
186
|
+
aria-hidden="true"
|
|
187
|
+
style={{
|
|
188
|
+
position: "absolute",
|
|
189
|
+
top: -1, // cover the 1px border exactly
|
|
190
|
+
left: -1,
|
|
191
|
+
width: CURVE_R + 1,
|
|
192
|
+
height: CURVE_R + 1,
|
|
193
|
+
pointerEvents: "none",
|
|
194
|
+
zIndex: 2, // above the border
|
|
195
|
+
overflow: "hidden",
|
|
196
|
+
}}
|
|
197
|
+
>
|
|
198
|
+
<svg
|
|
199
|
+
width={CURVE_R + 1}
|
|
200
|
+
height={CURVE_R + 1}
|
|
201
|
+
viewBox={`0 0 ${CURVE_R + 1} ${CURVE_R + 1}`}
|
|
202
|
+
fill="none"
|
|
203
|
+
>
|
|
204
|
+
{/* surface-soft fill that bleeds over the border */}
|
|
205
|
+
<rect width={CURVE_R + 1} height={CURVE_R + 1} fill="var(--color-surface-soft)" />
|
|
206
|
+
{/* canvas quarter-circle cutout */}
|
|
207
|
+
<path
|
|
208
|
+
d={`M${CURVE_R + 1} 0 L${CURVE_R + 1} ${CURVE_R + 1} Q0 ${CURVE_R + 1} 0 0 Z`}
|
|
209
|
+
fill="var(--color-canvas)"
|
|
210
|
+
/>
|
|
211
|
+
</svg>
|
|
212
|
+
</div>
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
// ─── Right panel placeholder ──────────────────────────────────────────────────
|
|
216
|
+
|
|
217
|
+
const RightPanelPlaceholder = () => (
|
|
218
|
+
<div className="flex-1 flex flex-col items-center justify-center" style={{ minHeight: "100%" }}>
|
|
219
|
+
<svg width="64" height="64" viewBox="0 0 72 72" fill="none" className="text-hairline-strong mb-lg" aria-hidden="true">
|
|
220
|
+
<rect x="4" y="4" width="64" height="64" rx="10" stroke="currentColor" strokeWidth="2.5" strokeDasharray="6 4" />
|
|
221
|
+
<rect x="14" y="14" width="20" height="20" rx="4" fill="currentColor" opacity="0.15" />
|
|
222
|
+
<rect x="38" y="14" width="20" height="20" rx="4" fill="currentColor" opacity="0.1" />
|
|
223
|
+
<rect x="14" y="38" width="44" height="12" rx="4" fill="currentColor" opacity="0.08" />
|
|
224
|
+
</svg>
|
|
225
|
+
<p className="text-body-sm text-muted-soft">Preview will appear here</p>
|
|
226
|
+
</div>
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
// ─── Internal prompt footer ───────────────────────────────────────────────────
|
|
230
|
+
|
|
231
|
+
const PromptFooter: React.FC<{ chatProps?: ChatScreenProps }> = ({ chatProps }) => {
|
|
232
|
+
const [mode, setMode] = React.useState<PromptMode>("Build");
|
|
233
|
+
return (
|
|
234
|
+
<div className="w-full px-md pb-md pt-sm" style={{ background: "var(--color-surface-soft)" }}>
|
|
235
|
+
<PromptInputBar
|
|
236
|
+
placeholder={chatProps?.placeholder ?? "Ask Lovable…"}
|
|
237
|
+
mode={mode}
|
|
238
|
+
onModeChange={setMode}
|
|
239
|
+
onSend={chatProps?.onSend}
|
|
240
|
+
models={chatProps?.models}
|
|
241
|
+
selectedModelId={chatProps?.selectedModelId}
|
|
242
|
+
onModelChange={chatProps?.onModelChange}
|
|
243
|
+
/>
|
|
244
|
+
</div>
|
|
245
|
+
);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// ─── Main Component ───────────────────────────────────────────────────────────
|
|
249
|
+
|
|
250
|
+
export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
|
|
251
|
+
(
|
|
252
|
+
{
|
|
253
|
+
navbarProps,
|
|
254
|
+
chatProps,
|
|
255
|
+
rightPanel,
|
|
256
|
+
rightPanelTabs = [],
|
|
257
|
+
rightPanelActiveTab = 0,
|
|
258
|
+
onRightPanelTabChange,
|
|
259
|
+
defaultChatWidth = 340,
|
|
260
|
+
projectName = "My Project",
|
|
261
|
+
onRenameProject,
|
|
262
|
+
onBackToProjects,
|
|
263
|
+
onHome,
|
|
264
|
+
avatarInitials = "A",
|
|
265
|
+
className,
|
|
266
|
+
},
|
|
267
|
+
ref,
|
|
268
|
+
) => {
|
|
269
|
+
const [activeTab, setActiveTab] = React.useState(rightPanelActiveTab);
|
|
270
|
+
const [chatWidth, setChatWidth] = React.useState(defaultChatWidth);
|
|
271
|
+
const [chatCollapsed, setChatCollapsed] = React.useState(false);
|
|
272
|
+
|
|
273
|
+
const topChatColRef = React.useRef<HTMLDivElement>(null);
|
|
274
|
+
const bodyChatColRef = React.useRef<HTMLDivElement>(null);
|
|
275
|
+
const topDividerRef = React.useRef<HTMLDivElement>(null);
|
|
276
|
+
const bodyDividerRef = React.useRef<HTMLDivElement>(null);
|
|
277
|
+
|
|
278
|
+
const isDragging = React.useRef(false);
|
|
279
|
+
const startX = React.useRef(0);
|
|
280
|
+
const startWidth = React.useRef(defaultChatWidth);
|
|
281
|
+
const currentWidth = React.useRef(defaultChatWidth);
|
|
282
|
+
|
|
283
|
+
const collapseTransition = `width ${COLLAPSE_DURATION}ms cubic-bezier(0.4,0,0.2,1)`;
|
|
284
|
+
const opacityTransition = `opacity ${COLLAPSE_DURATION}ms ease`;
|
|
285
|
+
|
|
286
|
+
React.useEffect(() => { setActiveTab(rightPanelActiveTab); }, [rightPanelActiveTab]);
|
|
287
|
+
|
|
288
|
+
const handleTabChange = (i: number) => {
|
|
289
|
+
setActiveTab(i);
|
|
290
|
+
onRightPanelTabChange?.(i);
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const onDividerMouseDown = (e: React.MouseEvent) => {
|
|
294
|
+
if (chatCollapsed) return;
|
|
295
|
+
e.preventDefault();
|
|
296
|
+
|
|
297
|
+
isDragging.current = true;
|
|
298
|
+
startX.current = e.clientX;
|
|
299
|
+
startWidth.current = currentWidth.current;
|
|
300
|
+
|
|
301
|
+
const colNodes = [topChatColRef.current, bodyChatColRef.current];
|
|
302
|
+
const divNodes = [topDividerRef.current, bodyDividerRef.current];
|
|
303
|
+
for (const el of [...colNodes, ...divNodes]) {
|
|
304
|
+
if (el) el.style.transition = "none";
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
document.body.style.cursor = "col-resize";
|
|
308
|
+
document.body.style.userSelect = "none";
|
|
309
|
+
|
|
310
|
+
const onMove = (ev: MouseEvent) => {
|
|
311
|
+
if (!isDragging.current) return;
|
|
312
|
+
const next = Math.min(
|
|
313
|
+
MAX_CHAT_WIDTH,
|
|
314
|
+
Math.max(MIN_CHAT_WIDTH, startWidth.current + ev.clientX - startX.current),
|
|
315
|
+
);
|
|
316
|
+
currentWidth.current = next;
|
|
317
|
+
applyWidth(colNodes, next);
|
|
318
|
+
applyWidth(divNodes, 6);
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const onUp = () => {
|
|
322
|
+
if (!isDragging.current) return;
|
|
323
|
+
isDragging.current = false;
|
|
324
|
+
document.body.style.cursor = "";
|
|
325
|
+
document.body.style.userSelect = "";
|
|
326
|
+
window.removeEventListener("mousemove", onMove);
|
|
327
|
+
window.removeEventListener("mouseup", onUp);
|
|
328
|
+
setChatWidth(currentWidth.current);
|
|
329
|
+
restoreTransition([...colNodes, ...divNodes], collapseTransition);
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
window.addEventListener("mousemove", onMove);
|
|
333
|
+
window.addEventListener("mouseup", onUp);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const renderedWidth = chatCollapsed ? COLLAPSED_RAIL_WIDTH : chatWidth;
|
|
337
|
+
const hasTabs = Array.isArray(rightPanelTabs) && rightPanelTabs.length > 0;
|
|
338
|
+
|
|
339
|
+
return (
|
|
340
|
+
<div
|
|
341
|
+
ref={ref}
|
|
342
|
+
className={["w-full flex flex-col overflow-hidden", className].filter(Boolean).join(" ")}
|
|
343
|
+
style={{ height: "100vh", background: "var(--color-surface-soft)" }}
|
|
344
|
+
>
|
|
345
|
+
{/* ══════════════════════════════════════════════════════════════
|
|
346
|
+
TOP BAR
|
|
347
|
+
══════════════════════════════════════════════════════════════ */}
|
|
348
|
+
<div
|
|
349
|
+
className="w-full flex flex-shrink-0 items-center"
|
|
350
|
+
style={{ height: TOPBAR_HEIGHT, background: "var(--color-surface-soft)" }}
|
|
351
|
+
>
|
|
352
|
+
<div
|
|
353
|
+
ref={topChatColRef}
|
|
354
|
+
className="flex-shrink-0 h-full"
|
|
355
|
+
style={{
|
|
356
|
+
width: renderedWidth,
|
|
357
|
+
minWidth: 0,
|
|
358
|
+
transition: collapseTransition,
|
|
359
|
+
position: "relative",
|
|
360
|
+
zIndex: 500,
|
|
361
|
+
}}
|
|
362
|
+
>
|
|
363
|
+
<div
|
|
364
|
+
className="flex items-center px-sm gap-sm h-full"
|
|
365
|
+
style={{
|
|
366
|
+
opacity: chatCollapsed ? 0 : 1,
|
|
367
|
+
transition: opacityTransition,
|
|
368
|
+
pointerEvents: chatCollapsed ? "none" : "auto",
|
|
369
|
+
}}
|
|
370
|
+
>
|
|
371
|
+
<AvatarNav
|
|
372
|
+
initials={avatarInitials}
|
|
373
|
+
onBackToProjects={onBackToProjects}
|
|
374
|
+
onHome={onHome}
|
|
375
|
+
/>
|
|
376
|
+
<div className="flex-1 min-w-0" style={{ position: "relative", zIndex: 1000 }}>
|
|
377
|
+
<WorkspaceMenu
|
|
378
|
+
workspaceName={projectName}
|
|
379
|
+
onRename={onRenameProject}
|
|
380
|
+
className="w-full"
|
|
381
|
+
/>
|
|
382
|
+
</div>
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
|
|
386
|
+
<div
|
|
387
|
+
ref={topDividerRef}
|
|
388
|
+
className="flex-shrink-0"
|
|
389
|
+
style={{
|
|
390
|
+
width: chatCollapsed ? 0 : 6,
|
|
391
|
+
overflow: "hidden",
|
|
392
|
+
transition: collapseTransition,
|
|
393
|
+
}}
|
|
394
|
+
/>
|
|
395
|
+
|
|
396
|
+
<div
|
|
397
|
+
className="flex-1 flex items-center px-sm h-full gap-xs overflow-visible"
|
|
398
|
+
style={{ background: "var(--color-surface-soft)" }}
|
|
399
|
+
>
|
|
400
|
+
<Button
|
|
401
|
+
variant="ghost"
|
|
402
|
+
size="sm"
|
|
403
|
+
aria-label={chatCollapsed ? "Expand chat panel" : "Collapse chat panel"}
|
|
404
|
+
onClick={() => setChatCollapsed((v) => !v)}
|
|
405
|
+
className="!p-xs !rounded-md flex-shrink-0"
|
|
406
|
+
>
|
|
407
|
+
<LayoutPanelIcon />
|
|
408
|
+
</Button>
|
|
409
|
+
|
|
410
|
+
{hasTabs && (
|
|
411
|
+
<nav aria-label="Panel tabs" className="flex items-center gap-xs ml-xs overflow-x-auto">
|
|
412
|
+
{rightPanelTabs.map((tab, i) => (
|
|
413
|
+
<Button
|
|
414
|
+
key={tab}
|
|
415
|
+
type="button"
|
|
416
|
+
variant={i === activeTab ? "secondary" : "ghost"}
|
|
417
|
+
size="sm"
|
|
418
|
+
onClick={() => handleTabChange(i)}
|
|
419
|
+
aria-selected={i === activeTab}
|
|
420
|
+
className={
|
|
421
|
+
i === activeTab
|
|
422
|
+
? "!bg-surface-strong !text-ink !border-hairline flex-shrink-0"
|
|
423
|
+
: "!text-muted hover:!text-ink flex-shrink-0"
|
|
424
|
+
}
|
|
425
|
+
>
|
|
426
|
+
{tab}
|
|
427
|
+
</Button>
|
|
428
|
+
))}
|
|
429
|
+
</nav>
|
|
430
|
+
)}
|
|
431
|
+
|
|
432
|
+
<div className="flex-1" />
|
|
433
|
+
|
|
434
|
+
<div className="flex-shrink-0" style={{ minWidth: "fit-content" }}>
|
|
435
|
+
<TopNavbar
|
|
436
|
+
{...navbarProps}
|
|
437
|
+
className="!border-0 !py-0 !px-0 !bg-transparent w-auto"
|
|
438
|
+
/>
|
|
439
|
+
</div>
|
|
440
|
+
</div>
|
|
441
|
+
</div>
|
|
442
|
+
|
|
443
|
+
{/* ══════════════════════════════════════════════════════════════
|
|
444
|
+
BODY ROW
|
|
445
|
+
══════════════════════════════════════════════════════════════ */}
|
|
446
|
+
<div className="flex flex-1 min-h-0 overflow-hidden">
|
|
447
|
+
|
|
448
|
+
{/* Chat panel body */}
|
|
449
|
+
<div
|
|
450
|
+
ref={bodyChatColRef}
|
|
451
|
+
className="flex flex-col flex-shrink-0 overflow-hidden"
|
|
452
|
+
style={{
|
|
453
|
+
width: renderedWidth,
|
|
454
|
+
minWidth: 0,
|
|
455
|
+
background: "var(--color-surface-soft)",
|
|
456
|
+
transition: collapseTransition,
|
|
457
|
+
}}
|
|
458
|
+
>
|
|
459
|
+
<div
|
|
460
|
+
className="flex flex-col flex-1 min-h-0 overflow-hidden"
|
|
461
|
+
style={{
|
|
462
|
+
opacity: chatCollapsed ? 0 : 1,
|
|
463
|
+
transition: opacityTransition,
|
|
464
|
+
pointerEvents: chatCollapsed ? "none" : "auto",
|
|
465
|
+
}}
|
|
466
|
+
>
|
|
467
|
+
<ChatScreen
|
|
468
|
+
{...chatProps}
|
|
469
|
+
className={["flex-1 min-h-0", chatProps?.className].filter(Boolean).join(" ")}
|
|
470
|
+
renderFooter={chatProps?.renderFooter ?? <PromptFooter chatProps={chatProps} />}
|
|
471
|
+
/>
|
|
472
|
+
</div>
|
|
473
|
+
</div>
|
|
474
|
+
|
|
475
|
+
{/* Drag handle */}
|
|
476
|
+
<div
|
|
477
|
+
ref={bodyDividerRef}
|
|
478
|
+
role="separator"
|
|
479
|
+
aria-label="Resize chat panel"
|
|
480
|
+
aria-orientation="vertical"
|
|
481
|
+
onMouseDown={onDividerMouseDown}
|
|
482
|
+
className="flex-shrink-0 flex items-center justify-center group"
|
|
483
|
+
style={{
|
|
484
|
+
width: chatCollapsed ? 0 : 6,
|
|
485
|
+
cursor: chatCollapsed ? "default" : "col-resize",
|
|
486
|
+
transition: collapseTransition,
|
|
487
|
+
overflow: "hidden",
|
|
488
|
+
position: "relative",
|
|
489
|
+
zIndex: 10,
|
|
490
|
+
background: "transparent",
|
|
491
|
+
}}
|
|
492
|
+
>
|
|
493
|
+
<div
|
|
494
|
+
className="rounded-full bg-hairline-strong group-hover:bg-primary transition-colors duration-150"
|
|
495
|
+
style={{ width: 3, height: 40, opacity: 0.4, flexShrink: 0 }}
|
|
496
|
+
/>
|
|
497
|
+
</div>
|
|
498
|
+
|
|
499
|
+
{/* ── White canvas card ─────────────────────────────────────
|
|
500
|
+
Layout:
|
|
501
|
+
• margin-right = PANEL_GAP_RIGHT → balanced side gap on the right
|
|
502
|
+
• border-top + border-left + border-right on the card itself
|
|
503
|
+
• top-left corner: concave SVG ornament covers the join
|
|
504
|
+
• top-right corner: rounded-tr-xl so the card sits inside the gap
|
|
505
|
+
──────────────────────────────────────────────────────────── */}
|
|
506
|
+
<div
|
|
507
|
+
className="flex-1 min-w-0 flex flex-col overflow-hidden"
|
|
508
|
+
style={{
|
|
509
|
+
background: "var(--color-canvas)",
|
|
510
|
+
borderRadius: `${CURVE_R}px ${CURVE_R}px 0 0`,
|
|
511
|
+
marginRight: PANEL_GAP_RIGHT,
|
|
512
|
+
border: "1px solid var(--color-hairline)",
|
|
513
|
+
borderBottom: "none",
|
|
514
|
+
position: "relative",
|
|
515
|
+
}}
|
|
516
|
+
>
|
|
517
|
+
{/* Concave corner: covers the top-left border join with a smooth notch */}
|
|
518
|
+
<ConcaveCorner />
|
|
519
|
+
|
|
520
|
+
<div
|
|
521
|
+
className="flex-1 min-h-0 overflow-auto flex flex-col"
|
|
522
|
+
style={{ position: "relative", zIndex: 0 }}
|
|
523
|
+
>
|
|
524
|
+
{rightPanel !== undefined
|
|
525
|
+
? <div className="w-full flex-1">{rightPanel}</div>
|
|
526
|
+
: <RightPanelPlaceholder />
|
|
527
|
+
}
|
|
528
|
+
</div>
|
|
529
|
+
</div>
|
|
530
|
+
|
|
531
|
+
</div>
|
|
532
|
+
</div>
|
|
533
|
+
);
|
|
534
|
+
},
|
|
535
|
+
);
|
|
536
|
+
|
|
537
|
+
AppLayout.displayName = "AppLayout";
|