From 699c3c1dba6ed7c67cab66d20129962bb58b9840 Mon Sep 17 00:00:00 2001 From: Irina Rueegg Date: Fri, 27 Mar 2026 15:56:15 +0100 Subject: [PATCH] Anpassung Options & Sidebar --- frontend/app.py | 23 +++++++---------------- frontend/sidebar.py | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/frontend/app.py b/frontend/app.py index 04b9c09..bfba19c 100644 --- a/frontend/app.py +++ b/frontend/app.py @@ -8,18 +8,9 @@ sys.path.insert(0, str(Path(__file__).parent.parent)) from frontend.sidebar import render_sidebar from frontend.editor import render_editor from frontend.chat import render_chat +from frontend.state import init_state - -def init_state(): - """Initialize session state variables.""" - if "selected_file" not in st.session_state: - st.session_state.selected_file = None - if "file_content" not in st.session_state: - st.session_state.file_content = "" - if "chat_history" not in st.session_state: - st.session_state.chat_history = [] - if "code_output" not in st.session_state: - st.session_state.code_output = "" +init_state() def main(): @@ -37,13 +28,13 @@ def main(): choice = render_sidebar() with right: - if choice == "Chat with AI Assistant": + if "Chat with AI Assistant" in choice: render_chat() - elif choice == "Code Editor": + if "Code Editor" in choice: render_editor() - elif choice == "File Explorer": - st.subheader("File Explorer") - st.info("File Explorer functionality is not implemented yet.") + #elif choice == "File Explorer": + # st.subheader("File Explorer") + # st.info("File Explorer functionality is not implemented yet.") if __name__ == "__main__": main() diff --git a/frontend/sidebar.py b/frontend/sidebar.py index 0c914a1..7e26017 100644 --- a/frontend/sidebar.py +++ b/frontend/sidebar.py @@ -3,8 +3,22 @@ import streamlit as st def render_sidebar(): st.sidebar.title("Navigation") - options = ["Chat with AI Assistant", "Code Editor", "File Explorer"] - choice = st.sidebar.radio("Go to:", options) + navigation_section = st.sidebar.container() + file_explorer_section = st.sidebar.container() + + with navigation_section: + options = ["Code Editor", "Chat with AI Assistant"] + choice = [] + + for option in options: + if st.sidebar.checkbox(option): + choice.append(option) + + with file_explorer_section: + st.sidebar.subheader("File Explorer") + st.sidebar.info("File Explorer functionality is not implemented yet.") + # selected_file = st.sidebar.file_uploader("Upload a file", type=["py", "txt", "md"]) + return choice