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
2 changes: 1 addition & 1 deletion account_management_dashboard/rxconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

config = rx.Config(
app_name="account_management_dashboard",
plugins=[rx.plugins.TailwindV3Plugin()],
plugins=[rx.plugins.SitemapPlugin(), rx.plugins.TailwindV3Plugin()],
)
2 changes: 1 addition & 1 deletion admin_dashboard/admin_dashboard/states/navigation_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ class NavigationState(rx.State):
@rx.var
def current_page(self) -> str:
"""Get the current page route."""
return self.router.page.path
return self.router.url.path
2 changes: 1 addition & 1 deletion admin_dashboard/rxconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

config = rx.Config(
app_name="admin_dashboard",
plugins=[rx.plugins.TailwindV3Plugin()],
plugins=[rx.plugins.SitemapPlugin(), rx.plugins.TailwindV3Plugin()],
)
2 changes: 1 addition & 1 deletion admin_panel/rxconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

config = rx.Config(
app_name="admin_panel",
plugins=[rx.plugins.TailwindV3Plugin()],
plugins=[rx.plugins.SitemapPlugin(), rx.plugins.TailwindV3Plugin()],
)
6 changes: 5 additions & 1 deletion ai_image_gen/ai_image_gen/backend/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class GeneratorState(rx.State):
upscaled_image: str = ""
is_downloading: bool = False

@rx.event
def set_output_image(self, value: str):
self.output_image = value

@rx.event(background=True)
async def generate_image(self):
try:
Expand Down Expand Up @@ -240,7 +244,7 @@ async def copy_image(self):
)
if image_url == DEFAULT_IMAGE:
image_url = (
self.router.page.full_raw_path + DEFAULT_IMAGE[1:]
self.router.url.removesuffix("/") + DEFAULT_IMAGE
) # Remove the /
yield rx.set_clipboard(image_url)
except Exception as e:
Expand Down
20 changes: 20 additions & 0 deletions ai_image_gen/ai_image_gen/backend/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,30 @@ def set_num_outputs(self, value: list):
def set_steps(self, value: list):
self.steps = value[0]

@rx.event
def set_prompt(self, value: str):
self.prompt = value

@rx.event
def set_negative_prompt(self, value: str):
self.negative_prompt = value

@rx.event
def set_scheduler(self, value: str):
self.scheduler = value

@rx.event
def set_guidance_scale(self, value: list):
self.guidance_scale = value[0]

@rx.event
def set_selected_style(self, value: str):
self.selected_style = value

@rx.event
def set_advanced_options_open(self, value: bool):
self.advanced_options_open = value

@rx.event
def randomize_prompt(self):
self.prompt = random.choice(prompt_list)
Expand Down
16 changes: 8 additions & 8 deletions ai_image_gen/ai_image_gen/components/options_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def prompt_input() -> rx.Component:
color=rx.color("gray", 10),
cursor="pointer",
_hover={"opacity": "0.8"},
on_click=OptionsState.setvar("prompt", ""),
on_click=OptionsState.set_prompt(""),
),
),
rx.tooltip(
Expand Down Expand Up @@ -252,7 +252,7 @@ def _style_preview(style_preset: list) -> rx.Component:
height="auto",
cursor="pointer",
background=rx.color("accent", 9),
on_click=OptionsState.setvar("selected_style", ""),
on_click=OptionsState.set_selected_style(""),
),
content=style_preset[0],
),
Expand All @@ -270,7 +270,7 @@ def _style_preview(style_preset: list) -> rx.Component:
height="auto",
cursor="pointer",
background=rx.color("accent", 9),
on_click=OptionsState.setvar("selected_style", style_preset[0]),
on_click=OptionsState.set_selected_style(style_preset[0]),
),
content=style_preset[0],
),
Expand All @@ -293,7 +293,7 @@ def style_selector() -> rx.Component:
color=rx.color("gray", 10),
cursor="pointer",
_hover={"opacity": "0.8"},
on_click=OptionsState.setvar("selected_style", ""),
on_click=OptionsState.set_selected_style(""),
),
spacing="4",
align="center",
Expand Down Expand Up @@ -345,7 +345,7 @@ def _negative_prompt() -> rx.Component:
color=rx.color("gray", 10),
cursor="pointer",
_hover={"opacity": "0.8"},
on_click=OptionsState.setvar("negative_prompt", ""),
on_click=OptionsState.set_negative_prompt(""),
),
),
spacing="4",
Expand Down Expand Up @@ -382,7 +382,7 @@ def _seed_input() -> rx.Component:
color=rx.color("gray", 10),
cursor="pointer",
_hover={"opacity": "0.8"},
on_click=OptionsState.setvar("seed", 0),
on_click=OptionsState.set_seed("0"),
),
),
spacing="4",
Expand Down Expand Up @@ -545,7 +545,7 @@ def advanced_options() -> rx.Component:
width="100%",
cursor="pointer",
_hover={"opacity": "0.8"},
on_click=OptionsState.setvar("advanced_options_open", False),
on_click=OptionsState.set_advanced_options_open(False),
),
rx.hstack(
rx.icon(
Expand All @@ -559,7 +559,7 @@ def advanced_options() -> rx.Component:
width="100%",
cursor="pointer",
_hover={"opacity": "0.8"},
on_click=OptionsState.setvar("advanced_options_open", True),
on_click=OptionsState.set_advanced_options_open(True),
),
),
rx.cond(
Expand Down
2 changes: 1 addition & 1 deletion ai_image_gen/ai_image_gen/pages/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _image_list_item(image: str) -> rx.Component:
max_width="5em",
cursor="pointer",
background=rx.color("accent", 9),
on_click=GeneratorState.setvar("output_image", image),
on_click=GeneratorState.set_output_image(image),
),
loading=GeneratorState.is_generating | GeneratorState.is_upscaling,
)
Expand Down
2 changes: 1 addition & 1 deletion ai_image_gen/rxconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

