Update app.py
Browse files
app.py
CHANGED
|
@@ -355,21 +355,10 @@ def create_radar_chart(metrics):
|
|
| 355 |
|
| 356 |
return fig
|
| 357 |
|
| 358 |
-
|
| 359 |
-
"""Toggle between light and dark mode for interface elements"""
|
| 360 |
-
if dark_mode:
|
| 361 |
-
style = "background-color: #2e2e2e; color: #ffffff;"
|
| 362 |
-
code_style = "background-color: #1e1e1e; color: #e0e0e0; font-family: 'Courier New', monospace;"
|
| 363 |
-
else:
|
| 364 |
-
style = "background-color: #ffffff; color: #333333;"
|
| 365 |
-
code_style = "background-color: #f5f5f5; color: #333333; font-family: 'Courier New', monospace;"
|
| 366 |
-
|
| 367 |
-
return [style for _ in range(len(elements) // 2)] + [code_style for _ in range(len(elements) // 2)]
|
| 368 |
|
| 369 |
def main():
|
| 370 |
with gr.Blocks(title="Salesforce B2B Commerce Migration Assistant", theme=gr.themes.Soft(primary_hue="blue")) as app:
|
| 371 |
-
# Initialize dark mode state
|
| 372 |
-
dark_mode = gr.State(False)
|
| 373 |
|
| 374 |
gr.Markdown("# Salesforce B2B Commerce Migration Assistant")
|
| 375 |
gr.Markdown("This tool helps migrate CloudCraze code to B2B Lightning Experience.")
|
|
@@ -585,18 +574,38 @@ def main():
|
|
| 585 |
|
| 586 |
# UI Preferences
|
| 587 |
with gr.Accordion("UI Preferences", open=False):
|
| 588 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 589 |
|
| 590 |
-
#
|
| 591 |
-
|
| 592 |
-
|
| 593 |
-
|
| 594 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 595 |
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
|
| 599 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 600 |
)
|
| 601 |
|
| 602 |
gr.Markdown("### About This Tool")
|
|
|
|
| 355 |
|
| 356 |
return fig
|
| 357 |
|
| 358 |
+
# Theme functionality has been moved to inline function in main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
|
| 360 |
def main():
|
| 361 |
with gr.Blocks(title="Salesforce B2B Commerce Migration Assistant", theme=gr.themes.Soft(primary_hue="blue")) as app:
|
|
|
|
|
|
|
| 362 |
|
| 363 |
gr.Markdown("# Salesforce B2B Commerce Migration Assistant")
|
| 364 |
gr.Markdown("This tool helps migrate CloudCraze code to B2B Lightning Experience.")
|
|
|
|
| 574 |
|
| 575 |
# UI Preferences
|
| 576 |
with gr.Accordion("UI Preferences", open=False):
|
| 577 |
+
theme_radio = gr.Radio(
|
| 578 |
+
label="Theme",
|
| 579 |
+
choices=["Light", "Dark"],
|
| 580 |
+
value="Light"
|
| 581 |
+
)
|
| 582 |
|
| 583 |
+
# Simple theme change function that applies CSS to individual components
|
| 584 |
+
def change_theme(theme_choice):
|
| 585 |
+
if theme_choice == "Dark":
|
| 586 |
+
explanation_style = "background-color: #2e2e2e; color: #ffffff;"
|
| 587 |
+
code_style = "background-color: #1e1e1e; color: #e0e0e0; font-family: 'Courier New', monospace;"
|
| 588 |
+
else: # Light
|
| 589 |
+
explanation_style = "background-color: #ffffff; color: #333333;"
|
| 590 |
+
code_style = "background-color: #f5f5f5; color: #333333; font-family: 'Courier New', monospace;"
|
| 591 |
+
|
| 592 |
+
return (
|
| 593 |
+
explanation_style, # trigger_explanation
|
| 594 |
+
code_style, # trigger_code_output
|
| 595 |
+
explanation_style, # object_explanation
|
| 596 |
+
code_style # object_code_output
|
| 597 |
+
)
|
| 598 |
|
| 599 |
+
# Connect the theme radio to the change_theme function
|
| 600 |
+
theme_radio.change(
|
| 601 |
+
fn=change_theme,
|
| 602 |
+
inputs=[theme_radio],
|
| 603 |
+
outputs=[
|
| 604 |
+
trigger_explanation,
|
| 605 |
+
trigger_code_output,
|
| 606 |
+
object_explanation,
|
| 607 |
+
object_code_output
|
| 608 |
+
]
|
| 609 |
)
|
| 610 |
|
| 611 |
gr.Markdown("### About This Tool")
|