dina1 commited on
Commit
d0b3192
·
verified ·
1 Parent(s): 4736882

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -2
app.py CHANGED
@@ -109,17 +109,48 @@ SVG_FLUENT = {
109
  # -----------------------
110
  # Sidebar Generator
111
  # -----------------------
112
- def generate_sidebar(app_title, active_label="Dashboard"):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  sidebar_html = "<div class='sidebar'>"
114
  sidebar_html += f"<div class='sidebar-header'>{SVG_FLUENT['hamburger']} {app_title}</div>"
 
 
115
  defaults = [("home", "Home"), ("recent", "Recent"), ("pinned", "Pinned")]
116
  for key, label in defaults:
117
  sidebar_html += f"<div class='sidebar-item'>{SVG_FLUENT[key]}<span>{label}</span></div>"
 
 
118
  sidebar_html += "<div class='sidebar-section'>My Work</div>"
119
- sidebar_html += f"<div class='sidebar-item active'><svg viewBox='0 0 24 24'><circle cx='12' cy='12' r='5' fill='#c5c5c5'/></svg><span>{active_label}</span></div>"
 
 
 
 
 
 
 
 
120
  sidebar_html += "</div>"
121
  return sidebar_html
122
 
 
123
  # -----------------------
124
  # Analyze Business PDF → Generate Multi-Screen HTML
125
  # -----------------------
 
109
  # -----------------------
110
  # Sidebar Generator
111
  # -----------------------
112
+ # -----------------------
113
+ # Sidebar Generator (Enhanced with unique icons)
114
+ # -----------------------
115
+ def generate_sidebar(app_title, screens, active_label="Dashboard"):
116
+ """
117
+ Dynamically builds the sidebar with unique icons for each screen.
118
+ The current screen (active_label) is highlighted in blue.
119
+ """
120
+
121
+ # Additional Fluent-style icons for screens
122
+ SCREEN_ICONS = [
123
+ """<svg viewBox="0 0 24 24"><path fill="#c5c5c5" d="M3 13h2v-2H3v2zm4 0h14v-2H7v2zm-4 5h2v-2H3v2zm4 0h14v-2H7v2zM3 8h2V6H3v2zm4 0h14V6H7v2z"/></svg>""", # list-style
124
+ """<svg viewBox="0 0 24 24"><path fill="#c5c5c5" d="M19 3H5a2 2 0 0 0-2 2v14l4-4h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2z"/></svg>""", # message/note
125
+ """<svg viewBox="0 0 24 24"><path fill="#c5c5c5" d="M3 3h18v4H3V3zm0 7h18v4H3v-4zm0 7h18v4H3v-4z"/></svg>""", # stacked docs
126
+ """<svg viewBox="0 0 24 24"><path fill="#c5c5c5" d="M12 2a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2zm1 15h-2v-2h2zm0-4h-2V7h2z"/></svg>""", # info icon
127
+ """<svg viewBox="0 0 24 24"><path fill="#c5c5c5" d="M12 4a8 8 0 0 0 0 16 8 8 0 1 0 0-16zm1 11h-2v-2h2zm0-4h-2V7h2z"/></svg>""", # alert-like
128
+ """<svg viewBox="0 0 24 24"><path fill="#c5c5c5" d="M12 2L2 7l10 5 10-5-10-5zm0 7l10 5-10 5-10-5 10-5zm0 7l10 5-10 5-10-5 10-5z"/></svg>""" # layered archive
129
+ ]
130
+
131
  sidebar_html = "<div class='sidebar'>"
132
  sidebar_html += f"<div class='sidebar-header'>{SVG_FLUENT['hamburger']} {app_title}</div>"
133
+
134
+ # Default static options
135
  defaults = [("home", "Home"), ("recent", "Recent"), ("pinned", "Pinned")]
136
  for key, label in defaults:
137
  sidebar_html += f"<div class='sidebar-item'>{SVG_FLUENT[key]}<span>{label}</span></div>"
138
+
139
+ # Dynamic section
140
  sidebar_html += "<div class='sidebar-section'>My Work</div>"
141
+ for i, screen in enumerate(screens):
142
+ screen_name = screen.get("screen_name", f"Screen {i+1}")
143
+ active_class = "active" if screen_name == active_label else ""
144
+ icon_svg = SCREEN_ICONS[i % len(SCREEN_ICONS)]
145
+ if active_class:
146
+ # Make active icon blue
147
+ icon_svg = icon_svg.replace("#c5c5c5", "#fff")
148
+ sidebar_html += f"<div class='sidebar-item {active_class}'>{icon_svg}<span>{screen_name}</span></div>"
149
+
150
  sidebar_html += "</div>"
151
  return sidebar_html
152
 
153
+
154
  # -----------------------
155
  # Analyze Business PDF → Generate Multi-Screen HTML
156
  # -----------------------