Spaces:
Running
Running
Update ui/ui_generators.py
Browse files- ui/ui_generators.py +359 -1
ui/ui_generators.py
CHANGED
@@ -521,7 +521,7 @@ def build_home_tab_ui():
|
|
521 |
|
522 |
with gr.Column():
|
523 |
btn_help = gr.Button("π Documentation", variant="secondary", size="lg",
|
524 |
-
|
525 |
|
526 |
# How it works section with enhanced styling
|
527 |
gr.HTML("""
|
@@ -662,3 +662,361 @@ def build_analytics_tab_plot_area(plot_configs):
|
|
662 |
|
663 |
return plot_ui_objects, section_titles_map
|
664 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
|
522 |
with gr.Column():
|
523 |
btn_help = gr.Button("π Documentation", variant="secondary", size="lg",
|
524 |
+
elem_classes="nav-button", scale=1)
|
525 |
|
526 |
# How it works section with enhanced styling
|
527 |
gr.HTML("""
|
|
|
662 |
|
663 |
return plot_ui_objects, section_titles_map
|
664 |
|
665 |
+
|
666 |
+
def create_enhanced_report_tab(agentic_modules_loaded_status: bool):
|
667 |
+
"""
|
668 |
+
Creates an enhanced report tab with Medium-style design for optimal readability.
|
669 |
+
This function returns the Gradio components that will be updated.
|
670 |
+
"""
|
671 |
+
|
672 |
+
# Custom CSS for Medium-style design
|
673 |
+
report_css = """
|
674 |
+
<style>
|
675 |
+
/* Medium-style Report Container */
|
676 |
+
.report-container {
|
677 |
+
max-width: 800px;
|
678 |
+
margin: 0 auto;
|
679 |
+
padding: 40px 20px;
|
680 |
+
font-family: 'Georgia', 'Charter', 'Times New Roman', serif;
|
681 |
+
line-height: 1.6;
|
682 |
+
color: #292929;
|
683 |
+
background: #ffffff;
|
684 |
+
}
|
685 |
+
|
686 |
+
/* Header Section */
|
687 |
+
.report-header {
|
688 |
+
text-align: center;
|
689 |
+
margin-bottom: 48px;
|
690 |
+
padding-bottom: 24px;
|
691 |
+
border-bottom: 1px solid #e6e6e6;
|
692 |
+
}
|
693 |
+
|
694 |
+
.report-title {
|
695 |
+
font-size: 2.5rem;
|
696 |
+
font-weight: 700;
|
697 |
+
color: #1a1a1a;
|
698 |
+
margin-bottom: 16px;
|
699 |
+
letter-spacing: -0.02em;
|
700 |
+
}
|
701 |
+
|
702 |
+
.report-subtitle {
|
703 |
+
font-size: 1.2rem;
|
704 |
+
color: #6b6b6b;
|
705 |
+
font-weight: 400;
|
706 |
+
margin-bottom: 24px;
|
707 |
+
}
|
708 |
+
|
709 |
+
/* Status Badge */
|
710 |
+
.status-badge {
|
711 |
+
display: inline-flex;
|
712 |
+
align-items: center;
|
713 |
+
padding: 8px 16px;
|
714 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
715 |
+
color: white;
|
716 |
+
border-radius: 20px;
|
717 |
+
font-size: 0.9rem;
|
718 |
+
font-weight: 500;
|
719 |
+
margin-bottom: 16px;
|
720 |
+
}
|
721 |
+
|
722 |
+
.status-badge::before {
|
723 |
+
content: "οΏ½";
|
724 |
+
margin-right: 8px;
|
725 |
+
}
|
726 |
+
|
727 |
+
/* Report Selection Area */
|
728 |
+
.report-selection {
|
729 |
+
background: #f8f9fa;
|
730 |
+
padding: 32px;
|
731 |
+
border-radius: 12px;
|
732 |
+
margin-bottom: 40px;
|
733 |
+
border: 1px solid #e9ecef;
|
734 |
+
}
|
735 |
+
|
736 |
+
.selection-title {
|
737 |
+
font-size: 1.3rem;
|
738 |
+
font-weight: 600;
|
739 |
+
color: #1a1a1a;
|
740 |
+
margin-bottom: 16px;
|
741 |
+
display: flex;
|
742 |
+
align-items: center;
|
743 |
+
}
|
744 |
+
|
745 |
+
.selection-title::before {
|
746 |
+
content: "π";
|
747 |
+
margin-right: 12px;
|
748 |
+
font-size: 1.5rem;
|
749 |
+
}
|
750 |
+
|
751 |
+
.selection-description {
|
752 |
+
color: #6b6b6b;
|
753 |
+
margin-bottom: 24px;
|
754 |
+
font-size: 1.05rem;
|
755 |
+
}
|
756 |
+
|
757 |
+
/* Report Content Area */
|
758 |
+
.report-content {
|
759 |
+
background: white;
|
760 |
+
padding: 0;
|
761 |
+
border-radius: 8px;
|
762 |
+
box-shadow: 0 2px 12px rgba(0,0,0,0.04);
|
763 |
+
border: 1px solid #e9ecef;
|
764 |
+
min-height: 400px;
|
765 |
+
}
|
766 |
+
|
767 |
+
.report-content .markdown {
|
768 |
+
padding: 40px;
|
769 |
+
font-size: 1.1rem;
|
770 |
+
line-height: 1.8;
|
771 |
+
}
|
772 |
+
|
773 |
+
/* Typography Enhancements */
|
774 |
+
.report-content h1 {
|
775 |
+
font-size: 2.2rem;
|
776 |
+
font-weight: 700;
|
777 |
+
color: #1a1a1a;
|
778 |
+
margin-bottom: 24px;
|
779 |
+
margin-top: 0;
|
780 |
+
letter-spacing: -0.02em;
|
781 |
+
}
|
782 |
+
|
783 |
+
.report-content h2 {
|
784 |
+
font-size: 1.8rem;
|
785 |
+
font-weight: 600;
|
786 |
+
color: #1a1a1a;
|
787 |
+
margin-top: 48px;
|
788 |
+
margin-bottom: 20px;
|
789 |
+
padding-bottom: 12px;
|
790 |
+
border-bottom: 2px solid #e6e6e6;
|
791 |
+
}
|
792 |
+
|
793 |
+
.report-content h3 {
|
794 |
+
font-size: 1.4rem;
|
795 |
+
font-weight: 600;
|
796 |
+
color: #2c2c2c;
|
797 |
+
margin-top: 36px;
|
798 |
+
margin-bottom: 16px;
|
799 |
+
}
|
800 |
+
|
801 |
+
.report-content p {
|
802 |
+
margin-bottom: 20px;
|
803 |
+
color: #292929;
|
804 |
+
font-size: 1.1rem;
|
805 |
+
}
|
806 |
+
|
807 |
+
.report-content ul, .report-content ol {
|
808 |
+
margin-bottom: 20px;
|
809 |
+
padding-left: 24px;
|
810 |
+
}
|
811 |
+
|
812 |
+
.report-content li {
|
813 |
+
margin-bottom: 8px;
|
814 |
+
color: #292929;
|
815 |
+
}
|
816 |
+
|
817 |
+
.report-content strong {
|
818 |
+
font-weight: 600;
|
819 |
+
color: #1a1a1a;
|
820 |
+
}
|
821 |
+
|
822 |
+
.report-content em {
|
823 |
+
font-style: italic;
|
824 |
+
color: #4a4a4a;
|
825 |
+
}
|
826 |
+
|
827 |
+
/* Quote Styling */
|
828 |
+
.report-content blockquote {
|
829 |
+
border-left: 4px solid #667eea;
|
830 |
+
padding-left: 20px;
|
831 |
+
margin: 24px 0;
|
832 |
+
font-style: italic;
|
833 |
+
color: #4a4a4a;
|
834 |
+
background: #f8f9fa;
|
835 |
+
padding: 20px;
|
836 |
+
border-radius: 4px;
|
837 |
+
}
|
838 |
+
|
839 |
+
/* Code Styling */
|
840 |
+
.report-content code {
|
841 |
+
background: #f1f3f4;
|
842 |
+
padding: 2px 6px;
|
843 |
+
border-radius: 4px;
|
844 |
+
font-family: 'Monaco', 'Menlo', monospace;
|
845 |
+
font-size: 0.9em;
|
846 |
+
color: #d73a49;
|
847 |
+
}
|
848 |
+
|
849 |
+
/* Empty State */
|
850 |
+
.empty-state {
|
851 |
+
text-align: center;
|
852 |
+
padding: 80px 40px;
|
853 |
+
color: #6b6b6b;
|
854 |
+
}
|
855 |
+
|
856 |
+
.empty-state-icon {
|
857 |
+
font-size: 4rem;
|
858 |
+
margin-bottom: 24px;
|
859 |
+
opacity: 0.6;
|
860 |
+
}
|
861 |
+
|
862 |
+
.empty-state-title {
|
863 |
+
font-size: 1.5rem;
|
864 |
+
font-weight: 600;
|
865 |
+
margin-bottom: 12px;
|
866 |
+
color: #4a4a4a;
|
867 |
+
}
|
868 |
+
|
869 |
+
.empty-state-description {
|
870 |
+
font-size: 1.1rem;
|
871 |
+
line-height: 1.6;
|
872 |
+
max-width: 400px;
|
873 |
+
margin: 0 auto;
|
874 |
+
}
|
875 |
+
|
876 |
+
/* Responsive Design */
|
877 |
+
@media (max-width: 768px) {
|
878 |
+
.report-container {
|
879 |
+
padding: 24px 16px;
|
880 |
+
}
|
881 |
+
|
882 |
+
.report-title {
|
883 |
+
font-size: 2rem;
|
884 |
+
}
|
885 |
+
|
886 |
+
.report-selection {
|
887 |
+
padding: 24px;
|
888 |
+
}
|
889 |
+
|
890 |
+
.report-content .markdown {
|
891 |
+
padding: 24px;
|
892 |
+
}
|
893 |
+
|
894 |
+
.report-content h1 {
|
895 |
+
font-size: 1.8rem;
|
896 |
+
}
|
897 |
+
|
898 |
+
.report-content h2 {
|
899 |
+
font-size: 1.5rem;
|
900 |
+
}
|
901 |
+
|
902 |
+
.empty-state {
|
903 |
+
padding: 60px 20px;
|
904 |
+
}
|
905 |
+
}
|
906 |
+
|
907 |
+
/* Gradio Component Overrides */
|
908 |
+
.gradio-container .report-content .markdown {
|
909 |
+
background: transparent !important;
|
910 |
+
border: none !important;
|
911 |
+
}
|
912 |
+
|
913 |
+
/* Dropdown Styling */
|
914 |
+
.report-selection .gr-dropdown {
|
915 |
+
background: white;
|
916 |
+
border: 2px solid #e9ecef;
|
917 |
+
border-radius: 8px;
|
918 |
+
font-size: 1.05rem;
|
919 |
+
}
|
920 |
+
|
921 |
+
.report-selection .gr-dropdown:focus {
|
922 |
+
border-color: #667eea;
|
923 |
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
924 |
+
}
|
925 |
+
|
926 |
+
/* Loading Animation */
|
927 |
+
.loading-indicator {
|
928 |
+
display: flex;
|
929 |
+
align-items: center;
|
930 |
+
justify-content: center;
|
931 |
+
padding: 40px;
|
932 |
+
color: #6b6b6b;
|
933 |
+
}
|
934 |
+
|
935 |
+
.loading-indicator::before {
|
936 |
+
content: "β³";
|
937 |
+
margin-right: 12px;
|
938 |
+
animation: spin 2s linear infinite;
|
939 |
+
}
|
940 |
+
|
941 |
+
@keyframes spin {
|
942 |
+
0% { transform: rotate(0deg); }
|
943 |
+
100% { transform: rotate(360deg); }
|
944 |
+
}
|
945 |
+
</style>
|
946 |
+
"""
|
947 |
+
|
948 |
+
# Inject custom CSS
|
949 |
+
gr.HTML(report_css)
|
950 |
+
|
951 |
+
# Main container
|
952 |
+
with gr.Column(elem_classes=["report-container"]):
|
953 |
+
# Header section
|
954 |
+
with gr.Column(elem_classes=["report-header"]):
|
955 |
+
gr.HTML("""
|
956 |
+
<div class="report-title">π Comprehensive Analysis Report</div>
|
957 |
+
<div class="report-subtitle">AI-Generated Insights from Your LinkedIn Data</div>
|
958 |
+
<div class="status-badge">Generated from Bubble.io</div>
|
959 |
+
""")
|
960 |
+
|
961 |
+
# Report selection section
|
962 |
+
with gr.Column(elem_classes=["report-selection"]):
|
963 |
+
gr.HTML("""
|
964 |
+
<div class="selection-title">Report Library</div>
|
965 |
+
<div class="selection-description">
|
966 |
+
Select a pre-generated report from your analysis library to view detailed insights,
|
967 |
+
trends, and recommendations based on your LinkedIn organization data.
|
968 |
+
</div>
|
969 |
+
""")
|
970 |
+
|
971 |
+
# Status indicator
|
972 |
+
agentic_pipeline_status_md = gr.Markdown(
|
973 |
+
"π **Status:** Loading report data...",
|
974 |
+
elem_classes=["loading-indicator"]
|
975 |
+
)
|
976 |
+
|
977 |
+
# Report selector dropdown
|
978 |
+
with gr.Row():
|
979 |
+
report_selector_dd = gr.Dropdown(
|
980 |
+
label="π Select Report",
|
981 |
+
choices=[],
|
982 |
+
interactive=True,
|
983 |
+
info="Choose from your available analysis reports",
|
984 |
+
elem_classes=["report-dropdown"]
|
985 |
+
)
|
986 |
+
|
987 |
+
# Report content display area
|
988 |
+
with gr.Column(elem_classes=["report-content"]):
|
989 |
+
agentic_report_display_md = gr.Markdown(
|
990 |
+
"""
|
991 |
+
<div class="empty-state">
|
992 |
+
<div class="empty-state-icon">π</div>
|
993 |
+
<div class="empty-state-title">No Report Selected</div>
|
994 |
+
<div class="empty-state-description">
|
995 |
+
Please select a report from the library above to view its detailed analysis and insights.
|
996 |
+
</div>
|
997 |
+
</div>
|
998 |
+
""",
|
999 |
+
elem_classes=["markdown"]
|
1000 |
+
)
|
1001 |
+
|
1002 |
+
# Error handling for when modules are not loaded
|
1003 |
+
if not agentic_modules_loaded_status:
|
1004 |
+
gr.HTML("""
|
1005 |
+
<div style="
|
1006 |
+
background: #fee;
|
1007 |
+
border: 1px solid #fcc;
|
1008 |
+
border-radius: 8px;
|
1009 |
+
padding: 20px;
|
1010 |
+
margin-top: 20px;
|
1011 |
+
text-align: center;
|
1012 |
+
">
|
1013 |
+
<div style="color: #c33; font-size: 1.2rem; font-weight: 600; margin-bottom: 8px;">
|
1014 |
+
β οΈ Module Loading Error
|
1015 |
+
</div>
|
1016 |
+
<div style="color: #666;">
|
1017 |
+
Agentic analysis modules could not be loaded. Please check your configuration.
|
1018 |
+
</div>
|
1019 |
+
</div>
|
1020 |
+
""")
|
1021 |
+
|
1022 |
+
return agentic_pipeline_status_md, report_selector_dd, agentic_report_display_md
|