Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions pcweb/components/docpage/sidebar/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
});
"""


def sidebar_link(*children, **props):
"""Create a sidebar link that closes the sidebar when clicked."""
return rx.link(
Expand Down Expand Up @@ -177,7 +178,9 @@ def sidebar_item_comp(
class_name="font-small",
),
rx.box(class_name="flex-grow"),
rx.accordion.icon(class_name="size-4 !text-slate-9 group-hover:!text-violet-9"),
rx.accordion.icon(
class_name="size-4 !text-slate-9 group-hover:!text-violet-9"
),
class_name="!px-0 flex items-center !bg-transparent !hover:bg-transparent !py-2 !pr-0 w-full !text-slate-9 aria-expanded:text-slate-11 hover:!text-slate-11 transition-color group",
),
),
Expand Down Expand Up @@ -546,9 +549,7 @@ def sidebar_comp(
rx.link( # pyright: ignore [reportCallIssue]
rx.box( # pyright: ignore [reportCallIssue]
rx.box( # pyright: ignore [reportCallIssue]
rx.icon(
"atom", size=16
), # pyright: ignore [reportCallIssue]
rx.icon("atom", size=16), # pyright: ignore [reportCallIssue]
rx.el.h5(
"Custom Components",
class_name="font-smbold text-[0.875rem] text-slate-12 leading-5 tracking-[-0.01313rem] transition-color",
Expand Down Expand Up @@ -586,9 +587,7 @@ def sidebar_comp(
rx.link( # pyright: ignore [reportCallIssue]
rx.box( # pyright: ignore [reportCallIssue]
rx.box( # pyright: ignore [reportCallIssue]
rx.icon(
"atom", size=16
), # pyright: ignore [reportCallIssue]
rx.icon("atom", size=16), # pyright: ignore [reportCallIssue]
rx.el.h5(
"Reflex Enterprise",
class_name="font-smbold text-[0.875rem] text-slate-12 leading-5 tracking-[-0.01313rem] transition-color",
Expand Down
2 changes: 2 additions & 0 deletions pcweb/components/icons/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def index_patterns() -> rx.Component:
),
]


def landing_patterns() -> rx.Component:
return [
rx.box(
Expand All @@ -72,6 +73,7 @@ def landing_patterns() -> rx.Component:
),
]


def hosting_patterns() -> rx.Component:
return [
rx.image(
Expand Down
1 change: 1 addition & 0 deletions pcweb/flexdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ def render(self, env) -> rx.Component:
),
)


class DemoOnly(flexdown.blocks.Block):
"""A block that displays only a component demo without showing the code."""

Expand Down
1 change: 1 addition & 0 deletions pcweb/pages/blog/blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pcweb.components.icons.icons import get_icon
from pcweb.meta.meta import create_meta_tags


def first_post_card(meta: dict, path: str) -> rx.Component:
return rx.link(
rx.box(
Expand Down
2 changes: 0 additions & 2 deletions pcweb/pages/customers/views/bento_cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,3 @@ def _card(company: str, is_company: bool = True, **kwarg) -> rx.Component:
class_name="shrink-0 absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-[1] pointer-events-none w-[15rem] h-[15rem]",
),
)


1 change: 1 addition & 0 deletions pcweb/pages/customers/views/footer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

from pcweb.pages.framework.views.footer_index import dark_mode_toggle


def footer_link(text: str, href: str) -> rx.Component:
return rx.link(
text,
Expand Down
2 changes: 2 additions & 0 deletions pcweb/pages/databricks/databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

document = flexdown.parse_file("pcweb/pages/databricks/databricks.md")


def databricks_content() -> rx.Component:
return rx.box(xd.render(document, document.filename))


@highlight_page(path="/databricks", title="Databricks - Reflex")
def databricks_page():
return databricks_content()
76 changes: 53 additions & 23 deletions pcweb/pages/docs/env_vars.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for documenting Reflex environment variables."""

from __future__ import annotations

import inspect
Expand All @@ -12,70 +13,86 @@

class EnvVarDocs:
"""Documentation for Reflex environment variables."""

@classmethod
def get_all_env_vars(cls) -> List[Tuple[str, Any]]:
"""Get all environment variables from the environment class.

Returns:
A list of tuples containing the environment variable name and its EnvVar instance.
"""
env_vars = []
for name, attr in inspect.getmembers(EnvironmentVariables):
if name.startswith('_') or not hasattr(attr, 'name'):
if name.startswith("_") or not hasattr(attr, "name"):
continue
env_vars.append((name, attr))
return env_vars

@classmethod
def get_env_var_docstring(cls, name: str) -> Optional[str]:
"""Get the docstring for an environment variable.

Args:
name: The name of the environment variable.

Returns:
The docstring for the environment variable, or None if not found.
"""
source_code = inspect.getsource(EnvironmentVariables)
lines = source_code.splitlines()

for i, line in enumerate(lines):
if f"{name}:" in line and "EnvVar" in line:
j = i - 1
comments = []
while j >= 0 and lines[j].strip().startswith('#'):
while j >= 0 and lines[j].strip().startswith("#"):
comments.insert(0, lines[j].strip()[1:].strip())
j -= 1
if comments:
return "\n".join(comments)
return None

@classmethod
def generate_env_var_table(cls, include_internal: bool = False) -> rx.Component:
"""Generate a table of environment variables.

Args:
include_internal: Whether to include internal environment variables.

Returns:
A Reflex component containing the table.
"""
env_vars = cls.get_all_env_vars()

