Spaces:
Running
Running
| import streamlit as st | |
| from layout import init_session_state, apply_theme | |
| from code_editor import render_code_editor | |
| from chatbot import render_chatbot | |
| # ββ Page Config ββββββββββββββββββββββββββββββ | |
| st.set_page_config( | |
| page_title="Pro Code Playground", | |
| page_icon="π»", | |
| layout="wide" | |
| ) | |
| init_session_state() | |
| # ββ Header βββββββββββββββββββββββββββββββββββ | |
| st.title("Pro Code Playground") | |
| st.markdown("Write, execute & export multi-language snippets, with builtβin AI assistance.") | |
| # ββ Theme Toggle βββββββββββββββββββββββββββββ | |
| _, _, theme_col = st.columns([3, 6, 1]) | |
| with theme_col: | |
| if st.button("π Dark Mode" if not st.session_state.dark_mode else "βοΈ Light Mode"): | |
| st.session_state.dark_mode = not st.session_state.dark_mode | |
| st.rerun() | |
| # ββ Apply Theme ββββββββββββββββββββββββββββββ | |
| colors, ace_theme = apply_theme() | |
| # ββ Layout βββββββββββββββββββββββββββββββββββ | |
| editor_col, assistant_col = st.columns((2, 1), gap="large") | |
| with editor_col: | |
| st.subheader("Editor") | |
| render_code_editor(ace_theme) | |
| with assistant_col: | |
| st.subheader("Code Assistant") | |
| render_chatbot( | |
| st.session_state.code, | |
| st.session_state.get("stdin", ""), | |
| st.session_state.get("code_output", ""), | |
| st.session_state.get("error_output", "") | |
| ) | |
| # ββ Footer βββββββββββββββββββββββββββββββββββ | |
| st.markdown(""" | |
| <div style='text-align:center; margin-top:1rem; opacity:0.6;'> | |
| Built with β€οΈ & Streamlit by Vaibhav | |
| </div> | |
| """, unsafe_allow_html=True) | |