GuglielmoTor commited on
Commit
4239e37
Β·
verified Β·
1 Parent(s): 6cbd816

Update ui/ui_generators.py

Browse files
Files changed (1) hide show
  1. ui/ui_generators.py +31 -45
ui/ui_generators.py CHANGED
@@ -764,16 +764,15 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
764
  min-height: 400px;
765
  }
766
 
767
- /* MODIFIED: Removed .report-content .markdown as the component is now gr.HTML */
768
- /* and direct styling is handled by the overall CSS */
769
- .report-content .gr-html { /* Target the inner HTML component directly */
770
  padding: 40px;
771
  font-size: 1.1rem;
772
  line-height: 1.8;
773
  }
774
 
775
- /* Typography Enhancements */
776
- .report-content h1 {
777
  font-size: 2.2rem;
778
  font-weight: 700;
779
  color: #1a1a1a;
@@ -782,7 +781,7 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
782
  letter-spacing: -0.02em;
783
  }
784
 
785
- .report-content h2 {
786
  font-size: 1.8rem;
787
  font-weight: 600;
788
  color: #1a1a1a;
@@ -792,7 +791,7 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
792
  border-bottom: 2px solid #e6e6e6;
793
  }
794
 
795
- .report-content h3 {
796
  font-size: 1.4rem;
797
  font-weight: 600;
798
  color: #2c2c2c;
@@ -800,34 +799,34 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
800
  margin-bottom: 16px;
801
  }
802
 
803
- .report-content p {
804
  margin-bottom: 20px;
805
  color: #292929;
806
  font-size: 1.1rem;
807
  }
808
 
809
- .report-content ul, .report-content ol {
810
  margin-bottom: 20px;
811
  padding-left: 24px;
812
  }
813
 
814
- .report-content li {
815
  margin-bottom: 8px;
816
  color: #292929;
817
  }
818
 
819
- .report-content strong {
820
  font-weight: 600;
821
  color: #1a1a1a;
822
  }
823
 
824
- .report-content em {
825
  font-style: italic;
826
  color: #4a4a4a;
827
  }
828
 
829
  /* Quote Styling */
830
- .report-content blockquote {
831
  border-left: 4px solid #667eea;
832
  padding-left: 20px;
833
  margin: 24px 0;
@@ -839,7 +838,7 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
839
  }
840
 
841
  /* Code Styling */
842
- .report-content code {
843
  background: #f1f3f4;
844
  padding: 2px 6px;
845
  border-radius: 4px;
@@ -889,15 +888,15 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
889
  padding: 24px;
890
  }
891
 
892
- .report-content .gr-html { /* Target the inner HTML component directly */
893
  padding: 24px;
894
  }
895
 
896
- .report-content h1 {
897
  font-size: 1.8rem;
898
  }
899
 
900
- .report-content h2 {
901
  font-size: 1.5rem;
902
  }
903
 
@@ -907,8 +906,7 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
907
  }
908
 
909
  /* Gradio Component Overrides */
910
- /* REMOVED: .gradio-container .report-content .markdown as component is now gr.HTML */
911
- .gradio-container .report-content .gr-html { /* Target the inner HTML component directly */
912
  background: transparent !important;
913
  border: none !important;
914
  }
@@ -926,25 +924,9 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
926
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
927
  }
928
 
929
- /* Loading Animation */
930
  .loading-indicator {
931
- display: flex;
932
- align-items: center;
933
- justify-content: center;
934
- padding: 40px;
935
- color: #6b6b6b;
936
- }
937
-
938
- /* MODIFIED: Removed animation for hourglass */
939
- .loading-indicator::before {
940
- content: "⏳";
941
- margin-right: 12px;
942
- /* animation: spin 2s linear infinite; */ /* REMOVED ANIMATION */
943
- }
944
-
945
- @keyframes spin {
946
- 0% { transform: rotate(0deg); }
947
- 100% { transform: rotate(360deg); }
948
  }
949
  </style>
950
  """
@@ -956,7 +938,8 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
956
  with gr.Column(elem_classes=["report-container"]):
957
  # Header section
958
  with gr.Column(elem_classes=["report-header"]):
959
- gr.HTML("""
 
960
  <div class="report-title">πŸ“Š Comprehensive Analysis Report</div>
961
  <div class="report-subtitle">AI-Generated Insights from Your LinkedIn Data</div>
962
  <div class="status-badge">Generated from Bubble.io</div>
@@ -972,10 +955,10 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
972
  </div>
973
  """)
974
 
975
- # Status indicator
976
  agentic_pipeline_status_md = gr.Markdown(
977
  "πŸ”„ **Status:** Loading report data...",
978
- elem_classes=["loading-indicator"]
979
  )
980
 
981
  # Report selector dropdown
@@ -990,8 +973,8 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
990
 
991
  # Report content display area
992
  with gr.Column(elem_classes=["report-content"]):
993
- # MODIFIED: Changed from gr.Markdown to gr.HTML to render raw HTML from format_report_for_display
994
- agentic_report_display_md = gr.HTML(
995
  """
996
  <div class="empty-state">
997
  <div class="empty-state-icon">πŸ“„</div>
@@ -1001,11 +984,12 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
1001
  </div>
