blixify-ui-web-mcp 0.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 +5 -0
- package/lib/components/action/button/README.md +75 -0
- package/lib/components/action/button/button.stories.tsx +138 -0
- package/lib/components/action/buttonGroup/README.md +79 -0
- package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +104 -0
- package/lib/components/action/iconButton/README.md +39 -0
- package/lib/components/action/iconButton/iconButton.stories.tsx +22 -0
- package/lib/components/action/radioList/README.md +98 -0
- package/lib/components/action/radioList/radioList.stories.tsx +181 -0
- package/lib/components/action/slider/README.md +86 -0
- package/lib/components/action/slider/slider.stories.tsx +133 -0
- package/lib/components/action/textButton/README.md +34 -0
- package/lib/components/action/textButton/textButton.stories.tsx +16 -0
- package/lib/components/action/toggle/README.md +39 -0
- package/lib/components/action/toggle/toggle.stories.tsx +23 -0
- package/lib/components/advanced/collapse/README.md +106 -0
- package/lib/components/advanced/collapse/collapse.stories.tsx +165 -0
- package/lib/components/advanced/infoWindow/README.md +69 -0
- package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +112 -0
- package/lib/components/advanced/popUp/README.md +95 -0
- package/lib/components/advanced/popUp/popUp.stories.tsx +189 -0
- package/lib/components/auth/bareSignIn/README.md +78 -0
- package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +141 -0
- package/lib/components/auth/bareSignUp/README.md +130 -0
- package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +159 -0
- package/lib/components/auth/signIn/README.md +53 -0
- package/lib/components/auth/signIn/signIn.stories.tsx +120 -0
- package/lib/components/auth/signUp/README.md +136 -0
- package/lib/components/auth/signUp/signUp.stories.tsx +193 -0
- package/lib/components/chart/README.md +13 -0
- package/lib/components/chart/areaChart/README.md +133 -0
- package/lib/components/chart/areaChart/areaChart.stories.tsx +199 -0
- package/lib/components/chart/barChart/README.md +193 -0
- package/lib/components/chart/barChart/barChart.stories.tsx +318 -0
- package/lib/components/chart/boxPlotChart/README.md +124 -0
- package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +104 -0
- package/lib/components/chart/bubbleChart/README.md +166 -0
- package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +144 -0
- package/lib/components/chart/card/README.md +107 -0
- package/lib/components/chart/card/card.stories.tsx +89 -0
- package/lib/components/chart/ganttChart/README.md +142 -0
- package/lib/components/chart/ganttChart/ganttChart.stories.tsx +138 -0
- package/lib/components/chart/heatmapChart/README.md +125 -0
- package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +106 -0
- package/lib/components/chart/lineChart/README.md +140 -0
- package/lib/components/chart/lineChart/lineChart.stories.tsx +152 -0
- package/lib/components/chart/pieChart/README.md +117 -0
- package/lib/components/chart/pieChart/pieChart.stories.tsx +180 -0
- package/lib/components/chart/polarAreaChart/README.md +126 -0
- package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +106 -0
- package/lib/components/chart/radarChart/README.md +57 -0
- package/lib/components/chart/radarChart/radarChart.stories.tsx +36 -0
- package/lib/components/chart/radialBar/README.md +152 -0
- package/lib/components/chart/radialBar/radialChart.stories.tsx +136 -0
- package/lib/components/chart/rangeBarChart/README.md +323 -0
- package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +208 -0
- package/lib/components/chart/statsCard/README.md +97 -0
- package/lib/components/chart/statsCard/statsCard.stories.tsx +183 -0
- package/lib/components/chart/treemapChart/README.md +142 -0
- package/lib/components/chart/treemapChart/treemapChart.stories.tsx +122 -0
- package/lib/components/chat/chatAnchor/README.md +113 -0
- package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +156 -0
- package/lib/components/chat/chatBase/README.md +223 -0
- package/lib/components/chat/chatBase/chatBase.stories.tsx +306 -0
- package/lib/components/chat/chatDashboard/README.md +161 -0
- package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +154 -0
- package/lib/components/data/dataGraph/README.md +13 -0
- package/lib/components/data/dataGraph/dataGraph.stories.tsx +84 -0
- package/lib/components/data/dataReference/README.md +62 -0
- package/lib/components/data/dataReference/dataReference.stories.tsx +53 -0
- package/lib/components/data/dataTemplate/README.md +903 -0
- package/lib/components/data/dataTemplate/dataModule.stories.tsx +196 -0
- package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +337 -0
- package/lib/components/data/dataWrapper/README.md +1077 -0
- package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +831 -0
- package/lib/components/data/queryForm/README.md +56 -0
- package/lib/components/data/queryForm/queryForm.stories.tsx +85 -0
- package/lib/components/data/readQuery/README.md +282 -0
- package/lib/components/data/readQuery/readQuery.stories.tsx +256 -0
- package/lib/components/data/readQueryHoc/README.md +89 -0
- package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +33 -0
- package/lib/components/data/writeQuery/README.md +178 -0
- package/lib/components/data/writeQuery/writeQuery.stories.tsx +209 -0
- package/lib/components/design/actionSection/README.md +47 -0
- package/lib/components/design/actionSection/actionSection.stories.tsx +74 -0
- package/lib/components/design/banner/README.md +43 -0
- package/lib/components/design/banner/banner.stories.tsx +34 -0
- package/lib/components/design/bannerAction/README.md +44 -0
- package/lib/components/design/bannerAction/bannerAction.stories.tsx +25 -0
- package/lib/components/design/blogSection/README.md +111 -0
- package/lib/components/design/blogSection/blogSection.stories.tsx +72 -0
- package/lib/components/design/carouselSection/README.md +82 -0
- package/lib/components/design/carouselSection/carouselSection.stories.tsx +52 -0
- package/lib/components/design/designList/README.md +60 -0
- package/lib/components/design/designList/designList.stories.tsx +44 -0
- package/lib/components/design/faq/README.md +121 -0
- package/lib/components/design/faq/faq.stories.tsx +103 -0
- package/lib/components/design/fileGrid/README.md +87 -0
- package/lib/components/design/fileGrid/fileGrid.stories.tsx +110 -0
- package/lib/components/design/fileViewer/README.md +40 -0
- package/lib/components/design/fileViewer/fileViewer.stories.tsx +28 -0
- package/lib/components/design/footerSection/README.md +62 -0
- package/lib/components/design/footerSection/footerSection.stories.tsx +84 -0
- package/lib/components/design/googleReview/README.md +45 -0
- package/lib/components/design/googleReview/googleReview.stories.tsx +33 -0
- package/lib/components/design/heroSection/README.md +48 -0
- package/lib/components/design/heroSection/heroSection.stories.tsx +85 -0
- package/lib/components/design/iconList/README.md +60 -0
- package/lib/components/design/iconList/iconList.stories.tsx +41 -0
- package/lib/components/design/imageGallery/README.md +56 -0
- package/lib/components/design/imageGallery/imageGallery.stories.tsx +45 -0
- package/lib/components/design/imageZoom/README.md +47 -0
- package/lib/components/design/imageZoom/imageZoom.stories.tsx +30 -0
- package/lib/components/design/leftContent/README.md +47 -0
- package/lib/components/design/leftContent/leftContent.stories.tsx +32 -0
- package/lib/components/design/logoCloud/README.md +42 -0
- package/lib/components/design/logoCloud/logoCloud.stories.tsx +44 -0
- package/lib/components/design/onboarding/README.md +100 -0
- package/lib/components/design/onboarding/onboarding.stories.tsx +113 -0
- package/lib/components/design/pricing/README.md +112 -0
- package/lib/components/design/pricing/pricing.stories.tsx +86 -0
- package/lib/components/design/rightContent/README.md +47 -0
- package/lib/components/design/rightContent/rightContent.stories.tsx +32 -0
- package/lib/components/design/sectionList/README.md +51 -0
- package/lib/components/design/sectionList/sectionList.stories.tsx +35 -0
- package/lib/components/design/teams/README.md +62 -0
- package/lib/components/design/teams/teams.stories.tsx +61 -0
- package/lib/components/display/alert/README.md +82 -0
- package/lib/components/display/alert/alert.stories.tsx +71 -0
- package/lib/components/display/calendar/README.md +113 -0
- package/lib/components/display/calendar/calendar.stories.tsx +159 -0
- package/lib/components/display/clipboard/README.md +36 -0
- package/lib/components/display/clipboard/clipboard.stories.tsx +32 -0
- package/lib/components/display/detailList/README.md +61 -0
- package/lib/components/display/detailList/detailList.stories.tsx +131 -0
- package/lib/components/display/drawer/README.md +74 -0
- package/lib/components/display/drawer/drawer.stories.tsx +66 -0
- package/lib/components/display/emptyState/README.md +38 -0
- package/lib/components/display/emptyState/emptyState.stories.tsx +22 -0
- package/lib/components/display/feeds/README.md +80 -0
- package/lib/components/display/feeds/feeds.stories.tsx +75 -0
- package/lib/components/display/flexTable/README.md +160 -0
- package/lib/components/display/flexTable/flexTable.stories.tsx +313 -0
- package/lib/components/display/grid/README.md +121 -0
- package/lib/components/display/grid/grid.stories.tsx +234 -0
- package/lib/components/display/kanban/README.md +78 -0
- package/lib/components/display/kanban/kanban.stories.tsx +133 -0
- package/lib/components/display/list/README.md +109 -0
- package/lib/components/display/list/list.stories.tsx +188 -0
- package/lib/components/display/loading/README.md +25 -0
- package/lib/components/display/loading/loading.stories.tsx +15 -0
- package/lib/components/display/mapView/README.md +99 -0
- package/lib/components/display/mapView/mapView.stories.tsx +225 -0
- package/lib/components/display/modal/README.md +43 -0
- package/lib/components/display/modal/modal.stories.tsx +81 -0
- package/lib/components/display/notification/README.md +43 -0
- package/lib/components/display/notification/notification.stories.tsx +30 -0
- package/lib/components/display/progress/README.md +25 -0
- package/lib/components/display/progress/progress.stories.tsx +15 -0
- package/lib/components/display/stepper/README.md +96 -0
- package/lib/components/display/stepper/stepper.stories.tsx +175 -0
- package/lib/components/display/table/README.md +176 -0
- package/lib/components/display/table/table.stories.tsx +330 -0
- package/lib/components/display/tag/README.md +74 -0
- package/lib/components/display/tag/tag.stories.tsx +79 -0
- package/lib/components/input/address/README.md +132 -0
- package/lib/components/input/address/address.stories.tsx +147 -0
- package/lib/components/input/canvas/README.md +131 -0
- package/lib/components/input/canvas/canvas.stories.tsx +165 -0
- package/lib/components/input/checkbox/README.md +61 -0
- package/lib/components/input/checkbox/checkbox.stories.tsx +30 -0
- package/lib/components/input/datePicker/README.md +124 -0
- package/lib/components/input/datePicker/datePicker.stories.tsx +197 -0
- package/lib/components/input/form/README.md +55 -0
- package/lib/components/input/form/form.stories.tsx +143 -0
- package/lib/components/input/markdown/README.md +146 -0
- package/lib/components/input/markdown/markdown.stories.tsx +40 -0
- package/lib/components/input/monthYearPicker/README.md +69 -0
- package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +47 -0
- package/lib/components/input/netPromoterScore/README.md +52 -0
- package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +30 -0
- package/lib/components/input/rating/README.md +51 -0
- package/lib/components/input/rating/rating.stories.tsx +30 -0
- package/lib/components/input/select/README.md +108 -0
- package/lib/components/input/select/select.stories.tsx +286 -0
- package/lib/components/input/signature/README.md +106 -0
- package/lib/components/input/signature/signature.stories.tsx +188 -0
- package/lib/components/input/textArea/README.md +55 -0
- package/lib/components/input/textArea/textArea.stories.tsx +30 -0
- package/lib/components/input/textInput/README.md +81 -0
- package/lib/components/input/textInput/textinput.stories.tsx +231 -0
- package/lib/components/input/uploadInput/README.md +134 -0
- package/lib/components/input/uploadInput/uploadInput.stories.tsx +193 -0
- package/lib/components/navigation/bars/README.md +40 -0
- package/lib/components/navigation/bars/bars.stories.tsx +85 -0
- package/lib/components/navigation/bottomTab/README.md +53 -0
- package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +32 -0
- package/lib/components/navigation/breadcrumb/README.md +48 -0
- package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +27 -0
- package/lib/components/navigation/header/README.md +149 -0
- package/lib/components/navigation/header/header.stories.tsx +107 -0
- package/lib/components/navigation/leftNav/README.md +91 -0
- package/lib/components/navigation/leftNav/leftNav.stories.tsx +106 -0
- package/lib/components/navigation/tabs/README.md +75 -0
- package/lib/components/navigation/tabs/tabs.stories.tsx +60 -0
- package/lib/components/structure/column/README.md +40 -0
- package/lib/components/structure/column/column.stories.tsx +26 -0
- package/lib/components/structure/container/README.md +34 -0
- package/lib/components/structure/container/container.stories.tsx +19 -0
- package/lib/components/structure/link/README.md +55 -0
- package/lib/components/structure/link/link.stories.tsx +30 -0
- package/lib/components/structure/text/README.md +42 -0
- package/lib/components/structure/text/text.stories.tsx +39 -0
- package/lib/components/template/authPage/authPage.stories.tsx +68 -0
- package/lib/components/template/landingPage/landingPage.stories.tsx +288 -0
- package/lib/components/template/productListing/productListing.stories.tsx +297 -0
- package/lib/components/template/productOverview/productOverview.stories.tsx +194 -0
- package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +252 -0
- package/lib/components/template/userHomePage/userHomePage.stories.tsx +605 -0
- package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +481 -0
- package/lib/mcp/server.d.ts +2 -0
- package/lib/mcp/server.d.ts.map +1 -0
- package/lib/mcp/server.js +33 -0
- package/lib/mcp/server.js.map +1 -0
- package/lib/mcp/tools/getBackendComponent.d.ts +13 -0
- package/lib/mcp/tools/getBackendComponent.d.ts.map +1 -0
- package/lib/mcp/tools/getBackendComponent.js +119 -0
- package/lib/mcp/tools/getBackendComponent.js.map +1 -0
- package/lib/mcp/tools/getComponent.d.ts +17 -0
- package/lib/mcp/tools/getComponent.d.ts.map +1 -0
- package/lib/mcp/tools/getComponent.js +118 -0
- package/lib/mcp/tools/getComponent.js.map +1 -0
- package/lib/mcp/tools/listComponents.d.ts +13 -0
- package/lib/mcp/tools/listComponents.d.ts.map +1 -0
- package/lib/mcp/tools/listComponents.js +113 -0
- package/lib/mcp/tools/listComponents.js.map +1 -0
- package/lib/mcp/tools/listTemplates.d.ts +13 -0
- package/lib/mcp/tools/listTemplates.d.ts.map +1 -0
- package/lib/mcp/tools/listTemplates.js +68 -0
- package/lib/mcp/tools/listTemplates.js.map +1 -0
- package/lib/mcp/tools/suggestTemplate.d.ts +17 -0
- package/lib/mcp/tools/suggestTemplate.d.ts.map +1 -0
- package/lib/mcp/tools/suggestTemplate.js +212 -0
- package/lib/mcp/tools/suggestTemplate.js.map +1 -0
- package/package.json +23 -0
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { storiesOf } from "@storybook/react";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Button } from "../../action/button";
|
|
4
|
+
import { ButtonGroup } from "../../action/buttonGroup";
|
|
5
|
+
import { LineChart } from "../../chart/lineChart";
|
|
6
|
+
import { Select } from "../../input/select";
|
|
7
|
+
import { TextInput } from "../../input/textInput";
|
|
8
|
+
import { Tabs } from "../../navigation/tabs";
|
|
9
|
+
import { Container } from "../../structure/container";
|
|
10
|
+
|
|
11
|
+
const stories = storiesOf("Template", module).addParameters({
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component:
|
|
15
|
+
"Full-page admin dashboard templates combining multiple components into ready-to-use layouts. These templates demonstrate real-world compositions of Tabs, LineChart, ButtonGroup, Select, TextInput, and Container for user analytics and leaderboard views.",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
interface User {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
img: string;
|
|
24
|
+
totalDeposits: string;
|
|
25
|
+
totalWithdrawals: string;
|
|
26
|
+
agreementLength: string;
|
|
27
|
+
timeOnPlatform: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const USERS: User[] = [
|
|
31
|
+
{
|
|
32
|
+
id: "250373435",
|
|
33
|
+
name: "Samantha Williams",
|
|
34
|
+
img: "https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=64&h=64&fit=facearea&facepad=2&q=80",
|
|
35
|
+
totalDeposits: "$18,783.33",
|
|
36
|
+
totalWithdrawals: "$9,876.54",
|
|
37
|
+
agreementLength: "124 days",
|
|
38
|
+
timeOnPlatform: "242 days",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "340434554",
|
|
42
|
+
name: "John Smith",
|
|
43
|
+
img: "https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=64&h=64&fit=facearea&facepad=2&q=80",
|
|
44
|
+
totalDeposits: "$22,100.00",
|
|
45
|
+
totalWithdrawals: "$11,200.00",
|
|
46
|
+
agreementLength: "98 days",
|
|
47
|
+
timeOnPlatform: "310 days",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "562953943",
|
|
51
|
+
name: "Tim Samuels",
|
|
52
|
+
img: "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=64&h=64&fit=facearea&facepad=2&q=80",
|
|
53
|
+
totalDeposits: "$9,450.00",
|
|
54
|
+
totalWithdrawals: "$3,200.00",
|
|
55
|
+
agreementLength: "60 days",
|
|
56
|
+
timeOnPlatform: "180 days",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: "736242242",
|
|
60
|
+
name: "Sandra Hagan",
|
|
61
|
+
img: "https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=64&h=64&fit=facearea&facepad=2&q=80",
|
|
62
|
+
totalDeposits: "$14,320.00",
|
|
63
|
+
totalWithdrawals: "$6,800.00",
|
|
64
|
+
agreementLength: "112 days",
|
|
65
|
+
timeOnPlatform: "200 days",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "2263456455",
|
|
69
|
+
name: "John Smith",
|
|
70
|
+
img: "https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=64&h=64&fit=facearea&facepad=2&q=80",
|
|
71
|
+
totalDeposits: "$7,890.00",
|
|
72
|
+
totalWithdrawals: "$2,100.00",
|
|
73
|
+
agreementLength: "45 days",
|
|
74
|
+
timeOnPlatform: "90 days",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "1231234964",
|
|
78
|
+
name: "Ali Hammad",
|
|
79
|
+
img: "https://images.unsplash.com/photo-1463453091185-61582044d556?w=64&h=64&fit=facearea&facepad=2&q=80",
|
|
80
|
+
totalDeposits: "$31,000.00",
|
|
81
|
+
totalWithdrawals: "$15,400.00",
|
|
82
|
+
agreementLength: "200 days",
|
|
83
|
+
timeOnPlatform: "400 days",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "1231234965",
|
|
87
|
+
name: "Manager Dep A",
|
|
88
|
+
img: "https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?w=64&h=64&fit=facearea&facepad=2&q=80",
|
|
89
|
+
totalDeposits: "$31,000.00",
|
|
90
|
+
totalWithdrawals: "$15,400.00",
|
|
91
|
+
agreementLength: "200 days",
|
|
92
|
+
timeOnPlatform: "400 days",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: "1231234966",
|
|
96
|
+
name: "Executive Dep B",
|
|
97
|
+
img: "https://images.unsplash.com/photo-1614204424926-196a80bf0be8?w=64&h=64&fit=facearea&facepad=2&q=80",
|
|
98
|
+
totalDeposits: "$31,000.00",
|
|
99
|
+
totalWithdrawals: "$15,400.00",
|
|
100
|
+
agreementLength: "200 days",
|
|
101
|
+
timeOnPlatform: "400 days",
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
const CHART_CATEGORIES = [
|
|
106
|
+
"Oct 1",
|
|
107
|
+
"Oct 5",
|
|
108
|
+
"Oct 10",
|
|
109
|
+
"Oct 15",
|
|
110
|
+
"Oct 20",
|
|
111
|
+
"Oct 25",
|
|
112
|
+
"Oct 30",
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
const DEPOSITS_DATA = [4200, 5100, 5800, 6100, 5400, 4900, 5600];
|
|
116
|
+
const WITHDRAWALS_DATA = [2800, 3200, 3500, 2100, 3000, 3800, 4200];
|
|
117
|
+
const PROFITS_DATA = [3100, 4500, 5200, 4251, 3800, 5500, 6300];
|
|
118
|
+
|
|
119
|
+
const NAV_TABS = [
|
|
120
|
+
{ id: "dashboard", name: "DASHBOARD", href: "#" },
|
|
121
|
+
{ id: "numbers", name: "NUMBERS", href: "#" },
|
|
122
|
+
{ id: "deposits", name: "DEPOSITS AND WITHDRAWALS", href: "#" },
|
|
123
|
+
{ id: "demographics", name: "DEMOGRAPHICS", href: "#" },
|
|
124
|
+
{ id: "referrals", name: "REFERRALS", href: "#" },
|
|
125
|
+
{ id: "users", name: "USERS", href: "#" },
|
|
126
|
+
];
|
|
127
|
+
|
|
128
|
+
const CHART_TABS = [
|
|
129
|
+
{ id: "Week", name: "Week" },
|
|
130
|
+
{ id: "Month", name: "Month" },
|
|
131
|
+
{ id: "Year", name: "Year" },
|
|
132
|
+
{ id: "All time", name: "All time" },
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
const RANKING_BADGES = ["🥇", "🥈", "🥉"];
|
|
136
|
+
|
|
137
|
+
const RANKED_USERS = [...USERS]
|
|
138
|
+
.map((u) => ({
|
|
139
|
+
...u,
|
|
140
|
+
score: Math.round(
|
|
141
|
+
(parseFloat(u.totalDeposits.replace(/[$,]/g, "")) /
|
|
142
|
+
parseFloat(u.timeOnPlatform.replace(" days", ""))) *
|
|
143
|
+
10
|
|
144
|
+
),
|
|
145
|
+
}))
|
|
146
|
+
.sort((a, b) => b.score - a.score);
|
|
147
|
+
|
|
148
|
+
const ALL_USERS_ID = "all";
|
|
149
|
+
|
|
150
|
+
// Pre-computed overall totals
|
|
151
|
+
const OVERALL_STATS = {
|
|
152
|
+
totalDeposits: `$${USERS.reduce(
|
|
153
|
+
(s, u) => s + parseFloat(u.totalDeposits.replace(/[$,]/g, "")),
|
|
154
|
+
0
|
|
155
|
+
).toLocaleString("en-US", { minimumFractionDigits: 2 })}`,
|
|
156
|
+
totalWithdrawals: `$${USERS.reduce(
|
|
157
|
+
(s, u) => s + parseFloat(u.totalWithdrawals.replace(/[$,]/g, "")),
|
|
158
|
+
0
|
|
159
|
+
).toLocaleString("en-US", { minimumFractionDigits: 2 })}`,
|
|
160
|
+
totalUsers: `${USERS.length} users`,
|
|
161
|
+
avgTimeOnPlatform: `${Math.round(
|
|
162
|
+
USERS.reduce(
|
|
163
|
+
(s, u) => s + parseFloat(u.timeOnPlatform.replace(" days", "")),
|
|
164
|
+
0
|
|
165
|
+
) / USERS.length
|
|
166
|
+
)} days avg`,
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
stories.add("User Ranking Dashboard", () => {
|
|
170
|
+
const [selectedId, setSelectedId] = useState<string>(ALL_USERS_ID);
|
|
171
|
+
const [search, setSearch] = useState("");
|
|
172
|
+
const [activeTab, setActiveTab] = useState("users");
|
|
173
|
+
const [activeChartTab, setActiveChartTab] = useState("Month");
|
|
174
|
+
|
|
175
|
+
const isOverall = selectedId === ALL_USERS_ID;
|
|
176
|
+
const selectedUser = isOverall
|
|
177
|
+
? null
|
|
178
|
+
: USERS.find((u) => u.id === selectedId) ?? null;
|
|
179
|
+
|
|
180
|
+
const filteredUsers = USERS.filter((u) =>
|
|
181
|
+
u.name.toLowerCase().includes(search.toLowerCase())
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
const statsRow = isOverall
|
|
185
|
+
? [
|
|
186
|
+
{ label: "Total deposits", value: OVERALL_STATS.totalDeposits },
|
|
187
|
+
{ label: "Total withdrawals", value: OVERALL_STATS.totalWithdrawals },
|
|
188
|
+
{ label: "Total users", value: OVERALL_STATS.totalUsers },
|
|
189
|
+
{
|
|
190
|
+
label: "Avg time on platform",
|
|
191
|
+
value: OVERALL_STATS.avgTimeOnPlatform,
|
|
192
|
+
},
|
|
193
|
+
]
|
|
194
|
+
: [
|
|
195
|
+
{ label: "Total deposits", value: selectedUser!.totalDeposits },
|
|
196
|
+
{ label: "Total withdrawals", value: selectedUser!.totalWithdrawals },
|
|
197
|
+
{ label: "Agreement length", value: selectedUser!.agreementLength },
|
|
198
|
+
{ label: "Time on platform", value: selectedUser!.timeOnPlatform },
|
|
199
|
+
];
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
<Container bgColor="py-8 bg-white">
|
|
203
|
+
<h1 className="text-2xl font-semibold text-gray-900 mb-6">
|
|
204
|
+
User Ranking Dashboard
|
|
205
|
+
</h1>
|
|
206
|
+
|
|
207
|
+
<div>
|
|
208
|
+
{/* Nav tabs */}
|
|
209
|
+
<div>
|
|
210
|
+
<Tabs
|
|
211
|
+
tabs={NAV_TABS}
|
|
212
|
+
selectedId={activeTab}
|
|
213
|
+
onClick={(id) => setActiveTab(id)}
|
|
214
|
+
/>
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
{/* Main content */}
|
|
218
|
+
<div className="flex flex-col lg:flex-row gap-5 py-4">
|
|
219
|
+
{/* Mobile: select dropdown */}
|
|
220
|
+
<div className="lg:hidden">
|
|
221
|
+
<Select
|
|
222
|
+
label="Select User"
|
|
223
|
+
value={selectedId}
|
|
224
|
+
placeholder="Select a user..."
|
|
225
|
+
options={[
|
|
226
|
+
{
|
|
227
|
+
key: ALL_USERS_ID,
|
|
228
|
+
label: "All Users",
|
|
229
|
+
secondaryLabel: "Platform overview",
|
|
230
|
+
image:
|
|
231
|
+
"https://images.unsplash.com/photo-1600880292089-90a7e086ee0c?w=64&h=64&fit=crop&q=80",
|
|
232
|
+
},
|
|
233
|
+
...USERS.map((u) => ({
|
|
234
|
+
key: u.id,
|
|
235
|
+
label: u.name,
|
|
236
|
+
secondaryLabel: `ID: ${u.id}`,
|
|
237
|
+
image: u.img,
|
|
238
|
+
})),
|
|
239
|
+
]}
|
|
240
|
+
type="button"
|
|
241
|
+
onChange={(id) => setSelectedId(id)}
|
|
242
|
+
/>
|
|
243
|
+
</div>
|
|
244
|
+
|
|
245
|
+
{/* Desktop: user list */}
|
|
246
|
+
<div className="hidden lg:block w-60 flex-shrink-0 border-r pr-4 xl:w-72">
|
|
247
|
+
<p className="text-xs font-semibold text-primary-600 mb-3">
|
|
248
|
+
USERS ON THE PLATFORM
|
|
249
|
+
</p>
|
|
250
|
+
<TextInput
|
|
251
|
+
label=""
|
|
252
|
+
value={search}
|
|
253
|
+
type="text"
|
|
254
|
+
placeholder="Search for a user..."
|
|
255
|
+
showMagnifyIcon
|
|
256
|
+
onChange={(e) => setSearch(e.target.value)}
|
|
257
|
+
/>
|
|
258
|
+
<ul className="mt-3 space-y-1 max-h-96 overflow-y-auto">
|
|
259
|
+
{/* All Users option */}
|
|
260
|
+
<li
|
|
261
|
+
onClick={() => setSelectedId(ALL_USERS_ID)}
|
|
262
|
+
className={`flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors ${
|
|
263
|
+
isOverall
|
|
264
|
+
? "bg-primary-50 border-l-2 border-primary-600"
|
|
265
|
+
: "hover:bg-gray-50"
|
|
266
|
+
}`}
|
|
267
|
+
>
|
|
268
|
+
<div className="w-9 h-9 rounded-full bg-primary-100 flex items-center justify-center flex-shrink-0">
|
|
269
|
+
<span className="text-primary-600 text-xs font-bold">
|
|
270
|
+
ALL
|
|
271
|
+
</span>
|
|
272
|
+
</div>
|
|
273
|
+
<div className="min-w-0 flex-1">
|
|
274
|
+
<p
|
|
275
|
+
className={`text-sm font-medium ${
|
|
276
|
+
isOverall ? "text-primary-700" : "text-gray-900"
|
|
277
|
+
}`}
|
|
278
|
+
>
|
|
279
|
+
All Users
|
|
280
|
+
</p>
|
|
281
|
+
<p className="text-xs text-gray-400">Platform Overview</p>
|
|
282
|
+
</div>
|
|
283
|
+
</li>
|
|
284
|
+
{filteredUsers.map((user) => {
|
|
285
|
+
const isSelected = user.id === selectedId;
|
|
286
|
+
const rank =
|
|
287
|
+
RANKED_USERS.findIndex((u) => u.id === user.id) + 1;
|
|
288
|
+
return (
|
|
289
|
+
<li
|
|
290
|
+
key={user.id}
|
|
291
|
+
onClick={() => setSelectedId(user.id)}
|
|
292
|
+
className={`flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors ${
|
|
293
|
+
isSelected
|
|
294
|
+
? "bg-primary-50 border-l-2 border-primary-600"
|
|
295
|
+
: "hover:bg-gray-50"
|
|
296
|
+
}`}
|
|
297
|
+
>
|
|
298
|
+
<img
|
|
299
|
+
src={user.img}
|
|
300
|
+
alt={user.name}
|
|
301
|
+
className="w-9 h-9 rounded-full object-cover flex-shrink-0"
|
|
302
|
+
/>
|
|
303
|
+
<div className="min-w-0 flex-1">
|
|
304
|
+
<p
|
|
305
|
+
className={`text-sm font-medium truncate ${
|
|
306
|
+
isSelected ? "text-primary-700" : "text-gray-900"
|
|
307
|
+
}`}
|
|
308
|
+
>
|
|
309
|
+
{user.name}
|
|
310
|
+
</p>
|
|
311
|
+
<p className="text-xs text-gray-400">ID: {user.id}</p>
|
|
312
|
+
</div>
|
|
313
|
+
<span className="text-sm flex-shrink-0">
|
|
314
|
+
{rank <= 3 ? RANKING_BADGES[rank - 1] : `#${rank}`}
|
|
315
|
+
</span>
|
|
316
|
+
</li>
|
|
317
|
+
);
|
|
318
|
+
})}
|
|
319
|
+
</ul>
|
|
320
|
+
</div>
|
|
321
|
+
|
|
322
|
+
{/* Right panel */}
|
|
323
|
+
<div className="flex-1">
|
|
324
|
+
{/* Stats */}
|
|
325
|
+
<div className="pb-2 border-b mb-5">
|
|
326
|
+
<div className="flex items-center justify-between pb-3">
|
|
327
|
+
<h2 className="text-base font-semibold text-primary-600">
|
|
328
|
+
{isOverall
|
|
329
|
+
? "Overall Stats"
|
|
330
|
+
: `${selectedUser!.name}'s Stats`}
|
|
331
|
+
</h2>
|
|
332
|
+
{!isOverall && (
|
|
333
|
+
<p className="text-xs text-gray-400">
|
|
334
|
+
ID: {selectedUser!.id}
|
|
335
|
+
</p>
|
|
336
|
+
)}
|
|
337
|
+
</div>
|
|
338
|
+
<div className="grid grid-cols-2 sm:flex sm:flex-nowrap sm:divide-x divide-gray-200">
|
|
339
|
+
{statsRow.map((stat) => (
|
|
340
|
+
<div key={stat.label} className="px-4 py-3 sm:flex-1">
|
|
341
|
+
<p className="text-xs text-gray-500">{stat.label}</p>
|
|
342
|
+
<p className="text-sm font-bold text-gray-900 mt-1">
|
|
343
|
+
{stat.value}
|
|
344
|
+
</p>
|
|
345
|
+
</div>
|
|
346
|
+
))}
|
|
347
|
+
{!isOverall && (
|
|
348
|
+
<div className="col-span-2 sm:col-span-1 sm:w-auto px-4 py-3 flex items-center justify-start sm:justify-center">
|
|
349
|
+
<Button
|
|
350
|
+
text="Transactions"
|
|
351
|
+
type="normal"
|
|
352
|
+
size="small"
|
|
353
|
+
onClick={() => {}}
|
|
354
|
+
/>
|
|
355
|
+
</div>
|
|
356
|
+
)}
|
|
357
|
+
</div>
|
|
358
|
+
</div>
|
|
359
|
+
|
|
360
|
+
{/* Ranking (overall) or Chart (specific user) */}
|
|
361
|
+
{isOverall ? (
|
|
362
|
+
<div className="flex flex-col-reverse lg:flex-row gap-5">
|
|
363
|
+
{/* Chart */}
|
|
364
|
+
<div className="flex-1">
|
|
365
|
+
<div className="flex flex-wrap items-center justify-between gap-2 mb-3">
|
|
366
|
+
<p className="text-sm font-medium text-gray-700">
|
|
367
|
+
Deposits, Withdrawals & Profits
|
|
368
|
+
</p>
|
|
369
|
+
<ButtonGroup
|
|
370
|
+
selection={CHART_TABS}
|
|
371
|
+
selectedId={activeChartTab}
|
|
372
|
+
variant="tag"
|
|
373
|
+
onClick={(id) => setActiveChartTab(id)}
|
|
374
|
+
size="small"
|
|
375
|
+
/>
|
|
376
|
+
</div>
|
|
377
|
+
<LineChart
|
|
378
|
+
key={`overall-${activeTab}-${activeChartTab}-ranked`}
|
|
379
|
+
title=""
|
|
380
|
+
chartOnly
|
|
381
|
+
categories={CHART_CATEGORIES}
|
|
382
|
+
xaxisTitle=""
|
|
383
|
+
yaxisTitle=""
|
|
384
|
+
multiLineSeries={[
|
|
385
|
+
{ name: "Deposits", data: DEPOSITS_DATA, unit: "$" },
|
|
386
|
+
{
|
|
387
|
+
name: "Withdrawals",
|
|
388
|
+
data: WITHDRAWALS_DATA,
|
|
389
|
+
unit: "$",
|
|
390
|
+
},
|
|
391
|
+
{ name: "Profits", data: PROFITS_DATA, unit: "$" },
|
|
392
|
+
]}
|
|
393
|
+
colors={["#00c875", "#df2f4a", "#579bfc"]}
|
|
394
|
+
disableAreaChart={false}
|
|
395
|
+
chartHeight={280}
|
|
396
|
+
legendPosition="bottom"
|
|
397
|
+
showToolbar={false}
|
|
398
|
+
hideGrid
|
|
399
|
+
enableGradient
|
|
400
|
+
hideOriginBorder
|
|
401
|
+
hideWhiteDot
|
|
402
|
+
/>
|
|
403
|
+
</div>
|
|
404
|
+
{/* Leaderboard */}
|
|
405
|
+
<div className="flex-shrink-0 border-b pb-4 lg:p-0 lg:w-64 lg:border-0">
|
|
406
|
+
<p className="text-sm font-medium text-gray-700 mb-3">
|
|
407
|
+
Ranking
|
|
408
|
+
</p>
|
|
409
|
+
<div className="space-y-2">
|
|
410
|
+
<p className="text-xs font-medium text-gray-400 uppercase tracking-wide mb-2">
|
|
411
|
+
Leaderboard
|
|
412
|
+
</p>
|
|
413
|
+
{RANKED_USERS.slice(0, 5).map((u, i) => (
|
|
414
|
+
<div
|
|
415
|
+
key={u.id}
|
|
416
|
+
className="flex items-center gap-2 py-1.5 rounded-lg"
|
|
417
|
+
>
|
|
418
|
+
<span className="text-sm w-5 text-center flex-shrink-0">
|
|
419
|
+
{i < 3 ? RANKING_BADGES[i] : `#${i + 1}`}
|
|
420
|
+
</span>
|
|
421
|
+
<img
|
|
422
|
+
src={u.img}
|
|
423
|
+
alt={u.name}
|
|
424
|
+
className="w-7 h-7 rounded-full object-cover flex-shrink-0"
|
|
425
|
+
/>
|
|
426
|
+
<div className="min-w-0 flex-1">
|
|
427
|
+
<p className="text-xs font-medium truncate text-gray-800">
|
|
428
|
+
{u.name}
|
|
429
|
+
</p>
|
|
430
|
+
</div>
|
|
431
|
+
<span className="text-xs text-gray-500 flex-shrink-0">
|
|
432
|
+
{u.score} pts
|
|
433
|
+
</span>
|
|
434
|
+
</div>
|
|
435
|
+
))}
|
|
436
|
+
</div>
|
|
437
|
+
</div>
|
|
438
|
+
</div>
|
|
439
|
+
) : (
|
|
440
|
+
<>
|
|
441
|
+
<div className="flex flex-wrap items-center justify-between gap-2 mb-3">
|
|
442
|
+
<p className="text-sm font-medium text-gray-700">
|
|
443
|
+
Deposits, Withdrawals & Profits
|
|
444
|
+
</p>
|
|
445
|
+
<ButtonGroup
|
|
446
|
+
selection={CHART_TABS}
|
|
447
|
+
selectedId={activeChartTab}
|
|
448
|
+
variant="tag"
|
|
449
|
+
onClick={(id) => setActiveChartTab(id)}
|
|
450
|
+
/>
|
|
451
|
+
</div>
|
|
452
|
+
<LineChart
|
|
453
|
+
key={`${selectedId}-${activeTab}-${activeChartTab}-ranked`}
|
|
454
|
+
title=""
|
|
455
|
+
chartOnly
|
|
456
|
+
categories={CHART_CATEGORIES}
|
|
457
|
+
xaxisTitle=""
|
|
458
|
+
yaxisTitle=""
|
|
459
|
+
multiLineSeries={[
|
|
460
|
+
{ name: "Deposits", data: DEPOSITS_DATA, unit: "$" },
|
|
461
|
+
{ name: "Withdrawals", data: WITHDRAWALS_DATA, unit: "$" },
|
|
462
|
+
{ name: "Profits", data: PROFITS_DATA, unit: "$" },
|
|
463
|
+
]}
|
|
464
|
+
colors={["#00c875", "#df2f4a", "#579bfc"]}
|
|
465
|
+
disableAreaChart={false}
|
|
466
|
+
chartHeight={280}
|
|
467
|
+
legendPosition="bottom"
|
|
468
|
+
showToolbar={false}
|
|
469
|
+
hideGrid
|
|
470
|
+
enableGradient
|
|
471
|
+
hideOriginBorder
|
|
472
|
+
hideWhiteDot
|
|
473
|
+
/>
|
|
474
|
+
</>
|
|
475
|
+
)}
|
|
476
|
+
</div>
|
|
477
|
+
</div>
|
|
478
|
+
</div>
|
|
479
|
+
</Container>
|
|
480
|
+
);
|
|
481
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
4
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5
|
+
const getBackendComponent_1 = require("./tools/getBackendComponent");
|
|
6
|
+
const getComponent_1 = require("./tools/getComponent");
|
|
7
|
+
const listComponents_1 = require("./tools/listComponents");
|
|
8
|
+
const listTemplates_1 = require("./tools/listTemplates");
|
|
9
|
+
const suggestTemplate_1 = require("./tools/suggestTemplate");
|
|
10
|
+
const server = new mcp_js_1.McpServer({
|
|
11
|
+
name: "blixify-ui-web-tools",
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
});
|
|
14
|
+
// INFO: inputSchema cast to any to avoid TS2589 deep type instantiation error on TS >=5.2
|
|
15
|
+
const tools = [
|
|
16
|
+
getComponent_1.getComponentTool,
|
|
17
|
+
listComponents_1.listComponentsTool,
|
|
18
|
+
suggestTemplate_1.suggestTemplateTool,
|
|
19
|
+
getBackendComponent_1.getBackendComponentTool,
|
|
20
|
+
listTemplates_1.listTemplatesTool,
|
|
21
|
+
];
|
|
22
|
+
for (const tool of tools) {
|
|
23
|
+
server.registerTool(tool.name, {
|
|
24
|
+
description: tool.description,
|
|
25
|
+
inputSchema: tool.inputSchema,
|
|
26
|
+
}, tool.handler);
|
|
27
|
+
}
|
|
28
|
+
async function main() {
|
|
29
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
30
|
+
await server.connect(transport);
|
|
31
|
+
}
|
|
32
|
+
main().catch(console.error);
|
|
33
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":";;AAAA,oEAAoE;AACpE,wEAAiF;AACjF,qEAAsE;AACtE,uDAAwD;AACxD,2DAA4D;AAC5D,yDAA0D;AAC1D,6DAA8D;AAE9D,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC;IAC3B,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,0FAA0F;AAC1F,MAAM,KAAK,GAAG;IACZ,+BAAgB;IAChB,mCAAkB;IAClB,qCAAmB;IACnB,6CAAuB;IACvB,iCAAiB;CAClB,CAAC;AAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;IACxB,MAAM,CAAC,YAAY,CACjB,IAAI,CAAC,IAAI,EACT;QACE,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAkB;KACrC,EACD,IAAI,CAAC,OAAc,CACpB,CAAC;CACH;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const getBackendComponentTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
6
|
+
handler(): Promise<{
|
|
7
|
+
content: {
|
|
8
|
+
type: "text";
|
|
9
|
+
text: string;
|
|
10
|
+
}[];
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=getBackendComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBackendComponent.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/getBackendComponent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqDxB,eAAO,MAAM,uBAAuB;;;;;;;;;;CA6DnC,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getBackendComponentTool = void 0;
|
|
27
|
+
const fs = __importStar(require("fs"));
|
|
28
|
+
const path = __importStar(require("path"));
|
|
29
|
+
const zod_1 = require("zod");
|
|
30
|
+
// At runtime __dirname is lib/mcp/tools; resolve up to project root then into lib/components/data
|
|
31
|
+
const PROJECT_ROOT = path.resolve(__dirname, "../../../");
|
|
32
|
+
const DATA_DIR = fs.existsSync(path.join(PROJECT_ROOT, "src/components/data"))
|
|
33
|
+
? path.join(PROJECT_ROOT, "src/components/data")
|
|
34
|
+
: path.join(PROJECT_ROOT, "lib/components/data");
|
|
35
|
+
/**
|
|
36
|
+
* Backend components are the data-layer components under src/components/data.
|
|
37
|
+
* We surface the ones that have a README or stories file, plus the dataWrapper
|
|
38
|
+
* which is the primary integration point for building dashboard pages.
|
|
39
|
+
*/
|
|
40
|
+
const BACKEND_COMPONENTS = {
|
|
41
|
+
dataWrapper: {
|
|
42
|
+
dir: path.join(DATA_DIR, "dataWrapper"),
|
|
43
|
+
description: "Primary wrapper for embedding data tables, forms, and views (list/read/update) into dashboard pages. Handles schema, backend config, navigation, and all view types.",
|
|
44
|
+
},
|
|
45
|
+
dataTemplate: {
|
|
46
|
+
dir: path.join(DATA_DIR, "dataTemplate"),
|
|
47
|
+
description: "Lower-level data component driven by a Space object from the Blixify backend. Use dataWrapper instead for custom integrations.",
|
|
48
|
+
},
|
|
49
|
+
queryForm: {
|
|
50
|
+
dir: path.join(DATA_DIR, "queryForm"),
|
|
51
|
+
description: "Standalone filter/query form component for building custom search UIs.",
|
|
52
|
+
},
|
|
53
|
+
readQuery: {
|
|
54
|
+
dir: path.join(DATA_DIR, "readQuery"),
|
|
55
|
+
description: "Read-only query component for fetching and displaying data.",
|
|
56
|
+
},
|
|
57
|
+
dataGraph: {
|
|
58
|
+
dir: path.join(DATA_DIR, "dataGraph"),
|
|
59
|
+
description: "Chart and graph components backed by live data queries.",
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
function readFileIfExists(filePath) {
|
|
63
|
+
return fs.existsSync(filePath) ? fs.readFileSync(filePath, "utf-8") : null;
|
|
64
|
+
}
|
|
65
|
+
function findStoriesFile(dir) {
|
|
66
|
+
if (!fs.existsSync(dir))
|
|
67
|
+
return null;
|
|
68
|
+
const found = fs
|
|
69
|
+
.readdirSync(dir)
|
|
70
|
+
.find((f) => f.endsWith(".stories.tsx") || f.endsWith(".stories.ts"));
|
|
71
|
+
return found ? path.join(dir, found) : null;
|
|
72
|
+
}
|
|
73
|
+
exports.getBackendComponentTool = {
|
|
74
|
+
name: "get_backend_component",
|
|
75
|
+
description: "Get documentation and usage examples for Blixify backend/data components used to build dashboard pages — e.g. DataTemplateWrapper for table listings, forms, and CRUD views with schema and workspace config.",
|
|
76
|
+
inputSchema: zod_1.z.object({}),
|
|
77
|
+
async handler() {
|
|
78
|
+
const sections = [
|
|
79
|
+
"# Blixify Backend Components\n",
|
|
80
|
+
"These components connect your UI to a MongoDB (or Firebase) backend. " +
|
|
81
|
+
"For most dashboard pages (table listings, read views, create/edit forms), " +
|
|
82
|
+
"**`DataTemplateWrapper`** (`dataWrapper`) is the recommended starting point.\n",
|
|
83
|
+
];
|
|
84
|
+
// Overview table
|
|
85
|
+
const overviewLines = Object.entries(BACKEND_COMPONENTS).map(([name, { description }]) => `- **${name}**: ${description}`);
|
|
86
|
+
sections.push("## Available Components\n\n" + overviewLines.join("\n"));
|
|
87
|
+
// Full docs for dataWrapper (the primary one)
|
|
88
|
+
const dw = BACKEND_COMPONENTS["dataWrapper"];
|
|
89
|
+
const readme = readFileIfExists(path.join(dw.dir, "README.md"));
|
|
90
|
+
const storiesPath = findStoriesFile(dw.dir);
|
|
91
|
+
const stories = storiesPath ? readFileIfExists(storiesPath) : null;
|
|
92
|
+
if (readme) {
|
|
93
|
+
sections.push("---\n\n## DataTemplateWrapper — Full Documentation\n\n" + readme);
|
|
94
|
+
}
|
|
95
|
+
if (stories) {
|
|
96
|
+
sections.push("---\n\n## DataTemplateWrapper — Stories (live usage examples)\n\n```tsx\n" +
|
|
97
|
+
stories +
|
|
98
|
+
"\n```");
|
|
99
|
+
}
|
|
100
|
+
// Brief summaries for the rest
|
|
101
|
+
for (const [name, { dir, description }] of Object.entries(BACKEND_COMPONENTS)) {
|
|
102
|
+
if (name === "dataWrapper")
|
|
103
|
+
continue;
|
|
104
|
+
const otherReadme = readFileIfExists(path.join(dir, "README.md"));
|
|
105
|
+
if (otherReadme) {
|
|
106
|
+
sections.push(`---\n\n## ${name}\n\n_${description}_\n\n` + otherReadme);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
content: [
|
|
111
|
+
{
|
|
112
|
+
type: "text",
|
|
113
|
+
text: sections.join("\n\n"),
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=getBackendComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBackendComponent.js","sourceRoot":"","sources":["../../../src/mcp/tools/getBackendComponent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,6BAAwB;AAExB,kGAAkG;AAClG,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,WAA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