From 8df1890e7dedbb36640cfbfc3b06033797bed121 Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Thu, 30 Jan 2025 16:36:57 -0800 Subject: [PATCH] add help link for show_built_with_reflex option --- reflex/reflex.py | 5 +++++ reflex/utils/prerequisites.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/reflex/reflex.py b/reflex/reflex.py index a74024201..72c8e1c5a 100644 --- a/reflex/reflex.py +++ b/reflex/reflex.py @@ -26,6 +26,8 @@ except TypeError: # Fallback for older typer versions. cli = typer.Typer(add_completion=False) +SHOW_BUILT_WITH_REFLEX_INFO = "https://reflex.dev/docs/hosting/reflex-branding/" + # Get the config. config = get_config() @@ -188,6 +190,7 @@ def _run( option_name="show_built_with_reflex", allowed_tiers=["team", "enterprise"], fallback_value=True, + help_link=SHOW_BUILT_WITH_REFLEX_INFO, ) # Get the app module. @@ -334,6 +337,7 @@ def export( option_name="show_built_with_reflex", allowed_tiers=["team", "enterprise"], fallback_value=False, + help_link=SHOW_BUILT_WITH_REFLEX_INFO, ) export_utils.export( @@ -536,6 +540,7 @@ def deploy( option_name="show_built_with_reflex", allowed_tiers=["pro", "team", "enterprise"], fallback_value=True, + help_link=SHOW_BUILT_WITH_REFLEX_INFO, ) # Set the log level. diff --git a/reflex/utils/prerequisites.py b/reflex/utils/prerequisites.py index db428e785..c490cbb7b 100644 --- a/reflex/utils/prerequisites.py +++ b/reflex/utils/prerequisites.py @@ -1984,6 +1984,7 @@ def check_config_option_in_tier( option_name: str, allowed_tiers: list[str], fallback_value: Any, + help_link: str | None = None ): """Check if a config option is allowed for the authenticated user's current tier. @@ -1991,6 +1992,7 @@ def check_config_option_in_tier( option_name: The name of the option to check. allowed_tiers: The tiers that are allowed to use the option. fallback_value: The fallback value if the option is not allowed. + help_link: The help link to show to a user that is authenticated. """ from reflex_cli.v2.utils import hosting @@ -2005,8 +2007,10 @@ def check_config_option_in_tier( current_tier = authenticated_token[1].get("tier", "").lower() the_remedy = ( f"Your current subscription tier is `{current_tier}`. " - f"Please upgrade to {allowed_tiers} to access this option." + f"Please upgrade to {allowed_tiers} to access this option. " ) + if help_link: + the_remedy += f"See {help_link} for more information." if current_tier not in allowed_tiers: console.warn(f"Config option `{option_name}` is restricted. {the_remedy}") setattr(config, option_name, fallback_value)