1002
  </div>
1003
  """,
1004
- elem_classes=["gr-html"] # Changed elem_classes to target gr-html if needed
 
1005
  )
1006
 
1007
  # Error handling for when modules are not loaded
1008
- if not agentic_modules_loaded_status:
1009
  gr.HTML("""
1010
  <div style="
1011
  background: #fee;
@@ -1024,4 +1008,6 @@ def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
1024
  </div>
1025
  """)
1026
 
1027
- return agentic_pipeline_status_md, report_selector_dd, agentic_report_display_md
 
 
 
764
  min-height: 400px;
765
  }
766
 
767
+ /* MODIFIED: Adjusted target for the report body's content */
768
+ .report-body-content { /* New class for the Markdown content container */
 
769
  padding: 40px;
770
  font-size: 1.1rem;
771
  line-height: 1.8;
772
  }
773
 
774
+ /* Typography Enhancements for the Markdown content */
775
+ .report-body-content h1 {
776
  font-size: 2.2rem;
777
  font-weight: 700;
778
  color: #1a1a1a;
 
781
  letter-spacing: -0.02em;
782
  }
783
 
784
+ .report-body-content h2 {
785
  font-size: 1.8rem;
786
  font-weight: 600;
787
  color: #1a1a1a;
 
791
  border-bottom: 2px solid #e6e6e6;
792
  }
793
 
794
+ .report-body-content h3 {
795
  font-size: 1.4rem;
796
  font-weight: 600;
797
  color: #2c2c2c;
 
799
  margin-bottom: 16px;
800
  }
801
 
802
+ .report-body-content p {
803
  margin-bottom: 20px;
804
  color: #292929;
805
  font-size: 1.1rem;
806
  }
807
 
808
+ .report-body-content ul, .report-body-content ol {
809
  margin-bottom: 20px;
810
  padding-left: 24px;
811
  }
812
 
813
+ .report-body-content li {
814
  margin-bottom: 8px;
815
  color: #292929;
816
  }
817
 
818
+ .report-body-content strong {
819
  font-weight: 600;
820
  color: #1a1a1a;
821
  }
822
 
823
+ .report-body-content em {
824
  font-style: italic;
825
  color: #4a4a4a;
826
  }
827
 
828
  /* Quote Styling */
829
+ .report-body-content blockquote {
830
  border-left: 4px solid #667eea;
831
  padding-left: 20px;
832
  margin: 24px 0;
 
838
  }
839
 
840
  /* Code Styling */
841
+ .report-body-content code {
842
  background: #f1f3f4;
843
  padding: 2px 6px;
844
  border-radius: 4px;
 
888
  padding: 24px;
889
  }
890
 
891
+ .report-body-content { /* Target the inner HTML component directly */
892
  padding: 24px;
893
  }
894
 
895
+ .report-body-content h1 {
896
  font-size: 1.8rem;
897
  }
898
 
899
+ .report-body-content h2 {
900
  font-size: 1.5rem;
901
  }
902
 
 
906
  }
907
 
908
  /* Gradio Component Overrides */
909
+ .report-content .gradio-container {
 
910
  background: transparent !important;
911
  border: none !important;
912
  }
 
924
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
925
  }
926
 
927
+ /* Loading Indicator: Hidden by default */
928
  .loading-indicator {
929
+ display: none !important; /* Hide the entire loading indicator block */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
930
  }
931
  </style>
932
  """
 
938
  with gr.Column(elem_classes=["report-container"]):
939
  # Header section
940
  with gr.Column(elem_classes=["report-header"]):
941
+ # This HTML component will display the dynamic title and subtitle
942
+ report_header_html_display = gr.HTML("""
943
  <div class="report-title">πŸ“Š Comprehensive Analysis Report</div>
944
  <div class="report-subtitle">AI-Generated Insights from Your LinkedIn Data</div>
945
  <div class="status-badge">Generated from Bubble.io</div>
 
955
  </div>
956
  """)
957
 
958
+ # Status indicator (now hidden by default via CSS)
959
  agentic_pipeline_status_md = gr.Markdown(
960
  "πŸ”„ **Status:** Loading report data...",
961
+ elem_classes=["loading-indicator"] # This class now hides the element
962
  )
963
 
964
  # Report selector dropdown
 
973
 
974
  # Report content display area
975
  with gr.Column(elem_classes=["report-content"]):
976
+ # This Markdown component will display the actual report text, formatted as Markdown
977
+ report_body_markdown_display = gr.Markdown(
978
  """
979
  <div class="empty-state">
980
  <div class="empty-state-icon">πŸ“„</div>
 
984
  </div>
985
  </div>
986
  """,
987
+ # Apply styles to the content within the Markdown component using a wrapper div
988
+ elem_classes=["report-body-content"]
989
  )
990
 
991
  # Error handling for when modules are not loaded
992
+ if not agentic_modules_loaded_loaded_status:
993
  gr.HTML("""
994
  <div style="
995
  background: #fee;
 
1008
  </div>
1009
  """)
1010
 
1011
+ # Return both header HTML and body Markdown components for app.py to update
1012
+ return agentic_pipeline_status_md, report_selector_dd, report_header_html_display, report_body_markdown_display
1013
+