instruction
stringlengths
0
1k
input
stringlengths
1
1k
output
stringlengths
10
6.51k
from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.button import button def glow() -> rx.Component: return rx.box( class_name="absolute flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[-1] top-[-1.25rem] pointer-events-none w-[20rem] h-[5rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,0.207)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.661)_0%,_rgba(252,252,253,0.00)_100%)]", ) def header() -> rx.Component: return rx.box( rx.el.h3( "Have questions?", class_name="text-slate-12 text-3xl font-semibold", ), rx.el.p( "Check FAQ", class_name="text-slate-9 text-3xl font-semibold", ), class_name="flex items-center justify-between text-slate-11 flex-col pt-[5rem]", ) def sales_button() -> rx.Component: return rx.el.div( lemcal_dialog(
import reflex as rx
import reflex as rx
from pcweb.components.button import button def glow() -> rx.Component: return rx.box( class_name="absolute flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[-1] top-[-1.25rem] pointer-events-none w-[20rem] h-[5rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,0.207)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.661)_0%,_rgba(252,252,253,0.00)_100%)]", ) def header() -> rx.Component: return rx.box( rx.el.h3( "Have questions?", class_name="text-slate-12 text-3xl font-semibold", ), rx.el.p( "Check FAQ", class_name="text-slate-9 text-3xl font-semibold", ), class_name="flex items-center justify-between text-slate-11 flex-col pt-[5rem]", ) def sales_button() -> rx.Component: return rx.el.div( lemcal_dialog( rx.el.div( glow(),
from reflex_ui.blocks.lemcal import lemcal_dialog
import reflex as rx from reflex_ui.blocks.lemcal import lemcal_dialog
def glow() -> rx.Component: return rx.box( class_name="absolute flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[-1] top-[-1.25rem] pointer-events-none w-[20rem] h-[5rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,0.207)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.661)_0%,_rgba(252,252,253,0.00)_100%)]", ) def header() -> rx.Component: return rx.box( rx.el.h3( "Have questions?", class_name="text-slate-12 text-3xl font-semibold", ), rx.el.p( "Check FAQ", class_name="text-slate-9 text-3xl font-semibold", ), class_name="flex items-center justify-between text-slate-11 flex-col pt-[5rem]", ) def sales_button() -> rx.Component: return rx.el.div( lemcal_dialog( rx.el.div( glow(), button( "Need more he
from pcweb.components.button import button
import reflex as rx from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.button import button
def header() -> rx.Component: return rx.box( rx.el.h3( "Have questions?", class_name="text-slate-12 text-3xl font-semibold", ), rx.el.p( "Check FAQ", class_name="text-slate-9 text-3xl font-semibold", ), class_name="flex items-center justify-between text-slate-11 flex-col pt-[5rem]", ) def sales_button() -> rx.Component: return rx.el.div( lemcal_dialog( rx.el.div( glow(), button( "Need more help? Contact sales", variant="secondary", class_name="!text-slate-11 !font-semibold !text-sm w-fit", ), ), ), class_name="self-center relative", ) def accordion(title: str, content: rx.Component) -> rx.Component: """The accordion component. Args: title (str): The title of the accordion. content (rx.Component): Th
def glow() -> rx.Component: return rx.box( class_name="absolute flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[-1] top-[-1.25rem] pointer-events-none w-[20rem] h-[5rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,0.207)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.661)_0%,_rgba(252,252,253,0.00)_100%)]", )
import reflex as rx from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.button import button def glow() -> rx.Component: return rx.box( class_name="absolute flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[-1] top-[-1.25rem] pointer-events-none w-[20rem] h-[5rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,0.207)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.661)_0%,_rgba(252,252,253,0.00)_100%)]", )
def sales_button() -> rx.Component: return rx.el.div( lemcal_dialog( rx.el.div( glow(), button( "Need more help? Contact sales", variant="secondary", class_name="!text-slate-11 !font-semibold !text-sm w-fit", ), ), ), class_name="self-center relative", ) def accordion(title: str, content: rx.Component) -> rx.Component: """The accordion component. Args: title (str): The title of the accordion. content (rx.Component): The content of the accordion. Returns: The accordion component. """ return rx.accordion.root( rx.accordion.item( rx.accordion.trigger( rx.el.h3( title, class_name="font-semibold text-base text-slate-12 text-start" ), rx.icon( tag="plus",
def header() -> rx.Component: return rx.box( rx.el.h3( "Have questions?", class_name="text-slate-12 text-3xl font-semibold", ), rx.el.p( "Check FAQ", class_name="text-slate-9 text-3xl font-semibold", ), class_name="flex items-center justify-between text-slate-11 flex-col pt-[5rem]", )
import reflex as rx from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.button import button def glow() -> rx.Component: return rx.box( class_name="absolute flex-shrink-0 rounded-[120rem] left-1/2 -translate-x-1/2 z-[-1] top-[-1.25rem] pointer-events-none w-[20rem] h-[5rem] dark:[background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(58,45,118,0.207)_0%,_rgba(21,22,24,0.00)_100%)] [background-image:radial-gradient(50%_50%_at_50%_50%,_rgba(235,228,255,0.661)_0%,_rgba(252,252,253,0.00)_100%)]", ) def header() -> rx.Component: return rx.box( rx.el.h3( "Have questions?", class_name="text-slate-12 text-3xl font-semibold", ), rx.el.p( "Check FAQ", class_name="text-slate-9 text-3xl font-semibold", ), class_name="flex items-center justify-between text-slate-11 flex-col pt-[5rem]", )
def accordion(title: str, content: rx.Component) -> rx.Component: """The accordion component. Args: title (str): The title of the accordion. content (rx.Component): The content of the accordion. Returns: The accordion component. """ return rx.accordion.root( rx.accordion.item( rx.accordion.trigger( rx.el.h3( title, class_name="font-semibold text-base text-slate-12 text-start" ), rx.icon( tag="plus", size=16, class_name="!text-slate-9 group-data-[state=open]:rotate-45 transition-transform", ), class_name="hover:!bg-transparent !p-[0.5rem_0rem] !justify-between gap-4 group", ), rx.accordion.content( content, class_name="before:!h-0 after:!h-0 radix-state-open:animate-accordion-down radix-state-closed:animat
def sales_button() -> rx.Component: return rx.el.div( lemcal_dialog( rx.el.div( glow(), button( "Need more help? Contact sales", variant="secondary", class_name="!text-slate-11 !font-semibold !text-sm w-fit", ), ), ), class_name="self-center relative", )
ent): The content of the accordion. Returns: The accordion component. """ return rx.accordion.root( rx.accordion.item( rx.accordion.trigger( rx.el.h3( title, class_name="font-semibold text-base text-slate-12 text-start" ), rx.icon( tag="plus", size=16, class_name="!text-slate-9 group-data-[state=open]:rotate-45 transition-transform", ), class_name="hover:!bg-transparent !p-[0.5rem_0rem] !justify-between gap-4 group", ), rx.accordion.content( content, class_name="before:!h-0 after:!h-0 radix-state-open:animate-accordion-down radix-state-closed:animate-accordion-up transition-all !px-0", ), ), collapsible=True, class_name="!p-0 w-full overflow-hidden !bg-slate-1 !rounded-none !shadow-none", )
faq_items = [ ( "Can I use Reflex for free?", "Yes! Reflex is open source and free to use. You can self-host your apps or use our hosting platform which has a generous free tier.", ), ( "What is the difference between Reflex and Reflex Cloud?", "Reflex is our open-source framework for building web apps. Reflex Cloud is our platform for hosting Reflex apps.", ), ( "Why was I charged $1 after adding a credit card?", "A $1 USD transaction is performed as a credit security check to ensure your card details are correct and authorized. The charge is refunded after the transaction completes.", ), ( "How usage based billing is calculated?", "Usage is calculated based on compute resources (CPU/RAM) consumed by your app. We measure this in compute units per minute.", ), ( "What happens when I upgrade?", "When you upgrade your plan, you'll immediately get access to the new featur
def accordion_text(text: str) -> rx.Component: return rx.el.p(text, class_name="text-slate-9 text-sm font-medium")
without interruption.", ), ( "What are credits?", "Credits can be used for both hosting and building. In hosting, credits are used for compute resources. In building, credits are consumed per message sent.", ), ( "What happens if I cancel the plan?", "If you cancel, you'll maintain access until the end of your current billing period. After that, your app will be downgraded to the free tier limits.", ), ( "What determines the total amount billed?", "Your bill is determined by your base plan plus any usage-based charges for compute resources that exceed the plan limits.", ), ( "How to cancel subscription?", "You can cancel your subscription anytime from your account dashboard. No long-term commitments required.", ), ( "Can I add members to my project?", "Yes! You can add unlimited members to your project with a per seat monthly charge on additional seats.", ), ]
def faq() -> rx.Component: return rx.el.section( header(), rx.box( *[ accordion(title, accordion_text(content)) for title, content in faq_items ], class_name="max-w-[40rem] flex justify-center items-center flex-col mx-auto w-full gap-2", ), sales_button(), class_name="flex flex-col gap-8 w-full max-w-[64.19rem] 2xl:border-x border-slate-4 2xl:border-b pb-[6rem]", )
from urllib.parse import quote_plus import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.se
from typing import NamedTuple, TypedDict
from typing import NamedTuple, TypedDict
import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true'
from urllib.parse import quote_plus
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus
import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}",
import reflex as rx
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus import reflex as rx
from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_externa
import reflex_ui as ui
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus import reflex as rx import reflex_ui as ui
from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self
from reflex.experimental.client_state import ClientStateVar
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar
from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credit
from reflex_ui.blocks.lemcal import lemcal_dialog
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog
from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) ->
from pcweb.components.hosting_banner import HostingBannerState
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState
from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO
from pcweb.components.number_flow import number_flow
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow
YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits:
from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL
# 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return Select
YEARLY_MONTHS_FREE = 2
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free
monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"]) return SelectedTier(
YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12
class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"]) return SelectedTier(tier="Pro 25", price=PRO_TIERS_TABLE["Pro 25"]["price"]) class Feature(NamedTuple): icon: str text:
monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", )
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", )
class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"]) return SelectedTier(tier="Pro 25", price=PRO_TIERS_TABLE["Pro 25"]["price"]) class Feature(NamedTuple): icon: str text: str component: rx.Component | None = None def radial_cir
class SelectedTier(TypedDict): tier: str price: int
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int
class Feature(NamedTuple): icon: str text: str component: rx.Component | None = None def radial_circle(violet: bool = False) -> rx.Component: """Create a radial circle background image component. Args: violet: Whether to use the violet variant. Defaults to False. Returns: A Reflex image component configured as a radial circle background. """ theme = "violet" if violet else "" return rx.image( src=rx.color_mode_cond( light=f"/logos/light/radial_circle{theme}.svg", dark=f"/logos/dark/radial_circle{theme}.svg", ), alt="Radial circle", loading="lazy", class_name="top-0 right-0 absolute pointer-events-none z-[-1]", ) def card( title: str, price: str | rx.Component, description: str | rx.Component, features: list[Feature], cta_button: rx.Component, ) -> rx.Component: return rx.box( rx.el.h3(title, class_name="font-medium text-second
class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"]) return SelectedTier(tier="Pro 25", price=PRO_TIERS_TABLE["Pro 25"]["price"])
from typing import NamedTuple, TypedDict from urllib.parse import quote_plus import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event
@rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"]) return SelectedTier(tier="Pro 25", price=PRO_TIERS_TABLE["Pro 25"]["price"]) class Feature(NamedTuple): icon: str text: str component: rx.Component | None = None def radial_circle(violet: bool = False) -> rx.Component: """Create a radial circle background image component. Args: violet: Whether to use the violet variant. Defaults to False. Returns: A Reflex image component configured as a radial circle background. """ theme = "violet" if violet else "" return rx.image( src=rx.color_mode_cond( light=f"/logos/light/radial_circle{theme}.svg",
def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, )
e import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event
@rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"]) return SelectedTier(tier="Pro 25", price=PRO_TIERS_TABLE["Pro 25"]["price"]) class Feature(NamedTuple): icon: str text: str component: rx.Component | None = None def radial_circle(violet: bool = False) -> rx.Component: """Create a radial circle background image component. Args: violet: Whether to use the violet variant. Defaults to False. Returns: A Reflex image component configured as a radial circle background. """ theme = "violet" if violet else "" return rx.image( src=rx.color_mode_cond( light=f"/logos/light/radial_circle{theme}.svg", dark=f"/logos/dark/radial_circle{theme}.svg", ), alt="Radial circle", loading="la
def update_credits(self, credits: str): self.credits = int(credits.replace(",", ""))
mcal import lemcal_dialog from pcweb.components.hosting_banner import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str):
@rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"]) return SelectedTier(tier="Pro 25", price=PRO_TIERS_TABLE["Pro 25"]["price"]) class Feature(NamedTuple): icon: str text: str component: rx.Component | None = None def radial_circle(violet: bool = False) -> rx.Component: """Create a radial circle background image component. Args: violet: Whether to use the violet variant. Defaults to False. Returns: A Reflex image component configured as a radial circle background. """ theme = "violet" if violet else "" return rx.image( src=rx.color_mode_cond( light=f"/logos/light/radial_circle{theme}.svg", dark=f"/logos/dark/radial_circle{theme}.svg", ), alt="Radial circle", loading="la
self.credits = int(credits.replace(",", ""))
r import HostingBannerState from pcweb.components.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var
class Feature(NamedTuple): icon: str text: str component: rx.Component | None = None def radial_circle(violet: bool = False) -> rx.Component: """Create a radial circle background image component. Args: violet: Whether to use the violet variant. Defaults to False. Returns: A Reflex image component configured as a radial circle background. """ theme = "violet" if violet else "" return rx.image( src=rx.color_mode_cond( light=f"/logos/light/radial_circle{theme}.svg", dark=f"/logos/dark/radial_circle{theme}.svg", ), alt="Radial circle", loading="lazy", class_name="top-0 right-0 absolute pointer-events-none z-[-1]", ) def card( title: str, price: str | rx.Component, description: str | rx.Component, features: list[Feature], cta_button: rx.Component, ) -> rx.Component: return rx.box( rx.el.h3(title, class_name="font-medium text-second
def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"]) return SelectedTier(tier="Pro 25", price=PRO_TIERS_TABLE["Pro 25"]["price"])
.number_flow import number_flow from pcweb.constants import PRO_TIERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier:
return SelectedTier(tier="Pro 25", price=PRO_TIERS_TABLE["Pro 25"]["price"]) class Feature(NamedTuple): icon: str text: str component: rx.Component | None = None def radial_circle(violet: bool = False) -> rx.Component: """Create a radial circle background image component. Args: violet: Whether to use the violet variant. Defaults to False. Returns: A Reflex image component configured as a radial circle background. """ theme = "violet" if violet else "" return rx.image( src=rx.color_mode_cond( light=f"/logos/light/radial_circle{theme}.svg", dark=f"/logos/dark/radial_circle{theme}.svg", ), alt="Radial circle", loading="lazy", class_name="top-0 right-0 absolute pointer-events-none z-[-1]", ) def card( title: str, price: str | rx.Component, description: str | rx.Component, features: list[Feature], cta_button: rx.Component, ) -> rx.Comp
for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"])
IERS_TABLE, REFLEX_BUILD_URL, REFLEX_CLOUD_URL YEARLY_MONTHS_FREE = 2 # 2 months free YEARLY_DISCOUNT_MULTIPLIER = (12 - YEARLY_MONTHS_FREE) / 12 monthly_yearly_toggle_cs = ClientStateVar.create( "monthly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items():
return SelectedTier(tier="Pro 25", price=PRO_TIERS_TABLE["Pro 25"]["price"]) class Feature(NamedTuple): icon: str text: str component: rx.Component | None = None def radial_circle(violet: bool = False) -> rx.Component: """Create a radial circle background image component. Args: violet: Whether to use the violet variant. Defaults to False. Returns: A Reflex image component configured as a radial circle background. """ theme = "violet" if violet else "" return rx.image( src=rx.color_mode_cond( light=f"/logos/light/radial_circle{theme}.svg", dark=f"/logos/dark/radial_circle{theme}.svg", ), alt="Radial circle", loading="lazy", class_name="top-0 right-0 absolute pointer-events-none z-[-1]", ) def card( title: str, price: str | rx.Component, description: str | rx.Component, features: list[Feature], cta_button: rx.Component, ) -> rx.Comp
if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"])
thly_yearly_toggle_value", default="monthly", ) class SelectedTier(TypedDict): tier: str price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"]) return SelectedTier(tier="Pro 25", price=PRO_TIERS_TABLE["Pro 25"]["price"])
def radial_circle(violet: bool = False) -> rx.Component: """Create a radial circle background image component. Args: violet: Whether to use the violet variant. Defaults to False. Returns: A Reflex image component configured as a radial circle background. """ theme = "violet" if violet else "" return rx.image( src=rx.color_mode_cond( light=f"/logos/light/radial_circle{theme}.svg", dark=f"/logos/dark/radial_circle{theme}.svg", ), alt="Radial circle", loading="lazy", class_name="top-0 right-0 absolute pointer-events-none z-[-1]", ) def card( title: str, price: str | rx.Component, description: str | rx.Component, features: list[Feature], cta_button: rx.Component, ) -> rx.Component: return rx.box( rx.el.h3(title, class_name="font-medium text-secondary-12 text-2xl mb-1.5"), ( rx.el.span( description,
class Feature(NamedTuple): icon: str text: str component: rx.Component | None = None
price: int class ProTierState(rx.State): credits: rx.Field[int] = rx.field(default=PRO_TIERS_TABLE["Pro 25"]["credits"]) @rx.event def redirect_to_billing(self, yearly: bool = False): return rx.redirect( f"{REFLEX_CLOUD_URL.rstrip('/')}/?redirect_url={REFLEX_CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"]) return SelectedTier(tier="Pro 25", price=PRO_TIERS_TABLE["Pro 25"]["price"]) class Feature(NamedTuple): icon: str text: str component: rx.Component | None = None
def card( title: str, price: str | rx.Component, description: str | rx.Component, features: list[Feature], cta_button: rx.Component, ) -> rx.Component: return rx.box( rx.el.h3(title, class_name="font-medium text-secondary-12 text-2xl mb-1.5"), ( rx.el.span( description, class_name="text-sm font-medium text-secondary-11 text-pretty", ) if isinstance(description, str) else description ), ( rx.el.span( price, class_name="text-3xl text-secondary-12 font-semibold py-4", ) if isinstance(price, str) else price ), rx.el.ul( *[ rx.el.li( ui.icon(feature.icon, class_name="text-secondary-10", size=16), feature.text, feature.component if feature.component else rx.fragment(),
def radial_circle(violet: bool = False) -> rx.Component: """Create a radial circle background image component. Args: violet: Whether to use the violet variant. Defaults to False. Returns: A Reflex image component configured as a radial circle background. """ theme = "violet" if violet else "" return rx.image( src=rx.color_mode_cond( light=f"/logos/light/radial_circle{theme}.svg", dark=f"/logos/dark/radial_circle{theme}.svg", ), alt="Radial circle", loading="lazy", class_name="top-0 right-0 absolute pointer-events-none z-[-1]", )
CLOUD_URL.rstrip('/')}/billing/?tier={quote_plus(self.selected_tier['tier'])}{'&yearly=true' if yearly else ''}", is_external=True, ) @rx.event def update_credits(self, credits: str): self.credits = int(credits.replace(",", "")) @rx.var def selected_tier(self) -> SelectedTier: for tier_name, tier_data in PRO_TIERS_TABLE.items(): if tier_data["credits"] == self.credits: return SelectedTier(tier=tier_name, price=tier_data["price"]) return SelectedTier(tier="Pro 25", price=PRO_TIERS_TABLE["Pro 25"]["price"]) class Feature(NamedTuple): icon: str text: str component: rx.Component | None = None def radial_circle(violet: bool = False) -> rx.Component: """Create a radial circle background image component. Args: violet: Whether to use the violet variant. Defaults to False. Returns: A Reflex image component configured as a radial circle background. """
return rx.image( src=rx.color_mode_cond( light=f"/logos/light/radial_circle{theme}.svg", dark=f"/logos/dark/radial_circle{theme}.svg", ), alt="Radial circle", loading="lazy", class_name="top-0 right-0 absolute pointer-events-none z-[-1]", ) def card( title: str, price: str | rx.Component, description: str | rx.Component, features: list[Feature], cta_button: rx.Component, ) -> rx.Component: return rx.box( rx.el.h3(title, class_name="font-medium text-secondary-12 text-2xl mb-1.5"), ( rx.el.span( description, class_name="text-sm font-medium text-secondary-11 text-pretty", ) if isinstance(description, str) else description ), ( rx.el.span( price, class_name="text-3xl text-secondary-12 font-semibold py-4", ) if isins
theme = "violet" if violet else ""
mb-1.5"), rx.el.p(description, class_name="text-sm font-medium text-secondary-11"), ( rx.el.span( price, class_name="text-3xl text-secondary-12 font-semibold py-4", ) if isinstance(price, str) else price ), rx.el.ul( *[ rx.el.li( ui.icon(feature.icon, class_name="text-primary-10", size=16), feature.text, feature.component if feature.component else rx.fragment(), class_name="text-sm font-medium text-secondary-12 flex items-center gap-2", ) for feature in features ], class_name="flex flex-col gap-2", ), rx.box(class_name="flex-1"), cta_button, class_name="flex flex-col p-10 border border-slate-4 rounded-[1.125rem] shadow-small bg-secondary-2 w-full h-[30.5rem] relative z-[1]", )
def pricing_cards() -> rx.Component: return rx.el.div( card( "Hobby", "Free", "Perfect for getting started and trying out Reflex.", [ Feature( "TokenCircleIcon", "50 daily credits (up to 150/month)", ), Feature("EarthIcon", "Public apps only"), Feature("CheckmarkBadge02Icon", "Built with Reflex Attribution"), Feature("PlugSocketIcon", "Integrations"), ], ui.link( render_=ui.button( "Start building for free", variant="secondary", size="lg", class_name="w-full font-semibold", ), to=REFLEX_BUILD_URL, target="_blank", ), ), card( "Pro", number_flow( value=rx.cond(
def pro_tiers_select() -> rx.Component: return rx.el.div( ui.select( items=[f"{int(tier['credits']):,}" for tier in PRO_TIERS_TABLE.values()], value=f"{ProTierState.credits:,}", on_value_change=ProTierState.update_credits, size="xs", ), rx.el.span( "monthly credits", class_name="text-sm font-medium text-secondary-12", ), class_name="flex flex-row gap-2 items-center **:data-[slot=select-trigger]:min-w-22", )
s.", [ Feature( "UserMultipleIcon", "Role based access: Collaborators/Editors/Viewers", ), Feature("PlugSocketIcon", "Enterprise Integrations"), Feature("GithubIcon", "Enterprise Repo Sync"), Feature( "AiCloud01Icon", "Deploy to Databricks, AWS, Azure, GCP, Other" ), Feature("ShieldKeyIcon", "SOC 2, HIPAA BAA compliance"), Feature("QuestionIcon", "Dedicated Support Channel"), Feature("CustomerSupportIcon", "Onboarding support"), ], lemcal_dialog( ui.button( "Contact sales", variant="primary", size="lg", class_name="w-full font-semibold", ), ), ), class_name="grid xl:grid-cols-3 grid-cols-1 gap-4 w-full", )
def monthly_yearly_toggle(): return rx.el.div( ui.tabs( ui.tabs.list( ui.tabs.tab( "Monthly", value="monthly", class_name="text-base h-9 px-4" ), ui.tabs.tab( "Yearly (2 months free)", value="yearly", class_name="text-base h-9 px-4", ), ui.tabs.indicator(class_name="h-9"), ), default_value="monthly", value=monthly_yearly_toggle_cs.value, on_value_change=monthly_yearly_toggle_cs.set_value, class_name="flex items-center justify-center pb-10", ), class_name="2xl:border-x border-slate-4 w-full mx-auto max-w-[64.19rem]", ) def plan_cards(): return rx.box( header(), # monthly_yearly_toggle(), rx.el.style( """ number-flow-react::part(suffix) { color: var(--secon
def header(): return rx.box( rx.el.h3( "Choose the perfect plan for your needs", class_name="text-slate-12 text-3xl font-semibold text-center", ), rx.el.p( "Start free, scale as you grow, or go enterprise for maximum power", class_name="text-slate-9 text-xl font-semibold text-center", ), class_name="flex items-center justify-between text-slate-11 flex-col lg:pt-[4.5rem] pt-[2.5rem] pb-[3.5rem] 2xl:border-x border-slate-4 max-w-[64.19rem] mx-auto w-full gap-1", )
rt Channel"), Feature("CustomerSupportIcon", "Onboarding support"), ], lemcal_dialog( ui.button( "Contact sales", variant="primary", size="lg", class_name="w-full font-semibold", ), ), ), class_name="grid xl:grid-cols-3 grid-cols-1 gap-4 w-full", ) def header(): return rx.box( rx.el.h3( "Choose the perfect plan for your needs", class_name="text-slate-12 text-3xl font-semibold text-center", ), rx.el.p( "Start free, scale as you grow, or go enterprise for maximum power", class_name="text-slate-9 text-xl font-semibold text-center", ), class_name="flex items-center justify-between text-slate-11 flex-col lg:pt-[4.5rem] pt-[2.5rem] pb-[3.5rem] 2xl:border-x border-slate-4 max-w-[64.19rem] mx-auto w-full gap-1", )
def plan_cards(): return rx.box( header(), # monthly_yearly_toggle(), rx.el.style( """ number-flow-react::part(suffix) { color: var(--secondary-10); font-weight: 450; font-size: large; letter-spacing: -0.00875em; } """ ), pricing_cards(), class_name=( "flex flex-col w-full justify-center items-center max-w-[85rem] mx-auto", rx.cond( HostingBannerState.show_banner, "pt-[8rem] lg:pt-[7rem]", "pt-[8rem] lg:pt-[4rem]", ), ), )
def monthly_yearly_toggle(): return rx.el.div( ui.tabs( ui.tabs.list( ui.tabs.tab( "Monthly", value="monthly", class_name="text-base h-9 px-4" ), ui.tabs.tab( "Yearly (2 months free)", value="yearly", class_name="text-base h-9 px-4", ), ui.tabs.indicator(class_name="h-9"), ), default_value="monthly", value=monthly_yearly_toggle_cs.value, on_value_change=monthly_yearly_toggle_cs.set_value, class_name="flex items-center justify-center pb-10", ), class_name="2xl:border-x border-slate-4 w-full mx-auto max-w-[64.19rem]", )
nter", ), class_name="flex items-center justify-between text-slate-11 flex-col lg:pt-[4.5rem] pt-[2.5rem] pb-[3.5rem] 2xl:border-x border-slate-4 max-w-[64.19rem] mx-auto w-full gap-1", ) def monthly_yearly_toggle(): return rx.el.div( ui.tabs( ui.tabs.list( ui.tabs.tab( "Monthly", value="monthly", class_name="text-base h-9 px-4" ), ui.tabs.tab( "Yearly (2 months free)", value="yearly", class_name="text-base h-9 px-4", ), ui.tabs.indicator(class_name="h-9"), ), default_value="monthly", value=monthly_yearly_toggle_cs.value, on_value_change=monthly_yearly_toggle_cs.set_value, class_name="flex items-center justify-center pb-10", ), class_name="2xl:border-x border-slate-4 w-full mx-auto max-w-[64.19rem]", )
def plan_cards(): return rx.box( header(), # monthly_yearly_toggle(), rx.el.style( """ number-flow-react::part(suffix) { color: var(--secondary-10); font-weight: 450; font-size: large; letter-spacing: -0.00875em; } """ ), pricing_cards(), class_name=( "flex flex-col w-full justify-center items-center max-w-[85rem] mx-auto", rx.cond( HostingBannerState.show_banner, "pt-[8rem] lg:pt-[7rem]", "pt-[8rem] lg:pt-[4rem]", ), ), )
from pcweb.meta.meta import hosting_meta_tags from pcweb.pages.framework.index_colors import index_colors from pcweb.pages.framework.views.footer_index import footer_index from pcweb.pages.pricing.calculator import calculator_section from pcweb.pages.pricing.faq import faq from pcweb.pages.pricing.plan_cards import plan_cards from pcweb.pages.pricing.slider_calculator import MachineState, slider_calculator from pcweb.pages.pricing.table import tiers_tables pricing_path = "/pricing" @rx.page( route=pricing_path, title="Reflex · Pricing", meta=hosting_meta_tags, on_load=MachineState.reset_machines, ) def pricing() -> rx.Component: """Get the Pricing landing page.""" from pcweb.components.docpage.navbar import navbar return rx.box( index_colors(), navbar(), rx.el.main( rx.box( plan_cards(), tiers_tables(), slider_calculator(), calculator_section(),
import reflex as rx
import reflex as rx
from pcweb.pages.framework.index_colors import index_colors from pcweb.pages.framework.views.footer_index import footer_index from pcweb.pages.pricing.calculator import calculator_section from pcweb.pages.pricing.faq import faq from pcweb.pages.pricing.plan_cards import plan_cards from pcweb.pages.pricing.slider_calculator import MachineState, slider_calculator from pcweb.pages.pricing.table import tiers_tables pricing_path = "/pricing" @rx.page( route=pricing_path, title="Reflex · Pricing", meta=hosting_meta_tags, on_load=MachineState.reset_machines, ) def pricing() -> rx.Component: """Get the Pricing landing page.""" from pcweb.components.docpage.navbar import navbar return rx.box( index_colors(), navbar(), rx.el.main( rx.box( plan_cards(), tiers_tables(), slider_calculator(), calculator_section(), faq(), class_name="flex
from pcweb.meta.meta import hosting_meta_tags
import reflex as rx from pcweb.meta.meta import hosting_meta_tags
from pcweb.pages.framework.views.footer_index import footer_index from pcweb.pages.pricing.calculator import calculator_section from pcweb.pages.pricing.faq import faq from pcweb.pages.pricing.plan_cards import plan_cards from pcweb.pages.pricing.slider_calculator import MachineState, slider_calculator from pcweb.pages.pricing.table import tiers_tables pricing_path = "/pricing" @rx.page( route=pricing_path, title="Reflex · Pricing", meta=hosting_meta_tags, on_load=MachineState.reset_machines, ) def pricing() -> rx.Component: """Get the Pricing landing page.""" from pcweb.components.docpage.navbar import navbar return rx.box( index_colors(), navbar(), rx.el.main( rx.box( plan_cards(), tiers_tables(), slider_calculator(), calculator_section(), faq(), class_name="flex flex-col relative justify-center items-center w-full",
from pcweb.pages.framework.index_colors import index_colors
import reflex as rx from pcweb.meta.meta import hosting_meta_tags from pcweb.pages.framework.index_colors import index_colors
from pcweb.pages.pricing.calculator import calculator_section from pcweb.pages.pricing.faq import faq from pcweb.pages.pricing.plan_cards import plan_cards from pcweb.pages.pricing.slider_calculator import MachineState, slider_calculator from pcweb.pages.pricing.table import tiers_tables pricing_path = "/pricing" @rx.page( route=pricing_path, title="Reflex · Pricing", meta=hosting_meta_tags, on_load=MachineState.reset_machines, ) def pricing() -> rx.Component: """Get the Pricing landing page.""" from pcweb.components.docpage.navbar import navbar return rx.box( index_colors(), navbar(), rx.el.main( rx.box( plan_cards(), tiers_tables(), slider_calculator(), calculator_section(), faq(), class_name="flex flex-col relative justify-center items-center w-full", ), class_name="flex flex-col w-full relative h
from pcweb.pages.framework.views.footer_index import footer_index
import reflex as rx from pcweb.meta.meta import hosting_meta_tags from pcweb.pages.framework.index_colors import index_colors from pcweb.pages.framework.views.footer_index import footer_index
from pcweb.pages.pricing.faq import faq from pcweb.pages.pricing.plan_cards import plan_cards from pcweb.pages.pricing.slider_calculator import MachineState, slider_calculator from pcweb.pages.pricing.table import tiers_tables pricing_path = "/pricing" @rx.page( route=pricing_path, title="Reflex · Pricing", meta=hosting_meta_tags, on_load=MachineState.reset_machines, ) def pricing() -> rx.Component: """Get the Pricing landing page.""" from pcweb.components.docpage.navbar import navbar return rx.box( index_colors(), navbar(), rx.el.main( rx.box( plan_cards(), tiers_tables(), slider_calculator(), calculator_section(), faq(), class_name="flex flex-col relative justify-center items-center w-full", ), class_name="flex flex-col w-full relative h-full justify-center items-center", ), footer_
from pcweb.pages.pricing.calculator import calculator_section
import reflex as rx from pcweb.meta.meta import hosting_meta_tags from pcweb.pages.framework.index_colors import index_colors from pcweb.pages.framework.views.footer_index import footer_index from pcweb.pages.pricing.calculator import calculator_section
from pcweb.pages.pricing.plan_cards import plan_cards from pcweb.pages.pricing.slider_calculator import MachineState, slider_calculator from pcweb.pages.pricing.table import tiers_tables pricing_path = "/pricing" @rx.page( route=pricing_path, title="Reflex · Pricing", meta=hosting_meta_tags, on_load=MachineState.reset_machines, ) def pricing() -> rx.Component: """Get the Pricing landing page.""" from pcweb.components.docpage.navbar import navbar return rx.box( index_colors(), navbar(), rx.el.main( rx.box( plan_cards(), tiers_tables(), slider_calculator(), calculator_section(), faq(), class_name="flex flex-col relative justify-center items-center w-full", ), class_name="flex flex-col w-full relative h-full justify-center items-center", ), footer_index(), class_name="flex flex-c
from pcweb.pages.pricing.faq import faq
import reflex as rx from pcweb.meta.meta import hosting_meta_tags from pcweb.pages.framework.index_colors import index_colors from pcweb.pages.framework.views.footer_index import footer_index from pcweb.pages.pricing.calculator import calculator_section from pcweb.pages.pricing.faq import faq
from pcweb.pages.pricing.slider_calculator import MachineState, slider_calculator from pcweb.pages.pricing.table import tiers_tables pricing_path = "/pricing" @rx.page( route=pricing_path, title="Reflex · Pricing", meta=hosting_meta_tags, on_load=MachineState.reset_machines, ) def pricing() -> rx.Component: """Get the Pricing landing page.""" from pcweb.components.docpage.navbar import navbar return rx.box( index_colors(), navbar(), rx.el.main( rx.box( plan_cards(), tiers_tables(), slider_calculator(), calculator_section(), faq(), class_name="flex flex-col relative justify-center items-center w-full", ), class_name="flex flex-col w-full relative h-full justify-center items-center", ), footer_index(), class_name="flex flex-col w-full max-w-[94.5rem] justify-center items-center
from pcweb.pages.pricing.plan_cards import plan_cards
import reflex as rx from pcweb.meta.meta import hosting_meta_tags from pcweb.pages.framework.index_colors import index_colors from pcweb.pages.framework.views.footer_index import footer_index from pcweb.pages.pricing.calculator import calculator_section from pcweb.pages.pricing.faq import faq from pcweb.pages.pricing.plan_cards import plan_cards
from pcweb.pages.pricing.table import tiers_tables pricing_path = "/pricing" @rx.page( route=pricing_path, title="Reflex · Pricing", meta=hosting_meta_tags, on_load=MachineState.reset_machines, ) def pricing() -> rx.Component: """Get the Pricing landing page.""" from pcweb.components.docpage.navbar import navbar return rx.box( index_colors(), navbar(), rx.el.main( rx.box( plan_cards(), tiers_tables(), slider_calculator(), calculator_section(), faq(), class_name="flex flex-col relative justify-center items-center w-full", ), class_name="flex flex-col w-full relative h-full justify-center items-center", ), footer_index(), class_name="flex flex-col w-full max-w-[94.5rem] justify-center items-center mx-auto px-4 lg:px-5 relative", )
from pcweb.pages.pricing.slider_calculator import MachineState, slider_calculator
import reflex as rx from pcweb.meta.meta import hosting_meta_tags from pcweb.pages.framework.index_colors import index_colors from pcweb.pages.framework.views.footer_index import footer_index from pcweb.pages.pricing.calculator import calculator_section from pcweb.pages.pricing.faq import faq from pcweb.pages.pricing.plan_cards import plan_cards from pcweb.pages.pricing.slider_calculator import MachineState, slider_calculator
pricing_path = "/pricing" @rx.page( route=pricing_path, title="Reflex · Pricing", meta=hosting_meta_tags, on_load=MachineState.reset_machines, ) def pricing() -> rx.Component: """Get the Pricing landing page.""" from pcweb.components.docpage.navbar import navbar return rx.box( index_colors(), navbar(), rx.el.main( rx.box( plan_cards(), tiers_tables(), slider_calculator(), calculator_section(), faq(), class_name="flex flex-col relative justify-center items-center w-full", ), class_name="flex flex-col w-full relative h-full justify-center items-center", ), footer_index(), class_name="flex flex-col w-full max-w-[94.5rem] justify-center items-center mx-auto px-4 lg:px-5 relative", )
from pcweb.pages.pricing.table import tiers_tables
import reflex as rx from pcweb.meta.meta import hosting_meta_tags from pcweb.pages.framework.index_colors import index_colors from pcweb.pages.framework.views.footer_index import footer_index from pcweb.pages.pricing.calculator import calculator_section from pcweb.pages.pricing.faq import faq from pcweb.pages.pricing.plan_cards import plan_cards from pcweb.pages.pricing.slider_calculator import MachineState, slider_calculator from pcweb.pages.pricing.table import tiers_tables
@rx.page( route=pricing_path, title="Reflex · Pricing", meta=hosting_meta_tags, on_load=MachineState.reset_machines, ) def pricing() -> rx.Component: """Get the Pricing landing page.""" from pcweb.components.docpage.navbar import navbar return rx.box( index_colors(), navbar(), rx.el.main( rx.box( plan_cards(), tiers_tables(), slider_calculator(), calculator_section(), faq(), class_name="flex flex-col relative justify-center items-center w-full", ), class_name="flex flex-col w-full relative h-full justify-center items-center", ), footer_index(), class_name="flex flex-col w-full max-w-[94.5rem] justify-center items-center mx-auto px-4 lg:px-5 relative", )
pricing_path = "/pricing"
import reflex as rx from pcweb.meta.meta import hosting_meta_tags from pcweb.pages.framework.index_colors import index_colors from pcweb.pages.framework.views.footer_index import footer_index from pcweb.pages.pricing.calculator import calculator_section from pcweb.pages.pricing.faq import faq from pcweb.pages.pricing.plan_cards import plan_cards from pcweb.pages.pricing.slider_calculator import MachineState, slider_calculator from pcweb.pages.pricing.table import tiers_tables pricing_path = "/pricing" @rx.page( route=pricing_path, title="Reflex · Pricing", meta=hosting_meta_tags, on_load=MachineState.reset_machines, ) def pricing() -> rx.Component: """Get the Pricing landing page."""
return rx.box( index_colors(), navbar(), rx.el.main( rx.box( plan_cards(), tiers_tables(), slider_calculator(), calculator_section(), faq(), class_name="flex flex-col relative justify-center items-center w-full", ), class_name="flex flex-col w-full relative h-full justify-center items-center", ), footer_index(), class_name="flex flex-col w-full max-w-[94.5rem] justify-center items-center mx-auto px-4 lg:px-5 relative", )
from pcweb.components.docpage.navbar import navbar
import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index]
from dataclasses import dataclass
from dataclasses import dataclass
import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_T
import reflex as rx
from dataclasses import dataclass import reflex as rx
from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key]
import reflex_ui as ui
from dataclasses import dataclass import reflex as rx import reflex_ui as ui
from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"],
from reflex.experimental.client_state import ClientStateVar
from dataclasses import dataclass import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar
from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu
from reflex_ui.blocks.lemcal import lemcal_dialog
from dataclasses import dataclass import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog
from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index
from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL
from dataclasses import dataclass import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL
_SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) ->
from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, )
from dataclasses import dataclass import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, )
machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ra
_SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] )
from dataclasses import dataclass import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] )
def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(cr
machine_keys = list(COMPUTE_TABLE.keys())
from dataclasses import dataclass import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys())
@dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.cr
def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str)
from dataclasses import dataclass import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass
def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.create(pro_tier_keys) MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0] def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1 def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index] class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: r
class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, )
from dataclasses import dataclass import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod
def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.create(pro_tier_keys) MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0] def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1 def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index] class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: r
def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, )
from dataclasses import dataclass import reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index."""
specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.create(pro_tier_keys) MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0] def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1 d
machine_key = machine_keys[index]
port reflex as rx import reflex_ui as ui from reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index]
weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.create(pro_tier_keys) MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0] def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1 def get_message_credits(messages_tier_index:
specs = COMPUTE_TABLE[machine_key]
om reflex.experimental.client_state import ClientStateVar from reflex_ui.blocks.lemcal import lemcal_dialog from pcweb.constants import PRO_TIERS_TABLE, REFLEX_CLOUD_URL from pcweb.pages.pricing.calculator import ( COMPUTE_TABLE, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key]
return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.create(pro_tier_keys) MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0] def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1 def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAG
weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"])
, CREDITS_PER_HOUR_CPU, CREDITS_PER_HOUR_GB, ) _SORTED_TIERS = sorted( [{"key": k, **v} for k, v in PRO_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, )
message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.create(pro_tier_keys) MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0] def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1 def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index] class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_c
def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2)
_TIERS_TABLE.items()], key=lambda x: x["credits"] ) machine_keys = list(COMPUTE_TABLE.keys()) def format_number(number: int | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine."""
return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.create(pro_tier_keys) MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0] def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1 def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index] class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pr
credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB
nt | float) -> str: """Format number with locale string, handling non-numeric values.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2)
pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.create(pro_tier_keys) MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0] def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1 def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index] class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] =
message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False)
s.""" return rx.Var( f"(typeof {number} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False)
COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.create(pro_tier_keys) MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0] def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1 def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index] class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: {
pro_tier_keys = list(PRO_TIERS_TABLE.keys())
umber} === 'number' ? {number} : 0).toLocaleString('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys())
PRO_TIER_KEYS = rx.Var.create(pro_tier_keys) MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0] def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1 def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index] class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_
COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys)
g('en-US')" ).to(str) @dataclass class Machine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys)
MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0] def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1 def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index] class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_enterprise": False, "name": "Pro
PRO_TIER_KEYS = rx.Var.create(pro_tier_keys)
achine: vcpu: int ram: float index: int weekly_credits: float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.create(pro_tier_keys)
def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1 def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index] class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_enterprise": False, "name": "Pro Plan", "credits": 0, } ) def _recalculate
MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0]
float = 0.0 @classmethod def from_index(cls, index: int) -> "Machine": """Create Machine from COMPUTE_TABLE index.""" machine_key = machine_keys[index] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.create(pro_tier_keys) MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0]
def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index] class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_enterprise": False, "name": "Pro Plan", "credits": 0, } ) def _recalculate_all(self): """Recalculate all derived values when state changes.""" # Calculate machines weekly credits using cached values machines_credits = sum(m.we
def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1
] specs = COMPUTE_TABLE[machine_key] weekly_credits = calculate_weekly_credits(specs["vcpu"], specs["ram"]) return cls( vcpu=specs["vcpu"], ram=specs["ram"], index=index, weekly_credits=weekly_credits, ) def calculate_weekly_credits(vcpu: int, ram: float) -> float: """Calculate weekly credits for a machine.""" credits_per_hour = vcpu * CREDITS_PER_HOUR_CPU + ram * CREDITS_PER_HOUR_GB return round(credits_per_hour * 24 * 7, 2) message_tooltip_open_cs = ClientStateVar.create("message_tooltip_open", default=False) pro_tier_keys = list(PRO_TIERS_TABLE.keys()) COMPUTE_TABLE_KEYS = rx.Var.create(machine_keys) PRO_TIER_KEYS = rx.Var.create(pro_tier_keys) MESSAGES_VALUES = [0] + [50 * (2**i) for i in range(9)] + [20000, 0] def get_is_enterprise_tier(messages_tier_index: int) -> bool: """Check if slider is at Enterprise position.""" return messages_tier_index == len(MESSAGES_VALUES) - 1
class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_enterprise": False, "name": "Pro Plan", "credits": 0, } ) def _recalculate_all(self): """Recalculate all derived values when state changes.""" # Calculate machines weekly credits using cached values machines_credits = sum(m.weekly_credits for m in self.machines) self.machines_weekly_credits = machines_credits # Calculate current tier based on message credits
def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index]
== len(MESSAGES_VALUES) - 1 def get_message_credits(messages_tier_index: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index] class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_enterprise": False, "name": "Pro Plan", "credits": 0, } ) def _recalculate_all(self): """Recalculate all derived values when state changes.""" # Calculate machines weekly credits using cached values
self.machines_weekly_credits = machines_credits # Calculate current tier based on message credits msg_credits = get_message_credits(self.messages_tier_index) is_enterprise = get_is_enterprise_tier(self.messages_tier_index) # Early return path for enterprise tier if is_enterprise: self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", } self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current
machines_credits = sum(m.weekly_credits for m in self.machines)
x: int) -> int: """Get credits from message tier slider.""" return MESSAGES_VALUES[messages_tier_index] class MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_enterprise": False, "name": "Pro Plan", "credits": 0, } ) def _recalculate_all(self): """Recalculate all derived values when state changes.""" # Calculate machines weekly credits using cached values machines_credits = sum(m.weekly_credits for m in self.machines)
# Calculate current tier based on message credits msg_credits = get_message_credits(self.messages_tier_index) is_enterprise = get_is_enterprise_tier(self.messages_tier_index) # Early return path for enterprise tier if is_enterprise: self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", } self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": c
self.machines_weekly_credits = machines_credits
lass MachineState(rx.State): machines: rx.Field[list[Machine]] = rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_enterprise": False, "name": "Pro Plan", "credits": 0, } ) def _recalculate_all(self): """Recalculate all derived values when state changes.""" # Calculate machines weekly credits using cached values machines_credits = sum(m.weekly_credits for m in self.machines) self.machines_weekly_credits = machines_credits # Calculate current tier based on message credits
is_enterprise = get_is_enterprise_tier(self.messages_tier_index) # Early return path for enterprise tier if is_enterprise: self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", } self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["pr
msg_credits = get_message_credits(self.messages_tier_index)
rx.field(default_factory=list) messages_tier_index: rx.Field[int] = rx.field(default=0) machines_weekly_credits: rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_enterprise": False, "name": "Pro Plan", "credits": 0, } ) def _recalculate_all(self): """Recalculate all derived values when state changes.""" # Calculate machines weekly credits using cached values machines_credits = sum(m.weekly_credits for m in self.machines) self.machines_weekly_credits = machines_credits # Calculate current tier based on message credits msg_credits = get_message_credits(self.messages_tier_index)
# Early return path for enterprise tier if is_enterprise: self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", } self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credi
is_enterprise = get_is_enterprise_tier(self.messages_tier_index)
rx.Field[float] = rx.field(default=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_enterprise": False, "name": "Pro Plan", "credits": 0, } ) def _recalculate_all(self): """Recalculate all derived values when state changes.""" # Calculate machines weekly credits using cached values machines_credits = sum(m.weekly_credits for m in self.machines) self.machines_weekly_credits = machines_credits # Calculate current tier based on message credits msg_credits = get_message_credits(self.messages_tier_index) is_enterprise = get_is_enterprise_tier(self.messages_tier_index) # Early return path for enterprise tier
# Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom",
if is_enterprise: self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", } self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return
fault=0.0) current_tier: rx.Field[dict] = rx.field( default_factory=lambda: {"key": "Pro", "credits": 0, "price": 0} ) total_credits: rx.Field[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_enterprise": False, "name": "Pro Plan", "credits": 0, } ) def _recalculate_all(self): """Recalculate all derived values when state changes.""" # Calculate machines weekly credits using cached values machines_credits = sum(m.weekly_credits for m in self.machines) self.machines_weekly_credits = machines_credits # Calculate current tier based on message credits msg_credits = get_message_credits(self.messages_tier_index) is_enterprise = get_is_enterprise_tier(self.messages_tier_index) # Early return path for enterprise tier if is_enterprise:
self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/m
self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", }
ld[str] = rx.field(default="0") recommended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_enterprise": False, "name": "Pro Plan", "credits": 0, } ) def _recalculate_all(self): """Recalculate all derived values when state changes.""" # Calculate machines weekly credits using cached values machines_credits = sum(m.weekly_credits for m in self.machines) self.machines_weekly_credits = machines_credits # Calculate current tier based on message credits msg_credits = get_message_credits(self.messages_tier_index) is_enterprise = get_is_enterprise_tier(self.messages_tier_index) # Early return path for enterprise tier if is_enterprise: self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", }
self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": Fa
self.total_credits = "Custom"
ended_tier_info: rx.Field[dict] = rx.field( default_factory=lambda: { "price": "$0/mo", "needs_enterprise": False, "name": "Pro Plan", "credits": 0, } ) def _recalculate_all(self): """Recalculate all derived values when state changes.""" # Calculate machines weekly credits using cached values machines_credits = sum(m.weekly_credits for m in self.machines) self.machines_weekly_credits = machines_credits # Calculate current tier based on message credits msg_credits = get_message_credits(self.messages_tier_index) is_enterprise = get_is_enterprise_tier(self.messages_tier_index) # Early return path for enterprise tier if is_enterprise: self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", } self.total_credits = "Custom"
return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Cust
self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", }
ate all derived values when state changes.""" # Calculate machines weekly credits using cached values machines_credits = sum(m.weekly_credits for m in self.machines) self.machines_weekly_credits = machines_credits # Calculate current tier based on message credits msg_credits = get_message_credits(self.messages_tier_index) is_enterprise = get_is_enterprise_tier(self.messages_tier_index) # Early return path for enterprise tier if is_enterprise: self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", } self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once
total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom",
current_tier = self._find_tier_for_credits(msg_credits)
e machines weekly credits using cached values machines_credits = sum(m.weekly_credits for m in self.machines) self.machines_weekly_credits = machines_credits # Calculate current tier based on message credits msg_credits = get_message_credits(self.messages_tier_index) is_enterprise = get_is_enterprise_tier(self.messages_tier_index) # Early return path for enterprise tier if is_enterprise: self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", } self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits)
total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_m
total = msg_credits + machines_credits
machines_credits = sum(m.weekly_credits for m in self.machines) self.machines_weekly_credits = machines_credits # Calculate current tier based on message credits msg_credits = get_message_credits(self.messages_tier_index) is_enterprise = get_is_enterprise_tier(self.messages_tier_index) # Early return path for enterprise tier if is_enterprise: self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", } self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits
# Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_
total_tier = self._find_tier_for_credits(total)
machines_weekly_credits = machines_credits # Calculate current tier based on message credits msg_credits = get_message_credits(self.messages_tier_index) is_enterprise = get_is_enterprise_tier(self.messages_tier_index) # Early return path for enterprise tier if is_enterprise: self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", } self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier
# Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True)
self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", }
eturn path for enterprise tier if is_enterprise: self.current_tier = { "key": "Enterprise", "credits": msg_credits, "price": "custom", } self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display
# Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.fro
self.total_credits = f"{total:,}" if total_tier else "Custom"
"key": "Enterprise", "credits": msg_credits, "price": "custom", } self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info
@rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalculate_all() def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS: if credits <= tie
if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", }
"credits": msg_credits, "price": "custom", } self.total_credits = "Custom" self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier:
else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalc
self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], }
terprise", "credits": "Custom", } return # Non-enterprise path - find tiers once current_tier = self._find_tier_for_credits(msg_credits) total = msg_credits + machines_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else:
@rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalculate_all() def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS: if credits <= tie
self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", }
s_credits total_tier = self._find_tier_for_credits(total) # Set current tier self.current_tier = { "key": current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True)
@rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalculate_all() def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS: if credits <= tier["credits"]: return tier return None @rx.event(temporal=True) def reset_machines(self): self.reset(
def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all()
: current_tier["key"] if current_tier else "Enterprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True)
@rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalculate_all() def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS: if credits <= tier["credits"]: return tier return None @rx.event(temporal=True) def reset_machines(self): self.reset() self._recalculate_all() def total_credits_card() -> rx.Component: return rx.el.div( rx.el.span( "Estimated Credits (Monthly)", clas
def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all()
terprise", "credits": msg_credits, "price": current_tier["price"] if current_tier else "custom", } # Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int):
self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalculate_all() def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS: if credits <= tier["credits"]: return tier return None @rx.event(temporal=True) def reset_machines(self): self.reset() self._recalculate_all() def total_credits_card() -> rx.Component: return rx.el.div( rx.el.span( "Estimated Cred
self.machines = self.machines[:index] + self.machines[index + 1 :]
# Set total credits display self.total_credits = f"{total:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True)
@rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalculate_all() def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS: if credits <= tier["credits"]: return tier return None @rx.event(temporal=True) def reset_machines(self): self.reset() self._recalculate_all() def total_credits_card() -> rx.Component: return rx.el.div( rx.el.span( "Estimated Credits (Monthly)", class_name="text-secondary-12 text-sm font-medium mb-2", ), rx.el.div( rx.el.div( rx.cond( get_is_enterprise_tier(MachineState.messages_tier_index),
def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all()
al:,}" if total_tier else "Custom" # Set recommended tier info if total_tier: self.recommended_tier_info = { "price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int):
yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalculate_all() def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS: if credits <= tier["credits"]: return tier return None @rx.event(temporal=True) def reset_machines(self): self.reset() self._recalculate_all() def total_credits_card() -> rx.Component: return rx.el.div( rx.el.span( "Estimated Credits (Monthly)", class_name="text-secondary-12 text-sm font-medium mb-2", ), rx.el.div( rx.el.div( rx.cond( get_is_enterpr
self.machines[index] = Machine.from_index(new_machine_index)
"price": f"${total_tier['price']}/mo", "needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True)
def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS: if credits <= tier["credits"]: return tier return None @rx.event(temporal=True) def reset_machines(self): self.reset() self._recalculate_all() def total_credits_card() -> rx.Component: return rx.el.div( rx.el.span( "Estimated Credits (Monthly)", class_name="text-secondary-12 text-sm font-medium mb-2", ), rx.el.div( rx.el.div( rx.cond( get_is_enterprise_tier(MachineState.messages_tier_index), rx.el.span( "Reflex Build Credits (Custom)", class_name="text-secondary-11 text-sm font-medium", ), rx.el.span( f"Reflex Build
def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalculate_all()
"needs_enterprise": False, "name": f"{total_tier['key']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int):
self.messages_tier_index = new_tier_index yield self._recalculate_all() def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS: if credits <= tier["credits"]: return tier return None @rx.event(temporal=True) def reset_machines(self): self.reset() self._recalculate_all() def total_credits_card() -> rx.Component: return rx.el.div( rx.el.span( "Estimated Credits (Monthly)", class_name="text-secondary-12 text-sm font-medium mb-2", ), rx.el.div( rx.el.div( rx.cond( get_is_enterprise_tier(MachineState.messages_tier_index), rx.el.span( "Reflex Build Credits (Custom)", class_name="text-secondary-11 text-sm font-medium"
if new_tier_index == self.messages_tier_index: return
ey']} Plan", "credits": total_tier["credits"], } else: self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return
yield self._recalculate_all() def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS: if credits <= tier["credits"]: return tier return None @rx.event(temporal=True) def reset_machines(self): self.reset() self._recalculate_all() def total_credits_card() -> rx.Component: return rx.el.div( rx.el.span( "Estimated Credits (Monthly)", class_name="text-secondary-12 text-sm font-medium mb-2", ), rx.el.div( rx.el.div( rx.cond( get_is_enterprise_tier(MachineState.messages_tier_index), rx.el.span( "Reflex Build Credits (Custom)", class_name="text-secondary-11 text-sm font-medium", ), rx.el
self.messages_tier_index = new_tier_index
self.recommended_tier_info = { "price": "Custom", "needs_enterprise": True, "name": "Enterprise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalculate_all()
@rx.event(temporal=True) def reset_machines(self): self.reset() self._recalculate_all() def total_credits_card() -> rx.Component: return rx.el.div( rx.el.span( "Estimated Credits (Monthly)", class_name="text-secondary-12 text-sm font-medium mb-2", ), rx.el.div( rx.el.div( rx.cond( get_is_enterprise_tier(MachineState.messages_tier_index), rx.el.span( "Reflex Build Credits (Custom)", class_name="text-secondary-11 text-sm font-medium", ), rx.el.span( f"Reflex Build Credits ({format_number(MachineState.current_tier['credits'])})", class_name="text-secondary-11 text-sm font-medium", ), ), rx.cond( get_is_enterprise_tier(MachineState.messages
def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS: if credits <= tier["credits"]: return tier return None
ise", "credits": "Custom", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalculate_all() def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search."""
return None @rx.event(temporal=True) def reset_machines(self): self.reset() self._recalculate_all() def total_credits_card() -> rx.Component: return rx.el.div( rx.el.span( "Estimated Credits (Monthly)", class_name="text-secondary-12 text-sm font-medium mb-2", ), rx.el.div( rx.el.div( rx.cond( get_is_enterprise_tier(MachineState.messages_tier_index), rx.el.span( "Reflex Build Credits (Custom)", class_name="text-secondary-11 text-sm font-medium", ), rx.el.span( f"Reflex Build Credits ({format_number(MachineState.current_tier['credits'])})", class_name="text-secondary-11 text-sm font-medium", ), ), rx.cond( get_is_enterprise_tier(M
for tier in _SORTED_TIERS: if credits <= tier["credits"]: return tier
m", } @rx.event(temporal=True) def add_machine(self): self.machines.append(Machine.from_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalculate_all() def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS:
return None @rx.event(temporal=True) def reset_machines(self): self.reset() self._recalculate_all() def total_credits_card() -> rx.Component: return rx.el.div( rx.el.span( "Estimated Credits (Monthly)", class_name="text-secondary-12 text-sm font-medium mb-2", ), rx.el.div( rx.el.div( rx.cond( get_is_enterprise_tier(MachineState.messages_tier_index), rx.el.span( "Reflex Build Credits (Custom)", class_name="text-secondary-11 text-sm font-medium", ), rx.el.span( f"Reflex Build Credits ({format_number(MachineState.current_tier['credits'])})", class_name="text-secondary-11 text-sm font-medium", ), ), rx.cond( get_is_enterprise_tier(M
if credits <= tier["credits"]: return tier
rom_index(0)) self._recalculate_all() @rx.event(temporal=True) def remove_machine(self, index: int): self.machines = self.machines[:index] + self.machines[index + 1 :] self._recalculate_all() @rx.event(temporal=True) def update_machine(self, index: int, new_machine_index: int): self.machines[index] = Machine.from_index(new_machine_index) yield self._recalculate_all() @rx.event(temporal=True) def update_messages_tier(self, new_tier_index: int): if new_tier_index == self.messages_tier_index: return self.messages_tier_index = new_tier_index yield self._recalculate_all() def _find_tier_for_credits(self, credits: float) -> dict | None: """Find Pro tier that fits the given credits using binary search.""" for tier in _SORTED_TIERS: if credits <= tier["credits"]: return tier return None @rx.event(temporal=True)
def total_credits_card() -> rx.Component: return rx.el.div( rx.el.span( "Estimated Credits (Monthly)", class_name="text-secondary-12 text-sm font-medium mb-2", ), rx.el.div( rx.el.div( rx.cond( get_is_enterprise_tier(MachineState.messages_tier_index), rx.el.span( "Reflex Build Credits (Custom)", class_name="text-secondary-11 text-sm font-medium", ), rx.el.span( f"Reflex Build Credits ({format_number(MachineState.current_tier['credits'])})", class_name="text-secondary-11 text-sm font-medium", ), ), rx.cond( get_is_enterprise_tier(MachineState.messages_tier_index), rx.el.span( "Custom", class_nam
def reset_machines(self): self.reset() self._recalculate_all()
open=message_tooltip_open_cs.value, side="bottom", ), ), ), min=0, max=len(MESSAGES_VALUES) - 1, step=1, on_value_change=lambda new_tier_index: rx.cond( MachineState.messages_tier_index != new_tier_index, MachineState.update_messages_tier(new_tier_index).throttle(150), rx.noop(), ), on_value_committed=MachineState.update_messages_tier, min_steps_between_values=1, class_name="w-full max-w-full", ), on_mouse_enter=message_tooltip_open_cs.set_value(True), on_mouse_leave=message_tooltip_open_cs.set_value(False), class_name=ui.cn( ui.card.class_names.ROOT, "w-full lg:p-6 p-4 flex flex-col gap-4 bg-secondary-1", ), ) @rx.memo def machine_card(machine: Machine, index: int) -> rx.Component:
machine_name = COMPUTE_TABLE_KEYS[machine.index] return rx.el.div( rx.el.button( ui.icon("MultiplicationSignIcon", class_name="text-secondary-1 size-4"), on_click=MachineState.remove_machine(index), class_name="absolute -top-1 -right-1 z-10 size-5 flex items-center justify-center rounded-full bg-secondary-12 hover:bg-secondary-11 transition-colors lg:opacity-0 group-hover:opacity-100", ), rx.el.div( rx.el.div( ui.icon("ComputerIcon", class_name="text-secondary-11 size-5"), rx.el.span( f"{machine.vcpu}vCPU / {machine.ram}GB", class_name="text-secondary-12 lg:text-lg text-base font-medium", ), class_name="flex flex-row gap-2 items-center", ), rx.el.div( ui.tooltip( trigger=rx.el.span( ui.icon( "
machine_tooltip_open_cs = ClientStateVar.create( "machine_tooltip_open", default=False, global_ref=False )
), ), min=0, max=len(MESSAGES_VALUES) - 1, step=1, on_value_change=lambda new_tier_index: rx.cond( MachineState.messages_tier_index != new_tier_index, MachineState.update_messages_tier(new_tier_index).throttle(150), rx.noop(), ), on_value_committed=MachineState.update_messages_tier, min_steps_between_values=1, class_name="w-full max-w-full", ), on_mouse_enter=message_tooltip_open_cs.set_value(True), on_mouse_leave=message_tooltip_open_cs.set_value(False), class_name=ui.cn( ui.card.class_names.ROOT, "w-full lg:p-6 p-4 flex flex-col gap-4 bg-secondary-1", ), ) @rx.memo def machine_card(machine: Machine, index: int) -> rx.Component: machine_tooltip_open_cs = ClientStateVar.create( "machine_tooltip_open", default=False, global_ref=False )
return rx.el.div( rx.el.button( ui.icon("MultiplicationSignIcon", class_name="text-secondary-1 size-4"), on_click=MachineState.remove_machine(index), class_name="absolute -top-1 -right-1 z-10 size-5 flex items-center justify-center rounded-full bg-secondary-12 hover:bg-secondary-11 transition-colors lg:opacity-0 group-hover:opacity-100", ), rx.el.div( rx.el.div( ui.icon("ComputerIcon", class_name="text-secondary-11 size-5"), rx.el.span( f"{machine.vcpu}vCPU / {machine.ram}GB", class_name="text-secondary-12 lg:text-lg text-base font-medium", ), class_name="flex flex-row gap-2 items-center", ), rx.el.div( ui.tooltip( trigger=rx.el.span( ui.icon( "InformationCircleIcon", c
machine_name = COMPUTE_TABLE_KEYS[machine.index]