instruction
stringlengths
0
1k
input
stringlengths
1
1k
output
stringlengths
10
6.51k
"""Common templates used between pages in the app.""" from __future__ import annotations from typing import Callable import reflex as rx from .. import styles from ..components.navbar import navbar
# Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.item( rx.link( text, href=href, width="100%", color="inherit", ), _hover={ "color": styles.accent_color, "background_color": styles.accent_text_color, }, ) class ThemeState(rx.State): """The state for the theme of the app.""" accent_color: str = "crimson" gray_color: str = "gray" radius: str = "large" 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): sel
from ..components.sidebar import sidebar
"""Common templates used between pages in the app.""" from __future__ import annotations from typing import Callable import reflex as rx from .. import styles from ..components.navbar import navbar from ..components.sidebar import sidebar # Meta tags for the app.
def menu_item_link(text, href): return rx.menu.item( rx.link( text, href=href, width="100%", color="inherit", ), _hover={ "color": styles.accent_color, "background_color": styles.accent_text_color, }, ) class ThemeState(rx.State): """The state for the theme of the app.""" accent_color: str = "crimson" gray_color: str = "gray" radius: str = "large" 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 = [] def template( route: str | None = None, title: str | None = None, description: str | None = None, meta: st
default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ]
"""Common templates used between pages in the app.""" from __future__ import annotations from typing import Callable import reflex as rx from .. import styles from ..components.navbar import navbar from ..components.sidebar import sidebar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.item( rx.link( text, href=href, width="100%", color="inherit", ), _hover={ "color": styles.accent_color, "background_color": styles.accent_text_color, }, ) class ThemeState(rx.State): """The state for the theme of the app.""" accent_color: str = "crimson" gray_color: str = "gray" radius: str = "large" scaling: str = "100%" @rx.event
@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 = [] def template( route: str | None = None, title: str | None = None, description: str | None = None, meta: str | None = None, script_tags: list[rx.Component] | None = None, on_load: rx.event.EventType[()] | None = None, ) -> Callable[[Callable[[], rx.Component]], rx.Component]: """The template for each page of the app. Args: route: The route to reach the page. title: The title of the page. description: The description of the page. meta: Additional meta to add to the page. on_load: The event handler(s) called when the page load. script_tags: Scripts to attach to the page. Returns: The template with the page content.
def set_scaling(self, value: str): self.scaling = value
"""Common templates used between pages in the app.""" from __future__ import annotations from typing import Callable import reflex as rx from .. import styles from ..components.navbar import navbar from ..components.sidebar import sidebar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.item( rx.link( text, href=href, width="100%", color="inherit", ), _hover={ "color": styles.accent_color, "background_color": styles.accent_text_color, }, ) class ThemeState(rx.State): """The state for the theme of the app.""" accent_color: str = "crimson" gray_color: str = "gray" radius: str = "large" scaling: str = "100%" @rx.event def set_scaling(self, value: str):
@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 = [] def template( route: str | None = None, title: str | None = None, description: str | None = None, meta: str | None = None, script_tags: list[rx.Component] | None = None, on_load: rx.event.EventType[()] | None = None, ) -> Callable[[Callable[[], rx.Component]], rx.Component]: """The template for each page of the app. Args: route: The route to reach the page. title: The title of the page. description: The description of the page. meta: Additional meta to add to the page. on_load: The event handler(s) called when the page load. script_tags: Scripts to attach to the page. Returns: The template with the page content.
self.scaling = value
used between pages in the app.""" from __future__ import annotations from typing import Callable import reflex as rx from .. import styles from ..components.navbar import navbar from ..components.sidebar import sidebar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.item( rx.link( text, href=href, width="100%", color="inherit", ), _hover={ "color": styles.accent_color, "background_color": styles.accent_text_color, }, ) class ThemeState(rx.State): """The state for the theme of the app.""" accent_color: str = "crimson" gray_color: str = "gray" radius: str = "large" scaling: str = "100%" @rx.event def set_scaling(self, value: str): self.scaling = value @rx.event
@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 = [] def template( route: str | None = None, title: str | None = None, description: str | None = None, meta: str | None = None, script_tags: list[rx.Component] | None = None, on_load: rx.event.EventType[()] | None = None, ) -> Callable[[Callable[[], rx.Component]], rx.Component]: """The template for each page of the app. Args: route: The route to reach the page. title: The title of the page. description: The description of the page. meta: Additional meta to add to the page. on_load: The event handler(s) called when the page load. script_tags: Scripts to attach to the page. Returns: The template with the page content. """ def decorator(page_content: Callable[[], rx.Component]) -> rx.Componen
def set_radius(self, value: str): self.radius = value
_future__ import annotations from typing import Callable import reflex as rx from .. import styles from ..components.navbar import navbar from ..components.sidebar import sidebar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.item( rx.link( text, href=href, width="100%", color="inherit", ), _hover={ "color": styles.accent_color, "background_color": styles.accent_text_color, }, ) class ThemeState(rx.State): """The state for the theme of the app.""" accent_color: str = "crimson" gray_color: str = "gray" radius: str = "large" scaling: str = "100%" @rx.event def set_scaling(self, value: str): self.scaling = value @rx.event def set_radius(self, value: str):
@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 = [] def template( route: str | None = None, title: str | None = None, description: str | None = None, meta: str | None = None, script_tags: list[rx.Component] | None = None, on_load: rx.event.EventType[()] | None = None, ) -> Callable[[Callable[[], rx.Component]], rx.Component]: """The template for each page of the app. Args: route: The route to reach the page. title: The title of the page. description: The description of the page. meta: Additional meta to add to the page. on_load: The event handler(s) called when the page load. script_tags: Scripts to attach to the page. Returns: The template with the page content. """ def decorator(page_content: Callable[[], rx.Component]) -> rx.Componen
self.radius = value
ng import Callable import reflex as rx from .. import styles from ..components.navbar import navbar from ..components.sidebar import sidebar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.item( rx.link( text, href=href, width="100%", color="inherit", ), _hover={ "color": styles.accent_color, "background_color": styles.accent_text_color, }, ) class ThemeState(rx.State): """The state for the theme of the app.""" accent_color: str = "crimson" gray_color: str = "gray" radius: str = "large" 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
@rx.event def set_gray_color(self, value: str): self.gray_color = value ALL_PAGES = [] def template( route: str | None = None, title: str | None = None, description: str | None = None, meta: str | None = None, script_tags: list[rx.Component] | None = None, on_load: rx.event.EventType[()] | None = None, ) -> Callable[[Callable[[], rx.Component]], rx.Component]: """The template for each page of the app. Args: route: The route to reach the page. title: The title of the page. description: The description of the page. meta: Additional meta to add to the page. on_load: The event handler(s) called when the page load. script_tags: Scripts to attach to the page. Returns: The template with the page content. """ def decorator(page_content: Callable[[], rx.Component]) -> rx.Component: """The template for each page of the app. Args: page_content:
def set_accent_color(self, value: str): self.accent_color = value
import styles from ..components.navbar import navbar from ..components.sidebar import sidebar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.item( rx.link( text, href=href, width="100%", color="inherit", ), _hover={ "color": styles.accent_color, "background_color": styles.accent_text_color, }, ) class ThemeState(rx.State): """The state for the theme of the app.""" accent_color: str = "crimson" gray_color: str = "gray" radius: str = "large" 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):
@rx.event def set_gray_color(self, value: str): self.gray_color = value ALL_PAGES = [] def template( route: str | None = None, title: str | None = None, description: str | None = None, meta: str | None = None, script_tags: list[rx.Component] | None = None, on_load: rx.event.EventType[()] | None = None, ) -> Callable[[Callable[[], rx.Component]], rx.Component]: """The template for each page of the app. Args: route: The route to reach the page. title: The title of the page. description: The description of the page. meta: Additional meta to add to the page. on_load: The event handler(s) called when the page load. script_tags: Scripts to attach to the page. Returns: The template with the page content. """ def decorator(page_content: Callable[[], rx.Component]) -> rx.Component: """The template for each page of the app. Args: page_content:
self.accent_color = value
t navbar from ..components.sidebar import sidebar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.item( rx.link( text, href=href, width="100%", color="inherit", ), _hover={ "color": styles.accent_color, "background_color": styles.accent_text_color, }, ) class ThemeState(rx.State): """The state for the theme of the app.""" accent_color: str = "crimson" gray_color: str = "gray" radius: str = "large" 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
ALL_PAGES = [] def template( route: str | None = None, title: str | None = None, description: str | None = None, meta: str | None = None, script_tags: list[rx.Component] | None = None, on_load: rx.event.EventType[()] | None = None, ) -> Callable[[Callable[[], rx.Component]], rx.Component]: """The template for each page of the app. Args: route: The route to reach the page. title: The title of the page. description: The description of the page. meta: Additional meta to add to the page. on_load: The event handler(s) called when the page load. script_tags: Scripts to attach to the page. Returns: The template with the page content. """ def decorator(page_content: Callable[[], rx.Component]) -> rx.Component: """The template for each page of the app. Args: page_content: The content of the page. Returns: The template with the page conten
def set_gray_color(self, value: str): self.gray_color = value
bar # Meta tags for the app. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.item( rx.link( text, href=href, width="100%", color="inherit", ), _hover={ "color": styles.accent_color, "background_color": styles.accent_text_color, }, ) class ThemeState(rx.State): """The state for the theme of the app.""" accent_color: str = "crimson" gray_color: str = "gray" radius: str = "large" 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):
ALL_PAGES = [] def template( route: str | None = None, title: str | None = None, description: str | None = None, meta: str | None = None, script_tags: list[rx.Component] | None = None, on_load: rx.event.EventType[()] | None = None, ) -> Callable[[Callable[[], rx.Component]], rx.Component]: """The template for each page of the app. Args: route: The route to reach the page. title: The title of the page. description: The description of the page. meta: Additional meta to add to the page. on_load: The event handler(s) called when the page load. script_tags: Scripts to attach to the page. Returns: The template with the page content. """ def decorator(page_content: Callable[[], rx.Component]) -> rx.Component: """The template for each page of the app. Args: page_content: The content of the page. Returns: The template with the page conten
self.gray_color = value
pp. default_meta = [ { "name": "viewport", "content": "width=device-width, shrink-to-fit=no, initial-scale=1", }, ] def menu_item_link(text, href): return rx.menu.item( rx.link( text, href=href, width="100%", color="inherit", ), _hover={ "color": styles.accent_color, "background_color": styles.accent_text_color, }, ) class ThemeState(rx.State): """The state for the theme of the app.""" accent_color: str = "crimson" gray_color: str = "gray" radius: str = "large" 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
def template( route: str | None = None, title: str | None = None, description: str | None = None, meta: str | None = None, script_tags: list[rx.Component] | None = None, on_load: rx.event.EventType[()] | None = None, ) -> Callable[[Callable[[], rx.Component]], rx.Component]: """The template for each page of the app. Args: route: The route to reach the page. title: The title of the page. description: The description of the page. meta: Additional meta to add to the page. on_load: The event handler(s) called when the page load. script_tags: Scripts to attach to the page. Returns: The template with the page content. """ def decorator(page_content: Callable[[], rx.Component]) -> rx.Component: """The template for each page of the app. Args: page_content: The content of the page. Returns: The template with the page content. """
ALL_PAGES = []
title: str | None = None, description: str | None = None, meta: str | None = None, script_tags: list[rx.Component] | None = None, on_load: rx.event.EventType[()] | None = None, ) -> Callable[[Callable[[], rx.Component]], rx.Component]: """The template for each page of the app. Args: route: The route to reach the page. title: The title of the page. description: The description of the page. meta: Additional meta to add to the page. on_load: The event handler(s) called when the page load. script_tags: Scripts to attach to the page. Returns: The template with the page content. """ def decorator(page_content: Callable[[], rx.Component]) -> rx.Component: """The template for each page of the app. Args: page_content: The content of the page. Returns: The template with the page content. """ # Get the meta tags for the page.
def templated_page(): return rx.flex( navbar(), sidebar(), rx.flex( rx.vstack( page_content(), width="100%", **styles.template_content_style, ), width="100%", **styles.template_page_style, max_width=[ "100%", "100%", "100%", "100%", "100%", styles.max_width, ], ), flex_direction=[ "column", "column", "column", "column", "column", "row", ], width="100%", margin="auto", positio
all_meta = [*default_meta, *(meta or [])]
, **styles.template_content_style, ), width="100%", **styles.template_page_style, max_width=[ "100%", "100%", "100%", "100%", "100%", styles.max_width, ], ), flex_direction=[ "column", "column", "column", "column", "column", "row", ], width="100%", margin="auto", position="relative", ) @rx.page( route=route, title=title, description=description, meta=all_meta, script_tags=script_tags, on_load=on_load, )
ALL_PAGES.append( { "route": route, } | ({"title": title} if title is not None else {}) ) return theme_wrap return decorator
def theme_wrap(): return rx.theme( templated_page(), has_background=True, accent_color=ThemeState.accent_color, gray_color=ThemeState.gray_color, radius=ThemeState.radius, scaling=ThemeState.scaling, )
from reflex.components.radix.themes.base import LiteralAccentColor def flag(initials: str) -> rx.Component: return rx.image( src=f"https://flag.vercel.app/s/{initials}.svg", loading="lazy", decoding="async", width="24px", height="auto", border_radius="2px", ) def item( country: str, initials: str, progress: int, color: LiteralAccentColor ) -> rx.Component: return ( rx.hstack( rx.hstack( flag(initials), rx.text( country, size="3", weight="medium", display=["none", "none", "none", "none", "flex"], ), width=["10%", "10%", "10%", "10%", "25%"], align="center", spacing="3", ), rx.flex( rx.text( f"{progress}%", position="absolute", t
import reflex as rx
import reflex as rx
def flag(initials: str) -> rx.Component: return rx.image( src=f"https://flag.vercel.app/s/{initials}.svg", loading="lazy", decoding="async", width="24px", height="auto", border_radius="2px", ) def item( country: str, initials: str, progress: int, color: LiteralAccentColor ) -> rx.Component: return ( rx.hstack( rx.hstack( flag(initials), rx.text( country, size="3", weight="medium", display=["none", "none", "none", "none", "flex"], ), width=["10%", "10%", "10%", "10%", "25%"], align="center", spacing="3", ), rx.flex( rx.text( f"{progress}%", position="absolute", top="50%", left=["90%", "90%", "90%", "90%", "95
from reflex.components.radix.themes.base import LiteralAccentColor
import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] 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] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta
import datetime
import datetime
import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] 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] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i)
import random
import datetime import random
from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] 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] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strf
import reflex as rx
import datetime import random import reflex as rx
class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] 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] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000),
from reflex.components.radix.themes.base import ( LiteralAccentColor, )
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly"
revenue_data = [] orders_data = [] 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] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "
users_data = []
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = []
orders_data = [] 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] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": (
revenue_data = []
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = []
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] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.d
orders_data = []
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_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] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datet
device_data = []
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] 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] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i)
yearly_device_data = []
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] device_data = [] yearly_device_data = [] @rx.event
@rx.event def set_selected_tab(self, tab: str | list[str]): self.selected_tab = tab if isinstance(tab, str) else tab[0] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Orders": random.randint(100, 50
def set_timeframe(self, value: str): self.timeframe = value
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] device_data = [] yearly_device_data = [] @rx.event def set_timeframe(self, value: str):
@rx.event def set_selected_tab(self, tab: str | list[str]): self.selected_tab = tab if isinstance(tab, str) else tab[0] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Orders": random.randint(100, 50
self.timeframe = value
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] device_data = [] yearly_device_data = [] @rx.event def set_timeframe(self, value: str): self.timeframe = value @rx.event
def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Orders": random.randint(100, 500), } ) for i in range(30, -1, -1): self.users_data.append( {
def set_selected_tab(self, tab: str | list[str]): self.selected_tab = tab if isinstance(tab, str) else tab[0]
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] 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]):
def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Orders": random.randint(100, 500), } ) for i in range(30, -1, -1): self.users_data.append( {
self.selected_tab = tab if isinstance(tab, str) else tab[0]
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] 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]
def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Orders": random.randint(100, 500), } ) for i in range(30, -1, -1): self.users_data.append( { "Date": ( datetime.datetime.now() - datetime.ti
def toggle_areachart(self): self.area_toggle = not self.area_toggle
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] 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] def toggle_areachart(self):
def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Orders": random.randint(100, 500), } ) for i in range(30, -1, -1): self.users_data.append( { "Date": ( datetime.datetime.now() - datetime.ti
self.area_toggle = not self.area_toggle
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] 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] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize
for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Orders": random.randint(100, 500), } ) for i in range(30, -1, -1): self.users_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Users": random.randint(100, 500), }
if self.users_data: return
import datetime import random import reflex as rx from reflex.components.radix.themes.base import ( LiteralAccentColor, ) class StatsState(rx.State): area_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] 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] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return
for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Orders": random.randint(100, 500), } ) for i in range(30, -1, -1): self.users_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Users": random.randint(100, 500), } ) self.device_data = [ {"name": "Desktop", "value": 23, "fill": "var(--blue-8)"}, {"name": "Mobile", "value": 47, "fill": "var(--green-8)"}, {"name": "Tablet", "value": 25, "fill": "var(--purple-8)"}, {"name": "Other", "value": 5, "fill": "var(--red-8)"}, ] self.yearly_devi
for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } )
a_toggle: bool = True selected_tab: str = "users" timeframe: str = "Monthly" users_data = [] revenue_data = [] orders_data = [] 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] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } )
for i in range(30, -1, -1): self.users_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Users": random.randint(100, 500), } ) self.device_data = [ {"name": "Desktop", "value": 23, "fill": "var(--blue-8)"}, {"name": "Mobile", "value": 47, "fill": "var(--green-8)"}, {"name": "Tablet", "value": 25, "fill": "var(--purple-8)"}, {"name": "Other", "value": 5, "fill": "var(--red-8)"}, ] self.yearly_device_data = [ {"name": "Desktop", "value": 34, "fill": "var(--blue-8)"}, {"name": "Mobile", "value": 46, "fill": "var(--green-8)"}, {"name": "Tablet", "value": 21, "fill": "var(--purple-8)"}, {"name": "Other", "value": 9, "fill": "var(--red-8)"}, ] def area_toggle() -> r
for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Orders": random.randint(100, 500), } )
, tab: str | list[str]): self.selected_tab = tab if isinstance(tab, str) else tab[0] def toggle_areachart(self): self.area_toggle = not self.area_toggle def randomize_data(self): # If data is already populated, don't randomize if self.users_data: return for i in range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Orders": random.randint(100, 500), } )
self.device_data = [ {"name": "Desktop", "value": 23, "fill": "var(--blue-8)"}, {"name": "Mobile", "value": 47, "fill": "var(--green-8)"}, {"name": "Tablet", "value": 25, "fill": "var(--purple-8)"}, {"name": "Other", "value": 5, "fill": "var(--red-8)"}, ] self.yearly_device_data = [ {"name": "Desktop", "value": 34, "fill": "var(--blue-8)"}, {"name": "Mobile", "value": 46, "fill": "var(--green-8)"}, {"name": "Tablet", "value": 21, "fill": "var(--purple-8)"}, {"name": "Other", "value": 9, "fill": "var(--red-8)"}, ] def area_toggle() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.icon_button( rx.icon("area-chart"), size="2", cursor="pointer", variant="surface", on_click=StatsState.toggle_areachart, ), rx.icon_button( rx.icon("bar-chart-3")
for i in range(30, -1, -1): self.users_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Users": random.randint(100, 500), } )
range(30, -1, -1): # Include today's data self.revenue_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Revenue": random.randint(1000, 5000), } ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Orders": random.randint(100, 500), } ) for i in range(30, -1, -1): self.users_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Users": random.randint(100, 500), } )
self.yearly_device_data = [ {"name": "Desktop", "value": 34, "fill": "var(--blue-8)"}, {"name": "Mobile", "value": 46, "fill": "var(--green-8)"}, {"name": "Tablet", "value": 21, "fill": "var(--purple-8)"}, {"name": "Other", "value": 9, "fill": "var(--red-8)"}, ] def area_toggle() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.icon_button( rx.icon("area-chart"), size="2", cursor="pointer", variant="surface", on_click=StatsState.toggle_areachart, ), rx.icon_button( rx.icon("bar-chart-3"), size="2", cursor="pointer", variant="surface", on_click=StatsState.toggle_areachart, ), ) def _create_gradient(color: LiteralAccentColor, id: str) -> rx.Component: return ( rx.el.svg.defs( rx.el.svg.linear_gradient( r
self.device_data = [ {"name": "Desktop", "value": 23, "fill": "var(--blue-8)"}, {"name": "Mobile", "value": 47, "fill": "var(--green-8)"}, {"name": "Tablet", "value": 25, "fill": "var(--purple-8)"}, {"name": "Other", "value": 5, "fill": "var(--red-8)"}, ]
} ) for i in range(30, -1, -1): self.orders_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Orders": random.randint(100, 500), } ) for i in range(30, -1, -1): self.users_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Users": random.randint(100, 500), } ) self.device_data = [ {"name": "Desktop", "value": 23, "fill": "var(--blue-8)"}, {"name": "Mobile", "value": 47, "fill": "var(--green-8)"}, {"name": "Tablet", "value": 25, "fill": "var(--purple-8)"}, {"name": "Other", "value": 5, "fill": "var(--red-8)"}, ]
def area_toggle() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.icon_button( rx.icon("area-chart"), size="2", cursor="pointer", variant="surface", on_click=StatsState.toggle_areachart, ), rx.icon_button( rx.icon("bar-chart-3"), size="2", cursor="pointer", variant="surface", on_click=StatsState.toggle_areachart, ), ) def _create_gradient(color: LiteralAccentColor, id: str) -> rx.Component: return ( rx.el.svg.defs( rx.el.svg.linear_gradient( rx.el.svg.stop( stop_color=rx.color(color, 7), offset="5%", stop_opacity=0.8 ), rx.el.svg.stop( stop_color=rx.color(color, 7), offset="95%", stop_opacity=0 ), x1=0, x2=0, y1=0,
self.yearly_device_data = [ {"name": "Desktop", "value": 34, "fill": "var(--blue-8)"}, {"name": "Mobile", "value": 46, "fill": "var(--green-8)"}, {"name": "Tablet", "value": 21, "fill": "var(--purple-8)"}, {"name": "Other", "value": 9, "fill": "var(--red-8)"}, ]
} ) for i in range(30, -1, -1): self.users_data.append( { "Date": ( datetime.datetime.now() - datetime.timedelta(days=i) ).strftime("%m-%d"), "Users": random.randint(100, 500), } ) self.device_data = [ {"name": "Desktop", "value": 23, "fill": "var(--blue-8)"}, {"name": "Mobile", "value": 47, "fill": "var(--green-8)"}, {"name": "Tablet", "value": 25, "fill": "var(--purple-8)"}, {"name": "Other", "value": 5, "fill": "var(--red-8)"}, ] self.yearly_device_data = [ {"name": "Desktop", "value": 34, "fill": "var(--blue-8)"}, {"name": "Mobile", "value": 46, "fill": "var(--green-8)"}, {"name": "Tablet", "value": 21, "fill": "var(--purple-8)"}, {"name": "Other", "value": 9, "fill": "var(--red-8)"}, ]
def _create_gradient(color: LiteralAccentColor, id: str) -> rx.Component: return ( rx.el.svg.defs( rx.el.svg.linear_gradient( rx.el.svg.stop( stop_color=rx.color(color, 7), offset="5%", stop_opacity=0.8 ), rx.el.svg.stop( stop_color=rx.color(color, 7), offset="95%", stop_opacity=0 ), x1=0, x2=0, y1=0, y2=1, id=id, ), ), ) def _custom_tooltip(color: LiteralAccentColor) -> rx.Component: return ( rx.recharts.graphing_tooltip( separator=" : ", content_style={ "backgroundColor": rx.color("gray", 1), "borderRadius": "var(--radius-2)", "borderWidth": "1px", "borderColor": rx.color(color, 7), "padding": "0.5rem", "boxShadow": "0 4p
def area_toggle() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.icon_button( rx.icon("area-chart"), size="2", cursor="pointer", variant="surface", on_click=StatsState.toggle_areachart, ), rx.icon_button( rx.icon("bar-chart-3"), size="2", cursor="pointer", variant="surface", on_click=StatsState.toggle_areachart, ), )
"var(--green-8)"}, {"name": "Tablet", "value": 25, "fill": "var(--purple-8)"}, {"name": "Other", "value": 5, "fill": "var(--red-8)"}, ] self.yearly_device_data = [ {"name": "Desktop", "value": 34, "fill": "var(--blue-8)"}, {"name": "Mobile", "value": 46, "fill": "var(--green-8)"}, {"name": "Tablet", "value": 21, "fill": "var(--purple-8)"}, {"name": "Other", "value": 9, "fill": "var(--red-8)"}, ] def area_toggle() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.icon_button( rx.icon("area-chart"), size="2", cursor="pointer", variant="surface", on_click=StatsState.toggle_areachart, ), rx.icon_button( rx.icon("bar-chart-3"), size="2", cursor="pointer", variant="surface", on_click=StatsState.toggle_areachart, ), )
def _custom_tooltip(color: LiteralAccentColor) -> rx.Component: return ( rx.recharts.graphing_tooltip( separator=" : ", content_style={ "backgroundColor": rx.color("gray", 1), "borderRadius": "var(--radius-2)", "borderWidth": "1px", "borderColor": rx.color(color, 7), "padding": "0.5rem", "boxShadow": "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)", }, is_animation_active=True, ), ) def users_chart() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.recharts.area_chart( _create_gradient("blue", "colorBlue"), _custom_tooltip("blue"), rx.recharts.cartesian_grid( stroke_dasharray="3 3", ), rx.recharts.area( data_key="Users", stroke=rx.color("blue", 9),
def _create_gradient(color: LiteralAccentColor, id: str) -> rx.Component: return ( rx.el.svg.defs( rx.el.svg.linear_gradient( rx.el.svg.stop( stop_color=rx.color(color, 7), offset="5%", stop_opacity=0.8 ), rx.el.svg.stop( stop_color=rx.color(color, 7), offset="95%", stop_opacity=0 ), x1=0, x2=0, y1=0, y2=1, id=id, ), ), )
StatsState.area_toggle, rx.icon_button( rx.icon("area-chart"), size="2", cursor="pointer", variant="surface", on_click=StatsState.toggle_areachart, ), rx.icon_button( rx.icon("bar-chart-3"), size="2", cursor="pointer", variant="surface", on_click=StatsState.toggle_areachart, ), ) def _create_gradient(color: LiteralAccentColor, id: str) -> rx.Component: return ( rx.el.svg.defs( rx.el.svg.linear_gradient( rx.el.svg.stop( stop_color=rx.color(color, 7), offset="5%", stop_opacity=0.8 ), rx.el.svg.stop( stop_color=rx.color(color, 7), offset="95%", stop_opacity=0 ), x1=0, x2=0, y1=0, y2=1, id=id, ), ), )
def users_chart() -> rx.Component: return rx.cond( StatsState.area_toggle, rx.recharts.area_chart( _create_gradient("blue", "colorBlue"), _custom_tooltip("blue"), rx.recharts.cartesian_grid( stroke_dasharray="3 3", ), rx.recharts.area( data_key="Users", stroke=rx.color("blue", 9), fill="url(#colorBlue)", type_="monotone", ), rx.recharts.x_axis(data_key="Date", scale="auto"), rx.recharts.y_axis(), rx.recharts.legend(), data=StatsState.users_data, height=425, ), rx.recharts.bar_chart( rx.recharts.cartesian_grid( stroke_dasharray="3 3", ), _custom_tooltip("blue"), rx.recharts.bar( data_key="Users", stroke=rx.color("blue", 9), fill=r
def _custom_tooltip(color: LiteralAccentColor) -> rx.Component: return ( rx.recharts.graphing_tooltip( separator=" : ", content_style={ "backgroundColor": rx.color("gray", 1), "borderRadius": "var(--radius-2)", "borderWidth": "1px", "borderColor": rx.color(color, 7), "padding": "0.5rem", "boxShadow": "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)", }, is_animation_active=True, ), )
, ) def pie_chart() -> rx.Component: return rx.cond( StatsState.timeframe == "Yearly", rx.recharts.pie_chart( rx.recharts.pie( data=StatsState.yearly_device_data, data_key="value", name_key="name", cx="50%", cy="50%", padding_angle=1, inner_radius="70", outer_radius="100", label=True, ), rx.recharts.legend(), height=300, ), rx.recharts.pie_chart( rx.recharts.pie( data=StatsState.device_data, data_key="value", name_key="name", cx="50%", cy="50%", padding_angle=1, inner_radius="70", outer_radius="100", label=True, ), rx.recharts.legend(), height=300, ), )
def timeframe_select() -> rx.Component: return rx.select( ["Monthly", "Yearly"], default_value="Monthly", value=StatsState.timeframe, variant="surface", on_change=StatsState.set_timeframe, )
from reflex.components.radix.themes.base import LiteralAccentColor, LiteralGrayColor from .. import styles from ..templates.template import ThemeState primary_color_dict: dict[str, str] = { color.capitalize(): f"linear-gradient(45deg, {rx.color(color, 10)}, {rx.color(color, 8)})" for color in LiteralAccentColor.__args__ } secondary_color_dict: dict[str, str] = { color.capitalize(): f"linear-gradient(45deg, {rx.color(color, 10)}, {rx.color(color, 8)})" for color in LiteralGrayColor.__args__ if color != "auto" # Remove auto from the list } class ColorPickerState(rx.State): primary_color_options: dict[str, str] = primary_color_dict secondary_color_options: dict[str, str] = secondary_color_dict def _display_primary_color(color: list) -> rx.Component: return rx.tooltip( rx.box( rx.cond( color[0].lower() == ThemeState.accent_color.lower(), rx.box( rx.icon("check", color=rx.color("
import reflex as rx
import reflex as rx
from .. import styles from ..templates.template import ThemeState primary_color_dict: dict[str, str] = { color.capitalize(): f"linear-gradient(45deg, {rx.color(color, 10)}, {rx.color(color, 8)})" for color in LiteralAccentColor.__args__ } secondary_color_dict: dict[str, str] = { color.capitalize(): f"linear-gradient(45deg, {rx.color(color, 10)}, {rx.color(color, 8)})" for color in LiteralGrayColor.__args__ if color != "auto" # Remove auto from the list } class ColorPickerState(rx.State): primary_color_options: dict[str, str] = primary_color_dict secondary_color_options: dict[str, str] = secondary_color_dict def _display_primary_color(color: list) -> rx.Component: return rx.tooltip( rx.box( rx.cond( color[0].lower() == ThemeState.accent_color.lower(), rx.box( rx.icon("check", color=rx.color("gray", 12)), bg=color[1], height=styles.color
from reflex.components.radix.themes.base import LiteralAccentColor, LiteralGrayColor
import reflex as rx from reflex.components.radix.themes.base import LiteralAccentColor, LiteralGrayColor
from ..templates.template import ThemeState primary_color_dict: dict[str, str] = { color.capitalize(): f"linear-gradient(45deg, {rx.color(color, 10)}, {rx.color(color, 8)})" for color in LiteralAccentColor.__args__ } secondary_color_dict: dict[str, str] = { color.capitalize(): f"linear-gradient(45deg, {rx.color(color, 10)}, {rx.color(color, 8)})" for color in LiteralGrayColor.__args__ if color != "auto" # Remove auto from the list } class ColorPickerState(rx.State): primary_color_options: dict[str, str] = primary_color_dict secondary_color_options: dict[str, str] = secondary_color_dict def _display_primary_color(color: list) -> rx.Component: return rx.tooltip( rx.box( rx.cond( color[0].lower() == ThemeState.accent_color.lower(), rx.box( rx.icon("check", color=rx.color("gray", 12)), bg=color[1], height=styles.color_box_size,
from .. import styles
import reflex as rx from reflex.components.radix.themes.base import LiteralAccentColor, LiteralGrayColor from .. import styles
primary_color_dict: dict[str, str] = { color.capitalize(): f"linear-gradient(45deg, {rx.color(color, 10)}, {rx.color(color, 8)})" for color in LiteralAccentColor.__args__ } secondary_color_dict: dict[str, str] = { color.capitalize(): f"linear-gradient(45deg, {rx.color(color, 10)}, {rx.color(color, 8)})" for color in LiteralGrayColor.__args__ if color != "auto" # Remove auto from the list } class ColorPickerState(rx.State): primary_color_options: dict[str, str] = primary_color_dict secondary_color_options: dict[str, str] = secondary_color_dict def _display_primary_color(color: list) -> rx.Component: return rx.tooltip( rx.box( rx.cond( color[0].lower() == ThemeState.accent_color.lower(), rx.box( rx.icon("check", color=rx.color("gray", 12)), bg=color[1], height=styles.color_box_size, width=styles.color_box_size,
from ..templates.template import ThemeState
import reflex as rx from reflex.components.radix.themes.base import LiteralAccentColor, LiteralGrayColor from .. import styles from ..templates.template import ThemeState primary_color_dict: dict[str, str] = { color.capitalize(): f"linear-gradient(45deg, {rx.color(color, 10)}, {rx.color(color, 8)})" for color in LiteralAccentColor.__args__ } secondary_color_dict: dict[str, str] = { color.capitalize(): f"linear-gradient(45deg, {rx.color(color, 10)}, {rx.color(color, 8)})" for color in LiteralGrayColor.__args__ if color != "auto" # Remove auto from the list }
def _display_primary_color(color: list) -> rx.Component: return rx.tooltip( rx.box( rx.cond( color[0].lower() == ThemeState.accent_color.lower(), rx.box( rx.icon("check", color=rx.color("gray", 12)), bg=color[1], height=styles.color_box_size, width=styles.color_box_size, border=f"2px solid {rx.color('gray', 12)}", style=styles.color_picker_style, ), rx.box( bg=color[1], height=styles.color_box_size, width=styles.color_box_size, style=styles.color_picker_style, ), ), on_click=ThemeState.set_accent_color(color[0].lower()), ), content=color[0], ) def _display_secondary_color(colors: list) -> rx.Component: return rx.tooltip( rx.bo
class ColorPickerState(rx.State): primary_color_options: dict[str, str] = primary_color_dict secondary_color_options: dict[str, str] = secondary_color_dict
ck=ThemeState.set_accent_color(color[0].lower()), ), content=color[0], ) def _display_secondary_color(colors: list) -> rx.Component: return rx.tooltip( rx.box( rx.cond( colors[0].lower() == ThemeState.gray_color.lower(), rx.box( rx.icon("check", color=rx.color("gray", 12)), bg=colors[1], height=styles.color_box_size, width=styles.color_box_size, border=f"2px solid {rx.color('gray', 12)}", style=styles.color_picker_style, ), rx.box( bg=colors[1], height=styles.color_box_size, width=styles.color_box_size, style=styles.color_picker_style, ), ), on_click=ThemeState.set_gray_color(colors[0].lower()), ), content=colors[0], )
def secondary_color_picker() -> rx.Component: return rx.flex( rx.foreach(ColorPickerState.secondary_color_options, _display_secondary_color), width="100%", max_width="40rem", wrap="wrap", gap=["15px", "15px", "20px"], )
def primary_color_picker() -> rx.Component: return rx.flex( rx.foreach(ColorPickerState.primary_color_options, _display_primary_color), width="100%", max_width="40rem", wrap="wrap", gap=["15px", "15px", "20px"], )
ray_color.lower(), rx.box( rx.icon("check", color=rx.color("gray", 12)), bg=colors[1], height=styles.color_box_size, width=styles.color_box_size, border=f"2px solid {rx.color('gray', 12)}", style=styles.color_picker_style, ), rx.box( bg=colors[1], height=styles.color_box_size, width=styles.color_box_size, style=styles.color_picker_style, ), ), on_click=ThemeState.set_gray_color(colors[0].lower()), ), content=colors[0], ) def primary_color_picker() -> rx.Component: return rx.flex( rx.foreach(ColorPickerState.primary_color_options, _display_primary_color), width="100%", max_width="40rem", wrap="wrap", gap=["15px", "15px", "20px"], )
def secondary_color_picker() -> rx.Component: return rx.flex( rx.foreach(ColorPickerState.secondary_color_options, _display_secondary_color), width="100%", max_width="40rem", wrap="wrap", gap=["15px", "15px", "20px"], )
import reflex as rx
def radius_picker() -> rx.Component: return ( rx.vstack( rx.hstack( rx.icon("radius"), rx.heading("Radius", size="6"), align="center", ), rx.select( [ "none", "small", "medium", "large", "full", ], size="3", value=ThemeState.radius, on_change=ThemeState.set_radius, ), width="100%", ), )
from ..templates.template import ThemeState
from ..templates.template import ThemeState def scaling_picker() -> rx.Component: return ( rx.vstack( rx.hstack( rx.icon("ruler"), rx.heading("Scaling", size="6"), align="center", ), rx.select( [ "90%", "95%", "100%", "105%", "110%", ], size="3", value=ThemeState.scaling, on_change=ThemeState.set_scaling, ), width="100%", ), )
import reflex as rx
import reflex as rx
def scaling_picker() -> rx.Component: return ( rx.vstack( rx.hstack( rx.icon("ruler"), rx.heading("Scaling", size="6"), align="center", ), rx.select( [ "90%", "95%", "100%", "105%", "110%", ], size="3", value=ThemeState.scaling, on_change=ThemeState.set_scaling, ), width="100%", ), )
from ..templates.template import ThemeState
from reflex.components.radix.themes.base import LiteralAccentColor from .. import styles def stats_card( stat_name: str, value: int, prev_value: int, icon: str, icon_color: LiteralAccentColor, extra_char: str = "", ) -> rx.Component: percentage_change = ( round(((value - prev_value) / prev_value) * 100, 2) if prev_value != 0 else 0 if value == 0 else float("inf") ) change = "increase" if value > prev_value else "decrease" arrow_icon = "trending-up" if value > prev_value else "trending-down" arrow_color = "grass" if value > prev_value else "tomato" return rx.card( rx.vstack( rx.hstack( rx.badge( rx.icon(tag=icon, size=34), color_scheme=icon_color, radius="full", padding="0.7rem", ), rx.vstack( rx.heading( f"
import reflex as rx
import reflex as rx
from .. import styles def stats_card( stat_name: str, value: int, prev_value: int, icon: str, icon_color: LiteralAccentColor, extra_char: str = "", ) -> rx.Component: percentage_change = ( round(((value - prev_value) / prev_value) * 100, 2) if prev_value != 0 else 0 if value == 0 else float("inf") ) change = "increase" if value > prev_value else "decrease" arrow_icon = "trending-up" if value > prev_value else "trending-down" arrow_color = "grass" if value > prev_value else "tomato" return rx.card( rx.vstack( rx.hstack( rx.badge( rx.icon(tag=icon, size=34), color_scheme=icon_color, radius="full", padding="0.7rem", ), rx.vstack( rx.heading( f"{extra_char}{value:,}", size="6",
from reflex.components.radix.themes.base import LiteralAccentColor
import reflex as rx from reflex.components.radix.themes.base import LiteralAccentColor
def stats_card( stat_name: str, value: int, prev_value: int, icon: str, icon_color: LiteralAccentColor, extra_char: str = "", ) -> rx.Component: percentage_change = ( round(((value - prev_value) / prev_value) * 100, 2) if prev_value != 0 else 0 if value == 0 else float("inf") ) change = "increase" if value > prev_value else "decrease" arrow_icon = "trending-up" if value > prev_value else "trending-down" arrow_color = "grass" if value > prev_value else "tomato" return rx.card( rx.vstack( rx.hstack( rx.badge( rx.icon(tag=icon, size=34), color_scheme=icon_color, radius="full", padding="0.7rem", ), rx.vstack( rx.heading( f"{extra_char}{value:,}", size="6", weight="
from .. import styles
import reflex as rx from reflex.components.radix.themes.base import LiteralAccentColor from .. import styles def stats_card( stat_name: str, value: int, prev_value: int, icon: str, icon_color: LiteralAccentColor, extra_char: str = "", ) -> rx.Component:
change = "increase" if value > prev_value else "decrease" arrow_icon = "trending-up" if value > prev_value else "trending-down" arrow_color = "grass" if value > prev_value else "tomato" return rx.card( rx.vstack( rx.hstack( rx.badge( rx.icon(tag=icon, size=34), color_scheme=icon_color, radius="full", padding="0.7rem", ), rx.vstack( rx.heading( f"{extra_char}{value:,}", size="6", weight="bold", ), rx.text(stat_name, size="4", weight="medium"), spacing="1", height="100%", align_items="start", width="100%", ), height="100%", spacing="4", align="center",
percentage_change = ( round(((value - prev_value) / prev_value) * 100, 2) if prev_value != 0 else 0 if value == 0 else float("inf") )
import reflex as rx from reflex.components.radix.themes.base import LiteralAccentColor from .. import styles def stats_card( stat_name: str, value: int, prev_value: int, icon: str, icon_color: LiteralAccentColor, extra_char: str = "", ) -> rx.Component: percentage_change = ( round(((value - prev_value) / prev_value) * 100, 2) if prev_value != 0 else 0 if value == 0 else float("inf") )
arrow_icon = "trending-up" if value > prev_value else "trending-down" arrow_color = "grass" if value > prev_value else "tomato" return rx.card( rx.vstack( rx.hstack( rx.badge( rx.icon(tag=icon, size=34), color_scheme=icon_color, radius="full", padding="0.7rem", ), rx.vstack( rx.heading( f"{extra_char}{value:,}", size="6", weight="bold", ), rx.text(stat_name, size="4", weight="medium"), spacing="1", height="100%", align_items="start", width="100%", ), height="100%", spacing="4", align="center", width="100%", ), rx.hsta
change = "increase" if value > prev_value else "decrease"
import reflex as rx from reflex.components.radix.themes.base import LiteralAccentColor from .. import styles def stats_card( stat_name: str, value: int, prev_value: int, icon: str, icon_color: LiteralAccentColor, extra_char: str = "", ) -> rx.Component: percentage_change = ( round(((value - prev_value) / prev_value) * 100, 2) if prev_value != 0 else 0 if value == 0 else float("inf") ) change = "increase" if value > prev_value else "decrease"
arrow_color = "grass" if value > prev_value else "tomato" return rx.card( rx.vstack( rx.hstack( rx.badge( rx.icon(tag=icon, size=34), color_scheme=icon_color, radius="full", padding="0.7rem", ), rx.vstack( rx.heading( f"{extra_char}{value:,}", size="6", weight="bold", ), rx.text(stat_name, size="4", weight="medium"), spacing="1", height="100%", align_items="start", width="100%", ), height="100%", spacing="4", align="center", width="100%", ), rx.hstack( rx.hstack( rx.icon(
arrow_icon = "trending-up" if value > prev_value else "trending-down"
import reflex as rx from reflex.components.radix.themes.base import LiteralAccentColor from .. import styles def stats_card( stat_name: str, value: int, prev_value: int, icon: str, icon_color: LiteralAccentColor, extra_char: str = "", ) -> rx.Component: percentage_change = ( round(((value - prev_value) / prev_value) * 100, 2) if prev_value != 0 else 0 if value == 0 else float("inf") ) change = "increase" if value > prev_value else "decrease" arrow_icon = "trending-up" if value > prev_value else "trending-down"
return rx.card( rx.vstack( rx.hstack( rx.badge( rx.icon(tag=icon, size=34), color_scheme=icon_color, radius="full", padding="0.7rem", ), rx.vstack( rx.heading( f"{extra_char}{value:,}", size="6", weight="bold", ), rx.text(stat_name, size="4", weight="medium"), spacing="1", height="100%", align_items="start", width="100%", ), height="100%", spacing="4", align="center", width="100%", ), rx.hstack( rx.hstack( rx.icon( tag=arrow_icon, size=24,
arrow_color = "grass" if value > prev_value else "tomato"
from ..backend.table_state import Item, TableState from ..components.status_badge import status_badge def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=18), rx.text(text), align="center", spacing="2", ), ) def _show_item(item: Item, index: int) -> rx.Component: bg_color = rx.cond( index % 2 == 0, rx.color("gray", 1), rx.color("accent", 2), ) hover_color = rx.cond( index % 2 == 0, rx.color("gray", 3), rx.color("accent", 3), ) return rx.table.row( rx.table.row_header_cell(item.name), rx.table.cell(f"${item.payment}"), rx.table.cell(item.date), rx.table.cell(status_badge(item.status)), style={"_hover": {"bg": hover_color}, "bg": bg_color}, align="center", ) def _pagination_view() -> rx.Component: return ( rx.h
import reflex as rx
import reflex as rx
from ..components.status_badge import status_badge def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=18), rx.text(text), align="center", spacing="2", ), ) def _show_item(item: Item, index: int) -> rx.Component: bg_color = rx.cond( index % 2 == 0, rx.color("gray", 1), rx.color("accent", 2), ) hover_color = rx.cond( index % 2 == 0, rx.color("gray", 3), rx.color("accent", 3), ) return rx.table.row( rx.table.row_header_cell(item.name), rx.table.cell(f"${item.payment}"), rx.table.cell(item.date), rx.table.cell(status_badge(item.status)), style={"_hover": {"bg": hover_color}, "bg": bg_color}, align="center", ) def _pagination_view() -> rx.Component: return ( rx.hstack( rx.text( "Page ",
from ..backend.table_state import Item, TableState
import reflex as rx from ..backend.table_state import Item, TableState
def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=18), rx.text(text), align="center", spacing="2", ), ) def _show_item(item: Item, index: int) -> rx.Component: bg_color = rx.cond( index % 2 == 0, rx.color("gray", 1), rx.color("accent", 2), ) hover_color = rx.cond( index % 2 == 0, rx.color("gray", 3), rx.color("accent", 3), ) return rx.table.row( rx.table.row_header_cell(item.name), rx.table.cell(f"${item.payment}"), rx.table.cell(item.date), rx.table.cell(status_badge(item.status)), style={"_hover": {"bg": hover_color}, "bg": bg_color}, align="center", ) def _pagination_view() -> rx.Component: return ( rx.hstack( rx.text( "Page ", rx.code(TableState.page_number),
from ..components.status_badge import status_badge
import reflex as rx from ..backend.table_state import Item, TableState from ..components.status_badge import status_badge
def _show_item(item: Item, index: int) -> rx.Component: bg_color = rx.cond( index % 2 == 0, rx.color("gray", 1), rx.color("accent", 2), ) hover_color = rx.cond( index % 2 == 0, rx.color("gray", 3), rx.color("accent", 3), ) return rx.table.row( rx.table.row_header_cell(item.name), rx.table.cell(f"${item.payment}"), rx.table.cell(item.date), rx.table.cell(status_badge(item.status)), style={"_hover": {"bg": hover_color}, "bg": bg_color}, align="center", ) def _pagination_view() -> rx.Component: return ( rx.hstack( rx.text( "Page ", rx.code(TableState.page_number), f" of {TableState.total_pages}", justify="end", ), rx.hstack( rx.icon_button( rx.icon("chevrons-left", size=18), on_click=TableState.first_
def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=18), rx.text(text), align="center", spacing="2", ), )
import reflex as rx from ..backend.table_state import Item, TableState from ..components.status_badge import status_badge def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=18), rx.text(text), align="center", spacing="2", ), )
def _pagination_view() -> rx.Component: return ( rx.hstack( rx.text( "Page ", rx.code(TableState.page_number), f" of {TableState.total_pages}", justify="end", ), rx.hstack( rx.icon_button( rx.icon("chevrons-left", size=18), on_click=TableState.first_page, opacity=rx.cond(TableState.page_number == 1, 0.6, 1), color_scheme=rx.cond(TableState.page_number == 1, "gray", "accent"), variant="soft", ), rx.icon_button( rx.icon("chevron-left", size=18), on_click=TableState.prev_page, opacity=rx.cond(TableState.page_number == 1, 0.6, 1), color_scheme=rx.cond(TableState.page_number == 1, "gray", "accent"), variant="soft", ),
def _show_item(item: Item, index: int) -> rx.Component: bg_color = rx.cond( index % 2 == 0, rx.color("gray", 1), rx.color("accent", 2), ) hover_color = rx.cond( index % 2 == 0, rx.color("gray", 3), rx.color("accent", 3), ) return rx.table.row( rx.table.row_header_cell(item.name), rx.table.cell(f"${item.payment}"), rx.table.cell(item.date), rx.table.cell(status_badge(item.status)), style={"_hover": {"bg": hover_color}, "bg": bg_color}, align="center", )
import reflex as rx from ..backend.table_state import Item, TableState from ..components.status_badge import status_badge def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=18), rx.text(text), align="center", spacing="2", ), ) def _show_item(item: Item, index: int) -> rx.Component:
hover_color = rx.cond( index % 2 == 0, rx.color("gray", 3), rx.color("accent", 3), ) return rx.table.row( rx.table.row_header_cell(item.name), rx.table.cell(f"${item.payment}"), rx.table.cell(item.date), rx.table.cell(status_badge(item.status)), style={"_hover": {"bg": hover_color}, "bg": bg_color}, align="center", ) def _pagination_view() -> rx.Component: return ( rx.hstack( rx.text( "Page ", rx.code(TableState.page_number), f" of {TableState.total_pages}", justify="end", ), rx.hstack( rx.icon_button( rx.icon("chevrons-left", size=18), on_click=TableState.first_page, opacity=rx.cond(TableState.page_number == 1, 0.6, 1), color_scheme=rx.cond(TableState.page_number == 1, "gray", "accent"),
bg_color = rx.cond( index % 2 == 0, rx.color("gray", 1), rx.color("accent", 2), )
import reflex as rx from ..backend.table_state import Item, TableState from ..components.status_badge import status_badge def _header_cell(text: str, icon: str) -> rx.Component: return rx.table.column_header_cell( rx.hstack( rx.icon(icon, size=18), rx.text(text), align="center", spacing="2", ), ) def _show_item(item: Item, index: int) -> rx.Component: bg_color = rx.cond( index % 2 == 0, rx.color("gray", 1), rx.color("accent", 2), )
return rx.table.row( rx.table.row_header_cell(item.name), rx.table.cell(f"${item.payment}"), rx.table.cell(item.date), rx.table.cell(status_badge(item.status)), style={"_hover": {"bg": hover_color}, "bg": bg_color}, align="center", ) def _pagination_view() -> rx.Component: return ( rx.hstack( rx.text( "Page ", rx.code(TableState.page_number), f" of {TableState.total_pages}", justify="end", ), rx.hstack( rx.icon_button( rx.icon("chevrons-left", size=18), on_click=TableState.first_page, opacity=rx.cond(TableState.page_number == 1, 0.6, 1), color_scheme=rx.cond(TableState.page_number == 1, "gray", "accent"), variant="soft", ), rx.icon_button( rx.icon("chev
hover_color = rx.cond( index % 2 == 0, rx.color("gray", 3), rx.color("accent", 3), )
from futuristic_dashboard.components.header import dashboard_header from futuristic_dashboard.components.main_content import main_content from futuristic_dashboard.components.right_sidebar import right_sidebar from futuristic_dashboard.components.sidebar import sidebar from futuristic_dashboard.states.dashboard_state import DashboardState def index() -> rx.Component: return rx.el.div( sidebar(), rx.el.div( dashboard_header(), rx.el.div( main_content(), right_sidebar(), class_name="flex flex-1 overflow-hidden", ), class_name="flex flex-col flex-1 overflow-hidden", ), rx.cond( DashboardState.mobile_sidebar_open, rx.el.div( on_click=DashboardState.toggle_mobile_sidebar, class_name="fixed inset-0 bg-black/50 z-30 md:hidden", ), None, ), class_name="flex h-screen
import reflex as rx
import reflex as rx
from futuristic_dashboard.components.main_content import main_content from futuristic_dashboard.components.right_sidebar import right_sidebar from futuristic_dashboard.components.sidebar import sidebar from futuristic_dashboard.states.dashboard_state import DashboardState def index() -> rx.Component: return rx.el.div( sidebar(), rx.el.div( dashboard_header(), rx.el.div( main_content(), right_sidebar(), class_name="flex flex-1 overflow-hidden", ), class_name="flex flex-col flex-1 overflow-hidden", ), rx.cond( DashboardState.mobile_sidebar_open, rx.el.div( on_click=DashboardState.toggle_mobile_sidebar, class_name="fixed inset-0 bg-black/50 z-30 md:hidden", ), None, ), class_name="flex h-screen bg-gray-950 text-gray-300 relative", on_mount=DashboardState
from futuristic_dashboard.components.header import dashboard_header
import reflex as rx from futuristic_dashboard.components.header import dashboard_header
from futuristic_dashboard.components.right_sidebar import right_sidebar from futuristic_dashboard.components.sidebar import sidebar from futuristic_dashboard.states.dashboard_state import DashboardState def index() -> rx.Component: return rx.el.div( sidebar(), rx.el.div( dashboard_header(), rx.el.div( main_content(), right_sidebar(), class_name="flex flex-1 overflow-hidden", ), class_name="flex flex-col flex-1 overflow-hidden", ), rx.cond( DashboardState.mobile_sidebar_open, rx.el.div( on_click=DashboardState.toggle_mobile_sidebar, class_name="fixed inset-0 bg-black/50 z-30 md:hidden", ), None, ), class_name="flex h-screen bg-gray-950 text-gray-300 relative", on_mount=DashboardState.update_time, ) app = rx.App( theme=rx.theme(appearance="lig
from futuristic_dashboard.components.main_content import main_content
import reflex as rx from futuristic_dashboard.components.header import dashboard_header from futuristic_dashboard.components.main_content import main_content
from futuristic_dashboard.components.sidebar import sidebar from futuristic_dashboard.states.dashboard_state import DashboardState def index() -> rx.Component: return rx.el.div( sidebar(), rx.el.div( dashboard_header(), rx.el.div( main_content(), right_sidebar(), class_name="flex flex-1 overflow-hidden", ), class_name="flex flex-col flex-1 overflow-hidden", ), rx.cond( DashboardState.mobile_sidebar_open, rx.el.div( on_click=DashboardState.toggle_mobile_sidebar, class_name="fixed inset-0 bg-black/50 z-30 md:hidden", ), None, ), class_name="flex h-screen bg-gray-950 text-gray-300 relative", on_mount=DashboardState.update_time, ) app = rx.App( theme=rx.theme(appearance="light"), stylesheets=[ "https://cdnjs.cloudflare.com/ajax/libs/
from futuristic_dashboard.components.right_sidebar import right_sidebar
import reflex as rx from futuristic_dashboard.components.header import dashboard_header from futuristic_dashboard.components.main_content import main_content from futuristic_dashboard.components.right_sidebar import right_sidebar
from futuristic_dashboard.states.dashboard_state import DashboardState def index() -> rx.Component: return rx.el.div( sidebar(), rx.el.div( dashboard_header(), rx.el.div( main_content(), right_sidebar(), class_name="flex flex-1 overflow-hidden", ), class_name="flex flex-col flex-1 overflow-hidden", ), rx.cond( DashboardState.mobile_sidebar_open, rx.el.div( on_click=DashboardState.toggle_mobile_sidebar, class_name="fixed inset-0 bg-black/50 z-30 md:hidden", ), None, ), class_name="flex h-screen bg-gray-950 text-gray-300 relative", on_mount=DashboardState.update_time, ) app = rx.App( theme=rx.theme(appearance="light"), stylesheets=[ "https://cdnjs.cloudflare.com/ajax/libs/feather-icons/4.29.0/feather.min.js" ], ) app.add_page(i
from futuristic_dashboard.components.sidebar import sidebar
import reflex as rx from futuristic_dashboard.components.header import dashboard_header from futuristic_dashboard.components.main_content import main_content from futuristic_dashboard.components.right_sidebar import right_sidebar from futuristic_dashboard.components.sidebar import sidebar
def index() -> rx.Component: return rx.el.div( sidebar(), rx.el.div( dashboard_header(), rx.el.div( main_content(), right_sidebar(), class_name="flex flex-1 overflow-hidden", ), class_name="flex flex-col flex-1 overflow-hidden", ), rx.cond( DashboardState.mobile_sidebar_open, rx.el.div( on_click=DashboardState.toggle_mobile_sidebar, class_name="fixed inset-0 bg-black/50 z-30 md:hidden", ), None, ), class_name="flex h-screen bg-gray-950 text-gray-300 relative", on_mount=DashboardState.update_time, ) app = rx.App( theme=rx.theme(appearance="light"), stylesheets=[ "https://cdnjs.cloudflare.com/ajax/libs/feather-icons/4.29.0/feather.min.js" ], ) app.add_page(index)
from futuristic_dashboard.states.dashboard_state import DashboardState
import reflex as rx from futuristic_dashboard.states.dashboard_state import ( PerformanceChartData, ) TOOLTIP_PROPS = { "cursor": {"fill": "rgba(200, 200, 200, 0.1)"}, "content_style": { "backgroundColor": "rgba(30, 41, 59, 0.9)", "borderColor": "rgba(51, 65, 85, 0.5)", "borderRadius": "8px", "boxShadow": "0 2px 10px rgba(0,0,0,0.2)", "padding": "8px 12px", }, "label_style": { "color": "#cbd5e1", "fontSize": "12px", "fontWeight": "bold", }, "item_style": {"color": "#94a3b8", "fontSize": "12px"}, } RECHART_WRAPPER_CLASS = "[&_.recharts-tooltip-cursor]:fill-zinc-500/10 [&_.recharts-tooltip-item]:!text-gray-300 [&_.recharts-tooltip-item-name]:!text-gray-400 [&_.recharts-tooltip-item-separator]:!text-gray-400 [&_.recharts-label]:!fill-gray-400 [&_.recharts-cartesian-axis-tick-value]:!fill-gray-400 [&_.recharts-legend-item-text]:!text-gray-300" def stat_card_chart( data: rx.Var[List[Dict[st
from typing import Dict, List
from typing import Dict, List
from futuristic_dashboard.states.dashboard_state import ( PerformanceChartData, ) TOOLTIP_PROPS = { "cursor": {"fill": "rgba(200, 200, 200, 0.1)"}, "content_style": { "backgroundColor": "rgba(30, 41, 59, 0.9)", "borderColor": "rgba(51, 65, 85, 0.5)", "borderRadius": "8px", "boxShadow": "0 2px 10px rgba(0,0,0,0.2)", "padding": "8px 12px", }, "label_style": { "color": "#cbd5e1", "fontSize": "12px", "fontWeight": "bold", }, "item_style": {"color": "#94a3b8", "fontSize": "12px"}, } RECHART_WRAPPER_CLASS = "[&_.recharts-tooltip-cursor]:fill-zinc-500/10 [&_.recharts-tooltip-item]:!text-gray-300 [&_.recharts-tooltip-item-name]:!text-gray-400 [&_.recharts-tooltip-item-separator]:!text-gray-400 [&_.recharts-label]:!fill-gray-400 [&_.recharts-cartesian-axis-tick-value]:!fill-gray-400 [&_.recharts-legend-item-text]:!text-gray-300" def stat_card_chart( data: rx.Var[List[Dict[str, int]]], color: rx.
import reflex as rx
from typing import Dict, List import reflex as rx
TOOLTIP_PROPS = { "cursor": {"fill": "rgba(200, 200, 200, 0.1)"}, "content_style": { "backgroundColor": "rgba(30, 41, 59, 0.9)", "borderColor": "rgba(51, 65, 85, 0.5)", "borderRadius": "8px", "boxShadow": "0 2px 10px rgba(0,0,0,0.2)", "padding": "8px 12px", }, "label_style": { "color": "#cbd5e1", "fontSize": "12px", "fontWeight": "bold", }, "item_style": {"color": "#94a3b8", "fontSize": "12px"}, } RECHART_WRAPPER_CLASS = "[&_.recharts-tooltip-cursor]:fill-zinc-500/10 [&_.recharts-tooltip-item]:!text-gray-300 [&_.recharts-tooltip-item-name]:!text-gray-400 [&_.recharts-tooltip-item-separator]:!text-gray-400 [&_.recharts-label]:!fill-gray-400 [&_.recharts-cartesian-axis-tick-value]:!fill-gray-400 [&_.recharts-legend-item-text]:!text-gray-300" def stat_card_chart( data: rx.Var[List[Dict[str, int]]], color: rx.Var[str] ) -> rx.Component: return rx.recharts.area_chart( rx.recharts.area
from futuristic_dashboard.states.dashboard_state import ( PerformanceChartData, )
from typing import Dict, List import reflex as rx from futuristic_dashboard.states.dashboard_state import ( PerformanceChartData, )
RECHART_WRAPPER_CLASS = "[&_.recharts-tooltip-cursor]:fill-zinc-500/10 [&_.recharts-tooltip-item]:!text-gray-300 [&_.recharts-tooltip-item-name]:!text-gray-400 [&_.recharts-tooltip-item-separator]:!text-gray-400 [&_.recharts-label]:!fill-gray-400 [&_.recharts-cartesian-axis-tick-value]:!fill-gray-400 [&_.recharts-legend-item-text]:!text-gray-300" def stat_card_chart( data: rx.Var[List[Dict[str, int]]], color: rx.Var[str] ) -> rx.Component: return rx.recharts.area_chart( rx.recharts.area( data_key="v", type_="natural", fill=rx.match( color, ("cyan", "url(#cyanGradient)"), ("purple", "url(#purpleGradient)"), ("teal", "url(#tealGradient)"), "url(#defaultGradient)", ), stroke=rx.match( color, ("cyan", "#22d3ee"), ("purple", "#a855f7"), ("teal", "#2dd4bf"),
TOOLTIP_PROPS = { "cursor": {"fill": "rgba(200, 200, 200, 0.1)"}, "content_style": { "backgroundColor": "rgba(30, 41, 59, 0.9)", "borderColor": "rgba(51, 65, 85, 0.5)", "borderRadius": "8px", "boxShadow": "0 2px 10px rgba(0,0,0,0.2)", "padding": "8px 12px", }, "label_style": { "color": "#cbd5e1", "fontSize": "12px", "fontWeight": "bold", }, "item_style": {"color": "#94a3b8", "fontSize": "12px"}, }
from typing import Dict, List import reflex as rx from futuristic_dashboard.states.dashboard_state import ( PerformanceChartData, ) TOOLTIP_PROPS = { "cursor": {"fill": "rgba(200, 200, 200, 0.1)"}, "content_style": { "backgroundColor": "rgba(30, 41, 59, 0.9)", "borderColor": "rgba(51, 65, 85, 0.5)", "borderRadius": "8px", "boxShadow": "0 2px 10px rgba(0,0,0,0.2)", "padding": "8px 12px", }, "label_style": { "color": "#cbd5e1", "fontSize": "12px", "fontWeight": "bold", }, "item_style": {"color": "#94a3b8", "fontSize": "12px"}, }
def stat_card_chart( data: rx.Var[List[Dict[str, int]]], color: rx.Var[str] ) -> rx.Component: return rx.recharts.area_chart( rx.recharts.area( data_key="v", type_="natural", fill=rx.match( color, ("cyan", "url(#cyanGradient)"), ("purple", "url(#purpleGradient)"), ("teal", "url(#tealGradient)"), "url(#defaultGradient)", ), stroke=rx.match( color, ("cyan", "#22d3ee"), ("purple", "#a855f7"), ("teal", "#2dd4bf"), "#8884d8", ), stroke_width=2, dot=False, fill_opacity=0.3, ), rx.el.defs( rx.el.linear_gradient( rx.el.stop( offset="5%", stop_color="#22d3ee", stop_opacity=0.8, ),
RECHART_WRAPPER_CLASS = "[&_.recharts-tooltip-cursor]:fill-zinc-500/10 [&_.recharts-tooltip-item]:!text-gray-300 [&_.recharts-tooltip-item-name]:!text-gray-400 [&_.recharts-tooltip-item-separator]:!text-gray-400 [&_.recharts-label]:!fill-gray-400 [&_.recharts-cartesian-axis-tick-value]:!fill-gray-400 [&_.recharts-legend-item-text]:!text-gray-300"
from futuristic_dashboard.states.dashboard_state import DashboardState def dashboard_header() -> rx.Component: return rx.el.header( rx.el.div( rx.el.button( rx.icon(tag="menu", class_name="size-6"), on_click=DashboardState.toggle_mobile_sidebar, class_name="p-2 text-gray-400 hover:text-gray-200 md:hidden mr-4", ), rx.el.div( rx.icon( tag="search", class_name="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 pointer-events-none", ), rx.el.input( placeholder="Search systems...", class_name="w-full pl-10 pr-4 py-2 bg-gray-800 border border-gray-700 rounded-lg text-gray-300 focus:outline-none focus:ring-1 focus:ring-cyan-500 focus:border-cyan-500 placeholder-gray-500", ), class_name="relative flex-grow max-w-xs hidden
import reflex as rx
import reflex as rx
def dashboard_header() -> rx.Component: return rx.el.header( rx.el.div( rx.el.button( rx.icon(tag="menu", class_name="size-6"), on_click=DashboardState.toggle_mobile_sidebar, class_name="p-2 text-gray-400 hover:text-gray-200 md:hidden mr-4", ), rx.el.div( rx.icon( tag="search", class_name="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 pointer-events-none", ), rx.el.input( placeholder="Search systems...", class_name="w-full pl-10 pr-4 py-2 bg-gray-800 border border-gray-700 rounded-lg text-gray-300 focus:outline-none focus:ring-1 focus:ring-cyan-500 focus:border-cyan-500 placeholder-gray-500", ), class_name="relative flex-grow max-w-xs hidden sm:block", ), class_name="flex items-center",
from futuristic_dashboard.states.dashboard_state import DashboardState
from futuristic_dashboard.components.charts import ( performance_line_chart, stat_card_chart, ) from futuristic_dashboard.states.dashboard_state import ( DashboardState, StatCardData, ) def stat_card(card_data: StatCardData) -> rx.Component: color = card_data["color"] return rx.el.div( rx.el.div( rx.el.div( rx.el.h3( card_data["title"], class_name="text-sm font-medium text-gray-400", ), rx.el.p( card_data["value"], class_name="text-2xl font-bold text-gray-100 mt-1", ), rx.el.p( card_data["sub_detail"], class_name="text-xs text-gray-500 mt-1", ), ), rx.el.div( rx.icon( tag=card_data["icon"], class_name="size-6", ), cl
import reflex as rx
import reflex as rx
from futuristic_dashboard.states.dashboard_state import ( DashboardState, StatCardData, ) def stat_card(card_data: StatCardData) -> rx.Component: color = card_data["color"] return rx.el.div( rx.el.div( rx.el.div( rx.el.h3( card_data["title"], class_name="text-sm font-medium text-gray-400", ), rx.el.p( card_data["value"], class_name="text-2xl font-bold text-gray-100 mt-1", ), rx.el.p( card_data["sub_detail"], class_name="text-xs text-gray-500 mt-1", ), ), rx.el.div( rx.icon( tag=card_data["icon"], class_name="size-6", ), class_name=f"p-3 rounded-lg bg-gradient-to-br from-{color}-500 to-{color}-600 text-white shadow-lg",
from futuristic_dashboard.components.charts import ( performance_line_chart, stat_card_chart, )
import reflex as rx from futuristic_dashboard.components.charts import ( performance_line_chart, stat_card_chart, )
def stat_card(card_data: StatCardData) -> rx.Component: color = card_data["color"] return rx.el.div( rx.el.div( rx.el.div( rx.el.h3( card_data["title"], class_name="text-sm font-medium text-gray-400", ), rx.el.p( card_data["value"], class_name="text-2xl font-bold text-gray-100 mt-1", ), rx.el.p( card_data["sub_detail"], class_name="text-xs text-gray-500 mt-1", ), ), rx.el.div( rx.icon( tag=card_data["icon"], class_name="size-6", ), class_name=f"p-3 rounded-lg bg-gradient-to-br from-{color}-500 to-{color}-600 text-white shadow-lg", ), class_name="flex justify-between items-start mb-3", ), stat_c
from futuristic_dashboard.states.dashboard_state import ( DashboardState, StatCardData, )
import reflex as rx from futuristic_dashboard.components.charts import ( performance_line_chart, stat_card_chart, ) from futuristic_dashboard.states.dashboard_state import ( DashboardState, StatCardData, ) def stat_card(card_data: StatCardData) -> rx.Component:
return rx.el.div( rx.el.div( rx.el.div( rx.el.h3( card_data["title"], class_name="text-sm font-medium text-gray-400", ), rx.el.p( card_data["value"], class_name="text-2xl font-bold text-gray-100 mt-1", ), rx.el.p( card_data["sub_detail"], class_name="text-xs text-gray-500 mt-1", ), ), rx.el.div( rx.icon( tag=card_data["icon"], class_name="size-6", ), class_name=f"p-3 rounded-lg bg-gradient-to-br from-{color}-500 to-{color}-600 text-white shadow-lg", ), class_name="flex justify-between items-start mb-3", ), stat_card_chart(card_data["chart_data"], card_data["color"]), class_name="bg-gray-800/5
color = card_data["color"]
from futuristic_dashboard.states.dashboard_state import ( DashboardState, QuickActionData, ResourceAllocationData, ) def system_time_section() -> rx.Component: return rx.el.div( rx.el.h3( "SYSTEM TIME", class_name="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-3", ), rx.el.p( DashboardState.current_time, class_name="text-3xl sm:text-4xl font-light text-cyan-300 tracking-widest mb-1", ), rx.el.p( DashboardState.current_date, class_name="text-sm text-gray-400 mb-4", ), rx.el.div( rx.el.div( rx.el.p( "Uptime", class_name="text-xs text-gray-500 mb-1", ), rx.el.p( DashboardState.uptime, class_name="text-xs sm:text-sm font-medium text-gray-200", ), class_name=
import reflex as rx
import reflex as rx
def system_time_section() -> rx.Component: return rx.el.div( rx.el.h3( "SYSTEM TIME", class_name="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-3", ), rx.el.p( DashboardState.current_time, class_name="text-3xl sm:text-4xl font-light text-cyan-300 tracking-widest mb-1", ), rx.el.p( DashboardState.current_date, class_name="text-sm text-gray-400 mb-4", ), rx.el.div( rx.el.div( rx.el.p( "Uptime", class_name="text-xs text-gray-500 mb-1", ), rx.el.p( DashboardState.uptime, class_name="text-xs sm:text-sm font-medium text-gray-200", ), class_name="bg-gray-700/50 p-2 sm:p-3 rounded-lg text-center", ), rx.el.div( rx.el.p(
from futuristic_dashboard.states.dashboard_state import ( DashboardState, QuickActionData, ResourceAllocationData, )
rx.el.p( "Uptime", class_name="text-xs text-gray-500 mb-1", ), rx.el.p( DashboardState.uptime, class_name="text-xs sm:text-sm font-medium text-gray-200", ), class_name="bg-gray-700/50 p-2 sm:p-3 rounded-lg text-center", ), rx.el.div( rx.el.p( "Time Zone", class_name="text-xs text-gray-500 mb-1", ), rx.el.p( DashboardState.time_zone, class_name="text-xs sm:text-sm font-medium text-gray-200", ), class_name="bg-gray-700/50 p-2 sm:p-3 rounded-lg text-center", ), class_name="grid grid-cols-2 gap-2 sm:gap-3", ), class_name="bg-gray-800/50 border border-gray-700/50 rounded-xl p-4 shadow-md backdrop-blur-sm mb-6", )
def quick_actions_section() -> rx.Component: return rx.el.div( rx.el.h3( "Quick Actions", class_name="text-sm sm:text-base font-semibold text-gray-300 mb-3", ), rx.el.div( rx.foreach( DashboardState.quick_actions, quick_action_button, ), class_name="grid grid-cols-2 gap-2 sm:gap-3", ), class_name="bg-gray-800/50 border border-gray-700/50 rounded-xl p-4 shadow-md backdrop-blur-sm mb-6", ) def resource_allocation_item( resource: ResourceAllocationData, ) -> rx.Component: value_str = resource["value"].to_string() color = resource["color"] return rx.el.div( rx.el.div( rx.el.span( resource["name"], class_name="text-xs sm:text-sm font-medium text-gray-300", ), rx.el.span( value_str + "% allocated", class_name=rx.cond(
def quick_action_button( action: QuickActionData, ) -> rx.Component: return rx.el.button( rx.icon( tag=action["icon"], class_name="size-5 mb-1 sm:mb-2", ), rx.el.span(action["name"], class_name="text-xs"), class_name="flex flex-col items-center justify-center bg-gray-700/50 p-3 sm:p-4 rounded-lg text-gray-300 hover:bg-gray-700 hover:text-cyan-300 transition-colors duration-150 focus:outline-none focus:ring-1 focus:ring-cyan-500 aspect-square", )
], class_name="size-5 mb-1 sm:mb-2", ), rx.el.span(action["name"], class_name="text-xs"), class_name="flex flex-col items-center justify-center bg-gray-700/50 p-3 sm:p-4 rounded-lg text-gray-300 hover:bg-gray-700 hover:text-cyan-300 transition-colors duration-150 focus:outline-none focus:ring-1 focus:ring-cyan-500 aspect-square", ) def quick_actions_section() -> rx.Component: return rx.el.div( rx.el.h3( "Quick Actions", class_name="text-sm sm:text-base font-semibold text-gray-300 mb-3", ), rx.el.div( rx.foreach( DashboardState.quick_actions, quick_action_button, ), class_name="grid grid-cols-2 gap-2 sm:gap-3", ), class_name="bg-gray-800/50 border border-gray-700/50 rounded-xl p-4 shadow-md backdrop-blur-sm mb-6", ) def resource_allocation_item( resource: ResourceAllocationData, ) -> rx.Component:
color = resource["color"] return rx.el.div( rx.el.div( rx.el.span( resource["name"], class_name="text-xs sm:text-sm font-medium text-gray-300", ), rx.el.span( value_str + "% allocated", class_name=rx.cond( color == "cyan", "text-xs sm:text-sm font-medium text-cyan-400", rx.cond( color == "pink", "text-xs sm:text-sm font-medium text-pink-400", rx.cond( color == "blue", "text-xs sm:text-sm font-medium text-blue-400", "text-xs sm:text-sm font-medium text-gray-400", ), ), ), ), class_name="flex justify-between mb-1", ), rx.el.div( rx.el.div(
value_str = resource["value"].to_string()
", ), rx.el.span(action["name"], class_name="text-xs"), class_name="flex flex-col items-center justify-center bg-gray-700/50 p-3 sm:p-4 rounded-lg text-gray-300 hover:bg-gray-700 hover:text-cyan-300 transition-colors duration-150 focus:outline-none focus:ring-1 focus:ring-cyan-500 aspect-square", ) def quick_actions_section() -> rx.Component: return rx.el.div( rx.el.h3( "Quick Actions", class_name="text-sm sm:text-base font-semibold text-gray-300 mb-3", ), rx.el.div( rx.foreach( DashboardState.quick_actions, quick_action_button, ), class_name="grid grid-cols-2 gap-2 sm:gap-3", ), class_name="bg-gray-800/50 border border-gray-700/50 rounded-xl p-4 shadow-md backdrop-blur-sm mb-6", ) def resource_allocation_item( resource: ResourceAllocationData, ) -> rx.Component: value_str = resource["value"].to_string()
return rx.el.div( rx.el.div( rx.el.span( resource["name"], class_name="text-xs sm:text-sm font-medium text-gray-300", ), rx.el.span( value_str + "% allocated", class_name=rx.cond( color == "cyan", "text-xs sm:text-sm font-medium text-cyan-400", rx.cond( color == "pink", "text-xs sm:text-sm font-medium text-pink-400", rx.cond( color == "blue", "text-xs sm:text-sm font-medium text-blue-400", "text-xs sm:text-sm font-medium text-gray-400", ), ), ), ), class_name="flex justify-between mb-1", ), rx.el.div( rx.el.div( style={"width": value_str
color = resource["color"]
nt-medium text-blue-400", "text-xs sm:text-sm font-medium text-gray-400", ), ), ), ), class_name="flex justify-between mb-1", ), rx.el.div( rx.el.div( style={"width": value_str + "%"}, class_name=rx.cond( color == "cyan", "h-1.5 rounded-full bg-cyan-500", rx.cond( color == "pink", "h-1.5 rounded-full bg-pink-500", rx.cond( color == "blue", "h-1.5 rounded-full bg-blue-500", "h-1.5 rounded-full bg-gray-500", ), ), ), ), class_name="w-full bg-gray-700 rounded-full h-1.5", ), class_name="mb-3 sm:mb-4", )
def right_sidebar() -> rx.Component: return rx.el.aside( system_time_section(), resource_allocation_section(), class_name="w-72 px-4 pt-4 pb-10 sm:p-6 flex-shrink-0 overflow-y-auto hidden lg:block h-screen sticky top-0 right-0", )
def resource_allocation_section() -> rx.Component: return rx.el.div( rx.el.h3( "Resource Allocation", class_name="text-sm sm:text-base font-semibold text-gray-300 mb-3", ), rx.foreach( DashboardState.resource_allocation, resource_allocation_item, ), class_name="bg-gray-800/50 border border-gray-700/50 rounded-xl p-4 shadow-md backdrop-blur-sm", )
d-full bg-cyan-500", rx.cond( color == "pink", "h-1.5 rounded-full bg-pink-500", rx.cond( color == "blue", "h-1.5 rounded-full bg-blue-500", "h-1.5 rounded-full bg-gray-500", ), ), ), ), class_name="w-full bg-gray-700 rounded-full h-1.5", ), class_name="mb-3 sm:mb-4", ) def resource_allocation_section() -> rx.Component: return rx.el.div( rx.el.h3( "Resource Allocation", class_name="text-sm sm:text-base font-semibold text-gray-300 mb-3", ), rx.foreach( DashboardState.resource_allocation, resource_allocation_item, ), class_name="bg-gray-800/50 border border-gray-700/50 rounded-xl p-4 shadow-md backdrop-blur-sm", )
def right_sidebar() -> rx.Component: return rx.el.aside( system_time_section(), resource_allocation_section(), class_name="w-72 px-4 pt-4 pb-10 sm:p-6 flex-shrink-0 overflow-y-auto hidden lg:block h-screen sticky top-0 right-0", )
import reflex as rx from futuristic_dashboard.states.dashboard_state import ( DashboardState, SystemStatusData, ) def navigation_item(item: Dict[str, str]) -> rx.Component: return rx.el.button( rx.icon(tag=item["icon"], class_name="mr-3 size-5"), rx.el.span(item["name"]), on_click=lambda: DashboardState.set_active_nav(item["name"]), class_name=rx.cond( DashboardState.active_nav == item["name"], "w-full flex items-center px-4 py-3 text-sm font-medium rounded-lg bg-cyan-600/20 text-cyan-300 border border-cyan-600/30", "w-full flex items-center px-4 py-3 text-sm font-medium rounded-lg text-gray-400 hover:bg-gray-800 hover:text-gray-200 transition-colors duration-150", ), ) def system_status_item( status: SystemStatusData, ) -> rx.Component: return rx.el.div( rx.el.div( rx.el.span( status["name"], class_name="text-xs font-medium text
from typing import Dict
from typing import Dict
from futuristic_dashboard.states.dashboard_state import ( DashboardState, SystemStatusData, ) def navigation_item(item: Dict[str, str]) -> rx.Component: return rx.el.button( rx.icon(tag=item["icon"], class_name="mr-3 size-5"), rx.el.span(item["name"]), on_click=lambda: DashboardState.set_active_nav(item["name"]), class_name=rx.cond( DashboardState.active_nav == item["name"], "w-full flex items-center px-4 py-3 text-sm font-medium rounded-lg bg-cyan-600/20 text-cyan-300 border border-cyan-600/30", "w-full flex items-center px-4 py-3 text-sm font-medium rounded-lg text-gray-400 hover:bg-gray-800 hover:text-gray-200 transition-colors duration-150", ), ) def system_status_item( status: SystemStatusData, ) -> rx.Component: return rx.el.div( rx.el.div( rx.el.span( status["name"], class_name="text-xs font-medium text-gray-400",
import reflex as rx
from typing import Dict import reflex as rx
def navigation_item(item: Dict[str, str]) -> rx.Component: return rx.el.button( rx.icon(tag=item["icon"], class_name="mr-3 size-5"), rx.el.span(item["name"]), on_click=lambda: DashboardState.set_active_nav(item["name"]), class_name=rx.cond( DashboardState.active_nav == item["name"], "w-full flex items-center px-4 py-3 text-sm font-medium rounded-lg bg-cyan-600/20 text-cyan-300 border border-cyan-600/30", "w-full flex items-center px-4 py-3 text-sm font-medium rounded-lg text-gray-400 hover:bg-gray-800 hover:text-gray-200 transition-colors duration-150", ), ) def system_status_item( status: SystemStatusData, ) -> rx.Component: return rx.el.div( rx.el.div( rx.el.span( status["name"], class_name="text-xs font-medium text-gray-400", ), rx.el.span( f"{status['value']}%", class_name="text-x
from futuristic_dashboard.states.dashboard_state import ( DashboardState, SystemStatusData, )
import datetime from typing import Dict, List, TypedDict import reflex as rx from futuristic_dashboard.states.data import ( performance_chart_data, quick_actions_data, resource_allocation_data, stat_card_data, system_status_data, ) class StatCardData(TypedDict): title: str value: str sub_detail: str icon: str color: str chart_data: List[Dict[str, int]] class SystemStatusData(TypedDict): name: str value: int color: str class ResourceAllocationData(TypedDict): name: str value: int color: str class QuickActionData(TypedDict): name: str icon: str class PerformanceChartData(TypedDict): time: str CPU: int Memory: int Network: int class DashboardState(rx.State): """Holds the state for the dashboard.""" current_time: str = datetime.datetime.now().strftime("%H:%M:%S") current_date: str = datetime.datetime.now().strftime("%b %d, %Y") uptime: str = "14d 06:42:18" time_zo
import asyncio
import asyncio
from typing import Dict, List, TypedDict import reflex as rx from futuristic_dashboard.states.data import ( performance_chart_data, quick_actions_data, resource_allocation_data, stat_card_data, system_status_data, ) class StatCardData(TypedDict): title: str value: str sub_detail: str icon: str color: str chart_data: List[Dict[str, int]] class SystemStatusData(TypedDict): name: str value: int color: str class ResourceAllocationData(TypedDict): name: str value: int color: str class QuickActionData(TypedDict): name: str icon: str class PerformanceChartData(TypedDict): time: str CPU: int Memory: int Network: int class DashboardState(rx.State): """Holds the state for the dashboard.""" current_time: str = datetime.datetime.now().strftime("%H:%M:%S") current_date: str = datetime.datetime.now().strftime("%b %d, %Y") uptime: str = "14d 06:42:18" time_zone: str = "UTC-0
import datetime
import asyncio import datetime
import reflex as rx from futuristic_dashboard.states.data import ( performance_chart_data, quick_actions_data, resource_allocation_data, stat_card_data, system_status_data, ) class StatCardData(TypedDict): title: str value: str sub_detail: str icon: str color: str chart_data: List[Dict[str, int]] class SystemStatusData(TypedDict): name: str value: int color: str class ResourceAllocationData(TypedDict): name: str value: int color: str class QuickActionData(TypedDict): name: str icon: str class PerformanceChartData(TypedDict): time: str CPU: int Memory: int Network: int class DashboardState(rx.State): """Holds the state for the dashboard.""" current_time: str = datetime.datetime.now().strftime("%H:%M:%S") current_date: str = datetime.datetime.now().strftime("%b %d, %Y") uptime: str = "14d 06:42:18" time_zone: str = "UTC-08:00" active_nav: str = "Dashboard"
from typing import Dict, List, TypedDict
import asyncio import datetime from typing import Dict, List, TypedDict
from futuristic_dashboard.states.data import ( performance_chart_data, quick_actions_data, resource_allocation_data, stat_card_data, system_status_data, ) class StatCardData(TypedDict): title: str value: str sub_detail: str icon: str color: str chart_data: List[Dict[str, int]] class SystemStatusData(TypedDict): name: str value: int color: str class ResourceAllocationData(TypedDict): name: str value: int color: str class QuickActionData(TypedDict): name: str icon: str class PerformanceChartData(TypedDict): time: str CPU: int Memory: int Network: int class DashboardState(rx.State): """Holds the state for the dashboard.""" current_time: str = datetime.datetime.now().strftime("%H:%M:%S") current_date: str = datetime.datetime.now().strftime("%b %d, %Y") uptime: str = "14d 06:42:18" time_zone: str = "UTC-08:00" active_nav: str = "Dashboard" active_performance
import reflex as rx
import asyncio import datetime from typing import Dict, List, TypedDict import reflex as rx
class StatCardData(TypedDict): title: str value: str sub_detail: str icon: str color: str chart_data: List[Dict[str, int]] class SystemStatusData(TypedDict): name: str value: int color: str class ResourceAllocationData(TypedDict): name: str value: int color: str class QuickActionData(TypedDict): name: str icon: str class PerformanceChartData(TypedDict): time: str CPU: int Memory: int Network: int class DashboardState(rx.State): """Holds the state for the dashboard.""" current_time: str = datetime.datetime.now().strftime("%H:%M:%S") current_date: str = datetime.datetime.now().strftime("%b %d, %Y") uptime: str = "14d 06:42:18" time_zone: str = "UTC-08:00" active_nav: str = "Dashboard" active_performance_tab: str = "Performance" mobile_sidebar_open: bool = False stat_cards: List[StatCardData] = stat_card_data system_status: List[SystemStatusData] = system_status_da
from futuristic_dashboard.states.data import ( performance_chart_data, quick_actions_data, resource_allocation_data, stat_card_data, system_status_data, )
import asyncio import datetime from typing import Dict, List, TypedDict import reflex as rx from futuristic_dashboard.states.data import ( performance_chart_data, quick_actions_data, resource_allocation_data, stat_card_data, system_status_data, )
class SystemStatusData(TypedDict): name: str value: int color: str class ResourceAllocationData(TypedDict): name: str value: int color: str class QuickActionData(TypedDict): name: str icon: str class PerformanceChartData(TypedDict): time: str CPU: int Memory: int Network: int class DashboardState(rx.State): """Holds the state for the dashboard.""" current_time: str = datetime.datetime.now().strftime("%H:%M:%S") current_date: str = datetime.datetime.now().strftime("%b %d, %Y") uptime: str = "14d 06:42:18" time_zone: str = "UTC-08:00" active_nav: str = "Dashboard" active_performance_tab: str = "Performance" mobile_sidebar_open: bool = False stat_cards: List[StatCardData] = stat_card_data system_status: List[SystemStatusData] = system_status_data resource_allocation: List[ResourceAllocationData] = resource_allocation_data quick_actions: List[QuickActionData] = quick_actions_data
class StatCardData(TypedDict): title: str value: str sub_detail: str icon: str color: str chart_data: List[Dict[str, int]]
import asyncio import datetime from typing import Dict, List, TypedDict import reflex as rx from futuristic_dashboard.states.data import ( performance_chart_data, quick_actions_data, resource_allocation_data, stat_card_data, system_status_data, ) class StatCardData(TypedDict): title: str value: str sub_detail: str icon: str color: str chart_data: List[Dict[str, int]]
class ResourceAllocationData(TypedDict): name: str value: int color: str class QuickActionData(TypedDict): name: str icon: str class PerformanceChartData(TypedDict): time: str CPU: int Memory: int Network: int class DashboardState(rx.State): """Holds the state for the dashboard.""" current_time: str = datetime.datetime.now().strftime("%H:%M:%S") current_date: str = datetime.datetime.now().strftime("%b %d, %Y") uptime: str = "14d 06:42:18" time_zone: str = "UTC-08:00" active_nav: str = "Dashboard" active_performance_tab: str = "Performance" mobile_sidebar_open: bool = False stat_cards: List[StatCardData] = stat_card_data system_status: List[SystemStatusData] = system_status_data resource_allocation: List[ResourceAllocationData] = resource_allocation_data quick_actions: List[QuickActionData] = quick_actions_data performance_chart_data: List[PerformanceChartData] = performance_chart_data
class SystemStatusData(TypedDict): name: str value: int color: str
import asyncio import datetime from typing import Dict, List, TypedDict import reflex as rx from futuristic_dashboard.states.data import ( performance_chart_data, quick_actions_data, resource_allocation_data, stat_card_data, system_status_data, ) class StatCardData(TypedDict): title: str value: str sub_detail: str icon: str color: str chart_data: List[Dict[str, int]] class SystemStatusData(TypedDict): name: str value: int color: str
class QuickActionData(TypedDict): name: str icon: str class PerformanceChartData(TypedDict): time: str CPU: int Memory: int Network: int class DashboardState(rx.State): """Holds the state for the dashboard.""" current_time: str = datetime.datetime.now().strftime("%H:%M:%S") current_date: str = datetime.datetime.now().strftime("%b %d, %Y") uptime: str = "14d 06:42:18" time_zone: str = "UTC-08:00" active_nav: str = "Dashboard" active_performance_tab: str = "Performance" mobile_sidebar_open: bool = False stat_cards: List[StatCardData] = stat_card_data system_status: List[SystemStatusData] = system_status_data resource_allocation: List[ResourceAllocationData] = resource_allocation_data quick_actions: List[QuickActionData] = quick_actions_data performance_chart_data: List[PerformanceChartData] = performance_chart_data system_load: int = 35 @rx.event(background=True) async def update_time(self):
class ResourceAllocationData(TypedDict): name: str value: int color: str
import asyncio import datetime from typing import Dict, List, TypedDict import reflex as rx from futuristic_dashboard.states.data import ( performance_chart_data, quick_actions_data, resource_allocation_data, stat_card_data, system_status_data, ) class StatCardData(TypedDict): title: str value: str sub_detail: str icon: str color: str chart_data: List[Dict[str, int]] class SystemStatusData(TypedDict): name: str value: int color: str class ResourceAllocationData(TypedDict): name: str value: int color: str
class PerformanceChartData(TypedDict): time: str CPU: int Memory: int Network: int class DashboardState(rx.State): """Holds the state for the dashboard.""" current_time: str = datetime.datetime.now().strftime("%H:%M:%S") current_date: str = datetime.datetime.now().strftime("%b %d, %Y") uptime: str = "14d 06:42:18" time_zone: str = "UTC-08:00" active_nav: str = "Dashboard" active_performance_tab: str = "Performance" mobile_sidebar_open: bool = False stat_cards: List[StatCardData] = stat_card_data system_status: List[SystemStatusData] = system_status_data resource_allocation: List[ResourceAllocationData] = resource_allocation_data quick_actions: List[QuickActionData] = quick_actions_data performance_chart_data: List[PerformanceChartData] = performance_chart_data system_load: int = 35 @rx.event(background=True) async def update_time(self): while True: async with self:
class QuickActionData(TypedDict): name: str icon: str