@designa8/vibedesign-v6 1.20.20 → 2.1.1
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/fonts/plusjakartasans/PlusJakartaSans-Italic[wght].ttf +0 -0
- package/dist/fonts/plusjakartasans/PlusJakartaSans[wght].ttf +0 -0
- package/dist/index.cjs +12027 -4942
- package/dist/index.js +12089 -5004
- package/dist/styles.css +1393 -97
- package/package.json +116 -1
- package/src/atoms/AgentQuestionCard/AgentQuestionCard.tsx +567 -0
- package/src/atoms/AgentQuestionCard/index.ts +6 -0
- package/src/atoms/AgentQuestionCard/preview.tsx +199 -0
- package/src/atoms/AppLayout/AppLayout.tsx +85 -22
- package/src/atoms/AppLayout/preview.tsx +4 -0
- package/src/atoms/AppSidebar/AppSidebar.tsx +222 -137
- package/src/atoms/AppSidebar/preview.tsx +61 -8
- package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +241 -169
- package/src/atoms/AppSidebarMobile/preview.tsx +59 -89
- package/src/atoms/AuthLogin/AuthLogin.tsx +86 -49
- package/src/atoms/AuthLogin/preview.tsx +16 -0
- package/src/atoms/AuthSignUp/AuthSignUp.tsx +206 -126
- package/src/atoms/AuthSignUp/preview.tsx +10 -0
- package/src/atoms/BottomSheet/BottomSheet.tsx +199 -0
- package/src/atoms/BottomSheet/index.ts +2 -0
- package/src/atoms/BottomSheet/preview.tsx +50 -0
- package/src/atoms/Button/Button.tsx +19 -3
- package/src/atoms/Button/preview.tsx +2 -1
- package/src/atoms/ChatHistorySidebar/ChatHistorySidebar.tsx +160 -84
- package/src/atoms/ChatHistorySidebar/preview.tsx +81 -42
- package/src/atoms/ChatScreen/ChatScreen.tsx +298 -33
- package/src/atoms/ChatScreen/preview.tsx +54 -90
- package/src/atoms/Chip/Chip.tsx +81 -33
- package/src/atoms/Chip/preview.tsx +39 -21
- package/src/atoms/CodeEditor/CodeEditor.tsx +10 -4
- package/src/atoms/ComponentActionsSheet/ComponentActionsSheet.tsx +165 -0
- package/src/atoms/ComponentActionsSheet/index.ts +7 -0
- package/src/atoms/ComponentActionsSheet/preview.tsx +67 -0
- package/src/atoms/ComponentCard/ComponentCard.tsx +17 -35
- package/src/atoms/ComponentCard/preview.tsx +9 -9
- package/src/atoms/DesignSystemLoader/DesignSystemLoader.tsx +153 -0
- package/src/atoms/DesignSystemLoader/index.ts +2 -0
- package/src/atoms/DesignSystemLoader/preview.tsx +19 -0
- package/src/atoms/DesignSystemShowcase/DesignSystemShowcase.tsx +410 -0
- package/src/atoms/DesignSystemShowcase/index.ts +6 -0
- package/src/atoms/DesignSystemShowcase/preview.tsx +22 -0
- package/src/atoms/DesignTokensPanel/DesignTokensPanel.data.ts +254 -0
- package/src/atoms/DesignTokensPanel/DesignTokensPanel.tsx +946 -0
- package/src/atoms/DesignTokensPanel/index.ts +9 -0
- package/src/atoms/DesignTokensPanel/preview.tsx +39 -0
- package/src/atoms/ExpandableMessage/ExpandableMessage.tsx +239 -0
- package/src/atoms/ExpandableMessage/fix-link-note.txt +3 -0
- package/src/atoms/ExpandableMessage/index.ts +2 -0
- package/src/atoms/ExpandableMessage/markdown.tsx +310 -0
- package/src/atoms/ExpandableMessage/preview.tsx +83 -0
- package/src/atoms/FilterTabBar/FilterTabBar.tsx +2 -2
- package/src/atoms/FontCombobox/FontCombobox.tsx +655 -0
- package/src/atoms/FontCombobox/index.ts +6 -0
- package/src/atoms/FontCombobox/preview.tsx +111 -0
- package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +894 -96
- package/src/atoms/HomePageTemplate/preview.tsx +4 -0
- package/src/atoms/Icon/Icon.tsx +17 -11
- package/src/atoms/Icon/icons.data.ts +34 -0
- package/src/atoms/Input/Input.tsx +37 -21
- package/src/atoms/LandingHero/LandingHero.tsx +545 -0
- package/src/atoms/LandingHero/index.ts +6 -0
- package/src/atoms/LandingHero/preview.tsx +88 -0
- package/src/atoms/MarketingFooter/MarketingFooter.tsx +215 -0
- package/src/atoms/MarketingFooter/index.ts +7 -0
- package/src/atoms/MarketingFooter/preview.tsx +28 -0
- package/src/atoms/MarketingNavbar/MarketingNavbar.tsx +451 -0
- package/src/atoms/MarketingNavbar/index.ts +7 -0
- package/src/atoms/MarketingNavbar/preview.tsx +109 -0
- package/src/atoms/MobileActionsDrawer/MobileActionsDrawer.tsx +548 -0
- package/src/atoms/MobileActionsDrawer/index.ts +9 -0
- package/src/atoms/MobileActionsDrawer/preview.tsx +109 -0
- package/src/atoms/Modal/Modal.tsx +77 -28
- package/src/atoms/PreviewDock/PreviewDock.tsx +119 -0
- package/src/atoms/PreviewDock/index.ts +2 -0
- package/src/atoms/PreviewDock/preview.tsx +30 -0
- package/src/atoms/PreviewToolbar/PreviewToolbar.tsx +47 -30
- package/src/atoms/PricingCard/PricingCard.tsx +15 -4
- package/src/atoms/PricingPageTemplate/PricingPageTemplate.tsx +109 -89
- package/src/atoms/ProjectSettingsModal/ProjectSettingsModal.tsx +314 -0
- package/src/atoms/ProjectSettingsModal/index.ts +2 -0
- package/src/atoms/ProjectSettingsModal/preview.tsx +130 -0
- package/src/atoms/ProjectSettingsModal/switch.snippet.txt +8 -0
- package/src/atoms/PromptInputBar/PromptInputBar.tsx +750 -302
- package/src/atoms/PromptInputBar/preview.tsx +64 -64
- package/src/atoms/SettingsPageTemplate/SettingsPageTemplate.tsx +272 -0
- package/src/atoms/SettingsPageTemplate/index.ts +2 -0
- package/src/atoms/SettingsPageTemplate/preview.tsx +29 -0
- package/src/atoms/SidebarUpgradeBanner/SidebarUpgradeBanner.tsx +178 -0
- package/src/atoms/SidebarUpgradeBanner/index.ts +2 -0
- package/src/atoms/SidebarUpgradeBanner/preview.tsx +47 -0
- package/src/atoms/SkeletonChip/SkeletonChip.tsx +198 -0
- package/src/atoms/SkeletonChip/index.ts +2 -0
- package/src/atoms/SkeletonChip/preview.tsx +44 -0
- package/src/atoms/TemplateHeader/TemplateHeader.tsx +129 -0
- package/src/atoms/TemplateHeader/index.ts +2 -0
- package/src/atoms/TemplateHeader/preview.tsx +39 -0
- package/src/atoms/TemplateHero/TemplateHero.tsx +286 -0
- package/src/atoms/TemplateHero/index.ts +2 -0
- package/src/atoms/TemplateHero/preview.tsx +32 -0
- package/src/atoms/TemplateSummary/TemplateSummary.tsx +85 -0
- package/src/atoms/TemplateSummary/index.ts +2 -0
- package/src/atoms/TemplateSummary/preview.tsx +10 -0
- package/src/atoms/Toast/Toast.tsx +178 -0
- package/src/atoms/Toast/index.ts +2 -0
- package/src/atoms/Toast/preview.tsx +100 -0
- package/src/atoms/TopNavbar/TopNavbar.tsx +145 -67
- package/src/atoms/TopNavbar/preview.tsx +13 -7
- package/src/atoms/TopupModal/TopupModal.tsx +94 -0
- package/src/atoms/TopupModal/index.ts +2 -0
- package/src/atoms/TopupModal/preview.tsx +22 -0
- package/src/atoms/UpgradeCard/UpgradeCard.tsx +124 -43
- package/src/atoms/UpgradeCard/index.ts +1 -1
- package/src/atoms/UpgradeCard/preview.tsx +7 -14
- package/src/atoms/UpgradeModal/UpgradeModal.tsx +192 -0
- package/src/atoms/UpgradeModal/index.ts +2 -0
- package/src/atoms/UpgradeModal/preview.tsx +41 -0
- package/src/index.ts +23 -0
- package/src/tokens.css +45 -7
- package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
- package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
AgentQuestionCard,
|
|
4
|
+
AGENT_QUESTION_FREE_TEXT_ID,
|
|
5
|
+
type AgentQuestionAnswer,
|
|
6
|
+
type AgentQuestionOption,
|
|
7
|
+
} from "./AgentQuestionCard";
|
|
8
|
+
|
|
9
|
+
const OPTIONS: AgentQuestionOption[] = [
|
|
10
|
+
{ id: "press", label: "Press it immediately" },
|
|
11
|
+
{ id: "study", label: "Study it carefully first" },
|
|
12
|
+
{ id: "walk", label: "Walk away and pretend you never saw it" },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const QUESTION =
|
|
16
|
+
"You find a mysterious button in the middle of a forest. What do you do?";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Stand-in for the generated design mockup the editor passes through
|
|
20
|
+
* `imageSrc` — a neutral placeholder so the demo needs no local asset.
|
|
21
|
+
*/
|
|
22
|
+
const MOCKUP_SRC = "https://placehold.co/640x400/e9e9ee/8a8a99?text=Design+mockup";
|
|
23
|
+
|
|
24
|
+
/** Default/empty → interactive: pick an option or type your own, then send. */
|
|
25
|
+
const EmptyThenLive: React.FC = () => {
|
|
26
|
+
const [selected, setSelected] = React.useState<string | null>(null);
|
|
27
|
+
const [text, setText] = React.useState("");
|
|
28
|
+
const [collapsed, setCollapsed] = React.useState(false);
|
|
29
|
+
const [sent, setSent] = React.useState<AgentQuestionAnswer | null>(null);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className="flex flex-col gap-sm">
|
|
33
|
+
<AgentQuestionCard
|
|
34
|
+
questionId="q-forest"
|
|
35
|
+
question={QUESTION}
|
|
36
|
+
questionNumber={1}
|
|
37
|
+
options={OPTIONS}
|
|
38
|
+
selectedOptionId={selected}
|
|
39
|
+
freeTextValue={text}
|
|
40
|
+
collapsed={collapsed}
|
|
41
|
+
onCollapsedChange={setCollapsed}
|
|
42
|
+
onAnswerChange={({ optionId, text: nextText }) => {
|
|
43
|
+
setSelected(optionId);
|
|
44
|
+
setText(nextText);
|
|
45
|
+
}}
|
|
46
|
+
onSubmit={(answer) => {
|
|
47
|
+
setSent(answer);
|
|
48
|
+
setCollapsed(true);
|
|
49
|
+
}}
|
|
50
|
+
/>
|
|
51
|
+
{sent ? (
|
|
52
|
+
<p className="text-caption text-muted">
|
|
53
|
+
Sent{" "}
|
|
54
|
+
<span className="text-ink">
|
|
55
|
+
{sent.optionId === AGENT_QUESTION_FREE_TEXT_ID ? sent.text : sent.optionId}
|
|
56
|
+
</span>{" "}
|
|
57
|
+
— the card collapsed into the restore bar, click Answer to reopen.
|
|
58
|
+
</p>
|
|
59
|
+
) : (
|
|
60
|
+
<p className="text-caption text-muted">
|
|
61
|
+
Pick an option or choose Other… and type, then press Send.
|
|
62
|
+
</p>
|
|
63
|
+
)}
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** Reference image → thumbnail above the answers, click for a large view. */
|
|
69
|
+
const WithImage: React.FC = () => {
|
|
70
|
+
const [selected, setSelected] = React.useState<string | null>(null);
|
|
71
|
+
const [text, setText] = React.useState("");
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<div className="flex flex-col gap-sm">
|
|
75
|
+
<AgentQuestionCard
|
|
76
|
+
questionId="q-image"
|
|
77
|
+
question="Which of these layouts should I build?"
|
|
78
|
+
questionNumber={1}
|
|
79
|
+
options={[
|
|
80
|
+
{ id: "first", label: "The dense dashboard" },
|
|
81
|
+
{ id: "second", label: "The card-based feed" },
|
|
82
|
+
]}
|
|
83
|
+
imageSrc={MOCKUP_SRC}
|
|
84
|
+
imageAlt="Generated mockup with a header and three panels"
|
|
85
|
+
selectedOptionId={selected}
|
|
86
|
+
freeTextValue={text}
|
|
87
|
+
onAnswerChange={({ optionId, text: nextText }) => {
|
|
88
|
+
setSelected(optionId);
|
|
89
|
+
setText(nextText);
|
|
90
|
+
}}
|
|
91
|
+
onSubmit={(answer) => console.log("submitted", answer)}
|
|
92
|
+
/>
|
|
93
|
+
<p className="text-caption text-muted">
|
|
94
|
+
Click the thumbnail to open the large view. Closing it leaves the answer
|
|
95
|
+
untouched.
|
|
96
|
+
</p>
|
|
97
|
+
</div>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default function Preview() {
|
|
102
|
+
const [selected, setSelected] = React.useState<string | null>("study");
|
|
103
|
+
|
|
104
|
+
const [errorSelected, setErrorSelected] = React.useState<string | null>(
|
|
105
|
+
AGENT_QUESTION_FREE_TEXT_ID,
|
|
106
|
+
);
|
|
107
|
+
const [errorText, setErrorText] = React.useState("");
|
|
108
|
+
const [showError, setShowError] = React.useState(true);
|
|
109
|
+
|
|
110
|
+
const [closedCollapsed, setClosedCollapsed] = React.useState(true);
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<div className="w-full max-w-3xl mx-auto p-lg space-y-xl">
|
|
114
|
+
{/* Default / Empty (live) */}
|
|
115
|
+
<section className="flex flex-col gap-sm">
|
|
116
|
+
<div>
|
|
117
|
+
<h3 className="text-body-md text-ink">Default / Empty</h3>
|
|
118
|
+
<p className="text-body-sm text-muted">
|
|
119
|
+
No option selected, Send is disabled. Click a row to enable it.
|
|
120
|
+
</p>
|
|
121
|
+
</div>
|
|
122
|
+
<EmptyThenLive />
|
|
123
|
+
</section>
|
|
124
|
+
|
|
125
|
+
{/* Reference image */}
|
|
126
|
+
<section className="flex flex-col gap-sm">
|
|
127
|
+
<div>
|
|
128
|
+
<h3 className="text-body-md text-ink">With reference image</h3>
|
|
129
|
+
<p className="text-body-sm text-muted">
|
|
130
|
+
The mockup sits between the question and the options; answers stay
|
|
131
|
+
on the card below it.
|
|
132
|
+
</p>
|
|
133
|
+
</div>
|
|
134
|
+
<WithImage />
|
|
135
|
+
</section>
|
|
136
|
+
|
|
137
|
+
{/* Selected */}
|
|
138
|
+
<section className="flex flex-col gap-sm">
|
|
139
|
+
<div>
|
|
140
|
+
<h3 className="text-body-md text-ink">Selected (option)</h3>
|
|
141
|
+
<p className="text-body-sm text-muted">
|
|
142
|
+
A tinted row, solid letter badge and trailing check. Send is enabled.
|
|
143
|
+
</p>
|
|
144
|
+
</div>
|
|
145
|
+
<AgentQuestionCard
|
|
146
|
+
questionId="q-selected"
|
|
147
|
+
question={QUESTION}
|
|
148
|
+
questionNumber={1}
|
|
149
|
+
options={OPTIONS}
|
|
150
|
+
selectedOptionId={selected}
|
|
151
|
+
onAnswerChange={({ optionId }) => setSelected(optionId)}
|
|
152
|
+
onSubmit={(answer) => console.log("submitted", answer)}
|
|
153
|
+
/>
|
|
154
|
+
</section>
|
|
155
|
+
|
|
156
|
+
{/* Error / other empty */}
|
|
157
|
+
<section className="flex flex-col gap-sm">
|
|
158
|
+
<div>
|
|
159
|
+
<h3 className="text-body-md text-ink">Error (Other… empty)</h3>
|
|
160
|
+
<p className="text-body-sm text-muted">
|
|
161
|
+
Other… is selected but blank. Submitting shows the error line.
|
|
162
|
+
</p>
|
|
163
|
+
</div>
|
|
164
|
+
<AgentQuestionCard
|
|
165
|
+
questionId="q-error"
|
|
166
|
+
question={QUESTION}
|
|
167
|
+
questionNumber={1}
|
|
168
|
+
options={OPTIONS}
|
|
169
|
+
selectedOptionId={errorSelected}
|
|
170
|
+
freeTextValue={errorText}
|
|
171
|
+
errorMessage={showError ? "Add your answer before sending" : undefined}
|
|
172
|
+
onAnswerChange={({ optionId, text }) => {
|
|
173
|
+
setErrorSelected(optionId);
|
|
174
|
+
setErrorText(text);
|
|
175
|
+
setShowError(false);
|
|
176
|
+
}}
|
|
177
|
+
/>
|
|
178
|
+
</section>
|
|
179
|
+
|
|
180
|
+
{/* Closed / restore bar */}
|
|
181
|
+
<section className="flex flex-col gap-sm">
|
|
182
|
+
<div>
|
|
183
|
+
<h3 className="text-body-md text-ink">Closed (restore bar)</h3>
|
|
184
|
+
<p className="text-body-sm text-muted">
|
|
185
|
+
Card collapsed after close. Click Answer to reopen it.
|
|
186
|
+
</p>
|
|
187
|
+
</div>
|
|
188
|
+
<AgentQuestionCard
|
|
189
|
+
questionId="q-closed"
|
|
190
|
+
question={QUESTION}
|
|
191
|
+
questionNumber={1}
|
|
192
|
+
options={OPTIONS}
|
|
193
|
+
collapsed={closedCollapsed}
|
|
194
|
+
onCollapsedChange={setClosedCollapsed}
|
|
195
|
+
/>
|
|
196
|
+
</section>
|
|
197
|
+
</div>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
@@ -31,6 +31,14 @@ export type MobilePanel = "chat" | "view";
|
|
|
31
31
|
|
|
32
32
|
export interface AppLayoutProps {
|
|
33
33
|
navbarProps?: TopNavbarProps;
|
|
34
|
+
/**
|
|
35
|
+
* Label for the Upgrade button rendered by the TopNavbar (desktop top bar and
|
|
36
|
+
* mobile view-panel top bar). Use it to relabel the button for paid users
|
|
37
|
+
* (e.g. "Manage plan"). The button itself still only renders when
|
|
38
|
+
* `navbarProps.onShare` is provided. When omitted, `navbarProps.upgradeLabel`
|
|
39
|
+
* is used, falling back to the TopNavbar default ("Upgrade").
|
|
40
|
+
*/
|
|
41
|
+
upgradeLabel?: string;
|
|
34
42
|
chatProps?: ChatScreenProps;
|
|
35
43
|
rightPanel?: React.ReactNode;
|
|
36
44
|
rightPanelTabs?: string[];
|
|
@@ -44,6 +52,12 @@ export interface AppLayoutProps {
|
|
|
44
52
|
avatarInitials?: string;
|
|
45
53
|
/** Mobile: which panel is shown by default. Defaults to "chat". */
|
|
46
54
|
defaultMobilePanel?: MobilePanel;
|
|
55
|
+
/**
|
|
56
|
+
* Mobile bottom tab bar: label of the second tab (the "view" panel, eye
|
|
57
|
+
* icon). Rendered as-is, with no text-transform, so multi-word labels keep
|
|
58
|
+
* their casing. The first tab always reads "Chat". Defaults to "View".
|
|
59
|
+
*/
|
|
60
|
+
mobileViewLabel?: string;
|
|
47
61
|
/** When true, hides the entire left-hand identity/navigation cluster in the top bar — the avatar nav (avatar initials, chevron, and its dropdown menu) and the project/workspace name control (desktop WorkspaceMenu and mobile project name) — while keeping the rest of the top bar (tabs, actions) visible. Useful for a distraction-free fullscreen preview overlay. Defaults to false. */
|
|
48
62
|
hideProjectName?: boolean;
|
|
49
63
|
/**
|
|
@@ -54,6 +68,20 @@ export interface AppLayoutProps {
|
|
|
54
68
|
* against the iframe rather than the browser window.
|
|
55
69
|
*/
|
|
56
70
|
fillViewport?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Below the md breakpoint only: when true, the chat history sidebar and the
|
|
73
|
+
* mobile top bar are not rendered. The chat panel, the view panel, and the
|
|
74
|
+
* bottom Chat/View tab bar stay. The mobile root becomes `relative` so an
|
|
75
|
+
* absolutely positioned `mobileOverlay` covers the whole mobile layout.
|
|
76
|
+
* Has no effect at md and up. Defaults to false.
|
|
77
|
+
*/
|
|
78
|
+
hideMobileChrome?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Rendered as the last child of the mobile root (after the content column)
|
|
81
|
+
* only when `hideMobileChrome` is true and the viewport is below md. Ignored
|
|
82
|
+
* otherwise.
|
|
83
|
+
*/
|
|
84
|
+
mobileOverlay?: React.ReactNode;
|
|
57
85
|
|
|
58
86
|
// ── Chat history sidebar (opt-in, folded left-edge drawer) ──────────────
|
|
59
87
|
|
|
@@ -86,17 +114,24 @@ export interface AppLayoutProps {
|
|
|
86
114
|
/** Called when a recent chat row is selected in the history sidebar. */
|
|
87
115
|
onSelectHistoryItem?: (id: string) => void;
|
|
88
116
|
onNewChat?: () => void;
|
|
117
|
+
/** Called when the history sidebar's project-settings control is used. Passed through to ChatHistorySidebar as onProjectSettings. When omitted, the settings control is hidden. */
|
|
118
|
+
onProjectSettings?: () => void;
|
|
89
119
|
|
|
90
120
|
className?: string;
|
|
91
121
|
}
|
|
92
122
|
|
|
93
123
|
// ─── useIsMobile ──────────────────────────────────────────────────────────────
|
|
94
124
|
|
|
125
|
+
// useLayoutEffect warns / no-ops on the server; fall back to useEffect there.
|
|
126
|
+
const useIsomorphicLayoutEffect =
|
|
127
|
+
typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
128
|
+
|
|
95
129
|
function useIsMobile(): boolean {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
React.
|
|
130
|
+
// Always start `false` so the first client render matches the server render
|
|
131
|
+
// (window is undefined on the server). The real value is read from
|
|
132
|
+
// matchMedia in a layout effect, which runs before paint.
|
|
133
|
+
const [mobile, setMobile] = React.useState(false);
|
|
134
|
+
useIsomorphicLayoutEffect(() => {
|
|
100
135
|
const mq = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
101
136
|
const handler = (e: MediaQueryListEvent) => setMobile(e.matches);
|
|
102
137
|
mq.addEventListener("change", handler);
|
|
@@ -122,6 +157,18 @@ function restoreTransition(els: (HTMLElement | null)[], transition: string) {
|
|
|
122
157
|
});
|
|
123
158
|
}
|
|
124
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Merge the top-level `upgradeLabel` into the TopNavbar props. The top-level
|
|
162
|
+
* prop wins when provided; otherwise `navbarProps.upgradeLabel` is preserved.
|
|
163
|
+
*/
|
|
164
|
+
function resolveNavbarProps(
|
|
165
|
+
navbarProps: TopNavbarProps | undefined,
|
|
166
|
+
upgradeLabel: string | undefined,
|
|
167
|
+
): TopNavbarProps | undefined {
|
|
168
|
+
if (upgradeLabel === undefined) return navbarProps;
|
|
169
|
+
return { ...navbarProps, upgradeLabel };
|
|
170
|
+
}
|
|
171
|
+
|
|
125
172
|
// ─── Avatar nav trigger (top-bar variant, used only when the history sidebar is off) ──────
|
|
126
173
|
// Composes the shared Menu molecule in `portal` mode so the item list always
|
|
127
174
|
// paints above the top bar's animated / z-indexed chat column, regardless of
|
|
@@ -206,9 +253,10 @@ const PromptFooter: React.FC<{ chatProps?: ChatScreenProps }> = ({ chatProps })
|
|
|
206
253
|
interface MobileTabBarProps {
|
|
207
254
|
activePanel: MobilePanel;
|
|
208
255
|
onChange: (p: MobilePanel) => void;
|
|
256
|
+
viewLabel?: string;
|
|
209
257
|
}
|
|
210
258
|
|
|
211
|
-
const MobileTabBar: React.FC<MobileTabBarProps> = ({ activePanel, onChange }) => (
|
|
259
|
+
const MobileTabBar: React.FC<MobileTabBarProps> = ({ activePanel, onChange, viewLabel = "View" }) => (
|
|
212
260
|
<div
|
|
213
261
|
className="flex-shrink-0 flex items-stretch border-t border-hairline-soft bg-canvas"
|
|
214
262
|
style={{ height: BOTTOM_TAB_HEIGHT }}
|
|
@@ -227,6 +275,7 @@ const MobileTabBar: React.FC<MobileTabBarProps> = ({ activePanel, onChange }) =>
|
|
|
227
275
|
aria-selected={active}
|
|
228
276
|
onClick={() => onChange(panel)}
|
|
229
277
|
className={[
|
|
278
|
+
"cursor-pointer transition duration-150 ease-out hover:bg-surface-soft active:scale-[0.98] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-blue disabled:cursor-not-allowed disabled:opacity-50",
|
|
230
279
|
"flex-1 flex-col !gap-xxs !rounded-none !border-0 !h-full",
|
|
231
280
|
active ? "!text-primary" : "!text-muted",
|
|
232
281
|
].join(" ")}
|
|
@@ -234,9 +283,8 @@ const MobileTabBar: React.FC<MobileTabBarProps> = ({ activePanel, onChange }) =>
|
|
|
234
283
|
<Icon name={panel === "chat" ? "chat-bubble" : "eye-view"} size={20} />
|
|
235
284
|
<span
|
|
236
285
|
className={["text-caption", active ? "font-weight-heading-sm text-primary" : "text-muted"].join(" ")}
|
|
237
|
-
style={{ textTransform: "capitalize" }}
|
|
238
286
|
>
|
|
239
|
-
{panel === "chat" ? "Chat" :
|
|
287
|
+
{panel === "chat" ? "Chat" : viewLabel}
|
|
240
288
|
</span>
|
|
241
289
|
</Button>
|
|
242
290
|
);
|
|
@@ -318,7 +366,8 @@ const MobileTopBar: React.FC<MobileTopBarProps> = ({
|
|
|
318
366
|
export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
|
|
319
367
|
(
|
|
320
368
|
{
|
|
321
|
-
navbarProps,
|
|
369
|
+
navbarProps: navbarPropsProp,
|
|
370
|
+
upgradeLabel,
|
|
322
371
|
chatProps,
|
|
323
372
|
rightPanel,
|
|
324
373
|
rightPanelTabs = [],
|
|
@@ -331,8 +380,11 @@ export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
|
|
|
331
380
|
onHome,
|
|
332
381
|
avatarInitials = "A",
|
|
333
382
|
defaultMobilePanel = "chat",
|
|
383
|
+
mobileViewLabel = "View",
|
|
334
384
|
hideProjectName = false,
|
|
335
385
|
fillViewport = true,
|
|
386
|
+
hideMobileChrome = false,
|
|
387
|
+
mobileOverlay,
|
|
336
388
|
showHistorySidebar = false,
|
|
337
389
|
historySidebarBrandName,
|
|
338
390
|
historySidebarOpen: historySidebarOpenProp,
|
|
@@ -345,12 +397,14 @@ export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
|
|
|
345
397
|
activeHistoryId,
|
|
346
398
|
onSelectHistoryItem,
|
|
347
399
|
onNewChat,
|
|
400
|
+
onProjectSettings,
|
|
348
401
|
className,
|
|
349
402
|
},
|
|
350
403
|
ref,
|
|
351
404
|
) => {
|
|
352
405
|
const isMobile = useIsMobile();
|
|
353
406
|
const rootHeight = fillViewport ? "100vh" : `${FALLBACK_HEIGHT}px`;
|
|
407
|
+
const navbarProps = resolveNavbarProps(navbarPropsProp, upgradeLabel);
|
|
354
408
|
|
|
355
409
|
// Desktop state
|
|
356
410
|
const [activeTab, setActiveTab] = React.useState(rightPanelActiveTab);
|
|
@@ -487,6 +541,7 @@ export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
|
|
|
487
541
|
avatarInitials={hideProjectName ? undefined : avatarInitials}
|
|
488
542
|
onBackToProjects={onBackToProjects}
|
|
489
543
|
onHome={onHome}
|
|
544
|
+
{...(onProjectSettings ? { onProjectSettings } : {})}
|
|
490
545
|
/>
|
|
491
546
|
) : null;
|
|
492
547
|
|
|
@@ -497,23 +552,29 @@ export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
|
|
|
497
552
|
return (
|
|
498
553
|
<div
|
|
499
554
|
ref={ref}
|
|
500
|
-
className={[
|
|
555
|
+
className={[
|
|
556
|
+
"w-full flex overflow-hidden bg-canvas",
|
|
557
|
+
hideMobileChrome ? "relative" : undefined,
|
|
558
|
+
className,
|
|
559
|
+
].filter(Boolean).join(" ")}
|
|
501
560
|
style={{ height: rootHeight }}
|
|
502
561
|
>
|
|
503
|
-
{historySidebar}
|
|
562
|
+
{!hideMobileChrome && historySidebar}
|
|
504
563
|
|
|
505
564
|
<div className="flex-1 min-w-0 flex flex-col overflow-hidden">
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
565
|
+
{!hideMobileChrome && (
|
|
566
|
+
<MobileTopBar
|
|
567
|
+
projectName={projectName}
|
|
568
|
+
avatarInitials={avatarInitials}
|
|
569
|
+
activePanel={mobilePanel}
|
|
570
|
+
navbarProps={navbarProps}
|
|
571
|
+
onRenameProject={onRenameProject}
|
|
572
|
+
onBackToProjects={onBackToProjects}
|
|
573
|
+
onHome={onHome}
|
|
574
|
+
hideProjectName={hideProjectName}
|
|
575
|
+
showHistorySidebar={showHistorySidebar}
|
|
576
|
+
/>
|
|
577
|
+
)}
|
|
517
578
|
|
|
518
579
|
<div className="flex-1 min-h-0 overflow-hidden relative">
|
|
519
580
|
{/* Chat panel */}
|
|
@@ -552,8 +613,10 @@ export const AppLayout = React.forwardRef<HTMLDivElement, AppLayoutProps>(
|
|
|
552
613
|
</div>
|
|
553
614
|
</div>
|
|
554
615
|
|
|
555
|
-
<MobileTabBar activePanel={mobilePanel} onChange={setMobilePanel} />
|
|
616
|
+
<MobileTabBar activePanel={mobilePanel} onChange={setMobilePanel} viewLabel={mobileViewLabel} />
|
|
556
617
|
</div>
|
|
618
|
+
|
|
619
|
+
{hideMobileChrome ? mobileOverlay : null}
|
|
557
620
|
</div>
|
|
558
621
|
);
|
|
559
622
|
}
|
|
@@ -61,6 +61,9 @@ export default function AppLayoutPreview() {
|
|
|
61
61
|
{/*
|
|
62
62
|
fillViewport=false renders the layout at a fixed content height instead
|
|
63
63
|
of 100vh — required inside this iframed preview.
|
|
64
|
+
|
|
65
|
+
onProjectSettings is passed here to demonstrate the history sidebar's
|
|
66
|
+
settings row; omit the prop entirely to hide that control.
|
|
64
67
|
*/}
|
|
65
68
|
<AppLayout
|
|
66
69
|
fillViewport={false}
|
|
@@ -73,6 +76,7 @@ export default function AppLayoutPreview() {
|
|
|
73
76
|
activeHistoryId={activeHistoryId}
|
|
74
77
|
onSelectHistoryItem={setActiveHistoryId}
|
|
75
78
|
onNewChat={() => setActiveHistoryId("")}
|
|
79
|
+
onProjectSettings={() => alert("Open project settings")}
|
|
76
80
|
navbarProps={{
|
|
77
81
|
avatarInitials: "OF",
|
|
78
82
|
version: "Latest",
|