Skip to content

Commit e4e2679

Browse files
Copilothotlong
andcommitted
Add Accounts page and improve Opportunities page in CRM Storybook
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 6fb8261 commit e4e2679

1 file changed

Lines changed: 69 additions & 8 deletions

File tree

packages/components/src/stories/CRMApp.stories.tsx

Lines changed: 69 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import {
88
Users,
99
Settings,
1010
FileText,
11-
GalleryVerticalEnd
11+
GalleryVerticalEnd,
12+
Building2,
13+
UserPlus,
14+
TrendingUp
1215
} from 'lucide-react';
1316

1417
/* --- MOCK DATA --- */
@@ -43,10 +46,20 @@ const CONTACTS_DATA = {
4346

4447
const OPPORTUNITIES_DATA = {
4548
opportunities: [
46-
{ id: 101, name: "TechCorp License Renewal", amount: 50000, stage: "Negotiation", probability: "80%" },
47-
{ id: 102, name: "SalesInc New Deal", amount: 12000, stage: "Qualified", probability: "40%" },
48-
{ id: 103, name: "StartupHub Seed", amount: 5000, stage: "Closed Won", probability: "100%" },
49-
{ id: 104, name: "Enterprise Ltd Expansion", amount: 150000, stage: "Proposal", probability: "60%" }
49+
{ id: 101, name: "TechCorp License Renewal", amount: 50000, stage: "Negotiation", probability: "80%", closeDate: "2026-02-15", contact: "Alice Johnson" },
50+
{ id: 102, name: "SalesInc New Deal", amount: 12000, stage: "Qualified", probability: "40%", closeDate: "2026-03-01", contact: "Bob Smith" },
51+
{ id: 103, name: "StartupHub Seed", amount: 5000, stage: "Closed Won", probability: "100%", closeDate: "2026-01-20", contact: "Charlie Davis" },
52+
{ id: 104, name: "Enterprise Ltd Expansion", amount: 150000, stage: "Proposal", probability: "60%", closeDate: "2026-02-28", contact: "Dana Wilson" }
53+
]
54+
};
55+
56+
const ACCOUNTS_DATA = {
57+
accounts: [
58+
{ id: 1, name: "TechCorp", industry: "Technology", revenue: 5000000, employees: 250, status: "Active" },
59+
{ id: 2, name: "SalesInc", industry: "Sales & Marketing", revenue: 1200000, employees: 50, status: "Active" },
60+
{ id: 3, name: "StartupHub", industry: "Venture Capital", revenue: 500000, employees: 15, status: "Lead" },
61+
{ id: 4, name: "Enterprise Ltd", industry: "Enterprise Software", revenue: 15000000, employees: 500, status: "Active" },
62+
{ id: 5, name: "Innovate LLC", industry: "Innovation", revenue: 3000000, employees: 100, status: "Active" }
5063
]
5164
};
5265

@@ -170,7 +183,10 @@ const opportunitiesSchema = {
170183
children: [
171184
{
172185
type: "page:header",
173-
props: { title: "Opportunities", description: "View and track sales deals." }
186+
props: { title: "Opportunities", description: "View and track sales deals." },
187+
children: [
188+
{ type: "button", props: { children: "New Opportunity", size: "sm" } }
189+
]
174190
},
175191
{
176192
type: "page:card",
@@ -182,9 +198,11 @@ const opportunitiesSchema = {
182198
props: {
183199
columns: [
184200
{ key: "name", label: "Deal Name", type: "text" },
201+
{ key: "contact", label: "Contact", type: "text" },
185202
{ key: "stage", label: "Stage", type: "text" },
186203
{ key: "amount", label: "Amount ($)", type: "number" },
187-
{ key: "probability", label: "Probability", type: "text" }
204+
{ key: "probability", label: "Probability", type: "text" },
205+
{ key: "closeDate", label: "Close Date", type: "text" }
188206
]
189207
}
190208
}
@@ -255,6 +273,39 @@ const SETTINGS_DATA = {
255273
}
256274
};
257275

276+
const accountsSchema = {
277+
type: "page",
278+
props: { title: "Accounts" },
279+
children: [
280+
{
281+
type: "page:header",
282+
props: { title: "Accounts", description: "Manage your business accounts and companies." },
283+
children: [
284+
{ type: "button", props: { children: "New Account", size: "sm" } }
285+
]
286+
},
287+
{
288+
type: "page:card",
289+
className: "mt-6",
290+
children: [
291+
{
292+
type: "view:grid",
293+
bind: "accounts",
294+
props: {
295+
columns: [
296+
{ key: "name", label: "Account Name", type: "text" },
297+
{ key: "industry", label: "Industry", type: "text" },
298+
{ key: "revenue", label: "Annual Revenue ($)", type: "number" },
299+
{ key: "employees", label: "Employees", type: "number" },
300+
{ key: "status", label: "Status", type: "text" }
301+
]
302+
}
303+
}
304+
]
305+
}
306+
]
307+
};
308+
258309
/* --- APP COMPONENT --- */
259310

260311
const CRMStoryApp = () => {
@@ -266,6 +317,8 @@ const CRMStoryApp = () => {
266317
return <SchemaRendererProvider dataSource={DASHBOARD_DATA}><SchemaRenderer schema={dashboardSchema} /></SchemaRendererProvider>;
267318
case "contacts":
268319
return <SchemaRendererProvider dataSource={CONTACTS_DATA}><SchemaRenderer schema={contactsSchema} /></SchemaRendererProvider>;
320+
case "accounts":
321+
return <SchemaRendererProvider dataSource={ACCOUNTS_DATA}><SchemaRenderer schema={accountsSchema} /></SchemaRendererProvider>;
269322
case "opportunities":
270323
return <SchemaRendererProvider dataSource={OPPORTUNITIES_DATA}><SchemaRenderer schema={opportunitiesSchema} /></SchemaRendererProvider>;
271324
case "settings":
@@ -315,12 +368,20 @@ const CRMStoryApp = () => {
315368
<Users />
316369
<span>Contacts</span>
317370
</SidebarMenuButton>
371+
<SidebarMenuButton
372+
isActive={activePage === "accounts"}
373+
onClick={() => setActivePage("accounts")}
374+
tooltip="Accounts"
375+
>
376+
<Building2 />
377+
<span>Accounts</span>
378+
</SidebarMenuButton>
318379
<SidebarMenuButton
319380
isActive={activePage === "opportunities"}
320381
onClick={() => setActivePage("opportunities")}
321382
tooltip="Opportunities"
322383
>
323-
<FileText />
384+
<TrendingUp />
324385
<span>Opportunities</span>
325386
</SidebarMenuButton>
326387
<SidebarMenuButton

0 commit comments

Comments
 (0)