@designa8/vibedesign-v6 1.20.19 → 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/BillingToggle/BillingToggle.tsx +2 -2
- 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
|
@@ -1,84 +1,84 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { PromptInputBar
|
|
3
|
-
|
|
4
|
-
// Stable placeholder images from picsum so the preview looks realistic
|
|
5
|
-
const SAMPLE_IMAGES: PastedImage[] = [
|
|
6
|
-
{
|
|
7
|
-
id: "img-1",
|
|
8
|
-
url: "https://picsum.photos/seed/ui1/160/160",
|
|
9
|
-
name: "screenshot.png",
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
id: "img-2",
|
|
13
|
-
url: "https://picsum.photos/seed/ui2/160/160",
|
|
14
|
-
name: "design-ref.jpg",
|
|
15
|
-
},
|
|
16
|
-
];
|
|
2
|
+
import { PromptInputBar } from "./PromptInputBar";
|
|
3
|
+
import type { PastedImage, PromptMode } from "./PromptInputBar";
|
|
17
4
|
|
|
18
5
|
const MODELS = [
|
|
19
|
-
{ id: "
|
|
20
|
-
{ id: "
|
|
21
|
-
{ id: "
|
|
6
|
+
{ id: "gpt-4o", name: "GPT-4o", tier: "Fast" },
|
|
7
|
+
{ id: "pro", name: "Reasoning Pro", tier: "Pro", description: "Better for complex tasks" },
|
|
8
|
+
{ id: "ultra", name: "Ultra Max", tier: "Max", available: false },
|
|
22
9
|
];
|
|
23
10
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<PromptInputBar
|
|
31
|
-
value={text}
|
|
32
|
-
onChange={setText}
|
|
33
|
-
pastedImages={images}
|
|
34
|
-
onImagesChange={setImages}
|
|
35
|
-
models={MODELS}
|
|
36
|
-
selectedModelId="gpt4o"
|
|
37
|
-
placeholder="Ask Lovable…"
|
|
38
|
-
/>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
11
|
+
const IMAGES: PastedImage[] = [
|
|
12
|
+
{ id: "a", url: "https://picsum.photos/seed/city-night/160/160", name: "City skyline" },
|
|
13
|
+
{ id: "b", url: "https://picsum.photos/seed/dune-grass/160/160", name: "Dune grass" },
|
|
14
|
+
];
|
|
41
15
|
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
);
|
|
16
|
+
export default function Preview() {
|
|
17
|
+
const [value, setValue] = React.useState("");
|
|
18
|
+
const [mode, setMode] = React.useState<PromptMode>("Build");
|
|
19
|
+
const [model, setModel] = React.useState("gpt-4o");
|
|
20
|
+
const [suggest, setSuggest] = React.useState(false);
|
|
21
|
+
const [images, setImages] = React.useState<PastedImage[]>(IMAGES);
|
|
22
|
+
const [notice, setNotice] = React.useState("");
|
|
50
23
|
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
<PromptInputBar
|
|
54
|
-
value="Make the background gradient go from purple to pink"
|
|
55
|
-
pastedImages={[SAMPLE_IMAGES[0]]}
|
|
56
|
-
isStreaming
|
|
57
|
-
onStop={() => {}}
|
|
58
|
-
models={MODELS}
|
|
59
|
-
selectedModelId="gemini"
|
|
60
|
-
/>
|
|
61
|
-
);
|
|
24
|
+
// Controlled recording demo that fails with a blocked microphone
|
|
25
|
+
const [blockedRecording, setBlockedRecording] = React.useState(false);
|
|
62
26
|
|
|
63
|
-
export default function Preview() {
|
|
64
27
|
return (
|
|
65
28
|
<div className="w-full max-w-3xl mx-auto p-lg space-y-xl">
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
With pasted images — hover a thumbnail to reveal the remove ×
|
|
29
|
+
<div className="space-y-sm pt-xxl">
|
|
30
|
+
<p className="text-caption text-muted">
|
|
31
|
+
Interactive: tap the mic to start recording. Confirm appends text, cancel (or Escape) discards it.
|
|
70
32
|
</p>
|
|
71
|
-
<
|
|
33
|
+
<PromptInputBar
|
|
34
|
+
value={value}
|
|
35
|
+
onChange={setValue}
|
|
36
|
+
mode={mode}
|
|
37
|
+
onModeChange={setMode}
|
|
38
|
+
models={MODELS}
|
|
39
|
+
selectedModelId={model}
|
|
40
|
+
onModelChange={(id) => {
|
|
41
|
+
setModel(id);
|
|
42
|
+
setNotice(`Model set to ${id}.`);
|
|
43
|
+
}}
|
|
44
|
+
onUnavailableModelClick={(id) => setNotice(`Model "${id}" is unavailable. Upgrade to use it.`)}
|
|
45
|
+
onAttach={() => setNotice("Upload file picked.")}
|
|
46
|
+
suggestDesigns={suggest}
|
|
47
|
+
onSuggestDesignsChange={setSuggest}
|
|
48
|
+
pastedImages={images}
|
|
49
|
+
onImagesChange={setImages}
|
|
50
|
+
onRecordingConfirm={(secs) => {
|
|
51
|
+
setValue((v) => `${v}${v ? " " : ""}A modern workspace with large windows and plants`);
|
|
52
|
+
setNotice(`Recorded ${secs}s and added the transcript.`);
|
|
53
|
+
}}
|
|
54
|
+
onRecordingCancel={() => setNotice("Recording discarded.")}
|
|
55
|
+
onSend={(text) => {
|
|
56
|
+
setNotice(`Sent: ${text || "(images only)"}`);
|
|
57
|
+
setValue("");
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
{notice && <p className="text-body-sm text-muted">{notice}</p>}
|
|
72
61
|
</div>
|
|
73
62
|
|
|
74
63
|
<div className="space-y-sm">
|
|
75
|
-
<p className="text-
|
|
76
|
-
|
|
64
|
+
<p className="text-caption text-muted">
|
|
65
|
+
Microphone blocked: the mic starts a controlled recording that reports an error. Close returns to idle.
|
|
66
|
+
</p>
|
|
67
|
+
<PromptInputBar
|
|
68
|
+
models={MODELS}
|
|
69
|
+
selectedModelId="gpt-4o"
|
|
70
|
+
pastedImages={IMAGES}
|
|
71
|
+
recording={blockedRecording}
|
|
72
|
+
recordingError={blockedRecording ? "Microphone blocked" : undefined}
|
|
73
|
+
onMic={() => setBlockedRecording(true)}
|
|
74
|
+
onRecordingCancel={() => setBlockedRecording(false)}
|
|
75
|
+
onRecordingConfirm={() => setBlockedRecording(false)}
|
|
76
|
+
/>
|
|
77
77
|
</div>
|
|
78
78
|
|
|
79
79
|
<div className="space-y-sm">
|
|
80
|
-
<p className="text-
|
|
81
|
-
<
|
|
80
|
+
<p className="text-caption text-muted">Empty state</p>
|
|
81
|
+
<PromptInputBar models={MODELS} selectedModelId="gpt-4o" />
|
|
82
82
|
</div>
|
|
83
83
|
</div>
|
|
84
84
|
);
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AppSidebar } from "../AppSidebar";
|
|
3
|
+
import type { NavEntry } from "../AppSidebar";
|
|
4
|
+
import { Button } from "../Button";
|
|
5
|
+
import { Dropdown } from "../Dropdown";
|
|
6
|
+
import type { DropdownOption } from "../Dropdown";
|
|
7
|
+
import { Modal } from "../Modal";
|
|
8
|
+
import { Input } from "../Input";
|
|
9
|
+
import { Chip } from "../Chip";
|
|
10
|
+
import { Icon } from "../Icon";
|
|
11
|
+
|
|
12
|
+
/* ─── Types ──────────────────────────────────────────────────────────────── */
|
|
13
|
+
|
|
14
|
+
export interface SettingsPlan {
|
|
15
|
+
name: string;
|
|
16
|
+
price: string;
|
|
17
|
+
renewsOn?: string;
|
|
18
|
+
/** When set, renders this full caption instead of the default "Renews on {renewsOn}" line — e.g. "Cancels on Oct 12, 2026" or "Access through Oct 12, 2026". */
|
|
19
|
+
periodCaption?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface SettingsPageTemplateProps {
|
|
23
|
+
/** When true, hides the AppSidebar and renders only the settings content column full-width. Defaults to false. */
|
|
24
|
+
hideSidebar?: boolean;
|
|
25
|
+
|
|
26
|
+
/** Nav entries for the left sidebar. Falls back to a sensible default set. */
|
|
27
|
+
sidebarEntries?: NavEntry[];
|
|
28
|
+
/** Active sidebar entry id. Defaults to "settings". */
|
|
29
|
+
activeSidebarId?: string;
|
|
30
|
+
onSidebarSelect?: (id: string) => void;
|
|
31
|
+
|
|
32
|
+
/** Signed-in user shown in the sidebar footer. */
|
|
33
|
+
userInitials?: string;
|
|
34
|
+
userEmail?: string;
|
|
35
|
+
onLogout?: () => void;
|
|
36
|
+
onSettings?: () => void;
|
|
37
|
+
|
|
38
|
+
/** Current plan summary, shown in the subscription card. */
|
|
39
|
+
plan?: SettingsPlan;
|
|
40
|
+
/** Opens the external billing portal (Stripe). */
|
|
41
|
+
onManageBilling?: () => void;
|
|
42
|
+
|
|
43
|
+
/** Model options for the global model picker. */
|
|
44
|
+
modelOptions?: DropdownOption[];
|
|
45
|
+
/** Currently selected model value (controlled). */
|
|
46
|
+
selectedModel?: string;
|
|
47
|
+
onModelChange?: (value: string) => void;
|
|
48
|
+
|
|
49
|
+
/** Delete-account flow (controlled confirmation modal). */
|
|
50
|
+
deleteModalOpen?: boolean;
|
|
51
|
+
onRequestDelete?: () => void;
|
|
52
|
+
onCancelDelete?: () => void;
|
|
53
|
+
onConfirmDelete?: () => void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const DEFAULT_ENTRIES: NavEntry[] = [
|
|
57
|
+
{ id: "home", label: "Home", icon: <Icon name="home" className="size-[18px]" /> },
|
|
58
|
+
{ id: "projects", label: "Projects", icon: <Icon name="folder" className="size-[18px]" /> },
|
|
59
|
+
{ id: "settings", label: "Settings", icon: <Icon name="settings-gear" className="size-[18px]" /> },
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
const DEFAULT_MODEL_OPTIONS: DropdownOption[] = [
|
|
63
|
+
{ label: "Sonnet — balanced, fast", value: "sonnet" },
|
|
64
|
+
{ label: "Opus — most capable", value: "opus" },
|
|
65
|
+
{ label: "Haiku — fastest, lightweight", value: "haiku" },
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
/* ─── Layout primitives ──────────────────────────────────────────────────── */
|
|
69
|
+
|
|
70
|
+
function SettingsSection({
|
|
71
|
+
title,
|
|
72
|
+
description,
|
|
73
|
+
icon,
|
|
74
|
+
children,
|
|
75
|
+
tone = "default",
|
|
76
|
+
}: {
|
|
77
|
+
title: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
icon: React.ReactNode;
|
|
80
|
+
children: React.ReactNode;
|
|
81
|
+
tone?: "default" | "danger";
|
|
82
|
+
}) {
|
|
83
|
+
return (
|
|
84
|
+
<section
|
|
85
|
+
className={[
|
|
86
|
+
"w-full rounded-xl border bg-surface p-lg flex flex-col gap-base",
|
|
87
|
+
tone === "danger" ? "border-semantic-error/40" : "border-hairline",
|
|
88
|
+
].join(" ")}
|
|
89
|
+
>
|
|
90
|
+
<div className="flex items-start gap-sm">
|
|
91
|
+
<span
|
|
92
|
+
className={[
|
|
93
|
+
"flex items-center justify-center rounded-md shrink-0",
|
|
94
|
+
tone === "danger" ? "bg-[var(--color-semantic-error-soft)] text-semantic-error" : "bg-primary-soft text-primary",
|
|
95
|
+
].join(" ")}
|
|
96
|
+
style={{ width: "36px", height: "36px" }}
|
|
97
|
+
>
|
|
98
|
+
{icon}
|
|
99
|
+
</span>
|
|
100
|
+
<div className="flex flex-col gap-xxs min-w-0">
|
|
101
|
+
<h2 className={`text-heading-sm ${tone === "danger" ? "text-semantic-error" : "text-ink"}`}>
|
|
102
|
+
{title}
|
|
103
|
+
</h2>
|
|
104
|
+
{description && <p className="text-body-sm text-muted">{description}</p>}
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
{children}
|
|
108
|
+
</section>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* ─── Component ──────────────────────────────────────────────────────────── */
|
|
113
|
+
|
|
114
|
+
export const SettingsPageTemplate = React.forwardRef<HTMLDivElement, SettingsPageTemplateProps>(
|
|
115
|
+
(
|
|
116
|
+
{
|
|
117
|
+
hideSidebar = false,
|
|
118
|
+
sidebarEntries = DEFAULT_ENTRIES,
|
|
119
|
+
activeSidebarId = "settings",
|
|
120
|
+
onSidebarSelect,
|
|
121
|
+
userInitials = "O",
|
|
122
|
+
userEmail = "ofer@example.com",
|
|
123
|
+
onLogout,
|
|
124
|
+
onSettings,
|
|
125
|
+
plan = { name: "Pro", price: "$20/mo", renewsOn: "May 12, 2025" },
|
|
126
|
+
onManageBilling,
|
|
127
|
+
modelOptions = DEFAULT_MODEL_OPTIONS,
|
|
128
|
+
selectedModel = "sonnet",
|
|
129
|
+
onModelChange,
|
|
130
|
+
deleteModalOpen = false,
|
|
131
|
+
onRequestDelete,
|
|
132
|
+
onCancelDelete,
|
|
133
|
+
onConfirmDelete,
|
|
134
|
+
},
|
|
135
|
+
ref,
|
|
136
|
+
) => {
|
|
137
|
+
const [confirmText, setConfirmText] = React.useState("");
|
|
138
|
+
const confirmed = confirmText.trim().toUpperCase() === "DELETE";
|
|
139
|
+
|
|
140
|
+
React.useEffect(() => {
|
|
141
|
+
if (!deleteModalOpen) setConfirmText("");
|
|
142
|
+
}, [deleteModalOpen]);
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<div ref={ref} className="w-full h-full flex bg-canvas" style={{ minHeight: "640px" }}>
|
|
146
|
+
{/* ── Left: app sidebar ── */}
|
|
147
|
+
{!hideSidebar && (
|
|
148
|
+
<AppSidebar
|
|
149
|
+
brandName="Acme"
|
|
150
|
+
entries={sidebarEntries}
|
|
151
|
+
activeId={activeSidebarId}
|
|
152
|
+
onSelect={onSidebarSelect}
|
|
153
|
+
userInitials={userInitials}
|
|
154
|
+
userEmail={userEmail}
|
|
155
|
+
onLogout={onLogout}
|
|
156
|
+
onSettings={onSettings}
|
|
157
|
+
/>
|
|
158
|
+
)}
|
|
159
|
+
|
|
160
|
+
{/* ── Right: settings content ── */}
|
|
161
|
+
<div className="flex-1 min-w-0 h-full overflow-y-auto">
|
|
162
|
+
<div className="w-full max-w-3xl mx-auto px-xl py-xxl flex flex-col gap-xl">
|
|
163
|
+
<div className="flex flex-col gap-xxs">
|
|
164
|
+
<h1 className="text-heading-lg text-ink">Settings</h1>
|
|
165
|
+
<p className="text-body-md text-muted">Manage your subscription, model preferences, and account.</p>
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
{/* Subscription */}
|
|
169
|
+
<SettingsSection
|
|
170
|
+
title="Subscription"
|
|
171
|
+
description="Billing is handled securely by Stripe."
|
|
172
|
+
icon={<Icon name="credit-card" className="size-[18px]" />}
|
|
173
|
+
>
|
|
174
|
+
<div className="flex items-center justify-between gap-base rounded-lg bg-surface-soft border border-hairline px-base py-base flex-wrap">
|
|
175
|
+
<div className="flex items-center gap-sm">
|
|
176
|
+
<Chip label={plan.name} variant="primary" size="md" />
|
|
177
|
+
<div className="flex flex-col gap-xxs">
|
|
178
|
+
<span className="text-body-md text-ink font-weight-heading-sm">{plan.price}</span>
|
|
179
|
+
{plan.periodCaption ? (
|
|
180
|
+
<span className="text-caption text-muted">{plan.periodCaption}</span>
|
|
181
|
+
) : (
|
|
182
|
+
plan.renewsOn && (
|
|
183
|
+
<span className="text-caption text-muted">Renews on {plan.renewsOn}</span>
|
|
184
|
+
)
|
|
185
|
+
)}
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
<Button variant="secondary" size="sm" onClick={onManageBilling}>
|
|
189
|
+
Manage on Stripe
|
|
190
|
+
<Icon name="external-link-arrow-up-right" className="size-4" />
|
|
191
|
+
</Button>
|
|
192
|
+
</div>
|
|
193
|
+
</SettingsSection>
|
|
194
|
+
|
|
195
|
+
{/* Model preference */}
|
|
196
|
+
<SettingsSection
|
|
197
|
+
title="Global model"
|
|
198
|
+
description="Choose the default model used across all your projects."
|
|
199
|
+
icon={<Icon name="cpu-chip-processor" className="size-[18px]" />}
|
|
200
|
+
>
|
|
201
|
+
<div className="w-full sm:w-2/3">
|
|
202
|
+
<Dropdown
|
|
203
|
+
label="Default model"
|
|
204
|
+
options={modelOptions}
|
|
205
|
+
value={selectedModel}
|
|
206
|
+
onChange={onModelChange}
|
|
207
|
+
placeholder="Select a model"
|
|
208
|
+
/>
|
|
209
|
+
</div>
|
|
210
|
+
</SettingsSection>
|
|
211
|
+
|
|
212
|
+
{/* Danger zone */}
|
|
213
|
+
<SettingsSection
|
|
214
|
+
title="Delete account"
|
|
215
|
+
description="Permanently remove your account and all associated data. This cannot be undone."
|
|
216
|
+
icon={<Icon name="warning-triangle-alert" className="size-[18px]" />}
|
|
217
|
+
tone="danger"
|
|
218
|
+
>
|
|
219
|
+
<div className="flex items-center justify-between gap-base rounded-lg bg-[var(--color-semantic-error-soft)] px-base py-base flex-wrap">
|
|
220
|
+
<p className="text-body-sm text-ink max-w-md">
|
|
221
|
+
All projects, chats, and settings will be permanently deleted. There is no way to recover your data afterward.
|
|
222
|
+
</p>
|
|
223
|
+
<Button variant="destructive" size="sm" onClick={onRequestDelete}>
|
|
224
|
+
<Icon name="trash-delete" className="size-4" />
|
|
225
|
+
Delete account
|
|
226
|
+
</Button>
|
|
227
|
+
</div>
|
|
228
|
+
</SettingsSection>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
{/* ── Confirmation modal ── */}
|
|
233
|
+
<Modal
|
|
234
|
+
isOpen={deleteModalOpen}
|
|
235
|
+
onClose={() => onCancelDelete?.()}
|
|
236
|
+
title="Delete account permanently?"
|
|
237
|
+
size="sm"
|
|
238
|
+
footer={
|
|
239
|
+
<>
|
|
240
|
+
<Button variant="secondary" size="sm" onClick={onCancelDelete}>
|
|
241
|
+
Cancel
|
|
242
|
+
</Button>
|
|
243
|
+
<Button
|
|
244
|
+
variant="destructive"
|
|
245
|
+
size="sm"
|
|
246
|
+
disabled={!confirmed}
|
|
247
|
+
onClick={onConfirmDelete}
|
|
248
|
+
>
|
|
249
|
+
Delete permanently
|
|
250
|
+
</Button>
|
|
251
|
+
</>
|
|
252
|
+
}
|
|
253
|
+
>
|
|
254
|
+
<div className="flex flex-col gap-base">
|
|
255
|
+
<p className="text-body-sm text-body">
|
|
256
|
+
This action is irreversible. Type <span className="text-ink font-weight-heading-sm">DELETE</span> to confirm.
|
|
257
|
+
</p>
|
|
258
|
+
<Input
|
|
259
|
+
value={confirmText}
|
|
260
|
+
onChange={(e) => setConfirmText(e.target.value)}
|
|
261
|
+
placeholder="DELETE"
|
|
262
|
+
fullWidth
|
|
263
|
+
aria-label="Type DELETE to confirm"
|
|
264
|
+
/>
|
|
265
|
+
</div>
|
|
266
|
+
</Modal>
|
|
267
|
+
</div>
|
|
268
|
+
);
|
|
269
|
+
},
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
SettingsPageTemplate.displayName = "SettingsPageTemplate";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SettingsPageTemplate } from "./SettingsPageTemplate";
|
|
3
|
+
|
|
4
|
+
export default function SettingsPageTemplatePreview() {
|
|
5
|
+
const [activeSidebarId, setActiveSidebarId] = React.useState("settings");
|
|
6
|
+
const [selectedModel, setSelectedModel] = React.useState("sonnet");
|
|
7
|
+
const [deleteModalOpen, setDeleteModalOpen] = React.useState(false);
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<div className="w-full">
|
|
11
|
+
<SettingsPageTemplate
|
|
12
|
+
activeSidebarId={activeSidebarId}
|
|
13
|
+
onSidebarSelect={setActiveSidebarId}
|
|
14
|
+
onLogout={() => alert("Logged out")}
|
|
15
|
+
plan={{ name: "Pro", price: "$20/mo", renewsOn: "May 12, 2025" }}
|
|
16
|
+
onManageBilling={() => alert("Opens Stripe billing portal")}
|
|
17
|
+
selectedModel={selectedModel}
|
|
18
|
+
onModelChange={setSelectedModel}
|
|
19
|
+
deleteModalOpen={deleteModalOpen}
|
|
20
|
+
onRequestDelete={() => setDeleteModalOpen(true)}
|
|
21
|
+
onCancelDelete={() => setDeleteModalOpen(false)}
|
|
22
|
+
onConfirmDelete={() => {
|
|
23
|
+
setDeleteModalOpen(false);
|
|
24
|
+
alert("Account deleted");
|
|
25
|
+
}}
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Icon } from "../Icon";
|
|
3
|
+
import { Button } from "../Button";
|
|
4
|
+
|
|
5
|
+
export interface SidebarUpgradeBannerProps
|
|
6
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
ctaLabel?: string;
|
|
10
|
+
onUpgrade?: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* "card" (default) renders the full card with icon, description, and a
|
|
13
|
+
* full-width CTA button. "compact" renders a smaller banner (title +
|
|
14
|
+
* subtitle left, animated 2x2 wave grid right) suited to a narrow
|
|
15
|
+
* sidebar footer — text wraps instead of truncating, and the whole row
|
|
16
|
+
* is clickable when onUpgrade is provided.
|
|
17
|
+
*/
|
|
18
|
+
size?: "card" | "compact";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Each of the 4 cells (and the halo ring) sit idle almost the entire cycle
|
|
22
|
+
// and only "flash" briefly near the end of it — a rare pulse rather than a
|
|
23
|
+
// continuous breathing loop. Every cell/ring runs a DIFFERENT, mutually
|
|
24
|
+
// prime-ish duration so their brief flashes drift in and out of sync
|
|
25
|
+
// instead of ever repeating in lockstep — it reads as an organic, randomly
|
|
26
|
+
// timed flicker rather than a metronome.
|
|
27
|
+
const COMPACT_GRID_KEYFRAMES = `
|
|
28
|
+
@keyframes sub-wave-cell {
|
|
29
|
+
0%, 92%, 100% { opacity: 0.35; transform: scale(0.7); }
|
|
30
|
+
96% { opacity: 1; transform: scale(1); }
|
|
31
|
+
}
|
|
32
|
+
@keyframes sub-wave-ring {
|
|
33
|
+
0%, 88%, 100% { opacity: 0; transform: scale(0.85); }
|
|
34
|
+
94% { opacity: 0.35; transform: scale(1.2); }
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
const CELL_TIMINGS = [
|
|
39
|
+
{ duration: "5.8s", delay: "0.2s" },
|
|
40
|
+
{ duration: "7.1s", delay: "1.6s" },
|
|
41
|
+
{ duration: "6.4s", delay: "0.9s" },
|
|
42
|
+
{ duration: "8.3s", delay: "2.4s" },
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
export const SidebarUpgradeBanner = React.forwardRef<
|
|
46
|
+
HTMLDivElement,
|
|
47
|
+
SidebarUpgradeBannerProps
|
|
48
|
+
>(
|
|
49
|
+
(
|
|
50
|
+
{
|
|
51
|
+
title = "Upgrade your plan",
|
|
52
|
+
description = "Get more credits, advanced features, and priority support.",
|
|
53
|
+
ctaLabel = "Upgrade now",
|
|
54
|
+
onUpgrade,
|
|
55
|
+
size = "card",
|
|
56
|
+
className,
|
|
57
|
+
...rest
|
|
58
|
+
},
|
|
59
|
+
ref,
|
|
60
|
+
) => {
|
|
61
|
+
if (size === "compact") {
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
ref={ref}
|
|
65
|
+
className={["w-full max-w-3xl mx-auto", className]
|
|
66
|
+
.filter(Boolean)
|
|
67
|
+
.join(" ")}
|
|
68
|
+
{...rest}
|
|
69
|
+
>
|
|
70
|
+
<style>{COMPACT_GRID_KEYFRAMES}</style>
|
|
71
|
+
|
|
72
|
+
<div
|
|
73
|
+
role={onUpgrade ? "button" : undefined}
|
|
74
|
+
tabIndex={onUpgrade ? 0 : undefined}
|
|
75
|
+
onClick={onUpgrade}
|
|
76
|
+
onKeyDown={(e) => {
|
|
77
|
+
if (onUpgrade && (e.key === "Enter" || e.key === " ")) {
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
onUpgrade();
|
|
80
|
+
}
|
|
81
|
+
}}
|
|
82
|
+
className={[
|
|
83
|
+
"group flex items-center gap-sm rounded-lg border border-hairline bg-canvas px-sm py-sm shadow-sm",
|
|
84
|
+
"transition-shadow duration-300 ease-out",
|
|
85
|
+
onUpgrade
|
|
86
|
+
? "cursor-pointer hover:shadow-md hover:border-hairline-strong active:scale-[0.98] focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary-focus focus-visible:outline-offset-2"
|
|
87
|
+
: "",
|
|
88
|
+
]
|
|
89
|
+
.filter(Boolean)
|
|
90
|
+
.join(" ")}
|
|
91
|
+
>
|
|
92
|
+
<div className="flex flex-1 flex-col gap-xxs min-w-0">
|
|
93
|
+
<span className="text-body-sm font-weight-heading-sm text-ink">
|
|
94
|
+
{title}
|
|
95
|
+
</span>
|
|
96
|
+
<span className="text-caption text-muted leading-caption">
|
|
97
|
+
{description}
|
|
98
|
+
</span>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<span className="relative flex size-7 shrink-0 items-center justify-center">
|
|
102
|
+
<span
|
|
103
|
+
aria-hidden="true"
|
|
104
|
+
className="absolute inset-0 rounded-full bg-logo-orange"
|
|
105
|
+
style={{
|
|
106
|
+
animationName: "sub-wave-ring",
|
|
107
|
+
animationDuration: "7s",
|
|
108
|
+
animationTimingFunction: "ease-in-out",
|
|
109
|
+
animationIterationCount: "infinite",
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
<span className="relative grid grid-cols-2 gap-xxs size-3.5">
|
|
113
|
+
{CELL_TIMINGS.map((timing, i) => (
|
|
114
|
+
<span
|
|
115
|
+
key={i}
|
|
116
|
+
aria-hidden="true"
|
|
117
|
+
className="rounded-xs bg-logo-orange"
|
|
118
|
+
style={{
|
|
119
|
+
animationName: "sub-wave-cell",
|
|
120
|
+
animationDuration: timing.duration,
|
|
121
|
+
animationTimingFunction: "ease-in-out",
|
|
122
|
+
animationIterationCount: "infinite",
|
|
123
|
+
animationFillMode: "both",
|
|
124
|
+
animationDelay: timing.delay,
|
|
125
|
+
}}
|
|
126
|
+
/>
|
|
127
|
+
))}
|
|
128
|
+
</span>
|
|
129
|
+
</span>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<div
|
|
137
|
+
ref={ref}
|
|
138
|
+
className={["relative w-full max-w-3xl mx-auto", className]
|
|
139
|
+
.filter(Boolean)
|
|
140
|
+
.join(" ")}
|
|
141
|
+
{...rest}
|
|
142
|
+
>
|
|
143
|
+
{/* Decorative accent bar — pops past the card's top/bottom edge */}
|
|
144
|
+
<span
|
|
145
|
+
aria-hidden="true"
|
|
146
|
+
className="absolute -left-[3px] top-1/2 h-[calc(100%+16px)] w-1.5 -translate-y-1/2 rounded-full bg-primary"
|
|
147
|
+
/>
|
|
148
|
+
|
|
149
|
+
<div className="rounded-xl border border-hairline bg-canvas p-lg shadow-sm">
|
|
150
|
+
<div className="flex items-start gap-md">
|
|
151
|
+
<span className="flex size-11 shrink-0 items-center justify-center rounded-md bg-primary-soft">
|
|
152
|
+
<Icon name="rocket" className="size-6 text-primary" aria-hidden="true" />
|
|
153
|
+
</span>
|
|
154
|
+
|
|
155
|
+
<div className="flex flex-col gap-xxs pt-xxs">
|
|
156
|
+
<span className="text-body-lg font-weight-heading-sm text-ink">
|
|
157
|
+
{title}
|
|
158
|
+
</span>
|
|
159
|
+
<span className="text-body-sm text-muted">{description}</span>
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<Button
|
|
164
|
+
type="button"
|
|
165
|
+
variant="primary"
|
|
166
|
+
size="md"
|
|
167
|
+
onClick={onUpgrade}
|
|
168
|
+
className="mt-md w-full rounded-md"
|
|
169
|
+
>
|
|
170
|
+
{ctaLabel}
|
|
171
|
+
</Button>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
);
|
|
175
|
+
},
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
SidebarUpgradeBanner.displayName = "SidebarUpgradeBanner";
|