File size: 1,929 Bytes
28e7fd6
1a353ec
c217967
 
28e7fd6
ca3a9c8
1a89634
 
 
 
 
76b1b72
ee225de
ca3a9c8
b8523b7
73d1f25
 
ca3a9c8
36e1e5a
a8a25ed
36e1e5a
e23907d
 
a8a25ed
ca3a9c8
a8a25ed
0ba5b95
ca3a9c8
1a89634
 
 
b8523b7
0a67d05
28e7fd6
1a89634
b8523b7
 
100b6c8
0602068
b8523b7
 
ee225de
 
ca3a9c8
ab2413a
1a353ec
c61b525
ee225de
73d1f25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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)