@danhachuel/thunderbolt 0.4.5 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/app/main.py +22 -2
  2. package/package.json +1 -1
package/app/main.py CHANGED
@@ -7136,12 +7136,29 @@ def main():
7136
7136
  st.session_state["page"] = target
7137
7137
  st.rerun()
7138
7138
 
7139
+ def is_nav_target_active(target: str) -> bool:
7140
+ """Return whether a menu target or one of its children is the current page."""
7141
+ if current_page == target:
7142
+ return True
7143
+ return any(child[0] == current_page for child in groups.get(target, []))
7144
+
7139
7145
  def render_nav_button(target: str, icon: str, label: str, scope: str):
7140
7146
  display_label = ui_text(label, ui_language)
7141
- if st.button(display_label, key=f"nav_{scope}_{target}", icon=icon, use_container_width=True, type="primary" if current_page == target else "secondary"):
7147
+ if st.button(display_label, key=f"nav_{scope}_{target}", icon=icon, use_container_width=True, type="primary" if is_nav_target_active(target) else "secondary"):
7142
7148
  navigate(target)
7143
7149
 
7144
7150
  with st.sidebar:
7151
+ st.markdown(
7152
+ """
7153
+ <style>
7154
+ section[data-testid="stSidebar"] [data-testid="stExpander"] summary strong {
7155
+ color: #c4b5fd;
7156
+ font-weight: 750;
7157
+ }
7158
+ </style>
7159
+ """,
7160
+ unsafe_allow_html=True,
7161
+ )
7145
7162
  version_markup = f'<span class="tb-brand-version">{APP_VERSION_LABEL}</span>' if APP_VERSION_LABEL else ""
7146
7163
  st.markdown(f'<div class="tb-brand"><span class="tb-brand-name">Thunderbolt</span>{version_markup}</div>', unsafe_allow_html=True)
7147
7164
  for target, icon, label in top_pages:
@@ -7150,7 +7167,10 @@ def main():
7150
7167
  render_nav_button(target, icon, label, "top")
7151
7168
  continue
7152
7169
  child_targets = {item[0] for item in children}
7153
- with st.expander(ui_text(label, ui_language), expanded=current_page in child_targets, icon=icon):
7170
+ group_active = is_nav_target_active(target)
7171
+ group_label = f"**{ui_text(label, ui_language)}**" if group_active else ui_text(label, ui_language)
7172
+ group_icon = ":material/radio_button_checked:" if group_active else icon
7173
+ with st.expander(group_label, expanded=current_page in child_targets, icon=group_icon):
7154
7174
  for child_target, child_icon, child_label in children:
7155
7175
  render_nav_button(child_target, child_icon, child_label, target)
7156
7176
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",