Improvements based on standup comments
This commit is contained in:
parent
3135a31151
commit
128d6d103c
@ -766,16 +766,3 @@ def format_data_editor_cell(cell: Any):
|
|||||||
"kind": Var(_js_expr="GridCellKind.Text"),
|
"kind": Var(_js_expr="GridCellKind.Text"),
|
||||||
"data": cell,
|
"data": cell,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def format_template_name(name: str) -> str:
|
|
||||||
"""Format the template name of remote templates obtained during reflex init.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
name: The name of the template.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
The formatted template name.
|
|
||||||
"""
|
|
||||||
formatted_name = to_kebab_case(name)
|
|
||||||
return formatted_name.removesuffix("-app").removesuffix("-template")
|
|
||||||
|
@ -39,7 +39,7 @@ from reflex.utils.exceptions import (
|
|||||||
GeneratedCodeHasNoFunctionDefs,
|
GeneratedCodeHasNoFunctionDefs,
|
||||||
raise_system_package_missing_error,
|
raise_system_package_missing_error,
|
||||||
)
|
)
|
||||||
from reflex.utils.format import format_library_name, format_template_name
|
from reflex.utils.format import format_library_name
|
||||||
from reflex.utils.registry import _get_npm_registry
|
from reflex.utils.registry import _get_npm_registry
|
||||||
|
|
||||||
CURRENTLY_INSTALLING_NODE = False
|
CURRENTLY_INSTALLING_NODE = False
|
||||||
@ -1221,11 +1221,14 @@ def prompt_for_template_options(templates: list[Template]) -> str:
|
|||||||
# Show the user the URLs of each template to preview.
|
# Show the user the URLs of each template to preview.
|
||||||
console.print("\nGet started with a template:")
|
console.print("\nGet started with a template:")
|
||||||
|
|
||||||
|
def format_demo_url_str(url: str) -> str:
|
||||||
|
return f" ({url})" if url else ""
|
||||||
|
|
||||||
# Prompt the user to select a template.
|
# Prompt the user to select a template.
|
||||||
id_to_name = {
|
id_to_name = {
|
||||||
str(
|
str(
|
||||||
idx
|
idx
|
||||||
): f"{template.name.replace('_', ' ').replace('-', ' ')} ({template.demo_url}) - {template.description}"
|
): f"{template.name.replace('_', ' ').replace('-', ' ')}{format_demo_url_str(template.demo_url)} - {template.description}"
|
||||||
for idx, template in enumerate(templates)
|
for idx, template in enumerate(templates)
|
||||||
}
|
}
|
||||||
for id in range(len(id_to_name)):
|
for id in range(len(id_to_name)):
|
||||||
@ -1291,7 +1294,6 @@ def fetch_app_templates(version: str) -> dict[str, Template]:
|
|||||||
|
|
||||||
filtered_templates = {}
|
filtered_templates = {}
|
||||||
for tp in templates_data:
|
for tp in templates_data:
|
||||||
tp["name"] = format_template_name(tp["name"])
|
|
||||||
if tp["hidden"] or tp["code_url"] is None:
|
if tp["hidden"] or tp["code_url"] is None:
|
||||||
continue
|
continue
|
||||||
known_fields = set(f.name for f in dataclasses.fields(Template))
|
known_fields = set(f.name for f in dataclasses.fields(Template))
|
||||||
@ -1580,14 +1582,14 @@ def get_init_cli_prompt_options() -> list[Template]:
|
|||||||
),
|
),
|
||||||
Template(
|
Template(
|
||||||
name=constants.Templates.AI,
|
name=constants.Templates.AI,
|
||||||
description="Generate a template using AI (Flexgen)",
|
description="Generate a template using AI [Experimental]",
|
||||||
demo_url=constants.Templates.REFLEX_BUILD_FRONTEND,
|
demo_url="",
|
||||||
code_url="",
|
code_url="",
|
||||||
),
|
),
|
||||||
Template(
|
Template(
|
||||||
name=constants.Templates.CHOOSE_TEMPLATES,
|
name=constants.Templates.CHOOSE_TEMPLATES,
|
||||||
description="Choose an existing template.",
|
description="Choose an existing template.",
|
||||||
demo_url=constants.Templates.REFLEX_TEMPLATES_URL,
|
demo_url="",
|
||||||
code_url="",
|
code_url="",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user