Skip to content

Commit 4f4254b

Browse files
committed
Enhance settings dropdown to reflect app state for chart size, marker visibility, legend display, line width, and theme toggle options.
1 parent 11f28c2 commit 4f4254b

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

dashboard/components/settings.py

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,31 @@ def create_settings_button(text: str, batch_name: str, action: str, tooltip: str
2424
def create_settings_dropdown(batch_name: str) -> DropDownNavContainer:
2525
"""Create the settings dropdown menu."""
2626
buttons = [
27-
("small charts", "toggle-size", "Toggle between compact and full-size chart views"),
27+
(
28+
"large charts" if app.state.small_charts else "small charts",
29+
"toggle-size",
30+
"Toggle between compact and full-size chart views"
31+
),
2832
(
2933
"two columns" if not app.state.two_columns else "one column",
3034
"toggle-columns",
3135
"Display charts in one or two columns"
3236
),
33-
("show markers", "toggle-markers", "Show/hide data point markers on the charts"),
34-
("show legend", "toggle-legend", "Display chart legends"),
35-
("narrow lines", "toggle-line-width", "Toggle between narrow and normal line thickness"),
37+
(
38+
"hide markers" if app.state.show_markers else "show markers",
39+
"toggle-markers",
40+
"Show/hide data point markers on the charts"
41+
),
42+
(
43+
"hide legend" if app.state.show_legend else "show legend",
44+
"toggle-legend",
45+
"Display chart legends"
46+
),
47+
(
48+
"normal lines" if not app.state.line_width == 2 else "narrow lines",
49+
"toggle-line-width",
50+
"Toggle between narrow and normal line thickness"
51+
),
3652
]
3753

3854
menu_items = [
@@ -42,8 +58,12 @@ def create_settings_dropdown(batch_name: str) -> DropDownNavContainer:
4258

4359
menu_items.extend([
4460
NavDividerLi(),
45-
create_settings_button("dark mode", batch_name, "toggle-theme",
46-
"Switch between light and dark color themes")
61+
create_settings_button(
62+
"dark mode" if not app.state.dark_mode else "light mode",
63+
batch_name,
64+
"toggle-theme",
65+
"Switch between light and dark color themes"
66+
)
4767
])
4868

4969
return DropDownNavContainer(NavHeaderLi("settings"), *menu_items)

0 commit comments

Comments
 (0)