config = rx.Config(
app_name="ai_image_gen",
tailwind=None,
plugins=[rx.plugins.SitemapPlugin()],
)
13 changes: 13 additions & 0 deletions api_admin_panel/api_admin_panel/states/queries.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import uuid

import httpx
import reflex as rx

from api_admin_panel.states.base import BaseState

Expand Down Expand Up @@ -43,24 +44,33 @@ class QueryState(BaseState):
total_pages: int = 1
formatted_headers: dict

@rx.event
def set_req_url(self, url: str):
self.req_url = url

@rx.event
def get_request(self, method: str):
self.current_req = method

@rx.event
def add_header(self):
self.headers.append(
{"id": str(uuid.uuid4()), "identifier": "headers", "key": "", "value": ""}
)

@rx.event
def add_body(self):
self.body.append(
{"id": str(uuid.uuid4()), "identifier": "body", "key": "", "value": ""}
)

@rx.event
def add_cookies(self):
self.cookies.append(
{"id": str(uuid.uuid4()), "identifier": "cookies", "key": "", "value": ""}
)

@rx.event
def remove_entry(self, data: dict[str, str]):
if data["identifier"] == "headers":
self.headers = [item for item in self.headers if item["id"] != data["id"]]
Expand All @@ -71,6 +81,7 @@ def remove_entry(self, data: dict[str, str]):
if data["identifier"] == "cookies":
self.cookies = [item for item in self.cookies if item["id"] != data["id"]]

@rx.event
async def update_attribute(self, data: dict[str, str], attribute: str, value: str):
data[attribute] = value

Expand All @@ -89,9 +100,11 @@ async def update_attribute(self, data: dict[str, str], attribute: str, value: st
data if item["id"] == data["id"] else item for item in self.cookies
]

@rx.event
async def update_keyy(self, key: str, data: dict[str, str]):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grey line, but why does keyy have 2 y 😕

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update keyyyyy 💅

await self.update_attribute(data, "key", key)

@rx.event
async def update_value(self, value: str, data: dict[str, str]):
await self.update_attribute(data, "value", value)

Expand Down
2 changes: 1 addition & 1 deletion api_admin_panel/rxconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

config = rx.Config(
app_name="api_admin_panel",
tailwind=None,
plugins=[rx.plugins.SitemapPlugin()],
)
2 changes: 1 addition & 1 deletion business_analytics_dashboard/rxconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

config = rx.Config(
app_name="business_analytics_dashboard",
plugins=[rx.plugins.TailwindV3Plugin()],
plugins=[rx.plugins.SitemapPlugin(), rx.plugins.TailwindV3Plugin()],
)
2 changes: 1 addition & 1 deletion chat_app/rxconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