if not include_internal:
env_vars = [(name, var) for name, var in env_vars if not getattr(var, 'internal', False)]

env_vars = [
(name, var)
for name, var in env_vars
if not getattr(var, "internal", False)
]

env_vars.sort(key=lambda x: x[0])

return rx.box(
rx.table.root(
rx.table.header(
rx.table.row(
rx.table.column_header_cell("Name", class_name="font-small text-slate-12 text-normal w-[20%] justify-start pl-4 font-bold"),
rx.table.column_header_cell("Type", class_name="font-small text-slate-12 text-normal w-[15%] justify-start pl-4 font-bold"),
rx.table.column_header_cell("Default", class_name="font-small text-slate-12 text-normal w-[15%] justify-start pl-4 font-bold"),
rx.table.column_header_cell("Description", class_name="font-small text-slate-12 text-normal w-[50%] justify-start pl-4 font-bold"),
rx.table.column_header_cell(
"Name",
class_name="font-small text-slate-12 text-normal w-[20%] justify-start pl-4 font-bold",
),
rx.table.column_header_cell(
"Type",
class_name="font-small text-slate-12 text-normal w-[15%] justify-start pl-4 font-bold",
),
rx.table.column_header_cell(
"Default",
class_name="font-small text-slate-12 text-normal w-[15%] justify-start pl-4 font-bold",
),
rx.table.column_header_cell(
"Description",
class_name="font-small text-slate-12 text-normal w-[50%] justify-start pl-4 font-bold",
),
)
),
rx.table.body(
Expand All @@ -86,7 +103,14 @@ def generate_env_var_table(cls, include_internal: bool = False) -> rx.Component:
class_name="w-[20%]",
),
rx.table.cell(
rx.code(str(var.type_.__name__ if hasattr(var.type_, "__name__") else str(var.type_)), class_name="code-style"),
rx.code(
str(
var.type_.__name__
if hasattr(var.type_, "__name__")
else str(var.type_)
),
class_name="code-style",
),
class_name="w-[15%]",
),
rx.table.cell(
Expand All @@ -110,13 +134,15 @@ def generate_env_var_table(cls, include_internal: bool = False) -> rx.Component:

def env_vars_page():
"""Generate the environment variables documentation page.

Returns:
A Reflex component containing the documentation.
"""
return rx.box(
h1_comp(text="Environment Variables"),
rx.code("reflex.config.EnvironmentVariables", class_name="code-style text-[18px]"),
rx.code(
"reflex.config.EnvironmentVariables", class_name="code-style text-[18px]"
),
rx.divider(),
markdown(
"""
Expand All @@ -131,5 +157,9 @@ def env_vars_page():
)


env_vars_doc = docpage("/docs/api-reference/environment-variables/", "Environment Variables", right_sidebar=False)(env_vars_page)
env_vars_doc = docpage(
"/docs/api-reference/environment-variables/",
"Environment Variables",
right_sidebar=False,
)(env_vars_page)
env_vars_doc.title = "Environment Variables"
2 changes: 0 additions & 2 deletions pcweb/pages/framework/views/open_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from pcweb.constants import GITHUB_STARS, CONTRIBUTION_URL, BUGS_URL




def stat(icon: str, stat: str, text: str) -> rx.Component:
return rx.box(
get_icon(icon),
Expand Down
4 changes: 2 additions & 2 deletions pcweb/pages/landing/views/companies.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"apple",
"microsoft",
"amazon",
"fastly",
"fastly",
"accenture",
"ibm",
"unicef",
Expand Down Expand Up @@ -95,7 +95,7 @@ def quote_box(company: str) -> rx.Component:
case_study = companies_case_studies_var[company]
return rx.fragment(
rx.text(
f'“{case_study["quote"]}”',
f"“{case_study['quote']}”",
class_name="text-xs text-slate-12 italic font-medium animate-fade animate-duration-[750ms] animate-fill-both",
),
rx.box(
Expand Down
3 changes: 2 additions & 1 deletion pcweb/pages/landing/views/framework_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pcweb.components.icons.hugeicons import hi
from pcweb.pages.framework.demos.demos import demo_section


def header() -> rx.Component:
return rx.box(
rx.image(
Expand Down Expand Up @@ -30,6 +31,6 @@ def header() -> rx.Component:
def framework_section() -> rx.Component:
return rx.el.section(
header(),
demo_section(color="jade"),
demo_section(color="jade"),
class_name="flex flex-col mx-auto w-full max-w-[84.19rem] justify-center items-center",
)
4 changes: 2 additions & 2 deletions pcweb/pages/pricing/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import reflex as rx
from reflex.event import EventType

from pcweb.constants import CAL_REQUEST_DEMO_URL
from pcweb.components.hosting_banner import HostingBannerState
from pcweb.components.new_button import button
from pcweb.constants import CAL_REQUEST_DEMO_URL
from pcweb.pages.framework.views.companies import pricing_page_companies
from pcweb.telemetry.postog_metrics import DemoEvent, send_data_to_posthog

Expand Down Expand Up @@ -149,7 +149,7 @@ def submit(self, form_data: dict[str, Any]):
email = form_data.get("email", "").lower()
if "@" in email:
domain = email.split("@")[1]
if domain in banned_domains:
if domain in banned_domains or ".edu" in domain:
self.banned_email = True
yield rx.set_focus("email")
return
Expand Down
Loading