11import reflex as rx
2- import httpx
2+
33from pcweb .components .icons .hugeicons import hi
4- from pcweb .constants import SCREENSHOT_BUCKET , REFLEX_BUILD_URL , RX_CLOUD_BACKEND
5- import asyncio
6- import contextlib
4+ from pcweb .components .new_button import button
5+ from pcweb .components .tabs import tabs
76
8- TEMPLATES_LIST = [
9- "bbfcc0b8-8f09-4211-884e-7ad2f1a36906" ,
10- "e6293a74-4a47-44a3-bc1e-8966863feb46" ,
11- "a7f5bf05-a34a-4b40-a39f-4f6c71ded78f" ,
12- "dd3a7d49-e174-41d3-8856-cad921a98749" ,
13- "576aab1d-e733-42fa-a13e-515fd72ba012" ,
14- "28194790-f5cc-4625-bd30-cf2693890e08" ,
15- "7e5346b7-025c-4ff3-9b32-c1b9d7afcaec" ,
16- "2f969644-3140-4dbb-b639-5d0a940603c2" ,
17- "47f86c01-59ec-4088-b47a-64ceddf58a6e" ,
18- "98afee02-538f-4334-ab10-f05c1c3d564b" ,
7+ items = [
8+ {
9+ "title" : "Analytics" ,
10+ "icon" : "analytics-01" ,
11+ "value" : "data" ,
12+ "color" : "orange" ,
13+ "image" : "/case_studies/analytics_dashboard.webp" ,
14+ "description" : "Convert notebooks into production apps with live tables, charts, and custom components." ,
15+ },
16+ {
17+ "title" : "Finance" ,
18+ "icon" : "money-02" ,
19+ "value" : "financial" ,
20+ "color" : "jade" ,
21+ "image" : "/case_studies/bayesline_app.png" ,
22+ "description" : "Financial analytics dashboard that delivers custom equity-factor risk models in minutes." ,
23+ },
24+ {
25+ "title" : "E-commerce" ,
26+ "icon" : "shopping-bag-01" ,
27+ "value" : "ecommerce" ,
28+ "color" : "blue" ,
29+ "image" : "/case_studies/sellerx_app.png" ,
30+ "description" : "Unify marketplace sales, inventory alerts, and supplier data in a single dashboard." ,
31+ },
32+ {
33+ "title" : "DevOps" ,
34+ "icon" : "ai-cloud-01" ,
35+ "value" : "engineering" ,
36+ "color" : "pink" ,
37+ "image" : "/case_studies/devops_app.png" ,
38+ "description" : "Surface real-time telemetry, automate routine infra tasks, and replace shell scripts with role-based web UIs" ,
39+ },
40+ {
41+ "title" : "Databases" ,
42+ "icon" : "database" ,
43+ "value" : "database" ,
44+ "color" : "gold" ,
45+ "image" : "/case_studies/admin_app.png" ,
46+ "description" : "Full-featured database dashboards and CRUD apps come together in minutes" ,
47+ },
48+ {
49+ "title" : "AI Workflows" ,
50+ "icon" : "sparkles" ,
51+ "value" : "ai" ,
52+ "color" : "purple" ,
53+ "image" : "/case_studies/ai_workflow.webp" ,
54+ "description" : "Transform unstructured content into actionable insights with OCR, speech-to-text, and LLM pipelines." ,
55+ },
1956]
2057
2158
22- async def retreive_templates ():
23- """Fetch and update the TEMPLATES_LIST."""
24- try :
25- while True :
26- with contextlib .suppress (Exception ):
27- async with httpx .AsyncClient () as client :
28- global TEMPLATES_LIST
29- response = await client .get (
30- f"{ RX_CLOUD_BACKEND } v1/flexgen/templates" ,
31- )
32- response_data = response .json ()
33- if isinstance (response_data , list ):
34- TEMPLATES_LIST = response_data
35-
36- await asyncio .sleep (60 * 10 )
37- except asyncio .CancelledError :
38- pass
39-
40-
41- class AIBuilderGallery (rx .State ):
42- @rx .var (interval = 60 * 10 )
43- def items (self ) -> list [str ]:
44- return TEMPLATES_LIST
45-
46-
4759def header () -> rx .Component :
4860 return rx .box (
4961 rx .image (
@@ -56,8 +68,7 @@ def header() -> rx.Component:
5668 class_name = "flex flex-row gap-2 items-center text-violet-9" ,
5769 ),
5870 rx .el .h2 (
59- """Instantly turn your ideas into real apps.
60- Try AI-powered generation""" ,
71+ """Use Cases by Industry""" ,
6172 class_name = "max-w-full w-full lg:text-3xl text-2xl text-center text-slate-12 font-semibold text-balance word-wrap break-words md:whitespace-pre" ,
6273 ),
6374 rx .el .p (
@@ -69,31 +80,68 @@ def header() -> rx.Component:
6980 )
7081
7182
72- def gallery_item (item : str ) -> rx .Component :
73- return rx .link (
74- rx .image (
75- src = f"{ SCREENSHOT_BUCKET } { item } " ,
76- class_name = "absolute top-0 left-0 w-full h-full object-cover hover:scale-105 transition-all duration-200 ease-out object-center" ,
83+ def tab_item (item : dict [str , str ]):
84+ return tabs .tab (
85+ hi (item ["icon" ], class_name = f"text-{ item ['color' ]} -9" , size = 19 ),
86+ item ["title" ],
87+ value = item ["value" ],
88+ class_name = "w-full rounded-none border border-slate-3 text-base" ,
89+ )
90+
91+
92+ def tab_panel (item : dict [str , str ]):
93+ return tabs .panel (
94+ rx .box (
95+ rx .image (
96+ src = item ["image" ],
97+ class_name = "size-full object-cover object-left-top border border-slate-3" ,
98+ ),
99+ class_name = "max-lg:aspect-square lg:h-[550px] overflow-hidden p-3" ,
100+ ),
101+ rx .box (
102+ rx .el .p (
103+ item ["description" ], class_name = "text-xl text-slate-10 font-semibold"
104+ ),
105+ class_name = "p-4" ,
77106 ),
78- href = f" { REFLEX_BUILD_URL } gen/ { item } /" ,
79- is_external = True ,
80- class_name = "relative overflow-hidden border-slate-3 border rounded-[1.125rem] h-[14rem] bg -slate-2 flex justify-center items-center w-full shadow-small " ,
107+ keep_mounted = True ,
108+ value = item [ "value" ] ,
109+ class_name = "border-t border-slate-3 flex flex-col divide-y divide -slate-3 data-[hidden]:hidden border-b " ,
81110 )
82111
83112
84- def gallery () -> rx .Component :
85- return rx .box (
86- rx .foreach (
87- AIBuilderGallery .items ,
88- lambda item : gallery_item (item ),
113+ def use_cases ():
114+ return rx .el .section (
115+ tabs .root (
116+ rx .box (
117+ tabs .list (
118+ * [tab_item (item ) for item in items ],
119+ tabs .indicator (class_name = "rounded-none bg-slate-4" ),
120+ class_name = "w-full flex justify-start rounded-none bg-slate-1 gap-2 max-lg:overflow-x-auto" ,
121+ ),
122+ class_name = "w-full flex justify-start px-2 py-1" ,
123+ ),
124+ * [tab_panel (item ) for item in items ],
125+ default_value = items [0 ]["value" ],
126+ class_name = "w-full flex flex-col border-t border-slate-3" ,
127+ ),
128+ rx .link (
129+ button (
130+ "View all use cases" ,
131+ size = "lg" ,
132+ icon = rx .icon ("chevron-right" , size = 16 ),
133+ variant = "transparent" ,
134+ class_name = "flex-row-reverse my-3.5" ,
135+ ),
136+ href = "/use-cases" ,
89137 ),
90- class_name = "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 " ,
138+ class_name = "flex flex-col mx-auto w-full max-w-[64.19rem] lg:border-x border-slate-3 justify-center items-center relative overflow-hidden border-b border-slate-3 " ,
91139 )
92140
93141
94142def ai_section () -> rx .Component :
95143 return rx .el .section (
96144 header (),
97- gallery (),
145+ use_cases (),
98146 class_name = "flex flex-col mx-auto w-full max-w-[84.19rem]" ,
99147 )
0 commit comments