Spaces:
Sleeping
Sleeping
bug fix
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ from layout import init_session_state, apply_theme
|
|
| 3 |
from code_editor import render_code_editor
|
| 4 |
from chatbot import render_chatbot
|
| 5 |
|
|
|
|
| 6 |
st.set_page_config(
|
| 7 |
page_title="Pro Code Playground",
|
| 8 |
page_icon="π»",
|
|
@@ -10,23 +11,28 @@ st.set_page_config(
|
|
| 10 |
)
|
| 11 |
init_session_state()
|
| 12 |
|
|
|
|
| 13 |
st.title("Pro Code Playground")
|
| 14 |
st.markdown("Write, execute & export multi-language snippets, with builtβin AI assistance.")
|
| 15 |
|
| 16 |
-
# Theme
|
| 17 |
_, _, theme_col = st.columns([3, 6, 1])
|
| 18 |
with theme_col:
|
| 19 |
if st.button("π Dark Mode" if not st.session_state.dark_mode else "βοΈ Light Mode"):
|
| 20 |
st.session_state.dark_mode = not st.session_state.dark_mode
|
| 21 |
st.rerun()
|
| 22 |
|
|
|
|
| 23 |
colors, ace_theme = apply_theme()
|
| 24 |
|
|
|
|
| 25 |
editor_col, assistant_col = st.columns((2, 1), gap="large")
|
| 26 |
|
| 27 |
with editor_col:
|
| 28 |
st.subheader("Editor")
|
| 29 |
-
|
|
|
|
|
|
|
| 30 |
|
| 31 |
with assistant_col:
|
| 32 |
st.subheader("Code Assistant")
|
|
@@ -36,6 +42,7 @@ with assistant_col:
|
|
| 36 |
st.session_state.get("error_output", "")
|
| 37 |
)
|
| 38 |
|
|
|
|
| 39 |
st.markdown("""
|
| 40 |
<div style='text-align:center; margin-top:1rem; opacity:0.6;'>
|
| 41 |
Built with β€οΈ & Streamlit by Vaibhav
|
|
|
|
| 3 |
from code_editor import render_code_editor
|
| 4 |
from chatbot import render_chatbot
|
| 5 |
|
| 6 |
+
# ββ Page Config ββββββββββββββββββββββββββββββ
|
| 7 |
st.set_page_config(
|
| 8 |
page_title="Pro Code Playground",
|
| 9 |
page_icon="π»",
|
|
|
|
| 11 |
)
|
| 12 |
init_session_state()
|
| 13 |
|
| 14 |
+
# ββ Header βββββββββββββββββββββββββββββββββββ
|
| 15 |
st.title("Pro Code Playground")
|
| 16 |
st.markdown("Write, execute & export multi-language snippets, with builtβin AI assistance.")
|
| 17 |
|
| 18 |
+
# ββ Theme Toggle βββββββββββββββββββββββββββββ
|
| 19 |
_, _, theme_col = st.columns([3, 6, 1])
|
| 20 |
with theme_col:
|
| 21 |
if st.button("π Dark Mode" if not st.session_state.dark_mode else "βοΈ Light Mode"):
|
| 22 |
st.session_state.dark_mode = not st.session_state.dark_mode
|
| 23 |
st.rerun()
|
| 24 |
|
| 25 |
+
# ββ Apply Theme ββββββββββββββββββββββββββββββ
|
| 26 |
colors, ace_theme = apply_theme()
|
| 27 |
|
| 28 |
+
# ββ Layout βββββββββββββββββββββββββββββββββββ
|
| 29 |
editor_col, assistant_col = st.columns((2, 1), gap="large")
|
| 30 |
|
| 31 |
with editor_col:
|
| 32 |
st.subheader("Editor")
|
| 33 |
+
selected_lang = st.session_state.get("language", "Python")
|
| 34 |
+
editor_key = f"editor_{selected_lang}"
|
| 35 |
+
render_code_editor(selected_lang, ace_theme, editor_key)
|
| 36 |
|
| 37 |
with assistant_col:
|
| 38 |
st.subheader("Code Assistant")
|
|
|
|
| 42 |
st.session_state.get("error_output", "")
|
| 43 |
)
|
| 44 |
|
| 45 |
+
# ββ Footer βββββββββββββββββββββββββββββββββββ
|
| 46 |
st.markdown("""
|
| 47 |
<div style='text-align:center; margin-top:1rem; opacity:0.6;'>
|
| 48 |
Built with β€οΈ & Streamlit by Vaibhav
|