Update app.py
Browse files
app.py
CHANGED
@@ -194,36 +194,38 @@ def workspace_page():
|
|
194 |
def project_view_page():
|
195 |
# Sidebar with logout and return buttons
|
196 |
st.sidebar.title(f"Project: {st.session_state.current_project}")
|
|
|
|
|
197 |
if st.sidebar.button("Log Out"):
|
198 |
st.session_state.authenticated = False
|
199 |
st.session_state.username = None
|
200 |
st.session_state.page = "login"
|
201 |
-
if st.sidebar.button("Back to Workspace"):
|
202 |
-
st.session_state.page = "workspace"
|
203 |
|
204 |
-
#
|
205 |
st.subheader(f"Project: {st.session_state.current_project}")
|
206 |
-
|
207 |
-
project_folder = os.path.join(user_folder, st.session_state.current_project)
|
208 |
-
|
209 |
-
st.write("File structure:")
|
210 |
|
211 |
-
|
212 |
-
|
213 |
-
|
|
|
214 |
|
215 |
-
|
216 |
-
if level == 0:
|
217 |
-
st.write(f"π {os.path.basename(root)}")
|
218 |
-
else:
|
219 |
-
with st.expander(f"{indent}π {os.path.basename(root)}"):
|
220 |
-
sub_indent = " " * 4 * (level + 1)
|
221 |
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
|
|
|
|
|
|
227 |
|
228 |
if __name__ == "__main__":
|
229 |
main()
|
|
|
194 |
def project_view_page():
|
195 |
# Sidebar with logout and return buttons
|
196 |
st.sidebar.title(f"Project: {st.session_state.current_project}")
|
197 |
+
if st.sidebar.button("Back to Workspace"):
|
198 |
+
st.session_state.page = "workspace"
|
199 |
if st.sidebar.button("Log Out"):
|
200 |
st.session_state.authenticated = False
|
201 |
st.session_state.username = None
|
202 |
st.session_state.page = "login"
|
|
|
|
|
203 |
|
204 |
+
# Main content for project page
|
205 |
st.subheader(f"Project: {st.session_state.current_project}")
|
206 |
+
st.write("Manage your project and explore its files.")
|
|
|
|
|
|
|
207 |
|
208 |
+
# Button to display file structure
|
209 |
+
if st.button("Show File Structure"):
|
210 |
+
user_folder = os.path.join("user_projects", st.session_state.username)
|
211 |
+
project_folder = os.path.join(user_folder, st.session_state.current_project)
|
212 |
|
213 |
+
st.write("File structure:")
|
|
|
|
|
|
|
|
|
|
|
214 |
|
215 |
+
for root, dirs, files in os.walk(project_folder):
|
216 |
+
level = root.replace(project_folder, "").count(os.sep)
|
217 |
+
indent = " " * 4 * level
|
218 |
|
219 |
+
# Display the folder name
|
220 |
+
if level == 0:
|
221 |
+
st.write(f"π {os.path.basename(root)}")
|
222 |
+
else:
|
223 |
+
with st.expander(f"{indent}π {os.path.basename(root)}"):
|
224 |
+
sub_indent = " " * 4 * (level + 1)
|
225 |
|
226 |
+
# List files in the folder
|
227 |
+
for file in files:
|
228 |
+
st.write(f"{sub_indent}π {file}")
|
229 |
|
230 |
if __name__ == "__main__":
|
231 |
main()
|