Skip to content

Commit 8080d75

Browse files
authored
fix for 0.7.0 (#1172)
1 parent fbe67e4 commit 8080d75

File tree

4 files changed

+22
-33
lines changed

4 files changed

+22
-33
lines changed

docs/api-reference/special_events.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Redirect the user to a new path within the application.
4545
```python demo
4646
rx.vstack(
4747
rx.button("open in tab", on_click=rx.redirect("/docs/api-reference/special-events")),
48-
rx.button("open in new tab", on_click=rx.redirect('https://github.com/reflex-dev/reflex/', external=True))
48+
rx.button("open in new tab", on_click=rx.redirect('https://github.com/reflex-dev/reflex/', is_external=True))
4949
)
5050
```
5151

@@ -61,7 +61,7 @@ class RedirectExampleState(rx.State):
6161

6262
@rx.event
6363
def change_page(self):
64-
return rx.redirect('https://github.com/reflex-dev/reflex/', external=True)
64+
return rx.redirect('https://github.com/reflex-dev/reflex/', is_external=True)
6565

6666
def redirect_example():
6767
return rx.vstack(

docs/pages/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Redirect the user to a new path within the application using `rx.redirect()`.
104104
```python demo
105105
rx.vstack(
106106
rx.button("open in tab", on_click=rx.redirect("/docs/api-reference/special_events")),
107-
rx.button("open in new tab", on_click=rx.redirect('https://github.com/reflex-dev/reflex/', external=True))
107+
rx.button("open in new tab", on_click=rx.redirect('https://github.com/reflex-dev/reflex/', is_external=True))
108108
)
109109
```
110110

@@ -124,7 +124,7 @@ class Redirect2ExampleState(rx.State):
124124

125125
@rx.event
126126
def change_page(self):
127-
return rx.redirect(self.url, external=True)
127+
return rx.redirect(self.url, is_external=True)
128128

129129
def redirect_example():
130130
return rx.vstack(

pcweb/pages/pricing/calculator.py

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class Tiers(enum.Enum):
1414

1515

1616
class BillingState(rx.State):
17-
1817
selected_plan: str = Tiers.PRO.value
1918
# Rates
2019
cpu_rate: float = 0.000463
@@ -54,11 +53,11 @@ def max_ram(self) -> int:
5453
return 64
5554

5655
@rx.event
57-
def change_plan(self, plan: str) -> None:
58-
self.selected_plan = plan
56+
def change_plan(self, plan: str | list[str]) -> None:
57+
self.selected_plan = plan[0] if isinstance(plan, list) else plan
5958
if plan == Tiers.PRO.value:
6059
self.included_cpu = 1
61-
self.included_ram = .5
60+
self.included_ram = 0.5
6261
self.included_seats = 1
6362
# Enforce Pro tier limits
6463
self.estimated_cpu_number = min(self.estimated_cpu_number, 5)
@@ -157,13 +156,13 @@ def pricing_widget() -> rx.Component:
157156
rx.box(
158157
rx.segmented_control.root(
159158
rx.segmented_control.item("Pro", value="Pro"),
160-
#rx.segmented_control.item("Team (coming soon)", value="Team"),
159+
# rx.segmented_control.item("Team (coming soon)", value="Team"),
161160
on_change=BillingState.change_plan,
162161
default_value="Pro",
163162
width="100%",
164163
),
165164
class_name="flex flex-row pt-2 !w-[8.5rem] !h-[2.25rem] mb-2",
166-
),
165+
),
167166
"",
168167
),
169168
# Team seats
@@ -225,37 +224,29 @@ def pricing_widget() -> rx.Component:
225224
rx.badge(
226225
f"Total: ${calculate_total()}- $20 free credits = ",
227226
rx.text.strong(f"${calculate_total()-20}/mo"),
228-
229-
size='3',
227+
size="3",
230228
),
231229
class_name="mt-6",
232-
)
230+
)
233231
),
234232
class_name="flex-1 flex flex-col relative h-full w-full max-w-[25rem] pb-2.5 z-[2]",
235233
)
236234

237235

238236
def calculate_total():
239237
# Base price using rx.cond
240-
base_price = rx.cond(
241-
BillingState.selected_plan == Tiers.PRO.value,
242-
20,
243-
250
244-
)
245-
238+
base_price = rx.cond(BillingState.selected_plan == Tiers.PRO.value, 20, 250)
239+
246240
# Calculate additional seats cost
247241
additional_seats = rx.cond(
248-
BillingState.estimated_seats > 1,
249-
BillingState.estimated_seats - 1,
250-
0
242+
BillingState.estimated_seats > 1, BillingState.estimated_seats - 1, 0
251243
)
252244
seat_cost = additional_seats * BillingState.seat_rate
253-
254-
compute_cost = (
255-
(BillingState.estimated_ram_gb) * (BillingState.mem_rate * MONTH_MINUTES) +
256-
(BillingState.estimated_cpu_number) * (BillingState.cpu_rate * MONTH_MINUTES)
257-
)
258-
245+
246+
compute_cost = (BillingState.estimated_ram_gb) * (
247+
BillingState.mem_rate * MONTH_MINUTES
248+
) + (BillingState.estimated_cpu_number) * (BillingState.cpu_rate * MONTH_MINUTES)
249+
259250
total = base_price + seat_cost + compute_cost
260251
return round(total)
261252

@@ -318,12 +309,10 @@ def calculator_section() -> rx.Component:
318309
width="100%",
319310
),
320311
align_items="center",
321-
width="100%",
312+
width="100%",
322313
),
323314
rx.box(pricing_widget()),
324315
class_name="flex flex-col p-8 border border-slate-4 rounded-[1.125rem] shadow-small bg-slate-2 relative z-[1]",
325-
),
316+
),
326317
class_name="flex flex-col w-full max-w-[64.19rem] 2xl:border-x border-slate-4 2xl:border-b pb-[6rem] justify-center items-center",
327318
)
328-
329-

pcweb/pcweb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,6 @@
143143
if _check_whitelisted_path(target):
144144
app.add_page(lambda: rx.fragment(), route=source, on_load=rx.redirect(target))
145145

146-
app.add_custom_404_page(page404.component)
146+
app.add_page(page404.component, route=page404.path)
147147

148148
app.register_lifespan_task(fetch_count)

0 commit comments

Comments
 (0)