Skip to content

Commit 85a7de4

Browse files
authored
Merge branch 'main' into more-use-case-templates
2 parents 4769370 + 351156f commit 85a7de4

File tree

15 files changed

+213
-58
lines changed

15 files changed

+213
-58
lines changed

cloud-prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ regions:
44
sjc: 1
55
ewr: 2
66
nrt: 1
7-
lhr: 1
7+
lhr: 2
88
vmtype: pc2m4
99
strategy: rolling
1010
envfile: prod.env

docs/custom-components/prerequisites-for-publishing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ image_style = {
1010
}
1111
```
1212

13-
In order to publish a Python package, you need to use a publishing utility. Any would work, but we recommend either [Twine](https://twine.readthedocs.io/en/stable/) or (uv)[https://docs.astral.sh/uv/guides/package/#publishing-your-package].
13+
In order to publish a Python package, you need to use a publishing utility. Any would work, but we recommend either [Twine](https://twine.readthedocs.io/en/stable/) or [uv](https://docs.astral.sh/uv/guides/package/#publishing-your-package).
1414

1515
## PyPI
1616

docs/library/graphing/other-charts/pyplot.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ def create_plot(theme: str, plot_data: tuple, scale: list):
8181
fig, ax = plt.subplots(facecolor=bg_color)
8282
ax.set_facecolor(bg_color)
8383

84-
for (x, y), color in zip(plot_data, ["#4e79a7", "#f28e2b", "#59a14f"]):
84+
for (x, y), color in zip(plot_data, ["#4e79a7", "#f28e2b"]):
8585
ax.scatter(x, y, c=color, s=scale, label=color, alpha=0.6, edgecolors="none")
8686

87-
ax.legend(facecolor=bg_color, edgecolor='none', labelcolor=text_color)
87+
ax.legend(loc="upper right", facecolor=bg_color, edgecolor='none', labelcolor=text_color)
8888
ax.grid(True, color=grid_color)
8989
ax.tick_params(colors=text_color)
9090
for spine in ax.spines.values():
@@ -97,17 +97,19 @@ def create_plot(theme: str, plot_data: tuple, scale: list):
9797
return fig
9898

9999
class PyplotState(rx.State):
100-
num_points: int = 100
101-
plot_data: tuple = tuple(np.random.rand(2, 100) for _ in range(3))
102-
scale: list = [random.uniform(0, 100) for _ in range(100)]
100+
num_points: int = 25
101+
plot_data: tuple = tuple(np.random.rand(2, 25) for _ in range(2))
102+
scale: list = [random.uniform(0, 100) for _ in range(25)]
103103

104+
@rx.event(temporal=True, throttle=500)
104105
def randomize(self):
105-
self.plot_data = tuple(np.random.rand(2, self.num_points) for _ in range(3))
106+
self.plot_data = tuple(np.random.rand(2, self.num_points) for _ in range(2))
106107
self.scale = [random.uniform(0, 100) for _ in range(self.num_points)]
107108

109+
@rx.event(temporal=True, throttle=500)
108110
def set_num_points(self, num_points: list[int | float]):
109111
self.num_points = int(num_points[0])
110-
self.randomize()
112+
yield PyplotState.randomize()
111113

112114
@rx.var
113115
def fig_light(self) -> Figure:
@@ -134,9 +136,9 @@ def pyplot_example():
134136
),
135137
rx.text("Number of Points:"),
136138
rx.slider(
137-
default_value=100,
139+
default_value=25,
138140
min_=10,
139-
max=1000,
141+
max=100,
140142
on_value_commit=PyplotState.set_num_points,
141143
),
142144
width="100%",

docs/vars/base_vars.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ app = rx.App()
215215

216216

217217
class State(rx.State):
218-
x: rx.Field[dict[str, list[int]]] = rx.field(\{})
218+
x: rx.Field[dict[str, list[int]]] = rx.field(default_factory=dict)
219219

220220

221221
@app.add_page

pcweb/components/docpage/navbar/navbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def new_component_section() -> rx.Component:
530530
nav_menu.item(
531531
rx.link(
532532
button(
533-
"Contact Sales",
533+
"Book a Demo",
534534
class_name="!h-8 !font-small-smbold !rounded-[0.625rem] whitespace-nowrap",
535535
),
536536
underline="none",

pcweb/components/docpage/navbar/typesense.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class TypesenseSearchState(rx.State):
8585

8686
# State variables
8787
search_query: rx.Field[str] = rx.field("")
88-
search_results: rx.Field[list[dict]] = rx.field([])
88+
search_results: rx.Field[list[dict]] = rx.field(default_factory=list)
8989
is_searching: rx.Field[bool] = rx.field(False)
9090
_show_results: bool = False
9191
selected_filter: rx.Field[str] = rx.field("All")

pcweb/components/r_svg_loader.py

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
import reflex as rx
2+
3+
loading_style = {
4+
"rect": {
5+
"opacity": "0",
6+
"animation": "fadeInStayOut 6s linear infinite",
7+
},
8+
"@keyframes fadeInStayOut": {
9+
"0%": {"opacity": "0"},
10+
"5%": {"opacity": "1"},
11+
"50%": {"opacity": "1"},
12+
"55%": {"opacity": "0"},
13+
"100%": {"opacity": "0"},
14+
},
15+
}
16+
17+
for i in range(1, 14):
18+
loading_style[f"rect:nth-child({i})"] = {"animation_delay": f"{(i - 1) * 0.2}s"}
19+
20+
21+
def svg_loading():
22+
return rx.box(
23+
rx.html(
24+
"""<svg width="88" height="88" viewBox="0 0 88 88" fill="none" xmlns="http://www.w3.org/2000/svg">
25+
<rect x="32" y="41" width="6" height="6" fill="#6E56CF"/>
26+
<rect x="38" y="29" width="6" height="6" fill="#6E56CF"/>
27+
<rect x="50" y="47" width="6" height="6" fill="#6E56CF"/>
28+
<rect x="32" y="53" width="6" height="6" fill="#6E56CF"/>
29+
<rect x="44" y="41" width="6" height="6" fill="#6E56CF"/>
30+
<rect x="50" y="35" width="6" height="6" fill="#6E56CF"/>
31+
<rect x="50" y="53" width="6" height="6" fill="#6E56CF"/>
32+
<rect x="44" y="29" width="6" height="6" fill="#6E56CF"/>
33+
<rect x="32" y="29" width="6" height="6" fill="#6E56CF"/>
34+
<rect x="32" y="47" width="6" height="6" fill="#6E56CF"/>
35+
<rect x="50" y="29" width="6" height="6" fill="#6E56CF"/>
36+
<rect x="38" y="41" width="6" height="6" fill="#6E56CF"/>
37+
<rect x="32" y="35" width="6" height="6" fill="#6E56CF"/>
38+
</svg>"""
39+
),
40+
style=loading_style,
41+
position="absolute",
42+
)
43+
44+
45+
spinner_style = {
46+
"g rect": {
47+
"transform-origin": "0 0",
48+
},
49+
"g rect:nth-of-type(1)": {
50+
"animation": "growShrinkWidth 3s linear infinite",
51+
"width": "0",
52+
},
53+
"g rect:nth-of-type(2)": {
54+
"animation": "growShrinkHeight 3s linear infinite 0.35s",
55+
"height": "0",
56+
},
57+
"g rect:nth-of-type(3)": {
58+
"animation": "growShrinkWidthReverse 3s linear infinite 0.7s",
59+
"width": "0",
60+
},
61+
"g rect:nth-of-type(4)": {
62+
"animation": "growShrinkHeightReverse 3s linear infinite 1.05s",
63+
"height": "0",
64+
},
65+
"@keyframes growShrinkWidth": {
66+
"0%": {"width": "0", "transform": "translateX(0)"},
67+
"12.5%": {"width": "40px", "transform": "translateX(0)"},
68+
"37.5%": {"width": "40px", "transform": "translateX(0)"},
69+
"50%": {"width": "40px", "transform": "translateX(0)"},
70+
"62.5%": {"width": "0", "transform": "translateX(40px)"},
71+
"100%": {"width": "0", "transform": "translateX(40px)"},
72+
},
73+
"@keyframes growShrinkHeight": {
74+
"0%": {"height": "0", "transform": "translateY(0)"},
75+
"12.5%": {"height": "40px", "transform": "translateY(0)"},
76+
"37.5%": {"height": "40px", "transform": "translateY(0)"},
77+
"50%": {"height": "40px", "transform": "translateY(0)"},
78+
"62.5%": {"height": "0", "transform": "translateY(40px)"},
79+
"100%": {"height": "0", "transform": "translateY(40px)"},
80+
},
81+
"@keyframes growShrinkWidthReverse": {
82+
"0%": {"width": "0", "transform": "translateX(41px)"},
83+
"12.5%": {"width": "41px", "transform": "translateX(0)"},
84+
"37.5%": {"width": "41px", "transform": "translateX(0)"},
85+
"50%": {"width": "41px", "transform": "translateX(0)"},
86+
"62.5%": {"width": "0", "transform": "translateX(0)"},
87+
"100%": {"width": "0", "transform": "translateX(0)"},
88+
},
89+
"@keyframes growShrinkHeightReverse": {
90+
"0%": {"height": "0", "transform": "translateY(40px)"},
91+
"12.5%": {"height": "40px", "transform": "translateY(0)"},
92+
"37.5%": {"height": "40px", "transform": "translateY(0)"},
93+
"50%": {"height": "40px", "transform": "translateY(0)"},
94+
"62.5%": {"height": "0", "transform": "translateY(0)"},
95+
"100%": {"height": "0", "transform": "translateY(0)"},
96+
},
97+
}
98+
99+
100+
def spinner_svg(mask_name: str):
101+
return rx.box(
102+
rx.html(
103+
f"""<svg width="88" height="88" viewBox="0 0 88 88" fill="none" xmlns="http://www.w3.org/2000/svg">
104+
<mask id="{mask_name}" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="20" y="20" width="48" height="48">
105+
<rect x="21" y="21" width="46" height="46" rx="7" stroke="black" stroke-width="2"/>
106+
</mask>
107+
<g mask="url(#{mask_name})">
108+
<rect x="20" y="20" width="0" height="8" fill="#6E56CF"/>
109+
<rect x="60" y="20" width="8" height="0" fill="#6E56CF"/>
110+
<rect x="27" y="60" width="0" height="8" fill="#6E56CF"/>
111+
<rect x="20" y="28" width="8" height="0" fill="#6E56CF"/>
112+
</g>
113+
</svg>"""
114+
),
115+
style=spinner_style,
116+
)
117+
118+
119+
def r_svg_loader():
120+
return rx.fragment(
121+
spinner_svg(mask_name="mask"),
122+
svg_loading(),
123+
)

pcweb/constants.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@
7171
RX_BUILD_BACKEND = os.getenv("RX_BUILD_BACKEND", "https://build-backend.reflex.dev/")
7272

7373
# Stats
74-
GITHUB_STARS = 23000
75-
DISCORD_USERS = 7000
76-
CONTRIBUTORS = 170
74+
GITHUB_STARS = 25000
75+
DISCORD_USERS = 7500
76+
CONTRIBUTORS = 180
7777

7878
MAX_FILE_SIZE_MB = 5
7979
MAX_FILE_SIZE_BYTES = MAX_FILE_SIZE_MB * 1024 * 1024
@@ -98,4 +98,4 @@
9898
# Posthog
9999
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY")
100100

101-
SLACK_DEMO_WEBHOOK_URL: str = os.environ.get("SLACK_DEMO_WEBHOOK_URL")
101+
SLACK_DEMO_WEBHOOK_URL: str = os.environ.get("SLACK_DEMO_WEBHOOK_URL")

pcweb/github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import reflex as rx
44

5-
REFLEX_STAR_COUNT = 23200
5+
REFLEX_STAR_COUNT = 25000
66

77

88
class GithubStarState(rx.State):

pcweb/pages/docs/custom_components.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ class CustomComponentGalleryState(rx.State):
3434
# Added available limits for the number of items per page
3535
limits: list[str] = ["10", "20", "50", "100"]
3636

37-
@rx.event
38-
def fetch_components_list(self):
37+
@rx.event(background=True, temporal=True)
38+
async def fetch_components_list(self):
3939
try:
40-
response = httpx.get(
41-
f"{os.getenv('RCC_ENDPOINT')}/custom-components/gallery"
42-
)
43-
response.raise_for_status()
44-
component_list = response.json()
40+
async with httpx.AsyncClient() as client:
41+
response = await client.get(
42+
f"{os.getenv('RCC_ENDPOINT')}/custom-components/gallery"
43+
)
44+
response.raise_for_status()
45+
component_list = response.json()
4546
except (httpx.HTTPError, json.JSONDecodeError) as ex:
4647
print(f"Internal error: failed to fetch components list due to: {ex}")
4748
return
@@ -55,12 +56,13 @@ def fetch_components_list(self):
5556
]
5657
c["download_url"] = package_url(c["package_name"])
5758

58-
self.original_components_list = component_list
59-
self.number_of_rows = len(component_list)
60-
self.total_pages = (
61-
self.number_of_rows + self.current_limit - 1
62-
) // self.current_limit
63-
self.paginate()
59+
async with self:
60+
self.original_components_list = component_list
61+
self.number_of_rows = len(component_list)
62+
self.total_pages = (
63+
self.number_of_rows + self.current_limit - 1
64+
) // self.current_limit
65+
yield CustomComponentGalleryState.paginate()
6466

6567
@rx.event
6668
def paginate(self) -> None:

0 commit comments

Comments
 (0)