@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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AppLayout } from "./AppLayout";
|
|
3
|
+
import type { ChatMessage } from "../ChatScreen";
|
|
4
|
+
|
|
5
|
+
// ─── Sample messages ──────────────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
const sampleMessages: ChatMessage[] = [
|
|
8
|
+
{
|
|
9
|
+
id: "1",
|
|
10
|
+
role: "user",
|
|
11
|
+
content: "Create a landing page with a hero section and pricing cards.",
|
|
12
|
+
userInitials: "OF",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: "2",
|
|
16
|
+
role: "ai",
|
|
17
|
+
content:
|
|
18
|
+
"I'll build a polished landing page with a hero, feature grid, and a 3-tier pricing section. Here's the plan:",
|
|
19
|
+
plan: {
|
|
20
|
+
title: "Build landing page: hero + feature grid + pricing tiers",
|
|
21
|
+
tasks: [
|
|
22
|
+
{ id: "p1", label: "Scaffold page layout and nav", status: "done" },
|
|
23
|
+
{ id: "p2", label: "Build hero section with CTA", status: "done" },
|
|
24
|
+
{
|
|
25
|
+
id: "p3",
|
|
26
|
+
label: "Create pricing card component",
|
|
27
|
+
status: "in_progress",
|
|
28
|
+
currentTool: "Writing atom…",
|
|
29
|
+
},
|
|
30
|
+
{ id: "p4", label: "Wire up responsiveness", status: "pending" },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "3",
|
|
36
|
+
role: "user",
|
|
37
|
+
content: "Looks great! Can you make the hero background a subtle gradient?",
|
|
38
|
+
userInitials: "OF",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "4",
|
|
42
|
+
role: "ai",
|
|
43
|
+
content: "Sure — adding a soft purple-to-white gradient behind the hero text now.",
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
// ─── Preview export ───────────────────────────────────────────────────────────
|
|
48
|
+
|
|
49
|
+
export default function AppLayoutPreview() {
|
|
50
|
+
return (
|
|
51
|
+
<div className="w-full" style={{ height: "100vh" }}>
|
|
52
|
+
{/*
|
|
53
|
+
Variant A: consumer passes explicit tabs — nav renders as expected.
|
|
54
|
+
Variant B (below, commented out): no tabs passed — nav is hidden.
|
|
55
|
+
*/}
|
|
56
|
+
<AppLayout
|
|
57
|
+
navbarProps={{
|
|
58
|
+
avatarInitials: "OF",
|
|
59
|
+
version: "Latest",
|
|
60
|
+
versions: ["Latest", "v1.2", "v1.1"],
|
|
61
|
+
onPublish: () => {},
|
|
62
|
+
onShare: () => {},
|
|
63
|
+
}}
|
|
64
|
+
chatProps={{
|
|
65
|
+
messages: sampleMessages,
|
|
66
|
+
placeholder: "Tell me what to build…",
|
|
67
|
+
}}
|
|
68
|
+
/* Pass an explicit non-empty array to show the tab nav */
|
|
69
|
+
rightPanelTabs={["Preview", "Dashboard"]}
|
|
70
|
+
rightPanelActiveTab={0}
|
|
71
|
+
defaultChatWidth={340}
|
|
72
|
+
/>
|
|
73
|
+
</div>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button } from "../Button";
|
|
3
|
+
import { WorkspaceMenu } from "../WorkspaceMenu";
|
|
4
|
+
import { NavItem } from "../NavItem";
|
|
5
|
+
import type { NavItemSubItem } from "../NavItem";
|
|
6
|
+
import { UpgradeCard } from "../UpgradeCard";
|
|
7
|
+
|
|
8
|
+
/* ─── Inline SVG icons ───────────────────────────────────────────────────── */
|
|
9
|
+
|
|
10
|
+
const LogoIcon = () => (
|
|
11
|
+
<svg width="32" height="32" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
12
|
+
<path d="M12 36C12 36 8 28 16 22C20 19 26 20 26 20C26 20 22 26 18 30C16 32 12 36 12 36Z" style={{ fill: "var(--color-logo-orange)" }} />
|
|
13
|
+
<path d="M24 8C24 8 36 12 36 24C36 30 32 36 26 38C26 38 28 30 26 24C25 20 24 8 24 8Z" style={{ fill: "var(--color-logo-violet)" }} />
|
|
14
|
+
<path d="M12 36C12 36 16 24 24 20C28 18 36 20 36 20C36 20 30 28 26 32C22 36 12 36 12 36Z" style={{ fill: "var(--color-logo-pink)", opacity: 0.7 }} />
|
|
15
|
+
</svg>
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
const GiftIcon = () => (
|
|
19
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "20px", height: "20px" }}>
|
|
20
|
+
<polyline points="20 12 20 22 4 22 4 12" />
|
|
21
|
+
<rect x="2" y="7" width="20" height="5" />
|
|
22
|
+
<line x1="12" y1="22" x2="12" y2="7" />
|
|
23
|
+
<path d="M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z" />
|
|
24
|
+
<path d="M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z" />
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const InboxIcon = () => (
|
|
29
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "20px", height: "20px" }}>
|
|
30
|
+
<polyline points="22 12 16 12 14 15 10 15 8 12 2 12" />
|
|
31
|
+
<path d="M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z" />
|
|
32
|
+
</svg>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const SidebarIcon = () => (
|
|
36
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ width: "18px", height: "18px" }}>
|
|
37
|
+
<rect x="3" y="3" width="18" height="18" rx="2" />
|
|
38
|
+
<line x1="9" y1="3" x2="9" y2="21" />
|
|
39
|
+
</svg>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
/* ─── Types ──────────────────────────────────────────────────────────────── */
|
|
43
|
+
|
|
44
|
+
export interface NavSubItem {
|
|
45
|
+
id: string;
|
|
46
|
+
label: string;
|
|
47
|
+
icon?: React.ReactNode;
|
|
48
|
+
/** When provided, a trash icon button appears on hover and calls this with the sub-item id. */
|
|
49
|
+
onDelete?: (id: string) => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface NavEntry {
|
|
53
|
+
id: string;
|
|
54
|
+
label: string;
|
|
55
|
+
icon?: React.ReactNode;
|
|
56
|
+
subItems?: NavSubItem[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface AppSidebarProps extends React.HTMLAttributes<HTMLElement> {
|
|
60
|
+
/**
|
|
61
|
+
* Brand / product name displayed in the header when the sidebar is expanded.
|
|
62
|
+
* If omitted the default logo icon is shown without a title.
|
|
63
|
+
*/
|
|
64
|
+
brandName?: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Navigation entries to render. Each entry may carry an optional icon and
|
|
68
|
+
* an optional array of sub-items. The sidebar manages its own
|
|
69
|
+
* expanded-subtree state internally.
|
|
70
|
+
*/
|
|
71
|
+
entries?: NavEntry[];
|
|
72
|
+
|
|
73
|
+
/** ID of the currently-active top-level entry. */
|
|
74
|
+
activeId?: string;
|
|
75
|
+
|
|
76
|
+
/** Called when the user selects a top-level entry. */
|
|
77
|
+
onSelect?: (id: string) => void;
|
|
78
|
+
|
|
79
|
+
/** ID of the currently-active sub-item (optional). */
|
|
80
|
+
activeSubId?: string;
|
|
81
|
+
|
|
82
|
+
/** Called when the user selects a sub-item. */
|
|
83
|
+
onSubSelect?: (id: string) => void;
|
|
84
|
+
|
|
85
|
+
// ── Footer opt-in props ──────────────────────────────────────────────────
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* When provided, renders a WorkspaceMenu with this name in the nav area
|
|
89
|
+
* (above entries). If omitted the WorkspaceMenu is not shown.
|
|
90
|
+
*/
|
|
91
|
+
workspaceName?: string;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* When true, renders the "Share Lovable" referral card in the footer.
|
|
95
|
+
* Defaults to false.
|
|
96
|
+
*/
|
|
97
|
+
showShareCard?: boolean;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* When true, renders the UpgradeCard in the footer.
|
|
101
|
+
* Defaults to false.
|
|
102
|
+
*/
|
|
103
|
+
showUpgradeCard?: boolean;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* When provided, renders a user avatar chip in the footer with these initials.
|
|
107
|
+
* If omitted the avatar is not shown.
|
|
108
|
+
*/
|
|
109
|
+
userInitials?: string;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* When provided, renders an inbox button in the footer and calls this on click.
|
|
113
|
+
* If omitted the inbox button is not shown.
|
|
114
|
+
*/
|
|
115
|
+
onInboxClick?: () => void;
|
|
116
|
+
|
|
117
|
+
// ── Legacy / backwards-compatible props ──────────────────────────────────
|
|
118
|
+
|
|
119
|
+
/** @deprecated Use activeId instead. */
|
|
120
|
+
activeItem?: string;
|
|
121
|
+
|
|
122
|
+
/** Controlled collapsed state */
|
|
123
|
+
collapsed?: boolean;
|
|
124
|
+
|
|
125
|
+
/** Callback when collapse button is clicked */
|
|
126
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
127
|
+
|
|
128
|
+
/** Optional children rendered below the nav (only shown when expanded). */
|
|
129
|
+
children?: React.ReactNode;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* ─── Component ──────────────────────────────────────────────────────────── */
|
|
133
|
+
|
|
134
|
+
export const AppSidebar = React.forwardRef<HTMLElement, AppSidebarProps>(
|
|
135
|
+
(
|
|
136
|
+
{
|
|
137
|
+
brandName,
|
|
138
|
+
entries,
|
|
139
|
+
activeId,
|
|
140
|
+
onSelect,
|
|
141
|
+
activeSubId,
|
|
142
|
+
onSubSelect,
|
|
143
|
+
// footer opt-in props
|
|
144
|
+
workspaceName,
|
|
145
|
+
showShareCard = false,
|
|
146
|
+
showUpgradeCard = false,
|
|
147
|
+
userInitials,
|
|
148
|
+
onInboxClick,
|
|
149
|
+
// legacy compat
|
|
150
|
+
activeItem,
|
|
151
|
+
collapsed: collapsedProp,
|
|
152
|
+
onCollapsedChange,
|
|
153
|
+
children,
|
|
154
|
+
className,
|
|
155
|
+
...rest
|
|
156
|
+
},
|
|
157
|
+
ref,
|
|
158
|
+
) => {
|
|
159
|
+
/* ── Collapse state ── */
|
|
160
|
+
const [internalCollapsed, setInternalCollapsed] = React.useState(false);
|
|
161
|
+
const isControlled = collapsedProp !== undefined;
|
|
162
|
+
const collapsed = isControlled ? collapsedProp : internalCollapsed;
|
|
163
|
+
|
|
164
|
+
const handleCollapse = () => {
|
|
165
|
+
const next = !collapsed;
|
|
166
|
+
if (!isControlled) setInternalCollapsed(next);
|
|
167
|
+
onCollapsedChange?.(next);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/* ── Expanded subtree state (managed internally per the spec) ── */
|
|
171
|
+
const [expandedIds, setExpandedIds] = React.useState<Set<string>>(new Set());
|
|
172
|
+
|
|
173
|
+
const toggleExpanded = (id: string) => {
|
|
174
|
+
setExpandedIds((prev) => {
|
|
175
|
+
const next = new Set(prev);
|
|
176
|
+
if (next.has(id)) next.delete(id);
|
|
177
|
+
else next.add(id);
|
|
178
|
+
return next;
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
/* ── Active resolution: new API takes priority over legacy activeItem ── */
|
|
183
|
+
const resolvedActiveId = activeId ?? activeItem ?? "";
|
|
184
|
+
|
|
185
|
+
const hasEntries = entries && entries.length > 0;
|
|
186
|
+
|
|
187
|
+
/* ── Footer visibility ── */
|
|
188
|
+
const hasFooterPromoContent = showShareCard || showUpgradeCard;
|
|
189
|
+
const hasFooterBottomContent = !!(userInitials || onInboxClick);
|
|
190
|
+
const hasFooterContent = hasFooterPromoContent || hasFooterBottomContent;
|
|
191
|
+
|
|
192
|
+
return (
|
|
193
|
+
<nav
|
|
194
|
+
ref={ref}
|
|
195
|
+
aria-label={brandName ?? "Application"}
|
|
196
|
+
className={[
|
|
197
|
+
"flex flex-col bg-canvas border-r border-hairline h-full overflow-hidden",
|
|
198
|
+
"transition-all duration-300 ease-in-out",
|
|
199
|
+
collapsed ? "w-14" : "w-64",
|
|
200
|
+
className,
|
|
201
|
+
]
|
|
202
|
+
.filter(Boolean)
|
|
203
|
+
.join(" ")}
|
|
204
|
+
{...(rest as React.HTMLAttributes<HTMLElement>)}
|
|
205
|
+
>
|
|
206
|
+
{/* ── Header: logo / brand name + collapse toggle ── */}
|
|
207
|
+
<div
|
|
208
|
+
className={[
|
|
209
|
+
"flex items-center px-md pt-md pb-sm flex-shrink-0 transition-all duration-300",
|
|
210
|
+
collapsed ? "justify-center" : "justify-between",
|
|
211
|
+
].join(" ")}
|
|
212
|
+
>
|
|
213
|
+
{/* Brand area — fades out when collapsed */}
|
|
214
|
+
<div
|
|
215
|
+
className="transition-all duration-300 ease-in-out overflow-hidden flex-shrink-0 flex items-center gap-sm min-w-0"
|
|
216
|
+
style={{ maxWidth: collapsed ? "0px" : "180px", opacity: collapsed ? 0 : 1 }}
|
|
217
|
+
>
|
|
218
|
+
<LogoIcon />
|
|
219
|
+
{brandName && (
|
|
220
|
+
<span className="text-body-sm font-weight-heading-sm text-ink truncate">
|
|
221
|
+
{brandName}
|
|
222
|
+
</span>
|
|
223
|
+
)}
|
|
224
|
+
</div>
|
|
225
|
+
|
|
226
|
+
{/* Collapse toggle */}
|
|
227
|
+
<Button
|
|
228
|
+
variant="ghost"
|
|
229
|
+
size="sm"
|
|
230
|
+
aria-label={collapsed ? "Expand sidebar" : "Collapse sidebar"}
|
|
231
|
+
onClick={handleCollapse}
|
|
232
|
+
className={[
|
|
233
|
+
"!p-xs !rounded-md flex-shrink-0 transition-all duration-200",
|
|
234
|
+
collapsed
|
|
235
|
+
? "!text-primary ring-2 ring-primary !bg-transparent hover:!bg-surface-soft"
|
|
236
|
+
: "",
|
|
237
|
+
]
|
|
238
|
+
.filter(Boolean)
|
|
239
|
+
.join(" ")}
|
|
240
|
+
>
|
|
241
|
+
<SidebarIcon />
|
|
242
|
+
</Button>
|
|
243
|
+
</div>
|
|
244
|
+
|
|
245
|
+
{/* ── Scrollable nav area ── */}
|
|
246
|
+
<div className="flex-1 overflow-y-auto overflow-x-hidden px-sm space-y-xxs pb-sm">
|
|
247
|
+
{/* Workspace selector — only when workspaceName provided and not collapsed */}
|
|
248
|
+
{workspaceName && (
|
|
249
|
+
<div
|
|
250
|
+
className="overflow-hidden transition-all duration-300 ease-in-out"
|
|
251
|
+
style={{
|
|
252
|
+
maxHeight: collapsed ? "0px" : "60px",
|
|
253
|
+
opacity: collapsed ? 0 : 1,
|
|
254
|
+
marginBottom: collapsed ? "0px" : "8px",
|
|
255
|
+
}}
|
|
256
|
+
>
|
|
257
|
+
<WorkspaceMenu workspaceName={workspaceName} initials={workspaceName.charAt(0).toUpperCase()} />
|
|
258
|
+
</div>
|
|
259
|
+
)}
|
|
260
|
+
|
|
261
|
+
{/* ── Generic entries (new API) ── */}
|
|
262
|
+
{hasEntries && (
|
|
263
|
+
<ul className="space-y-xxs" role="list">
|
|
264
|
+
{entries!.map((entry) => {
|
|
265
|
+
const isActive = resolvedActiveId === entry.id;
|
|
266
|
+
const hasSubItems = !!(entry.subItems && entry.subItems.length > 0);
|
|
267
|
+
const isExpanded = expandedIds.has(entry.id);
|
|
268
|
+
|
|
269
|
+
// Map AppSidebar's NavSubItem to NavItem's NavItemSubItem.
|
|
270
|
+
// Only pass subItems when there are actual sub-items — this ensures
|
|
271
|
+
// NavItem's isExpandable check (subItems && subItems.length > 0) is
|
|
272
|
+
// false for leaf entries, preventing the chevron from appearing.
|
|
273
|
+
const mappedSubItems: NavItemSubItem[] | undefined = hasSubItems
|
|
274
|
+
? entry.subItems!.map((sub) => ({
|
|
275
|
+
id: sub.id,
|
|
276
|
+
label: sub.label,
|
|
277
|
+
onDelete: sub.onDelete,
|
|
278
|
+
onClick: onSubSelect
|
|
279
|
+
? (_id: string) => onSubSelect(_id)
|
|
280
|
+
: undefined,
|
|
281
|
+
}))
|
|
282
|
+
: undefined;
|
|
283
|
+
|
|
284
|
+
return (
|
|
285
|
+
<NavItem
|
|
286
|
+
key={entry.id}
|
|
287
|
+
icon={entry.icon}
|
|
288
|
+
label={entry.label}
|
|
289
|
+
active={isActive}
|
|
290
|
+
iconOnly={collapsed}
|
|
291
|
+
subItems={!collapsed ? mappedSubItems : undefined}
|
|
292
|
+
expanded={hasSubItems ? isExpanded : undefined}
|
|
293
|
+
onExpandToggle={hasSubItems ? () => toggleExpanded(entry.id) : undefined}
|
|
294
|
+
onClick={(e) => {
|
|
295
|
+
onSelect?.(entry.id);
|
|
296
|
+
if (hasSubItems) {
|
|
297
|
+
e.preventDefault();
|
|
298
|
+
}
|
|
299
|
+
}}
|
|
300
|
+
/>
|
|
301
|
+
);
|
|
302
|
+
})}
|
|
303
|
+
</ul>
|
|
304
|
+
)}
|
|
305
|
+
|
|
306
|
+
{/* ── Optional children rendered below nav (only when expanded) ── */}
|
|
307
|
+
{children && (
|
|
308
|
+
<div
|
|
309
|
+
className="overflow-hidden transition-all duration-300 ease-in-out"
|
|
310
|
+
style={{ maxHeight: collapsed ? "0px" : "600px", opacity: collapsed ? 0 : 1 }}
|
|
311
|
+
>
|
|
312
|
+
{children}
|
|
313
|
+
</div>
|
|
314
|
+
)}
|
|
315
|
+
</div>
|
|
316
|
+
|
|
317
|
+
{/* ── Footer (only renders when there is footer content) ── */}
|
|
318
|
+
{hasFooterContent && (
|
|
319
|
+
<div className="flex-shrink-0 px-sm pb-md space-y-sm">
|
|
320
|
+
{/* Promo cards — hidden when collapsed */}
|
|
321
|
+
{hasFooterPromoContent && (
|
|
322
|
+
<div
|
|
323
|
+
className="overflow-hidden transition-all duration-300 ease-in-out space-y-sm"
|
|
324
|
+
style={{ maxHeight: collapsed ? "0px" : "300px", opacity: collapsed ? 0 : 1 }}
|
|
325
|
+
>
|
|
326
|
+
{/* Share card */}
|
|
327
|
+
{showShareCard && (
|
|
328
|
+
<div className="rounded-xl border border-hairline bg-surface px-md py-sm flex items-center justify-between gap-md">
|
|
329
|
+
<div className="flex flex-col gap-xxs min-w-0">
|
|
330
|
+
<span className="text-body-sm font-weight-heading-sm text-ink">Share Lovable</span>
|
|
331
|
+
<span className="text-caption text-muted">100 credits per paid referral</span>
|
|
332
|
+
</div>
|
|
333
|
+
<span
|
|
334
|
+
className="flex-shrink-0 flex items-center justify-center rounded-full bg-surface-strong"
|
|
335
|
+
style={{ width: "36px", height: "36px" }}
|
|
336
|
+
>
|
|
337
|
+
<GiftIcon />
|
|
338
|
+
</span>
|
|
339
|
+
</div>
|
|
340
|
+
)}
|
|
341
|
+
|
|
342
|
+
{/* Upgrade to Pro */}
|
|
343
|
+
{showUpgradeCard && (
|
|
344
|
+
<UpgradeCard eyebrow="" title="Upgrade to Pro" subtitle="Unlock more features" />
|
|
345
|
+
)}
|
|
346
|
+
</div>
|
|
347
|
+
)}
|
|
348
|
+
|
|
349
|
+
{/* Bottom bar: user avatar + inbox — only when at least one is provided */}
|
|
350
|
+
{hasFooterBottomContent && (
|
|
351
|
+
<div
|
|
352
|
+
className={[
|
|
353
|
+
"flex items-center pt-xs transition-all duration-300",
|
|
354
|
+
collapsed ? "justify-center" : "justify-between",
|
|
355
|
+
].join(" ")}
|
|
356
|
+
>
|
|
357
|
+
{/* User avatar — only when userInitials provided */}
|
|
358
|
+
{userInitials && (
|
|
359
|
+
<span
|
|
360
|
+
className="flex items-center justify-center rounded-full bg-primary text-on-primary text-body-sm font-weight-heading-sm cursor-pointer hover:bg-primary-hover transition-colors duration-150 flex-shrink-0"
|
|
361
|
+
style={{ width: "36px", height: "36px" }}
|
|
362
|
+
aria-label="User profile"
|
|
363
|
+
>
|
|
364
|
+
{userInitials}
|
|
365
|
+
</span>
|
|
366
|
+
)}
|
|
367
|
+
|
|
368
|
+
{/* Inbox — only when onInboxClick provided, fades out when collapsed */}
|
|
369
|
+
{onInboxClick && (
|
|
370
|
+
<div
|
|
371
|
+
className="overflow-hidden transition-all duration-300 ease-in-out"
|
|
372
|
+
style={{ maxWidth: collapsed ? "0px" : "40px", opacity: collapsed ? 0 : 1 }}
|
|
373
|
+
>
|
|
374
|
+
<Button
|
|
375
|
+
variant="ghost"
|
|
376
|
+
size="sm"
|
|
377
|
+
aria-label="Inbox"
|
|
378
|
+
onClick={onInboxClick}
|
|
379
|
+
className="!p-xs !rounded-sm relative"
|
|
380
|
+
>
|
|
381
|
+
<InboxIcon />
|
|
382
|
+
<span
|
|
383
|
+
className="absolute top-1 right-1 rounded-full bg-semantic-error"
|
|
384
|
+
aria-label="New notifications"
|
|
385
|
+
style={{ width: "8px", height: "8px" }}
|
|
386
|
+
/>
|
|
387
|
+
</Button>
|
|
388
|
+
</div>
|
|
389
|
+
)}
|
|
390
|
+
</div>
|
|
391
|
+
)}
|
|
392
|
+
</div>
|
|
393
|
+
)}
|
|
394
|
+
</nav>
|
|
395
|
+
);
|
|
396
|
+
},
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
AppSidebar.displayName = "AppSidebar";
|