Update app.py
Browse files
app.py
CHANGED
@@ -641,9 +641,9 @@ def saved_documentation_page():
|
|
641 |
def project_view_page():
|
642 |
# Sidebar with logout and return buttons
|
643 |
st.sidebar.image("SimplifAI Logo Long.jpeg", use_container_width=True)
|
644 |
-
st.sidebar.title(f"Project: {st.session_state.current_project}")
|
645 |
-
if st.sidebar.button("Back to Project Staging"):
|
646 |
-
st.session_state.page = "
|
647 |
st.rerun()
|
648 |
if st.sidebar.button("Log Out"):
|
649 |
st.session_state.authenticated = False
|
@@ -651,10 +651,24 @@ def project_view_page():
|
|
651 |
st.session_state.page = "login"
|
652 |
st.rerun()
|
653 |
|
|
|
|
|
|
|
|
|
|
|
654 |
# Main content for project page
|
655 |
st.subheader(f"Project: {st.session_state.current_project}")
|
656 |
st.write("Manage your project and explore its files.")
|
657 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
658 |
# Calculate number of files and lines of code
|
659 |
file_count = 0
|
660 |
total_lines = 0
|
@@ -674,8 +688,8 @@ def project_view_page():
|
|
674 |
st.write("### Project Metrics")
|
675 |
st.metric(label="Total Files", value=file_count)
|
676 |
st.metric(label="Lines of Code", value=total_lines)
|
677 |
-
|
678 |
-
|
679 |
st.write("### Actions")
|
680 |
col1, col2, col3 = st.columns(3)
|
681 |
|
@@ -698,14 +712,10 @@ def project_view_page():
|
|
698 |
st.session_state.show_file_structure = False
|
699 |
|
700 |
if st.session_state.show_file_structure:
|
701 |
-
|
702 |
-
project_folder = os.path.join(user_folder, st.session_state.current_project)
|
703 |
-
|
704 |
-
st.write("File structure:")
|
705 |
-
|
706 |
for root, dirs, files in os.walk(project_folder):
|
707 |
level = root.replace(project_folder, "").count(os.sep)
|
708 |
-
indent = "
|
709 |
|
710 |
if level == 0:
|
711 |
st.write(f"📂 {os.path.basename(root)}")
|
|
|
641 |
def project_view_page():
|
642 |
# Sidebar with logout and return buttons
|
643 |
st.sidebar.image("SimplifAI Logo Long.jpeg", use_container_width=True)
|
644 |
+
st.sidebar.title(f"Project: {st.session_state.current_project if st.session_state.current_project else 'No Project Selected'}")
|
645 |
+
if st.sidebar.button("Back to Project Staging"):
|
646 |
+
st.session_state.page = "workspace"
|
647 |
st.rerun()
|
648 |
if st.sidebar.button("Log Out"):
|
649 |
st.session_state.authenticated = False
|
|
|
651 |
st.session_state.page = "login"
|
652 |
st.rerun()
|
653 |
|
654 |
+
# Ensure a project is selected
|
655 |
+
if not st.session_state.current_project:
|
656 |
+
st.error("No project selected. Please select a project from the Project Staging page.")
|
657 |
+
return
|
658 |
+
|
659 |
# Main content for project page
|
660 |
st.subheader(f"Project: {st.session_state.current_project}")
|
661 |
st.write("Manage your project and explore its files.")
|
662 |
|
663 |
+
# Get project folder path
|
664 |
+
user_folder = os.path.join("user_projects", st.session_state.username)
|
665 |
+
project_folder = os.path.join(user_folder, st.session_state.current_project)
|
666 |
+
|
667 |
+
# Check if the project folder exists
|
668 |
+
if not os.path.exists(project_folder):
|
669 |
+
st.error(f"Project folder not found: {project_folder}")
|
670 |
+
return
|
671 |
+
|
672 |
# Calculate number of files and lines of code
|
673 |
file_count = 0
|
674 |
total_lines = 0
|
|
|
688 |
st.write("### Project Metrics")
|
689 |
st.metric(label="Total Files", value=file_count)
|
690 |
st.metric(label="Lines of Code", value=total_lines)
|
691 |
+
|
692 |
+
# Buttons for documentation functionality (side-by-side)
|
693 |
st.write("### Actions")
|
694 |
col1, col2, col3 = st.columns(3)
|
695 |
|
|
|
712 |
st.session_state.show_file_structure = False
|
713 |
|
714 |
if st.session_state.show_file_structure:
|
715 |
+
st.write("### Project File Structure")
|
|
|
|
|
|
|
|
|
716 |
for root, dirs, files in os.walk(project_folder):
|
717 |
level = root.replace(project_folder, "").count(os.sep)
|
718 |
+
indent = " " * 4 * level
|
719 |
|
720 |
if level == 0:
|
721 |
st.write(f"📂 {os.path.basename(root)}")
|