Skip to content

Commit eb6bd1d

Browse files
authored
tier flags (#1699)
1 parent d1b91e4 commit eb6bd1d

File tree

7 files changed

+385
-233
lines changed

7 files changed

+385
-233
lines changed

pcweb/components/docpage/navbar/navbar.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import reflex_ui as ui
55
from reflex_ui.blocks.demo_form import demo_form_dialog
66

7-
from pcweb.components.hosting_banner import hosting_banner
87
from pcweb.constants import REFLEX_BUILD_URL, REFLEX_CLOUD_URL
98
from pcweb.pages.blog import blogs
109
from pcweb.pages.blog.paths import blog_data
@@ -586,7 +585,6 @@ def new_component_section() -> rx.Component:
586585
@rx.memo
587586
def navbar() -> rx.Component:
588587
return rx.box(
589-
hosting_banner(),
590588
rx.el.header(
591589
new_component_section(),
592590
class_name="flex flex-row items-center gap-12 bg-slate-1 shadow-[inset_0_-0.5px_0_0_var(--c-slate-3)] px-4 lg:px-6 w-screen h-[48px] lg:h-[65px]",

pcweb/constants.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@
101101

102102
SLACK_DEMO_WEBHOOK_URL: str = os.environ.get("SLACK_DEMO_WEBHOOK_URL")
103103

104+
# Enable free tier flag
105+
ENABLE_FREE_TIER = os.getenv("ENABLE_FREE_TIER", "false").lower() == "true"
106+
107+
# Enable Pro tiers flag
108+
ENABLE_PRO_TIER = os.getenv("ENABLE_PRO_TIER", "false").lower() == "true"
109+
104110
# Pricing
105111
PRO_TIERS_TABLE = {
106112
"Pro 25": {"price": 25, "credits": 500},
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import reflex as rx
2+
3+
from pcweb.constants import ENABLE_FREE_TIER, ENABLE_PRO_TIER
4+
5+
6+
class EnableTiersState(rx.State):
7+
enable_free_tier: rx.Field[bool] = rx.field(default=ENABLE_FREE_TIER)
8+
enable_pro_tier: rx.Field[bool] = rx.field(default=ENABLE_PRO_TIER)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import reflex as rx
2+
from reflex_ui.blocks.demo_form import demo_form
3+
4+
from pcweb.pages.framework.views.companies import pricing_page_companies
5+
6+
7+
def book_a_demo_form() -> rx.Component:
8+
return rx.el.div(
9+
rx.el.div(
10+
rx.el.div(
11+
# Left column - Content
12+
rx.el.div(
13+
rx.el.h2(
14+
"Book a Demo",
15+
class_name="text-slate-12 text-4xl font-bold mb-8",
16+
),
17+
rx.el.div(
18+
"Enterprise-ready solutions designed for scale, compliance, and support. Contact us for a tailored quote based on your infrastructure and team size.",
19+
class_name="text-slate-11 text-md leading-relaxed mb-12 max-w-lg font-medium",
20+
),
21+
rx.el.div(
22+
pricing_page_companies(),
23+
class_name="flex flex-col",
24+
),
25+
class_name="mb-8 lg:mb-0 text-center sm:text-left",
26+
),
27+
# Right column - Form
28+
demo_form(
29+
class_name="relative bg-slate-1 p-6 sm:p-8 rounded-2xl border-2 border-violet-9 shadow-lg w-full max-w-md mx-auto lg:max-w-none lg:mx-0"
30+
),
31+
class_name="grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-16 max-w-7xl mx-auto items-start",
32+
),
33+
class_name="lg:pt-[4.5rem] pt-[2.5rem] pb-[3.5rem] px-8",
34+
),
35+
class_name="flex items-center justify-center 2xl:border-x border-slate-4 max-w-[64.19rem] mx-auto w-full gap-1 2xl:border-b",
36+
)

pcweb/pages/pricing/plan_cards.py

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
from reflex_ui.blocks.demo_form import demo_form_dialog
88

99
from pcweb.components.hosting_banner import HostingBannerState
10+
from pcweb.components.number_flow import number_flow
1011
from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL
12+
from pcweb.pages.pricing.enable_tiers_state import EnableTiersState
13+
from pcweb.pages.pricing.enterprise_demo_form import book_a_demo_form
1114

1215
YEARLY_MONTHS_FREE = 2 # 2 months free
1316
YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12
@@ -198,43 +201,46 @@ def pricing_cards() -> rx.Component:
198201
target="_blank",
199202
),
200203
),
201-
# card(
202-
# "Pro",
203-
# number_flow(
204-
# value=rx.cond(
205-
# monthly_yearly_toggle_cs.value == "monthly",
206-
# ProTierState.selected_tier["price"],
207-
# round(
208-
# ProTierState.selected_tier["price"]
209-
# * YEARLY_DISCOUNT_MULTIPLIER,
210-
# 1,
211-
# ),
212-
# ),
213-
# trend="0",
214-
# prefix="$",
215-
# suffix=" /monthly",
216-
# class_name="text-3xl text-secondary-12 font-semibold py-4",
217-
# ),
218-
# "Build, deploy and scale your apps.",
219-
# [
220-
# Feature("TokenCircleIcon", "", pro_tiers_select()),
221-
# Feature("SquareLock02Icon", "Private Projects"),
222-
# Feature("CursorInWindowIcon", "Full-Fledged Browser IDE"),
223-
# Feature("PlugSocketIcon", "Integrations"),
224-
# Feature("GithubIcon", "Connect to Github"),
225-
# Feature("Globe02Icon", "Custom Domains"),
226-
# Feature("CpuIcon", "Up to 8 GB RAM / 4 vCPU per deployed app"),
227-
# ],
228-
# ui.button(
229-
# "Start with Pro plan",
230-
# variant="secondary",
231-
# size="lg",
232-
# class_name="w-full font-semibold",
233-
# on_click=ProTierState.redirect_to_billing(
234-
# monthly_yearly_toggle_cs.value == "yearly"
235-
# ),
236-
# ),
237-
# ),
204+
rx.cond(
205+
EnableTiersState.enable_pro_tier,
206+
card(
207+
"Pro",
208+
number_flow(
209+
value=rx.cond(
210+
monthly_yearly_toggle_cs.value == "monthly",
211+
ProTierState.selected_tier["price"],
212+
round(
213+
ProTierState.selected_tier["price"]
214+
* YEARLY_DISCOUNT_MULTIPLIER,
215+
1,
216+
),
217+
),
218+
trend="0",
219+
prefix="$",
220+
suffix=" /monthly",
221+
class_name="text-3xl text-secondary-12 font-semibold py-4",
222+
),
223+
"Build, deploy and scale your apps.",
224+
[
225+
Feature("TokenCircleIcon", "", pro_tiers_select()),
226+
Feature("SquareLock02Icon", "Private Projects"),
227+
Feature("CursorInWindowIcon", "Full-Fledged Browser IDE"),
228+
Feature("PlugSocketIcon", "Integrations"),
229+
Feature("GithubIcon", "Connect to Github"),
230+
Feature("Globe02Icon", "Custom Domains"),
231+
Feature("CpuIcon", "Up to 8 GB RAM / 4 vCPU per deployed app"),
232+
],
233+
ui.button(
234+
"Start with Pro plan",
235+
variant="secondary",
236+
size="lg",
237+
class_name="w-full font-semibold",
238+
on_click=ProTierState.redirect_to_billing(
239+
monthly_yearly_toggle_cs.value == "yearly"
240+
),
241+
),
242+
),
243+
),
238244
popular_card(
239245
"Enterprise",
240246
"Custom",
@@ -262,7 +268,12 @@ def pricing_cards() -> rx.Component:
262268
),
263269
),
264270
),
265-
class_name="grid grid-cols-1 xl:grid-cols-2 gap-4 w-full xl:w-auto mx-auto justify-items-center",
271+
class_name=ui.cn(
272+
"grid grid-cols-1 xl:grid-cols-2 gap-4 w-full xl:w-auto mx-auto justify-items-center",
273+
rx.cond(
274+
EnableTiersState.enable_pro_tier, "xl:grid-cols-3", "xl:grid-cols-2"
275+
),
276+
),
266277
)
267278

268279

@@ -305,7 +316,10 @@ def monthly_yearly_toggle():
305316

306317
def plan_cards():
307318
return rx.box(
308-
header(),
319+
rx.cond(
320+
EnableTiersState.enable_free_tier,
321+
header(),
322+
),
309323
# monthly_yearly_toggle(),
310324
rx.el.style(
311325
"""
@@ -317,7 +331,11 @@ def plan_cards():
317331
}
318332
"""
319333
),
320-
pricing_cards(),
334+
rx.cond(
335+
EnableTiersState.enable_free_tier,
336+
pricing_cards(),
337+
book_a_demo_form(),
338+
),
321339
class_name=(
322340
"flex flex-col w-full justify-center items-center max-w-[85rem] mx-auto",
323341
rx.cond(

0 commit comments

Comments
 (0)