config = rx.Config(
app_name="chat_app",
plugins=[rx.plugins.TailwindV3Plugin()],
plugins=[rx.plugins.SitemapPlugin(), rx.plugins.TailwindV3Plugin()],
)
8 changes: 8 additions & 0 deletions ci_template/cijob/backend/table_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ class TableState(rx.State):
offset: int = 0
limit: int = 12 # Number of rows per page

@rx.event
def set_search_value(self, value: str):
self.search_value = value

@rx.event
def set_sort_value(self, value: str):
self.sort_value = value

@rx.var(cache=True)
def filtered_sorted_items(self) -> List[Item]:
items = self.items
Expand Down
16 changes: 16 additions & 0 deletions ci_template/cijob/templates/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ class ThemeState(rx.State):

scaling: str = "100%"

@rx.event
def set_scaling(self, value: str):
self.scaling = value

@rx.event
def set_radius(self, value: str):
self.radius = value

@rx.event
def set_accent_color(self, value: str):
self.accent_color = value

@rx.event
def set_gray_color(self, value: str):
self.gray_color = value


ALL_PAGES = []

Expand Down
4 changes: 2 additions & 2 deletions ci_template/cijob/views/color_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _display_primary_color(color: list) -> rx.Component:
style=styles.color_picker_style,
),
),
on_click=ThemeState.setvar("accent_color", color[0].lower()),
on_click=ThemeState.set_accent_color(color[0].lower()),
),
content=color[0],
)
Expand All @@ -67,7 +67,7 @@ def _display_secondary_color(colors: list) -> rx.Component:
style=styles.color_picker_style,
),
),
on_click=ThemeState.setvar("gray_color", colors[0].lower()),
on_click=ThemeState.set_gray_color(colors[0].lower()),
),
content=colors[0],
)
Expand Down
2 changes: 1 addition & 1 deletion ci_template/cijob/views/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def main_table() -> rx.Component:
rx.icon("x"),
justify="end",
cursor="pointer",
on_click=TableState.setvar("search_value", ""),
on_click=TableState.set_search_value(""),
display=rx.cond(TableState.search_value, "flex", "none"),
),
value=TableState.search_value,
Expand Down
2 changes: 1 addition & 1 deletion ci_template/rxconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

config = rx.Config(
app_name="cijob",
tailwind=None,
plugins=[rx.plugins.SitemapPlugin()],
)
2 changes: 1 addition & 1 deletion company_dashboard/rxconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

config = rx.Config(
app_name="company_dashboard",
plugins=[rx.plugins.TailwindV3Plugin()],
plugins=[rx.plugins.SitemapPlugin(), rx.plugins.TailwindV3Plugin()],
)
2 changes: 1 addition & 1 deletion customer_data_app/rxconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
config = rx.Config(
app_name="customer_data",
db_url=database_url,
tailwind=None,
plugins=[rx.plugins.SitemapPlugin()],
)
2 changes: 1 addition & 1 deletion dalle/rxconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

config = rx.Config(
app_name="dalle",
tailwind=None,
plugins=[rx.plugins.SitemapPlugin()],
)
8 changes: 8 additions & 0 deletions dashboard/dashboard/backend/table_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ class TableState(rx.State):
offset: int = 0
limit: int = 12 # Number of rows per page

@rx.event
def set_search_value(self, value: str):
self.search_value = value

@rx.event
def set_sort_value(self, value: str):
self.sort_value = value

@rx.var(cache=True)
def filtered_sorted_items(self) -> List[Item]:
items = self.items
Expand Down
16 changes: 16 additions & 0 deletions dashboard/dashboard/templates/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ class ThemeState(rx.State):

scaling: str = "100%"

@rx.event
def set_scaling(self, value: str):
self.scaling = value

@rx.event
def set_radius(self, value: str):
self.radius = value

@rx.event
def set_accent_color(self, value: str):
self.accent_color = value

@rx.event
def set_gray_color(self, value: str):
self.gray_color = value


ALL_PAGES = []

Expand Down
4 changes: 4 additions & 0 deletions dashboard/dashboard/views/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class StatsState(rx.State):
device_data = []
yearly_device_data = []

@rx.event
def set_timeframe(self, value: str):
self.timeframe = value

@rx.event
def set_selected_tab(self, tab: str | list[str]):
self.selected_tab = tab if isinstance(tab, str) else tab[0]
Expand Down
Loading