instruction
stringlengths
0
1k
input
stringlengths
1
1k
output
stringlengths
10
6.51k
"""The about page of the app."""
import reflex as rx from .. import styles from ..templates import template @template(route="/about", title="About") def about() -> rx.Component: """The about page. Returns: The UI for the about page. """ with Path("README.md").open(encoding="utf-8") as readme: content = readme.read() return rx.markdown(content, component_map=styles.markdown_style)
from pathlib import Path
"""The about page of the app.""" from pathlib import Path
from .. import styles from ..templates import template @template(route="/about", title="About") def about() -> rx.Component: """The about page. Returns: The UI for the about page. """ with Path("README.md").open(encoding="utf-8") as readme: content = readme.read() return rx.markdown(content, component_map=styles.markdown_style)
import reflex as rx
"""The about page of the app.""" from pathlib import Path import reflex as rx from .. import styles
@template(route="/about", title="About") def about() -> rx.Component: """The about page. Returns: The UI for the about page. """ with Path("README.md").open(encoding="utf-8") as readme: content = readme.read() return rx.markdown(content, component_map=styles.markdown_style)
from ..templates import template
"""The about page of the app.""" from pathlib import Path import reflex as rx from .. import styles from ..templates import template @template(route="/about", title="About") def about() -> rx.Component: """The about page. Returns: The UI for the about page. """ with Path("README.md").open(encoding="utf-8") as readme:
return rx.markdown(content, component_map=styles.markdown_style)
content = readme.read()
"""The dashboard page."""
from ..backend.table_state import TableState from ..templates import template from ..views.table import main_table @template(route="/", title="Dashboard", on_load=TableState.load_entries) def dashboard() -> rx.Component: """The dashboard page. Returns: The UI for the dashboard page. """ return rx.vstack( rx.heading("CI Job Dashboard", size="5"), main_table(), spacing="8", width="100%", )
import reflex as rx
"""The dashboard page.""" import reflex as rx
from ..templates import template from ..views.table import main_table @template(route="/", title="Dashboard", on_load=TableState.load_entries) def dashboard() -> rx.Component: """The dashboard page. Returns: The UI for the dashboard page. """ return rx.vstack( rx.heading("CI Job Dashboard", size="5"), main_table(), spacing="8", width="100%", )
from ..backend.table_state import TableState
"""The dashboard page.""" import reflex as rx from ..backend.table_state import TableState
from ..views.table import main_table @template(route="/", title="Dashboard", on_load=TableState.load_entries) def dashboard() -> rx.Component: """The dashboard page. Returns: The UI for the dashboard page. """ return rx.vstack( rx.heading("CI Job Dashboard", size="5"), main_table(), spacing="8", width="100%", )
from ..templates import template
"""The dashboard page.""" import reflex as rx from ..backend.table_state import TableState from ..templates import template
@template(route="/", title="Dashboard", on_load=TableState.load_entries) def dashboard() -> rx.Component: """The dashboard page. Returns: The UI for the dashboard page. """ return rx.vstack( rx.heading("CI Job Dashboard", size="5"), main_table(), spacing="8", width="100%", )
from ..views.table import main_table
"""The settings page."""
from ..templates import template from ..views.color_picker import primary_color_picker, secondary_color_picker from ..views.radius_picker import radius_picker from ..views.scaling_picker import scaling_picker @template(route="/settings", title="Settings") def settings() -> rx.Component: """The settings page. Returns: The UI for the settings page. """ return rx.vstack( rx.heading("Settings", size="5"), # Primary color picker rx.vstack( rx.hstack( rx.icon("palette", color=rx.color("accent", 10)), rx.heading("Primary color", size="6"), align="center", ), primary_color_picker(), spacing="4", width="100%", ), # Secondary color picker rx.vstack( rx.hstack( rx.icon("blend", color=rx.color("gray", 11)), rx.heading("Secondary color", size="6"), align="c
import reflex as rx
"""The settings page.""" import reflex as rx
from ..views.color_picker import primary_color_picker, secondary_color_picker from ..views.radius_picker import radius_picker from ..views.scaling_picker import scaling_picker @template(route="/settings", title="Settings") def settings() -> rx.Component: """The settings page. Returns: The UI for the settings page. """ return rx.vstack( rx.heading("Settings", size="5"), # Primary color picker rx.vstack( rx.hstack( rx.icon("palette", color=rx.color("accent", 10)), rx.heading("Primary color", size="6"), align="center", ), primary_color_picker(), spacing="4", width="100%", ), # Secondary color picker rx.vstack( rx.hstack( rx.icon("blend", color=rx.color("gray", 11)), rx.heading("Secondary color", size="6"), align="center", ),
from ..templates import template
"""The settings page.""" import reflex as rx from ..templates import template
from ..views.radius_picker import radius_picker from ..views.scaling_picker import scaling_picker @template(route="/settings", title="Settings") def settings() -> rx.Component: """The settings page. Returns: The UI for the settings page. """ return rx.vstack( rx.heading("Settings", size="5"), # Primary color picker rx.vstack( rx.hstack( rx.icon("palette", color=rx.color("accent", 10)), rx.heading("Primary color", size="6"), align="center", ), primary_color_picker(), spacing="4", width="100%", ), # Secondary color picker rx.vstack( rx.hstack( rx.icon("blend", color=rx.color("gray", 11)), rx.heading("Secondary color", size="6"), align="center", ), secondary_color_picker(), spacing="4", width="100%",
from ..views.color_picker import primary_color_picker, secondary_color_picker
"""The settings page.""" import reflex as rx from ..templates import template from ..views.color_picker import primary_color_picker, secondary_color_picker
from ..views.scaling_picker import scaling_picker @template(route="/settings", title="Settings") def settings() -> rx.Component: """The settings page. Returns: The UI for the settings page. """ return rx.vstack( rx.heading("Settings", size="5"), # Primary color picker rx.vstack( rx.hstack( rx.icon("palette", color=rx.color("accent", 10)), rx.heading("Primary color", size="6"), align="center", ), primary_color_picker(), spacing="4", width="100%", ), # Secondary color picker rx.vstack( rx.hstack( rx.icon("blend", color=rx.color("gray", 11)), rx.heading("Secondary color", size="6"), align="center", ), secondary_color_picker(), spacing="4", width="100%", ), # Radius picker radiu
from ..views.radius_picker import radius_picker
"""The settings page.""" import reflex as rx from ..templates import template from ..views.color_picker import primary_color_picker, secondary_color_picker from ..views.radius_picker import radius_picker
@template(route="/settings", title="Settings") def settings() -> rx.Component: """The settings page. Returns: The UI for the settings page. """ return rx.vstack( rx.heading("Settings", size="5"), # Primary color picker rx.vstack( rx.hstack( rx.icon("palette", color=rx.color("accent", 10)), rx.heading("Primary color", size="6"), align="center", ), primary_color_picker(), spacing="4", width="100%", ), # Secondary color picker rx.vstack( rx.hstack( rx.icon("blend", color=rx.color("gray", 11)), rx.heading("Secondary color", size="6"), align="center", ), secondary_color_picker(), spacing="4", width="100%", ), # Radius picker radius_picker(), # Scaling picker scali
from ..views.scaling_picker import scaling_picker
"""Common templates used between pages in the app."""
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 = "blue" 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.ev
from __future__ import annotations
"""Common templates used between pages in the app.""" from __future__ import annotations
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 = "blue" 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(
from typing import Callable
"""Common templates used between pages in the app.""" from __future__ import annotations from typing import Callable
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 = "blue" 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):
import reflex as rx
"""Common templates used between pages in the app.""" from __future__ import annotations from typing import Callable import reflex as rx
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 = "blue" 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
from .. import styles
"""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.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 = "blue" 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_gra
from ..components.navbar import navbar
"""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 = "blue" 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.g
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 = "blue" 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: str |
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", }, ]
class ThemeState(rx.State): """The state for the theme of the app.""" accent_color: str = "blue" 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: 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.
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, }, )
"""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 = "blue" 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 = "blue" 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
tes 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 = "blue" 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
m __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 = "blue" 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
yping 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 = "blue" 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 = "blue" 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
port 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 = "blue" 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
idebar # 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 = "blue" 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
e 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 = "blue" 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, )
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"], )
from ..templates.template import ThemeState 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%", ), )
import reflex as rx
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 ..backend.table_state import Item, TableState from ..components.status_badge import status_badge def _create_dialog( item: Item, icon_name: str, color_scheme: str, dialog_title: str ) -> rx.Component: return rx.dialog.root( rx.dialog.trigger( rx.icon_button( rx.icon(icon_name), color_scheme=color_scheme, size="2", variant="solid" ) ), rx.dialog.content( rx.vstack( rx.dialog.title(dialog_title), rx.dialog.description( rx.vstack( rx.text(item.pipeline), rx.text(item.workflow), status_badge(item.status), rx.text(item.timestamp), rx.text(item.duration), ) ), rx.dialog.close( rx.button("Close Dialog", size="2", color_scheme=color_scheme), ),
import reflex as rx
import reflex as rx
from ..components.status_badge import status_badge def _create_dialog( item: Item, icon_name: str, color_scheme: str, dialog_title: str ) -> rx.Component: return rx.dialog.root( rx.dialog.trigger( rx.icon_button( rx.icon(icon_name), color_scheme=color_scheme, size="2", variant="solid" ) ), rx.dialog.content( rx.vstack( rx.dialog.title(dialog_title), rx.dialog.description( rx.vstack( rx.text(item.pipeline), rx.text(item.workflow), status_badge(item.status), rx.text(item.timestamp), rx.text(item.duration), ) ), rx.dialog.close( rx.button("Close Dialog", size="2", color_scheme=color_scheme), ), ), ), ) def _delete_dialog(i
from ..backend.table_state import Item, TableState
import reflex as rx from ..backend.table_state import Item, TableState
def _create_dialog( item: Item, icon_name: str, color_scheme: str, dialog_title: str ) -> rx.Component: return rx.dialog.root( rx.dialog.trigger( rx.icon_button( rx.icon(icon_name), color_scheme=color_scheme, size="2", variant="solid" ) ), rx.dialog.content( rx.vstack( rx.dialog.title(dialog_title), rx.dialog.description( rx.vstack( rx.text(item.pipeline), rx.text(item.workflow), status_badge(item.status), rx.text(item.timestamp), rx.text(item.duration), ) ), rx.dialog.close( rx.button("Close Dialog", size="2", color_scheme=color_scheme), ), ), ), ) def _delete_dialog(item: Item) -> rx.Component: return _create_dial
from ..components.status_badge import status_badge
ort Item, TableState from ..components.status_badge import status_badge def _create_dialog( item: Item, icon_name: str, color_scheme: str, dialog_title: str ) -> rx.Component: return rx.dialog.root( rx.dialog.trigger( rx.icon_button( rx.icon(icon_name), color_scheme=color_scheme, size="2", variant="solid" ) ), rx.dialog.content( rx.vstack( rx.dialog.title(dialog_title), rx.dialog.description( rx.vstack( rx.text(item.pipeline), rx.text(item.workflow), status_badge(item.status), rx.text(item.timestamp), rx.text(item.duration), ) ), rx.dialog.close( rx.button("Close Dialog", size="2", color_scheme=color_scheme), ), ), ), )
def _approve_dialog(item: Item) -> rx.Component: return _create_dialog(item, "check", "grass", "Approve Dialog") def _edit_dialog(item: Item) -> rx.Component: return _create_dialog(item, "square-pen", "blue", "Edit Dialog") def _dialog_group(item: Item) -> rx.Component: return rx.hstack( _approve_dialog(item), _edit_dialog(item), _delete_dialog(item), align="center", spacing="2", width="100%", ) 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
def _delete_dialog(item: Item) -> rx.Component: return _create_dialog(item, "trash-2", "tomato", "Delete Dialog")
str, color_scheme: str, dialog_title: str ) -> rx.Component: return rx.dialog.root( rx.dialog.trigger( rx.icon_button( rx.icon(icon_name), color_scheme=color_scheme, size="2", variant="solid" ) ), rx.dialog.content( rx.vstack( rx.dialog.title(dialog_title), rx.dialog.description( rx.vstack( rx.text(item.pipeline), rx.text(item.workflow), status_badge(item.status), rx.text(item.timestamp), rx.text(item.duration), ) ), rx.dialog.close( rx.button("Close Dialog", size="2", color_scheme=color_scheme), ), ), ), ) def _delete_dialog(item: Item) -> rx.Component: return _create_dialog(item, "trash-2", "tomato", "Delete Dialog")
def _edit_dialog(item: Item) -> rx.Component: return _create_dialog(item, "square-pen", "blue", "Edit Dialog") def _dialog_group(item: Item) -> rx.Component: return rx.hstack( _approve_dialog(item), _edit_dialog(item), _delete_dialog(item), align="center", spacing="2", width="100%", ) 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.pipeline), rx.table.cell(item.workflow)
def _approve_dialog(item: Item) -> rx.Component: return _create_dialog(item, "check", "grass", "Approve Dialog")
rx.icon_button( rx.icon(icon_name), color_scheme=color_scheme, size="2", variant="solid" ) ), rx.dialog.content( rx.vstack( rx.dialog.title(dialog_title), rx.dialog.description( rx.vstack( rx.text(item.pipeline), rx.text(item.workflow), status_badge(item.status), rx.text(item.timestamp), rx.text(item.duration), ) ), rx.dialog.close( rx.button("Close Dialog", size="2", color_scheme=color_scheme), ), ), ), ) def _delete_dialog(item: Item) -> rx.Component: return _create_dialog(item, "trash-2", "tomato", "Delete Dialog") def _approve_dialog(item: Item) -> rx.Component: return _create_dialog(item, "check", "grass", "Approve Dialog")
def _dialog_group(item: Item) -> rx.Component: return rx.hstack( _approve_dialog(item), _edit_dialog(item), _delete_dialog(item), align="center", spacing="2", width="100%", ) 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.pipeline), rx.table.cell(item.workflow), rx.table.cell(status_badge(item.status)), rx.table.cell(item.timestamp), rx.table.cell(item
def _edit_dialog(item: Item) -> rx.Component: return _create_dialog(item, "square-pen", "blue", "Edit Dialog")
) ), rx.dialog.content( rx.vstack( rx.dialog.title(dialog_title), rx.dialog.description( rx.vstack( rx.text(item.pipeline), rx.text(item.workflow), status_badge(item.status), rx.text(item.timestamp), rx.text(item.duration), ) ), rx.dialog.close( rx.button("Close Dialog", size="2", color_scheme=color_scheme), ), ), ), ) def _delete_dialog(item: Item) -> rx.Component: return _create_dialog(item, "trash-2", "tomato", "Delete Dialog") def _approve_dialog(item: Item) -> rx.Component: return _create_dialog(item, "check", "grass", "Approve Dialog") def _edit_dialog(item: Item) -> rx.Component: return _create_dialog(item, "square-pen", "blue", "Edit Dialog")
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.pipeline), rx.table.cell(item.workflow), rx.table.cell(status_badge(item.status)), rx.table.cell(item.timestamp), rx.table.cell(item.duration), rx.table.cell(_dialog_group(item)), style={"_hover": {"bg": hover_color}, "bg": bg_color}, align="center", ) def _pagination_view() -> rx.Component: return ( rx.hstack(
def _dialog_group(item: Item) -> rx.Component: return rx.hstack( _approve_dialog(item), _edit_dialog(item), _delete_dialog(item), align="center", spacing="2", width="100%", )
e), rx.text(item.workflow), status_badge(item.status), rx.text(item.timestamp), rx.text(item.duration), ) ), rx.dialog.close( rx.button("Close Dialog", size="2", color_scheme=color_scheme), ), ), ), ) def _delete_dialog(item: Item) -> rx.Component: return _create_dialog(item, "trash-2", "tomato", "Delete Dialog") def _approve_dialog(item: Item) -> rx.Component: return _create_dialog(item, "check", "grass", "Approve Dialog") def _edit_dialog(item: Item) -> rx.Component: return _create_dialog(item, "square-pen", "blue", "Edit Dialog") def _dialog_group(item: Item) -> rx.Component: return rx.hstack( _approve_dialog(item), _edit_dialog(item), _delete_dialog(item), align="center", spacing="2", width="100%", )
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.pipeline), rx.table.cell(item.workflow), rx.table.cell(status_badge(item.status)), rx.table.cell(item.timestamp), rx.table.cell(item.duration), rx.table.cell(_dialog_group(item)), 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(
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", ), )
rx.dialog.close( rx.button("Close Dialog", size="2", color_scheme=color_scheme), ), ), ), ) def _delete_dialog(item: Item) -> rx.Component: return _create_dialog(item, "trash-2", "tomato", "Delete Dialog") def _approve_dialog(item: Item) -> rx.Component: return _create_dialog(item, "check", "grass", "Approve Dialog") def _edit_dialog(item: Item) -> rx.Component: return _create_dialog(item, "square-pen", "blue", "Edit Dialog") def _dialog_group(item: Item) -> rx.Component: return rx.hstack( _approve_dialog(item), _edit_dialog(item), _delete_dialog(item), align="center", spacing="2", width="100%", ) 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.pipeline), rx.table.cell(item.workflow), rx.table.cell(status_badge(item.status)), rx.table.cell(item.timestamp), rx.table.cell(item.duration), rx.table.cell(_dialog_group(item)), style={"_hover": {"bg": hover_color}, "bg": bg_color}, align="center", )
Dialog", size="2", color_scheme=color_scheme), ), ), ), ) def _delete_dialog(item: Item) -> rx.Component: return _create_dialog(item, "trash-2", "tomato", "Delete Dialog") def _approve_dialog(item: Item) -> rx.Component: return _create_dialog(item, "check", "grass", "Approve Dialog") def _edit_dialog(item: Item) -> rx.Component: return _create_dialog(item, "square-pen", "blue", "Edit Dialog") def _dialog_group(item: Item) -> rx.Component: return rx.hstack( _approve_dialog(item), _edit_dialog(item), _delete_dialog(item), align="center", spacing="2", width="100%", ) 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.pipeline), rx.table.cell(item.workflow), rx.table.cell(status_badge(item.status)), rx.table.cell(item.timestamp), rx.table.cell(item.duration), rx.table.cell(_dialog_group(item)), 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),
bg_color = rx.cond( index % 2 == 0, rx.color("gray", 1), rx.color("accent", 2), )
ialog(item: Item) -> rx.Component: return _create_dialog(item, "trash-2", "tomato", "Delete Dialog") def _approve_dialog(item: Item) -> rx.Component: return _create_dialog(item, "check", "grass", "Approve Dialog") def _edit_dialog(item: Item) -> rx.Component: return _create_dialog(item, "square-pen", "blue", "Edit Dialog") def _dialog_group(item: Item) -> rx.Component: return rx.hstack( _approve_dialog(item), _edit_dialog(item), _delete_dialog(item), align="center", spacing="2", width="100%", ) 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.pipeline), rx.table.cell(item.workflow), rx.table.cell(status_badge(item.status)), rx.table.cell(item.timestamp), rx.table.cell(item.duration), rx.table.cell(_dialog_group(item)), 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"
hover_color = rx.cond( index % 2 == 0, rx.color("gray", 3), rx.color("accent", 3), )
from company_dashboard.components.documents_table import ( documents_table_section, ) from company_dashboard.components.header import header_bar from company_dashboard.components.key_metrics import key_metrics_section from company_dashboard.components.sidebar import sidebar from company_dashboard.components.visitors_chart import ( visitors_chart_section, ) from company_dashboard.states.dashboard_state import DashboardState def index() -> rx.Component: """The main dashboard page.""" return rx.el.div( sidebar(), rx.el.main( header_bar(), rx.el.div( key_metrics_section(), visitors_chart_section(), documents_table_section(), class_name="p-6 space-y-6", ), class_name="w-full h-[100vh] overflow-y-auto", ), class_name="flex flex-row bg-gray-50 h-[100vh] w-full overflow-hidden", on_mount=DashboardState.load_initial_data,
import reflex as rx
import reflex as rx
from company_dashboard.components.header import header_bar from company_dashboard.components.key_metrics import key_metrics_section from company_dashboard.components.sidebar import sidebar from company_dashboard.components.visitors_chart import ( visitors_chart_section, ) from company_dashboard.states.dashboard_state import DashboardState def index() -> rx.Component: """The main dashboard page.""" return rx.el.div( sidebar(), rx.el.main( header_bar(), rx.el.div( key_metrics_section(), visitors_chart_section(), documents_table_section(), class_name="p-6 space-y-6", ), class_name="w-full h-[100vh] overflow-y-auto", ), class_name="flex flex-row bg-gray-50 h-[100vh] w-full overflow-hidden", on_mount=DashboardState.load_initial_data, ) app = rx.App( theme=rx.theme(appearance="light"), stylesheets=["https://cdn.ta
from company_dashboard.components.documents_table import ( documents_table_section, )
import reflex as rx from company_dashboard.components.documents_table import ( documents_table_section, )
from company_dashboard.components.key_metrics import key_metrics_section from company_dashboard.components.sidebar import sidebar from company_dashboard.components.visitors_chart import ( visitors_chart_section, ) from company_dashboard.states.dashboard_state import DashboardState def index() -> rx.Component: """The main dashboard page.""" return rx.el.div( sidebar(), rx.el.main( header_bar(), rx.el.div( key_metrics_section(), visitors_chart_section(), documents_table_section(), class_name="p-6 space-y-6", ), class_name="w-full h-[100vh] overflow-y-auto", ), class_name="flex flex-row bg-gray-50 h-[100vh] w-full overflow-hidden", on_mount=DashboardState.load_initial_data, ) app = rx.App( theme=rx.theme(appearance="light"), stylesheets=["https://cdn.tailwindcss.com"], style={ rx.el.label: {"font_fa
from company_dashboard.components.header import header_bar
import reflex as rx from company_dashboard.components.documents_table import ( documents_table_section, ) from company_dashboard.components.header import header_bar
from company_dashboard.components.sidebar import sidebar from company_dashboard.components.visitors_chart import ( visitors_chart_section, ) from company_dashboard.states.dashboard_state import DashboardState def index() -> rx.Component: """The main dashboard page.""" return rx.el.div( sidebar(), rx.el.main( header_bar(), rx.el.div( key_metrics_section(), visitors_chart_section(), documents_table_section(), class_name="p-6 space-y-6", ), class_name="w-full h-[100vh] overflow-y-auto", ), class_name="flex flex-row bg-gray-50 h-[100vh] w-full overflow-hidden", on_mount=DashboardState.load_initial_data, ) app = rx.App( theme=rx.theme(appearance="light"), stylesheets=["https://cdn.tailwindcss.com"], style={ rx.el.label: {"font_family": "JetBrains Mono,ui-monospace,monospace"}, rx.el.span: {"fo
from company_dashboard.components.key_metrics import key_metrics_section
import reflex as rx from company_dashboard.components.documents_table import ( documents_table_section, ) from company_dashboard.components.header import header_bar from company_dashboard.components.key_metrics import key_metrics_section
from company_dashboard.components.visitors_chart import ( visitors_chart_section, ) from company_dashboard.states.dashboard_state import DashboardState def index() -> rx.Component: """The main dashboard page.""" return rx.el.div( sidebar(), rx.el.main( header_bar(), rx.el.div( key_metrics_section(), visitors_chart_section(), documents_table_section(), class_name="p-6 space-y-6", ), class_name="w-full h-[100vh] overflow-y-auto", ), class_name="flex flex-row bg-gray-50 h-[100vh] w-full overflow-hidden", on_mount=DashboardState.load_initial_data, ) app = rx.App( theme=rx.theme(appearance="light"), stylesheets=["https://cdn.tailwindcss.com"], style={ rx.el.label: {"font_family": "JetBrains Mono,ui-monospace,monospace"}, rx.el.span: {"font_family": "JetBrains Mono,ui-monospace,monospace"},
from company_dashboard.components.sidebar import sidebar
import reflex as rx from company_dashboard.components.documents_table import ( documents_table_section, ) from company_dashboard.components.header import header_bar from company_dashboard.components.key_metrics import key_metrics_section from company_dashboard.components.sidebar import sidebar
from company_dashboard.states.dashboard_state import DashboardState def index() -> rx.Component: """The main dashboard page.""" return rx.el.div( sidebar(), rx.el.main( header_bar(), rx.el.div( key_metrics_section(), visitors_chart_section(), documents_table_section(), class_name="p-6 space-y-6", ), class_name="w-full h-[100vh] overflow-y-auto", ), class_name="flex flex-row bg-gray-50 h-[100vh] w-full overflow-hidden", on_mount=DashboardState.load_initial_data, ) app = rx.App( theme=rx.theme(appearance="light"), stylesheets=["https://cdn.tailwindcss.com"], style={ rx.el.label: {"font_family": "JetBrains Mono,ui-monospace,monospace"}, rx.el.span: {"font_family": "JetBrains Mono,ui-monospace,monospace"}, rx.el.h1: {"font_family": "JetBrains Mono,ui-monospace,monospace"}, rx.el.h
from company_dashboard.components.visitors_chart import ( visitors_chart_section, )
import reflex as rx from company_dashboard.components.documents_table import ( documents_table_section, ) from company_dashboard.components.header import header_bar from company_dashboard.components.key_metrics import key_metrics_section from company_dashboard.components.sidebar import sidebar from company_dashboard.components.visitors_chart import ( visitors_chart_section, )
def index() -> rx.Component: """The main dashboard page.""" return rx.el.div( sidebar(), rx.el.main( header_bar(), rx.el.div( key_metrics_section(), visitors_chart_section(), documents_table_section(), class_name="p-6 space-y-6", ), class_name="w-full h-[100vh] overflow-y-auto", ), class_name="flex flex-row bg-gray-50 h-[100vh] w-full overflow-hidden", on_mount=DashboardState.load_initial_data, ) app = rx.App( theme=rx.theme(appearance="light"), stylesheets=["https://cdn.tailwindcss.com"], style={ rx.el.label: {"font_family": "JetBrains Mono,ui-monospace,monospace"}, rx.el.span: {"font_family": "JetBrains Mono,ui-monospace,monospace"}, rx.el.h1: {"font_family": "JetBrains Mono,ui-monospace,monospace"}, rx.el.h2: {"font_family": "JetBrains Mono,ui-monospace,monospace"}, },
from company_dashboard.states.dashboard_state import DashboardState
from company_dashboard.states.dashboard_state import ( DashboardState, ) def document_tab_button(text: str, count: int = 0) -> rx.Component: """Button for selecting document table tabs.""" return rx.el.button( text, rx.cond( count > 0, rx.el.span( count, class_name="ml-1.5 px-1.5 py-0.5 text-xs font-medium rounded-full bg-gray-200 text-gray-600", ), rx.fragment(), ), on_click=lambda: DashboardState.set_document_tab(text), class_name=rx.cond( DashboardState.selected_document_tab == text, "px-3 py-1.5 text-sm font-medium text-gray-700 bg-gray-100 border border-gray-300 rounded-md shadow-sm", "px-3 py-1.5 text-sm font-medium text-gray-500 bg-white border border-transparent rounded-md hover:bg-gray-50 hover:text-gray-700", ), ) def status_badge(status: rx.Var[str]) -> rx.Component: """Displays a status
import reflex as rx
import reflex as rx
def document_tab_button(text: str, count: int = 0) -> rx.Component: """Button for selecting document table tabs.""" return rx.el.button( text, rx.cond( count > 0, rx.el.span( count, class_name="ml-1.5 px-1.5 py-0.5 text-xs font-medium rounded-full bg-gray-200 text-gray-600", ), rx.fragment(), ), on_click=lambda: DashboardState.set_document_tab(text), class_name=rx.cond( DashboardState.selected_document_tab == text, "px-3 py-1.5 text-sm font-medium text-gray-700 bg-gray-100 border border-gray-300 rounded-md shadow-sm", "px-3 py-1.5 text-sm font-medium text-gray-500 bg-white border border-transparent rounded-md hover:bg-gray-50 hover:text-gray-700", ), ) def status_badge(status: rx.Var[str]) -> rx.Component: """Displays a status badge based on the status string.""" return rx.el.span( rx.icon(
from company_dashboard.states.dashboard_state import ( DashboardState, )
def header_bar() -> rx.Component: """The header bar component.""" return rx.el.div( rx.el.div( rx.el.label( "reflex > build > ", class_name="text-sm font-semibold text-gray-500", ), rx.el.label( "dashboard", class_name="text-sm font-semibold text-gray-900", ), ), rx.el.div(), class_name="flex items-center justify-between h-12 px-6 bg-white border-b border-gray-200", )
import reflex as rx
from company_dashboard.states.dashboard_state import ( DashboardState, Metric, ) def metric_card(metric: Metric) -> rx.Component: """A card displaying a single key metric.""" return rx.el.div( rx.el.div( rx.el.p( metric["title"], class_name="text-sm font-medium text-gray-500", ), rx.el.div( rx.el.span( metric["change"], class_name=rx.cond( metric["change_direction"] == "up", "text-xs font-medium px-2 py-0.5 rounded-full bg-green-100 text-green-800", rx.cond( metric["change_direction"] == "down", "text-xs font-medium px-2 py-0.5 rounded-full bg-red-100 text-red-800", "text-xs font-medium px-2 py-0.5 rounded-full bg-gray-100 text-gray-800", ),
import reflex as rx
import reflex as rx
def metric_card(metric: Metric) -> rx.Component: """A card displaying a single key metric.""" return rx.el.div( rx.el.div( rx.el.p( metric["title"], class_name="text-sm font-medium text-gray-500", ), rx.el.div( rx.el.span( metric["change"], class_name=rx.cond( metric["change_direction"] == "up", "text-xs font-medium px-2 py-0.5 rounded-full bg-green-100 text-green-800", rx.cond( metric["change_direction"] == "down", "text-xs font-medium px-2 py-0.5 rounded-full bg-red-100 text-red-800", "text-xs font-medium px-2 py-0.5 rounded-full bg-gray-100 text-gray-800", ), ), ), rx.icon( tag=rx.cond(
from company_dashboard.states.dashboard_state import ( DashboardState, Metric, )
"text-red-600 ml-1", "text-gray-600 ml-1", ), ), ), class_name="flex items-center", ), class_name="flex items-center justify-between mb-1", ), rx.el.p( metric["value"], class_name="text-3xl font-semibold text-gray-900 mb-2", ), rx.el.div( rx.el.p( metric["description"], class_name="text-sm text-gray-700 mr-1", ), rx.icon( tag="bar-chart-2", size=16, class_name="text-gray-500", ), class_name="flex items-center text-sm text-gray-500", ), rx.el.p( metric["trend_description"], class_name="text-xs text-gray-400 mt-1", ), class_name="p-5 bg-white border border-gray-200 rounded-lg shadow-sm", )
def key_metrics_section() -> rx.Component: """The section displaying key metric cards.""" return rx.el.div( rx.foreach(DashboardState.key_metrics, metric_card), class_name="grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-4", )
def sidebar_item( text: str, icon: str, href: str = "#", is_active: bool = False, ) -> rx.Component: """A reusable sidebar item component.""" return rx.el.a( rx.icon(tag=icon, class_name="mr-3 size-4"), rx.el.label(text, class_name="text-sm"), href=href, class_name=rx.cond( is_active, "flex items-center px-4 py-2 text-sm font-medium text-gray-900 bg-gray-100 rounded-lg", "flex items-center px-4 py-2 text-sm font-medium text-gray-600 hover:bg-gray-50 hover:text-gray-900 rounded-lg", ), ) def sidebar() -> rx.Component: """The sidebar component for the dashboard.""" return rx.el.div( rx.el.div( rx.el.div( rx.el.label( "Reflex Build", class_name="text-sm font-semibold text-gray-900", ), rx.el.label( "v.0.0.1", class_name="text-sm
import reflex as rx
from company_dashboard.states.dashboard_state import ( TOOLTIP_PROPS, DashboardState, ) def time_range_button(text: str) -> rx.Component: """Button for selecting chart time range.""" return rx.el.button( text, on_click=lambda: DashboardState.set_visitor_timeframe(text), class_name=rx.cond( DashboardState.selected_visitor_timeframe == text, "px-3 py-1 text-sm font-medium text-gray-700 bg-gray-100 border border-gray-300 rounded-md shadow-sm", "px-3 py-1 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-md hover:bg-gray-50", ), ) def visitors_chart_section() -> rx.Component: """The section displaying the total visitors chart.""" return rx.el.div( rx.el.div( rx.el.div( rx.el.h2( "Total Visitors", class_name="text-lg font-semibold text-gray-900", ), rx.el.p(
import reflex as rx
import reflex as rx
def time_range_button(text: str) -> rx.Component: """Button for selecting chart time range.""" return rx.el.button( text, on_click=lambda: DashboardState.set_visitor_timeframe(text), class_name=rx.cond( DashboardState.selected_visitor_timeframe == text, "px-3 py-1 text-sm font-medium text-gray-700 bg-gray-100 border border-gray-300 rounded-md shadow-sm", "px-3 py-1 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-md hover:bg-gray-50", ), ) def visitors_chart_section() -> rx.Component: """The section displaying the total visitors chart.""" return rx.el.div( rx.el.div( rx.el.div( rx.el.h2( "Total Visitors", class_name="text-lg font-semibold text-gray-900", ), rx.el.p( "Total for the last 3 months", class_name="text-sm text-gra
from company_dashboard.states.dashboard_state import ( TOOLTIP_PROPS, DashboardState, )
import random from typing import List, TypedDict import reflex as rx from faker import Faker fake = Faker() class Metric(TypedDict): title: str value: str change: str change_direction: str description: str trend_description: str class VisitorDataPoint(TypedDict): date: str series1: int series2: int class DocumentRow(TypedDict): id: int header: str section_type: str status: str target: int limit: int reviewer: str class DashboardState(rx.State): """The state for the dashboard page.""" key_metrics: List[Metric] = [] visitor_data: List[VisitorDataPoint] = [] displayed_visitor_data: List[VisitorDataPoint] = [] document_data: List[DocumentRow] = [] selected_visitor_timeframe: str = "Last 3 months" selected_document_tab: str = "Outline" document_columns: List[str] = [ "", "Header", "Section Type", "Status", "Target", "Limit", "Rev
import datetime
import datetime
from typing import List, TypedDict import reflex as rx from faker import Faker fake = Faker() class Metric(TypedDict): title: str value: str change: str change_direction: str description: str trend_description: str class VisitorDataPoint(TypedDict): date: str series1: int series2: int class DocumentRow(TypedDict): id: int header: str section_type: str status: str target: int limit: int reviewer: str class DashboardState(rx.State): """The state for the dashboard page.""" key_metrics: List[Metric] = [] visitor_data: List[VisitorDataPoint] = [] displayed_visitor_data: List[VisitorDataPoint] = [] document_data: List[DocumentRow] = [] selected_visitor_timeframe: str = "Last 3 months" selected_document_tab: str = "Outline" document_columns: List[str] = [ "", "Header", "Section Type", "Status", "Target", "Limit", "Reviewer", ]
import random
import datetime import random
import reflex as rx from faker import Faker fake = Faker() class Metric(TypedDict): title: str value: str change: str change_direction: str description: str trend_description: str class VisitorDataPoint(TypedDict): date: str series1: int series2: int class DocumentRow(TypedDict): id: int header: str section_type: str status: str target: int limit: int reviewer: str class DashboardState(rx.State): """The state for the dashboard page.""" key_metrics: List[Metric] = [] visitor_data: List[VisitorDataPoint] = [] displayed_visitor_data: List[VisitorDataPoint] = [] document_data: List[DocumentRow] = [] selected_visitor_timeframe: str = "Last 3 months" selected_document_tab: str = "Outline" document_columns: List[str] = [ "", "Header", "Section Type", "Status", "Target", "Limit", "Reviewer", ] def _generate_fake_data(self):
from typing import List, TypedDict
import datetime import random from typing import List, TypedDict
from faker import Faker fake = Faker() class Metric(TypedDict): title: str value: str change: str change_direction: str description: str trend_description: str class VisitorDataPoint(TypedDict): date: str series1: int series2: int class DocumentRow(TypedDict): id: int header: str section_type: str status: str target: int limit: int reviewer: str class DashboardState(rx.State): """The state for the dashboard page.""" key_metrics: List[Metric] = [] visitor_data: List[VisitorDataPoint] = [] displayed_visitor_data: List[VisitorDataPoint] = [] document_data: List[DocumentRow] = [] selected_visitor_timeframe: str = "Last 3 months" selected_document_tab: str = "Outline" document_columns: List[str] = [ "", "Header", "Section Type", "Status", "Target", "Limit", "Reviewer", ] def _generate_fake_data(self): """Generates
import reflex as rx
import datetime import random from typing import List, TypedDict import reflex as rx
fake = Faker() class Metric(TypedDict): title: str value: str change: str change_direction: str description: str trend_description: str class VisitorDataPoint(TypedDict): date: str series1: int series2: int class DocumentRow(TypedDict): id: int header: str section_type: str status: str target: int limit: int reviewer: str class DashboardState(rx.State): """The state for the dashboard page.""" key_metrics: List[Metric] = [] visitor_data: List[VisitorDataPoint] = [] displayed_visitor_data: List[VisitorDataPoint] = [] document_data: List[DocumentRow] = [] selected_visitor_timeframe: str = "Last 3 months" selected_document_tab: str = "Outline" document_columns: List[str] = [ "", "Header", "Section Type", "Status", "Target", "Limit", "Reviewer", ] def _generate_fake_data(self): """Generates fake data for the dashb
from faker import Faker
import datetime import random from typing import List, TypedDict import reflex as rx from faker import Faker
class Metric(TypedDict): title: str value: str change: str change_direction: str description: str trend_description: str class VisitorDataPoint(TypedDict): date: str series1: int series2: int class DocumentRow(TypedDict): id: int header: str section_type: str status: str target: int limit: int reviewer: str class DashboardState(rx.State): """The state for the dashboard page.""" key_metrics: List[Metric] = [] visitor_data: List[VisitorDataPoint] = [] displayed_visitor_data: List[VisitorDataPoint] = [] document_data: List[DocumentRow] = [] selected_visitor_timeframe: str = "Last 3 months" selected_document_tab: str = "Outline" document_columns: List[str] = [ "", "Header", "Section Type", "Status", "Target", "Limit", "Reviewer", ] def _generate_fake_data(self): """Generates fake data for the dashboard."""
fake = Faker()
import datetime import random from typing import List, TypedDict import reflex as rx from faker import Faker fake = Faker()
class VisitorDataPoint(TypedDict): date: str series1: int series2: int class DocumentRow(TypedDict): id: int header: str section_type: str status: str target: int limit: int reviewer: str class DashboardState(rx.State): """The state for the dashboard page.""" key_metrics: List[Metric] = [] visitor_data: List[VisitorDataPoint] = [] displayed_visitor_data: List[VisitorDataPoint] = [] document_data: List[DocumentRow] = [] selected_visitor_timeframe: str = "Last 3 months" selected_document_tab: str = "Outline" document_columns: List[str] = [ "", "Header", "Section Type", "Status", "Target", "Limit", "Reviewer", ] def _generate_fake_data(self): """Generates fake data for the dashboard.""" self.key_metrics = [ { "title": "Total Revenue", "value": f"${fake.random_int(min=500000, max=2000000)
class Metric(TypedDict): title: str value: str change: str change_direction: str description: str trend_description: str
import datetime import random from typing import List, TypedDict import reflex as rx from faker import Faker fake = Faker() class Metric(TypedDict): title: str value: str change: str change_direction: str description: str trend_description: str
class DocumentRow(TypedDict): id: int header: str section_type: str status: str target: int limit: int reviewer: str class DashboardState(rx.State): """The state for the dashboard page.""" key_metrics: List[Metric] = [] visitor_data: List[VisitorDataPoint] = [] displayed_visitor_data: List[VisitorDataPoint] = [] document_data: List[DocumentRow] = [] selected_visitor_timeframe: str = "Last 3 months" selected_document_tab: str = "Outline" document_columns: List[str] = [ "", "Header", "Section Type", "Status", "Target", "Limit", "Reviewer", ] def _generate_fake_data(self): """Generates fake data for the dashboard.""" self.key_metrics = [ { "title": "Total Revenue", "value": f"${fake.random_int(min=500000, max=2000000):,}", "change": f"+{fake.random_number(digits=2, fix_len=True)}.{fake
class VisitorDataPoint(TypedDict): date: str series1: int series2: int
import datetime import random from typing import List, TypedDict import reflex as rx from faker import Faker fake = Faker() class Metric(TypedDict): title: str value: str change: str change_direction: str description: str trend_description: str class VisitorDataPoint(TypedDict): date: str series1: int series2: int
class DashboardState(rx.State): """The state for the dashboard page.""" key_metrics: List[Metric] = [] visitor_data: List[VisitorDataPoint] = [] displayed_visitor_data: List[VisitorDataPoint] = [] document_data: List[DocumentRow] = [] selected_visitor_timeframe: str = "Last 3 months" selected_document_tab: str = "Outline" document_columns: List[str] = [ "", "Header", "Section Type", "Status", "Target", "Limit", "Reviewer", ] def _generate_fake_data(self): """Generates fake data for the dashboard.""" self.key_metrics = [ { "title": "Total Revenue", "value": f"${fake.random_int(min=500000, max=2000000):,}", "change": f"+{fake.random_number(digits=2, fix_len=True)}.{fake.random_digit()}%", "change_direction": "up", "description": "Trending up this month", "trend_descr
class DocumentRow(TypedDict): id: int header: str section_type: str status: str target: int limit: int reviewer: str
f"Down {fake.random_number(digits=2, fix_len=True)}% this period", "trend_description": "Acquisition needs attention", }, { "title": "Active Accounts", "value": f"{fake.random_int(min=30000, max=60000):,}", "change": f"+{fake.random_number(digits=2, fix_len=True)}.{fake.random_digit()}%", "change_direction": "up", "description": "Strong user retention", "trend_description": "Engagement exceed targets", }, { "title": "Growth Rate", "value": f"{fake.random_number(digits=1, fix_len=True)}.{fake.random_digit()}%", "change": f"+{fake.random_number(digits=1, fix_len=True)}.{fake.random_digit()}%", "change_direction": "up", "description": "Steady performance", "trend_description": "Meets growth projections", }, ]
self.visitor_data = [] for i in range(90): date = today - datetime.timedelta(days=i) self.visitor_data.append( { "date": ( date.strftime("Jun %d") if date.month == 6 else date.strftime("%b %d") ), "series1": fake.random_int(min=100, max=500), "series2": fake.random_int(min=50, max=300), } ) self.displayed_visitor_data = self.visitor_data self.visitor_data.reverse() statuses = ["Done", "In Process", "Pending"] section_types = [ "Cover page", "Table of contents", "Narrative", "Technical approach", "Management plan", "Pricing section", ] self.document_data = [] for i in range(5): self.document_data.append(
today = datetime.date.today()
ix_len=True)}% this period", "trend_description": "Acquisition needs attention", }, { "title": "Active Accounts", "value": f"{fake.random_int(min=30000, max=60000):,}", "change": f"+{fake.random_number(digits=2, fix_len=True)}.{fake.random_digit()}%", "change_direction": "up", "description": "Strong user retention", "trend_description": "Engagement exceed targets", }, { "title": "Growth Rate", "value": f"{fake.random_number(digits=1, fix_len=True)}.{fake.random_digit()}%", "change": f"+{fake.random_number(digits=1, fix_len=True)}.{fake.random_digit()}%", "change_direction": "up", "description": "Steady performance", "trend_description": "Meets growth projections", }, ] today = datetime.date.today()
for i in range(90): date = today - datetime.timedelta(days=i) self.visitor_data.append( { "date": ( date.strftime("Jun %d") if date.month == 6 else date.strftime("%b %d") ), "series1": fake.random_int(min=100, max=500), "series2": fake.random_int(min=50, max=300), } ) self.displayed_visitor_data = self.visitor_data self.visitor_data.reverse() statuses = ["Done", "In Process", "Pending"] section_types = [ "Cover page", "Table of contents", "Narrative", "Technical approach", "Management plan", "Pricing section", ] self.document_data = [] for i in range(5): self.document_data.append( { "id":
self.visitor_data = []
"trend_description": "Acquisition needs attention", }, { "title": "Active Accounts", "value": f"{fake.random_int(min=30000, max=60000):,}", "change": f"+{fake.random_number(digits=2, fix_len=True)}.{fake.random_digit()}%", "change_direction": "up", "description": "Strong user retention", "trend_description": "Engagement exceed targets", }, { "title": "Growth Rate", "value": f"{fake.random_number(digits=1, fix_len=True)}.{fake.random_digit()}%", "change": f"+{fake.random_number(digits=1, fix_len=True)}.{fake.random_digit()}%", "change_direction": "up", "description": "Steady performance", "trend_description": "Meets growth projections", }, ] today = datetime.date.today() self.visitor_data = []
self.displayed_visitor_data = self.visitor_data self.visitor_data.reverse() statuses = ["Done", "In Process", "Pending"] section_types = [ "Cover page", "Table of contents", "Narrative", "Technical approach", "Management plan", "Pricing section", ] self.document_data = [] for i in range(5): self.document_data.append( { "id": i, "header": fake.catch_phrase().replace('"', ""), "section_type": random.choice(section_types), "status": random.choice(statuses), "target": fake.random_int(min=5, max=50), "limit": fake.random_int(min=3, max=30), "reviewer": fake.name(), } ) self.document_data[0].update( { "header": "Cover page",
for i in range(90): date = today - datetime.timedelta(days=i) self.visitor_data.append( { "date": ( date.strftime("Jun %d") if date.month == 6 else date.strftime("%b %d") ), "series1": fake.random_int(min=100, max=500), "series2": fake.random_int(min=50, max=300), } )
": "Acquisition needs attention", }, { "title": "Active Accounts", "value": f"{fake.random_int(min=30000, max=60000):,}", "change": f"+{fake.random_number(digits=2, fix_len=True)}.{fake.random_digit()}%", "change_direction": "up", "description": "Strong user retention", "trend_description": "Engagement exceed targets", }, { "title": "Growth Rate", "value": f"{fake.random_number(digits=1, fix_len=True)}.{fake.random_digit()}%", "change": f"+{fake.random_number(digits=1, fix_len=True)}.{fake.random_digit()}%", "change_direction": "up", "description": "Steady performance", "trend_description": "Meets growth projections", }, ] today = datetime.date.today() self.visitor_data = [] for i in range(90):
self.visitor_data.append( { "date": ( date.strftime("Jun %d") if date.month == 6 else date.strftime("%b %d") ), "series1": fake.random_int(min=100, max=500), "series2": fake.random_int(min=50, max=300), } ) self.displayed_visitor_data = self.visitor_data self.visitor_data.reverse() statuses = ["Done", "In Process", "Pending"] section_types = [ "Cover page", "Table of contents", "Narrative", "Technical approach", "Management plan", "Pricing section", ] self.document_data = [] for i in range(5): self.document_data.append( { "id": i, "header": fake.catch_phrase().replace('"', ""),
date = today - datetime.timedelta(days=i)
{ "title": "Growth Rate", "value": f"{fake.random_number(digits=1, fix_len=True)}.{fake.random_digit()}%", "change": f"+{fake.random_number(digits=1, fix_len=True)}.{fake.random_digit()}%", "change_direction": "up", "description": "Steady performance", "trend_description": "Meets growth projections", }, ] today = datetime.date.today() self.visitor_data = [] for i in range(90): date = today - datetime.timedelta(days=i) self.visitor_data.append( { "date": ( date.strftime("Jun %d") if date.month == 6 else date.strftime("%b %d") ), "series1": fake.random_int(min=100, max=500), "series2": fake.random_int(min=50, max=300), } )
self.visitor_data.reverse() statuses = ["Done", "In Process", "Pending"] section_types = [ "Cover page", "Table of contents", "Narrative", "Technical approach", "Management plan", "Pricing section", ] self.document_data = [] for i in range(5): self.document_data.append( { "id": i, "header": fake.catch_phrase().replace('"', ""), "section_type": random.choice(section_types), "status": random.choice(statuses), "target": fake.random_int(min=5, max=50), "limit": fake.random_int(min=3, max=30), "reviewer": fake.name(), } ) self.document_data[0].update( { "header": "Cover page", "section_type": "Cover page", "statu
self.displayed_visitor_data = self.visitor_data
digits=1, fix_len=True)}.{fake.random_digit()}%", "change": f"+{fake.random_number(digits=1, fix_len=True)}.{fake.random_digit()}%", "change_direction": "up", "description": "Steady performance", "trend_description": "Meets growth projections", }, ] today = datetime.date.today() self.visitor_data = [] for i in range(90): date = today - datetime.timedelta(days=i) self.visitor_data.append( { "date": ( date.strftime("Jun %d") if date.month == 6 else date.strftime("%b %d") ), "series1": fake.random_int(min=100, max=500), "series2": fake.random_int(min=50, max=300), } ) self.displayed_visitor_data = self.visitor_data self.visitor_data.reverse()
section_types = [ "Cover page", "Table of contents", "Narrative", "Technical approach", "Management plan", "Pricing section", ] self.document_data = [] for i in range(5): self.document_data.append( { "id": i, "header": fake.catch_phrase().replace('"', ""), "section_type": random.choice(section_types), "status": random.choice(statuses), "target": fake.random_int(min=5, max=50), "limit": fake.random_int(min=3, max=30), "reviewer": fake.name(), } ) self.document_data[0].update( { "header": "Cover page", "section_type": "Cover page", "status": "In Process", "target": 18, "limit": 5,
statuses = ["Done", "In Process", "Pending"]
"change": f"+{fake.random_number(digits=1, fix_len=True)}.{fake.random_digit()}%", "change_direction": "up", "description": "Steady performance", "trend_description": "Meets growth projections", }, ] today = datetime.date.today() self.visitor_data = [] for i in range(90): date = today - datetime.timedelta(days=i) self.visitor_data.append( { "date": ( date.strftime("Jun %d") if date.month == 6 else date.strftime("%b %d") ), "series1": fake.random_int(min=100, max=500), "series2": fake.random_int(min=50, max=300), } ) self.displayed_visitor_data = self.visitor_data self.visitor_data.reverse() statuses = ["Done", "In Process", "Pending"]
self.document_data = [] for i in range(5): self.document_data.append( { "id": i, "header": fake.catch_phrase().replace('"', ""), "section_type": random.choice(section_types), "status": random.choice(statuses), "target": fake.random_int(min=5, max=50), "limit": fake.random_int(min=3, max=30), "reviewer": fake.name(), } ) self.document_data[0].update( { "header": "Cover page", "section_type": "Cover page", "status": "In Process", "target": 18, "limit": 5, "reviewer": "Eddie Lake", } ) self.document_data[1].update( { "header": "Table of contents", "section_type": "Table of contents",
section_types = [ "Cover page", "Table of contents", "Narrative", "Technical approach", "Management plan", "Pricing section", ]
scription": "Meets growth projections", }, ] today = datetime.date.today() self.visitor_data = [] for i in range(90): date = today - datetime.timedelta(days=i) self.visitor_data.append( { "date": ( date.strftime("Jun %d") if date.month == 6 else date.strftime("%b %d") ), "series1": fake.random_int(min=100, max=500), "series2": fake.random_int(min=50, max=300), } ) self.displayed_visitor_data = self.visitor_data self.visitor_data.reverse() statuses = ["Done", "In Process", "Pending"] section_types = [ "Cover page", "Table of contents", "Narrative", "Technical approach", "Management plan", "Pricing section", ]
for i in range(5): self.document_data.append( { "id": i, "header": fake.catch_phrase().replace('"', ""), "section_type": random.choice(section_types), "status": random.choice(statuses), "target": fake.random_int(min=5, max=50), "limit": fake.random_int(min=3, max=30), "reviewer": fake.name(), } ) self.document_data[0].update( { "header": "Cover page", "section_type": "Cover page", "status": "In Process", "target": 18, "limit": 5, "reviewer": "Eddie Lake", } ) self.document_data[1].update( { "header": "Table of contents", "section_type": "Table of contents", "status": "Done",
self.document_data = []
tions", }, ] today = datetime.date.today() self.visitor_data = [] for i in range(90): date = today - datetime.timedelta(days=i) self.visitor_data.append( { "date": ( date.strftime("Jun %d") if date.month == 6 else date.strftime("%b %d") ), "series1": fake.random_int(min=100, max=500), "series2": fake.random_int(min=50, max=300), } ) self.displayed_visitor_data = self.visitor_data self.visitor_data.reverse() statuses = ["Done", "In Process", "Pending"] section_types = [ "Cover page", "Table of contents", "Narrative", "Technical approach", "Management plan", "Pricing section", ] self.document_data = []
self.document_data[0].update( { "header": "Cover page", "section_type": "Cover page", "status": "In Process", "target": 18, "limit": 5, "reviewer": "Eddie Lake", } ) self.document_data[1].update( { "header": "Table of contents", "section_type": "Table of contents", "status": "Done", "target": 29, "limit": 24, "reviewer": "Eddie Lake", } ) self.document_data[2].update( { "header": "Executive summary", "section_type": "Narrative", "status": "Done", "target": 10, "limit": 13, "reviewer": "Eddie Lake", } ) self.document_data[3].update( { "header": "Tech
for i in range(5): self.document_data.append( { "id": i, "header": fake.catch_phrase().replace('"', ""), "section_type": random.choice(section_types), "status": random.choice(statuses), "target": fake.random_int(min=5, max=50), "limit": fake.random_int(min=3, max=30), "reviewer": fake.name(), } )
"reviewer": "Eddie Lake", } ) self.document_data[1].update( { "header": "Table of contents", "section_type": "Table of contents", "status": "Done", "target": 29, "limit": 24, "reviewer": "Eddie Lake", } ) self.document_data[2].update( { "header": "Executive summary", "section_type": "Narrative", "status": "Done", "target": 10, "limit": 13, "reviewer": "Eddie Lake", } ) self.document_data[3].update( { "header": "Technical approach", "section_type": "Narrative", "status": "Done", "target": 27, "limit": 23, "reviewer": "Jamik Tashpulatov", } ) @rx.event
@rx.event def set_visitor_timeframe(self, timeframe: str): self.selected_visitor_timeframe = timeframe if timeframe == "Last 3 months": self.displayed_visitor_data = self.visitor_data if timeframe == "Last 30 days": self.displayed_visitor_data = self.visitor_data[-30:] if timeframe == "Last 7 days": self.displayed_visitor_data = self.visitor_data[-7:] @rx.event def set_document_tab(self, tab: str): self.selected_document_tab = tab TOOLTIP_PROPS = { "separator": ": ", "cursor": False, "is_animation_active": False, "label_style": {"fontWeight": "500"}, "item_style": { "color": "currentColor", "display": "flex", "paddingBottom": "0px", "justifyContent": "space-between", "textTransform": "capitalize", }, "content_style": { "borderRadius": "5px", "boxShadow": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "font
def load_initial_data(self): """Load initial fake data if not already loaded.""" if ( not self.key_metrics and (not self.visitor_data) and (not self.document_data) ): self._generate_fake_data()
{ "header": "Table of contents", "section_type": "Table of contents", "status": "Done", "target": 29, "limit": 24, "reviewer": "Eddie Lake", } ) self.document_data[2].update( { "header": "Executive summary", "section_type": "Narrative", "status": "Done", "target": 10, "limit": 13, "reviewer": "Eddie Lake", } ) self.document_data[3].update( { "header": "Technical approach", "section_type": "Narrative", "status": "Done", "target": 27, "limit": 23, "reviewer": "Jamik Tashpulatov", } ) @rx.event def load_initial_data(self): """Load initial fake data if not already loaded."""
@rx.event def set_visitor_timeframe(self, timeframe: str): self.selected_visitor_timeframe = timeframe if timeframe == "Last 3 months": self.displayed_visitor_data = self.visitor_data if timeframe == "Last 30 days": self.displayed_visitor_data = self.visitor_data[-30:] if timeframe == "Last 7 days": self.displayed_visitor_data = self.visitor_data[-7:] @rx.event def set_document_tab(self, tab: str): self.selected_document_tab = tab TOOLTIP_PROPS = { "separator": ": ", "cursor": False, "is_animation_active": False, "label_style": {"fontWeight": "500"}, "item_style": { "color": "currentColor", "display": "flex", "paddingBottom": "0px", "justifyContent": "space-between", "textTransform": "capitalize", }, "content_style": { "borderRadius": "5px", "boxShadow": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "font
if ( not self.key_metrics and (not self.visitor_data) and (not self.document_data) ): self._generate_fake_data()
"limit": 24, "reviewer": "Eddie Lake", } ) self.document_data[2].update( { "header": "Executive summary", "section_type": "Narrative", "status": "Done", "target": 10, "limit": 13, "reviewer": "Eddie Lake", } ) self.document_data[3].update( { "header": "Technical approach", "section_type": "Narrative", "status": "Done", "target": 27, "limit": 23, "reviewer": "Jamik Tashpulatov", } ) @rx.event def load_initial_data(self): """Load initial fake data if not already loaded.""" if ( not self.key_metrics and (not self.visitor_data) and (not self.document_data) ): self._generate_fake_data() @rx.event
@rx.event def set_document_tab(self, tab: str): self.selected_document_tab = tab TOOLTIP_PROPS = { "separator": ": ", "cursor": False, "is_animation_active": False, "label_style": {"fontWeight": "500"}, "item_style": { "color": "currentColor", "display": "flex", "paddingBottom": "0px", "justifyContent": "space-between", "textTransform": "capitalize", }, "content_style": { "borderRadius": "5px", "boxShadow": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "fontSize": "0.75rem", "lineHeight": "1rem", "fontWeight": "500", "minWidth": "8rem", "width": "auto", "padding": "0.375rem 0.625rem", "backgroundColor": "white", "border": "1px solid #e2e8f0", }, }
def set_visitor_timeframe(self, timeframe: str): self.selected_visitor_timeframe = timeframe if timeframe == "Last 3 months": self.displayed_visitor_data = self.visitor_data if timeframe == "Last 30 days": self.displayed_visitor_data = self.visitor_data[-30:] if timeframe == "Last 7 days": self.displayed_visitor_data = self.visitor_data[-7:]
} ) self.document_data[2].update( { "header": "Executive summary", "section_type": "Narrative", "status": "Done", "target": 10, "limit": 13, "reviewer": "Eddie Lake", } ) self.document_data[3].update( { "header": "Technical approach", "section_type": "Narrative", "status": "Done", "target": 27, "limit": 23, "reviewer": "Jamik Tashpulatov", } ) @rx.event def load_initial_data(self): """Load initial fake data if not already loaded.""" if ( not self.key_metrics and (not self.visitor_data) and (not self.document_data) ): self._generate_fake_data() @rx.event def set_visitor_timeframe(self, timeframe: str):
if timeframe == "Last 3 months": self.displayed_visitor_data = self.visitor_data if timeframe == "Last 30 days": self.displayed_visitor_data = self.visitor_data[-30:] if timeframe == "Last 7 days": self.displayed_visitor_data = self.visitor_data[-7:] @rx.event def set_document_tab(self, tab: str): self.selected_document_tab = tab TOOLTIP_PROPS = { "separator": ": ", "cursor": False, "is_animation_active": False, "label_style": {"fontWeight": "500"}, "item_style": { "color": "currentColor", "display": "flex", "paddingBottom": "0px", "justifyContent": "space-between", "textTransform": "capitalize", }, "content_style": { "borderRadius": "5px", "boxShadow": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "fontSize": "0.75rem", "lineHeight": "1rem", "fontWeight": "500", "minWidth": "8rem", "width"
self.selected_visitor_timeframe = timeframe
].update( { "header": "Executive summary", "section_type": "Narrative", "status": "Done", "target": 10, "limit": 13, "reviewer": "Eddie Lake", } ) self.document_data[3].update( { "header": "Technical approach", "section_type": "Narrative", "status": "Done", "target": 27, "limit": 23, "reviewer": "Jamik Tashpulatov", } ) @rx.event def load_initial_data(self): """Load initial fake data if not already loaded.""" if ( not self.key_metrics and (not self.visitor_data) and (not self.document_data) ): self._generate_fake_data() @rx.event def set_visitor_timeframe(self, timeframe: str): self.selected_visitor_timeframe = timeframe
if timeframe == "Last 30 days": self.displayed_visitor_data = self.visitor_data[-30:] if timeframe == "Last 7 days": self.displayed_visitor_data = self.visitor_data[-7:] @rx.event def set_document_tab(self, tab: str): self.selected_document_tab = tab TOOLTIP_PROPS = { "separator": ": ", "cursor": False, "is_animation_active": False, "label_style": {"fontWeight": "500"}, "item_style": { "color": "currentColor", "display": "flex", "paddingBottom": "0px", "justifyContent": "space-between", "textTransform": "capitalize", }, "content_style": { "borderRadius": "5px", "boxShadow": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "fontSize": "0.75rem", "lineHeight": "1rem", "fontWeight": "500", "minWidth": "8rem", "width": "auto", "padding": "0.375rem 0.625rem", "backgroundColor": "white", "border"
if timeframe == "Last 3 months": self.displayed_visitor_data = self.visitor_data
"Narrative", "status": "Done", "target": 10, "limit": 13, "reviewer": "Eddie Lake", } ) self.document_data[3].update( { "header": "Technical approach", "section_type": "Narrative", "status": "Done", "target": 27, "limit": 23, "reviewer": "Jamik Tashpulatov", } ) @rx.event def load_initial_data(self): """Load initial fake data if not already loaded.""" if ( not self.key_metrics and (not self.visitor_data) and (not self.document_data) ): self._generate_fake_data() @rx.event def set_visitor_timeframe(self, timeframe: str): self.selected_visitor_timeframe = timeframe if timeframe == "Last 3 months": self.displayed_visitor_data = self.visitor_data
if timeframe == "Last 7 days": self.displayed_visitor_data = self.visitor_data[-7:] @rx.event def set_document_tab(self, tab: str): self.selected_document_tab = tab TOOLTIP_PROPS = { "separator": ": ", "cursor": False, "is_animation_active": False, "label_style": {"fontWeight": "500"}, "item_style": { "color": "currentColor", "display": "flex", "paddingBottom": "0px", "justifyContent": "space-between", "textTransform": "capitalize", }, "content_style": { "borderRadius": "5px", "boxShadow": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "fontSize": "0.75rem", "lineHeight": "1rem", "fontWeight": "500", "minWidth": "8rem", "width": "auto", "padding": "0.375rem 0.625rem", "backgroundColor": "white", "border": "1px solid #e2e8f0", }, }
if timeframe == "Last 30 days": self.displayed_visitor_data = self.visitor_data[-30:]
e", "target": 10, "limit": 13, "reviewer": "Eddie Lake", } ) self.document_data[3].update( { "header": "Technical approach", "section_type": "Narrative", "status": "Done", "target": 27, "limit": 23, "reviewer": "Jamik Tashpulatov", } ) @rx.event def load_initial_data(self): """Load initial fake data if not already loaded.""" if ( not self.key_metrics and (not self.visitor_data) and (not self.document_data) ): self._generate_fake_data() @rx.event def set_visitor_timeframe(self, timeframe: str): self.selected_visitor_timeframe = timeframe if timeframe == "Last 3 months": self.displayed_visitor_data = self.visitor_data if timeframe == "Last 30 days":
if timeframe == "Last 7 days": self.displayed_visitor_data = self.visitor_data[-7:] @rx.event def set_document_tab(self, tab: str): self.selected_document_tab = tab TOOLTIP_PROPS = { "separator": ": ", "cursor": False, "is_animation_active": False, "label_style": {"fontWeight": "500"}, "item_style": { "color": "currentColor", "display": "flex", "paddingBottom": "0px", "justifyContent": "space-between", "textTransform": "capitalize", }, "content_style": { "borderRadius": "5px", "boxShadow": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "fontSize": "0.75rem", "lineHeight": "1rem", "fontWeight": "500", "minWidth": "8rem", "width": "auto", "padding": "0.375rem 0.625rem", "backgroundColor": "white", "border": "1px solid #e2e8f0", }, }
self.displayed_visitor_data = self.visitor_data[-30:]
"reviewer": "Eddie Lake", } ) self.document_data[3].update( { "header": "Technical approach", "section_type": "Narrative", "status": "Done", "target": 27, "limit": 23, "reviewer": "Jamik Tashpulatov", } ) @rx.event def load_initial_data(self): """Load initial fake data if not already loaded.""" if ( not self.key_metrics and (not self.visitor_data) and (not self.document_data) ): self._generate_fake_data() @rx.event def set_visitor_timeframe(self, timeframe: str): self.selected_visitor_timeframe = timeframe if timeframe == "Last 3 months": self.displayed_visitor_data = self.visitor_data if timeframe == "Last 30 days": self.displayed_visitor_data = self.visitor_data[-30:]
@rx.event def set_document_tab(self, tab: str): self.selected_document_tab = tab TOOLTIP_PROPS = { "separator": ": ", "cursor": False, "is_animation_active": False, "label_style": {"fontWeight": "500"}, "item_style": { "color": "currentColor", "display": "flex", "paddingBottom": "0px", "justifyContent": "space-between", "textTransform": "capitalize", }, "content_style": { "borderRadius": "5px", "boxShadow": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "fontSize": "0.75rem", "lineHeight": "1rem", "fontWeight": "500", "minWidth": "8rem", "width": "auto", "padding": "0.375rem 0.625rem", "backgroundColor": "white", "border": "1px solid #e2e8f0", }, }
if timeframe == "Last 7 days": self.displayed_visitor_data = self.visitor_data[-7:]
} ) self.document_data[3].update( { "header": "Technical approach", "section_type": "Narrative", "status": "Done", "target": 27, "limit": 23, "reviewer": "Jamik Tashpulatov", } ) @rx.event def load_initial_data(self): """Load initial fake data if not already loaded.""" if ( not self.key_metrics and (not self.visitor_data) and (not self.document_data) ): self._generate_fake_data() @rx.event def set_visitor_timeframe(self, timeframe: str): self.selected_visitor_timeframe = timeframe if timeframe == "Last 3 months": self.displayed_visitor_data = self.visitor_data if timeframe == "Last 30 days": self.displayed_visitor_data = self.visitor_data[-30:] if timeframe == "Last 7 days":
@rx.event def set_document_tab(self, tab: str): self.selected_document_tab = tab TOOLTIP_PROPS = { "separator": ": ", "cursor": False, "is_animation_active": False, "label_style": {"fontWeight": "500"}, "item_style": { "color": "currentColor", "display": "flex", "paddingBottom": "0px", "justifyContent": "space-between", "textTransform": "capitalize", }, "content_style": { "borderRadius": "5px", "boxShadow": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "fontSize": "0.75rem", "lineHeight": "1rem", "fontWeight": "500", "minWidth": "8rem", "width": "auto", "padding": "0.375rem 0.625rem", "backgroundColor": "white", "border": "1px solid #e2e8f0", }, }
self.displayed_visitor_data = self.visitor_data[-7:]
{ "header": "Technical approach", "section_type": "Narrative", "status": "Done", "target": 27, "limit": 23, "reviewer": "Jamik Tashpulatov", } ) @rx.event def load_initial_data(self): """Load initial fake data if not already loaded.""" if ( not self.key_metrics and (not self.visitor_data) and (not self.document_data) ): self._generate_fake_data() @rx.event def set_visitor_timeframe(self, timeframe: str): self.selected_visitor_timeframe = timeframe if timeframe == "Last 3 months": self.displayed_visitor_data = self.visitor_data if timeframe == "Last 30 days": self.displayed_visitor_data = self.visitor_data[-30:] if timeframe == "Last 7 days": self.displayed_visitor_data = self.visitor_data[-7:] @rx.event
TOOLTIP_PROPS = { "separator": ": ", "cursor": False, "is_animation_active": False, "label_style": {"fontWeight": "500"}, "item_style": { "color": "currentColor", "display": "flex", "paddingBottom": "0px", "justifyContent": "space-between", "textTransform": "capitalize", }, "content_style": { "borderRadius": "5px", "boxShadow": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "fontSize": "0.75rem", "lineHeight": "1rem", "fontWeight": "500", "minWidth": "8rem", "width": "auto", "padding": "0.375rem 0.625rem", "backgroundColor": "white", "border": "1px solid #e2e8f0", }, }
def set_document_tab(self, tab: str): self.selected_document_tab = tab
ch", "section_type": "Narrative", "status": "Done", "target": 27, "limit": 23, "reviewer": "Jamik Tashpulatov", } ) @rx.event def load_initial_data(self): """Load initial fake data if not already loaded.""" if ( not self.key_metrics and (not self.visitor_data) and (not self.document_data) ): self._generate_fake_data() @rx.event def set_visitor_timeframe(self, timeframe: str): self.selected_visitor_timeframe = timeframe if timeframe == "Last 3 months": self.displayed_visitor_data = self.visitor_data if timeframe == "Last 30 days": self.displayed_visitor_data = self.visitor_data[-30:] if timeframe == "Last 7 days": self.displayed_visitor_data = self.visitor_data[-7:] @rx.event def set_document_tab(self, tab: str):
TOOLTIP_PROPS = { "separator": ": ", "cursor": False, "is_animation_active": False, "label_style": {"fontWeight": "500"}, "item_style": { "color": "currentColor", "display": "flex", "paddingBottom": "0px", "justifyContent": "space-between", "textTransform": "capitalize", }, "content_style": { "borderRadius": "5px", "boxShadow": "0px 2px 6px 0px rgba(0, 0, 0, 0.1)", "fontSize": "0.75rem", "lineHeight": "1rem", "fontWeight": "500", "minWidth": "8rem", "width": "auto", "padding": "0.375rem 0.625rem", "backgroundColor": "white", "border": "1px solid #e2e8f0", }, }
self.selected_document_tab = tab
from .components.stats_cards import stats_cards_group from .views.navbar import navbar from .views.table import main_table def index() -> rx.Component: return rx.vstack( navbar(), stats_cards_group(), rx.box( main_table(), width="100%", ), width="100%", spacing="6", padding_x=["1.5em", "1.5em", "3em"], ) app = rx.App( theme=rx.theme( appearance="dark", has_background=True, radius="large", accent_color="grass" ), ) app.add_page( index, title="Customer Data App", description="A simple app to manage customer data.", )
import reflex as rx
import reflex as rx
from .views.navbar import navbar from .views.table import main_table def index() -> rx.Component: return rx.vstack( navbar(), stats_cards_group(), rx.box( main_table(), width="100%", ), width="100%", spacing="6", padding_x=["1.5em", "1.5em", "3em"], ) app = rx.App( theme=rx.theme( appearance="dark", has_background=True, radius="large", accent_color="grass" ), ) app.add_page( index, title="Customer Data App", description="A simple app to manage customer data.", )
from .components.stats_cards import stats_cards_group