Update app.py
Browse files
app.py
CHANGED
@@ -69,6 +69,10 @@ def main():
|
|
69 |
workspace_page()
|
70 |
elif st.session_state.page == "project_view":
|
71 |
project_view_page()
|
|
|
|
|
|
|
|
|
72 |
|
73 |
def login_page():
|
74 |
st.subheader("Please Log In or Register to Continue")
|
@@ -194,29 +198,52 @@ def workspace_page():
|
|
194 |
except Exception as e:
|
195 |
st.error(f"Failed to clone repository: {e}")
|
196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
def project_view_page():
|
198 |
# Sidebar with logout and return buttons
|
199 |
st.sidebar.title(f"Project: {st.session_state.current_project}")
|
200 |
if st.sidebar.button("Back to Workspace"):
|
201 |
st.session_state.page = "workspace"
|
|
|
202 |
if st.sidebar.button("Log Out"):
|
203 |
st.session_state.authenticated = False
|
204 |
st.session_state.username = None
|
205 |
st.session_state.page = "login"
|
206 |
-
|
207 |
-
# Initialize toggle state for file structure
|
208 |
-
if "show_file_structure" not in st.session_state:
|
209 |
-
st.session_state.show_file_structure = False
|
210 |
|
211 |
# Main content for project page
|
212 |
st.subheader(f"Project: {st.session_state.current_project}")
|
213 |
st.write("Manage your project and explore its files.")
|
214 |
|
215 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
if st.button("Show File Structure"):
|
217 |
st.session_state.show_file_structure = not st.session_state.show_file_structure
|
218 |
|
219 |
-
# Display file structure if toggled on
|
220 |
if st.session_state.show_file_structure:
|
221 |
user_folder = os.path.join("user_projects", st.session_state.username)
|
222 |
project_folder = os.path.join(user_folder, st.session_state.current_project)
|
@@ -227,18 +254,16 @@ def project_view_page():
|
|
227 |
level = root.replace(project_folder, "").count(os.sep)
|
228 |
indent = " " * 4 * level
|
229 |
|
230 |
-
# Display the folder name
|
231 |
if level == 0:
|
232 |
st.write(f"π {os.path.basename(root)}")
|
233 |
else:
|
234 |
with st.expander(f"{indent}π {os.path.basename(root)}"):
|
235 |
sub_indent = " " * 4 * (level + 1)
|
236 |
-
|
237 |
-
# List files in the folder
|
238 |
for file in files:
|
239 |
st.write(f"{sub_indent}π {file}")
|
240 |
|
241 |
|
|
|
242 |
if __name__ == "__main__":
|
243 |
main()
|
244 |
|
|
|
69 |
workspace_page()
|
70 |
elif st.session_state.page == "project_view":
|
71 |
project_view_page()
|
72 |
+
elif st.session_state.page == "generate_documentation":
|
73 |
+
generate_documentation_page()
|
74 |
+
elif st.session_state.page == "view_documentation":
|
75 |
+
view_documentation_page()
|
76 |
|
77 |
def login_page():
|
78 |
st.subheader("Please Log In or Register to Continue")
|
|
|
198 |
except Exception as e:
|
199 |
st.error(f"Failed to clone repository: {e}")
|
200 |
|
201 |
+
def generate_documentation_page():
|
202 |
+
st.subheader(f"Generate Documentation for {st.session_state.current_project}")
|
203 |
+
st.write("This page will allow the user to generate documentation for the selected project.")
|
204 |
+
if st.button("Back to Project"):
|
205 |
+
st.session_state.page = "project_view"
|
206 |
+
st.rerun()
|
207 |
+
|
208 |
+
def view_documentation_page():
|
209 |
+
st.subheader(f"View Documentation for {st.session_state.current_project}")
|
210 |
+
st.write("This page will display the generated documentation for the selected project.")
|
211 |
+
if st.button("Back to Project"):
|
212 |
+
st.session_state.page = "project_view"
|
213 |
+
st.rerun()
|
214 |
+
|
215 |
def project_view_page():
|
216 |
# Sidebar with logout and return buttons
|
217 |
st.sidebar.title(f"Project: {st.session_state.current_project}")
|
218 |
if st.sidebar.button("Back to Workspace"):
|
219 |
st.session_state.page = "workspace"
|
220 |
+
st.rerun()
|
221 |
if st.sidebar.button("Log Out"):
|
222 |
st.session_state.authenticated = False
|
223 |
st.session_state.username = None
|
224 |
st.session_state.page = "login"
|
225 |
+
st.rerun()
|
|
|
|
|
|
|
226 |
|
227 |
# Main content for project page
|
228 |
st.subheader(f"Project: {st.session_state.current_project}")
|
229 |
st.write("Manage your project and explore its files.")
|
230 |
|
231 |
+
# Buttons for documentation functionality
|
232 |
+
if st.button("Generate Documentation"):
|
233 |
+
st.session_state.page = "generate_documentation"
|
234 |
+
st.rerun()
|
235 |
+
|
236 |
+
if st.button("View Documentation"):
|
237 |
+
st.session_state.page = "view_documentation"
|
238 |
+
st.rerun()
|
239 |
+
|
240 |
+
# Toggle file structure display (if required)
|
241 |
+
if "show_file_structure" not in st.session_state:
|
242 |
+
st.session_state.show_file_structure = False
|
243 |
+
|
244 |
if st.button("Show File Structure"):
|
245 |
st.session_state.show_file_structure = not st.session_state.show_file_structure
|
246 |
|
|
|
247 |
if st.session_state.show_file_structure:
|
248 |
user_folder = os.path.join("user_projects", st.session_state.username)
|
249 |
project_folder = os.path.join(user_folder, st.session_state.current_project)
|
|
|
254 |
level = root.replace(project_folder, "").count(os.sep)
|
255 |
indent = " " * 4 * level
|
256 |
|
|
|
257 |
if level == 0:
|
258 |
st.write(f"π {os.path.basename(root)}")
|
259 |
else:
|
260 |
with st.expander(f"{indent}π {os.path.basename(root)}"):
|
261 |
sub_indent = " " * 4 * (level + 1)
|
|
|
|
|
262 |
for file in files:
|
263 |
st.write(f"{sub_indent}π {file}")
|
264 |
|
265 |
|
266 |
+
|
267 |
if __name__ == "__main__":
|
268 |
main()
|
269 |
|