vsj0702 commited on
Commit
ca3a9c8
Β·
verified Β·
1 Parent(s): 7add1f7
Files changed (1) hide show
  1. app.py +9 -2
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 toggle only
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
- render_code_editor(ace_theme)
 
 
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