Spaces:
Running
Running
Asish Karthikeya Gogineni commited on
Commit ·
134ff3d
1
Parent(s): c00752d
Refactor Code Studio UI to use horizontal tabs
Browse files- components/style.py +51 -34
- pages/1_⚡_Code_Studio.py +5 -2
components/style.py
CHANGED
|
@@ -12,84 +12,101 @@ def apply_custom_css():
|
|
| 12 |
except:
|
| 13 |
pass
|
| 14 |
|
| 15 |
-
st.markdown(
|
| 16 |
<style>
|
| 17 |
-
:root {
|
| 18 |
--glass-bg: rgba(30, 41, 59, 0.7);
|
| 19 |
--glass-border: rgba(255, 255, 255, 0.1);
|
| 20 |
-
}
|
| 21 |
|
| 22 |
/* Global Text */
|
| 23 |
-
p, div, span, label, h1, h2, h3, h4, h5, h6, .stMarkdown {
|
| 24 |
color: #E2E8F0 !important;
|
| 25 |
-
}
|
| 26 |
|
| 27 |
/* Sidebar */
|
| 28 |
-
section[data-testid="stSidebar"] {
|
| 29 |
background: rgba(11, 12, 16, 0.95);
|
| 30 |
border-right: 1px solid var(--glass-border);
|
| 31 |
-
}
|
| 32 |
|
| 33 |
/* Buttons */
|
| 34 |
-
.stButton button {
|
| 35 |
background: linear-gradient(135deg, #0EA5E9 0%, #2563EB 100%);
|
| 36 |
color: white !important;
|
| 37 |
border: none;
|
| 38 |
border-radius: 8px;
|
| 39 |
font-weight: 600;
|
| 40 |
-
}
|
| 41 |
-
.stButton button:hover {
|
| 42 |
transform: translateY(-1px);
|
| 43 |
box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
|
| 44 |
-
}
|
| 45 |
|
| 46 |
/* Chat Messages */
|
| 47 |
-
.stChatMessage {
|
| 48 |
background: var(--glass-bg);
|
| 49 |
border: 1px solid var(--glass-border);
|
| 50 |
border-radius: 12px;
|
| 51 |
-
}
|
| 52 |
-
.stChatMessage[data-testid="stChatMessage"]:nth-child(even) {
|
| 53 |
border-left: 3px solid #38BDF8;
|
| 54 |
background: linear-gradient(90deg, rgba(56, 189, 248, 0.05) 0%, rgba(15, 23, 42, 0.6) 100%);
|
| 55 |
-
}
|
| 56 |
|
| 57 |
/* IDE Layout & Scrolling */
|
| 58 |
-
.main .block-container {
|
| 59 |
max-width: 100% !important;
|
| 60 |
-
padding-
|
| 61 |
-
padding-
|
| 62 |
-
|
|
|
|
| 63 |
overflow: hidden;
|
| 64 |
-
}
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
overflow-y: auto;
|
| 69 |
overflow-x: hidden;
|
| 70 |
scrollbar-width: thin;
|
| 71 |
-
}
|
| 72 |
|
| 73 |
-
.stCode {
|
| 74 |
-
max-height:
|
| 75 |
overflow-y: auto !important;
|
| 76 |
-
}
|
| 77 |
|
| 78 |
/* Scrollbar styling */
|
| 79 |
-
::-webkit-scrollbar {
|
| 80 |
width: 6px;
|
| 81 |
height: 6px;
|
| 82 |
-
}
|
| 83 |
-
::-webkit-scrollbar-track {
|
| 84 |
background: transparent;
|
| 85 |
-
}
|
| 86 |
-
::-webkit-scrollbar-thumb {
|
| 87 |
background: #475569;
|
| 88 |
border-radius: 3px;
|
| 89 |
-
}
|
| 90 |
|
| 91 |
/* Source Chips */
|
| 92 |
-
.source-chip {
|
| 93 |
background: rgba(30, 41, 59, 0.4);
|
| 94 |
border: 1px solid rgba(148, 163, 184, 0.2);
|
| 95 |
border-radius: 6px;
|
|
@@ -101,6 +118,6 @@ def apply_custom_css():
|
|
| 101 |
gap: 6px;
|
| 102 |
margin-right: 8px;
|
| 103 |
margin-bottom: 8px;
|
| 104 |
-
}
|
| 105 |
</style>
|
| 106 |
""", unsafe_allow_html=True)
|
|
|
|
| 12 |
except:
|
| 13 |
pass
|
| 14 |
|
| 15 |
+
st.markdown("""
|
| 16 |
<style>
|
| 17 |
+
:root {
|
| 18 |
--glass-bg: rgba(30, 41, 59, 0.7);
|
| 19 |
--glass-border: rgba(255, 255, 255, 0.1);
|
| 20 |
+
}
|
| 21 |
|
| 22 |
/* Global Text */
|
| 23 |
+
p, div, span, label, h1, h2, h3, h4, h5, h6, .stMarkdown {
|
| 24 |
color: #E2E8F0 !important;
|
| 25 |
+
}
|
| 26 |
|
| 27 |
/* Sidebar */
|
| 28 |
+
section[data-testid="stSidebar"] {
|
| 29 |
background: rgba(11, 12, 16, 0.95);
|
| 30 |
border-right: 1px solid var(--glass-border);
|
| 31 |
+
}
|
| 32 |
|
| 33 |
/* Buttons */
|
| 34 |
+
.stButton button {
|
| 35 |
background: linear-gradient(135deg, #0EA5E9 0%, #2563EB 100%);
|
| 36 |
color: white !important;
|
| 37 |
border: none;
|
| 38 |
border-radius: 8px;
|
| 39 |
font-weight: 600;
|
| 40 |
+
}
|
| 41 |
+
.stButton button:hover {
|
| 42 |
transform: translateY(-1px);
|
| 43 |
box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
|
| 44 |
+
}
|
| 45 |
|
| 46 |
/* Chat Messages */
|
| 47 |
+
.stChatMessage {
|
| 48 |
background: var(--glass-bg);
|
| 49 |
border: 1px solid var(--glass-border);
|
| 50 |
border-radius: 12px;
|
| 51 |
+
}
|
| 52 |
+
.stChatMessage[data-testid="stChatMessage"]:nth-child(even) {
|
| 53 |
border-left: 3px solid #38BDF8;
|
| 54 |
background: linear-gradient(90deg, rgba(56, 189, 248, 0.05) 0%, rgba(15, 23, 42, 0.6) 100%);
|
| 55 |
+
}
|
| 56 |
|
| 57 |
/* IDE Layout & Scrolling */
|
| 58 |
+
.main .block-container {
|
| 59 |
max-width: 100% !important;
|
| 60 |
+
padding-top: 1rem !important; /* Minimized top padding */
|
| 61 |
+
padding-left: 1rem !important;
|
| 62 |
+
padding-right: 1rem !important;
|
| 63 |
+
max-height: 100vh;
|
| 64 |
overflow: hidden;
|
| 65 |
+
}
|
| 66 |
|
| 67 |
+
/* Align Tabs with Editor */
|
| 68 |
+
.stTabs [data-baseweb="tab-list"] {
|
| 69 |
+
gap: 2px;
|
| 70 |
+
background-color: transparent;
|
| 71 |
+
}
|
| 72 |
+
.stTabs [data-baseweb="tab"] {
|
| 73 |
+
height: 50px;
|
| 74 |
+
white-space: pre-wrap;
|
| 75 |
+
border-radius: 4px 4px 0px 0px;
|
| 76 |
+
gap: 2px;
|
| 77 |
+
padding-top: 0px;
|
| 78 |
+
padding-bottom: 0px;
|
| 79 |
+
color: #f8fafc !important; /* Force white text */
|
| 80 |
+
font-weight: 600;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
div[data-testid="column"] {
|
| 84 |
+
max-height: calc(100vh - 60px);
|
| 85 |
overflow-y: auto;
|
| 86 |
overflow-x: hidden;
|
| 87 |
scrollbar-width: thin;
|
| 88 |
+
}
|
| 89 |
|
| 90 |
+
.stCode {
|
| 91 |
+
max-height: 75vh !important;
|
| 92 |
overflow-y: auto !important;
|
| 93 |
+
}
|
| 94 |
|
| 95 |
/* Scrollbar styling */
|
| 96 |
+
::-webkit-scrollbar {
|
| 97 |
width: 6px;
|
| 98 |
height: 6px;
|
| 99 |
+
}
|
| 100 |
+
::-webkit-scrollbar-track {
|
| 101 |
background: transparent;
|
| 102 |
+
}
|
| 103 |
+
::-webkit-scrollbar-thumb {
|
| 104 |
background: #475569;
|
| 105 |
border-radius: 3px;
|
| 106 |
+
}
|
| 107 |
|
| 108 |
/* Source Chips */
|
| 109 |
+
.source-chip {
|
| 110 |
background: rgba(30, 41, 59, 0.4);
|
| 111 |
border: 1px solid rgba(148, 163, 184, 0.2);
|
| 112 |
border-radius: 6px;
|
|
|
|
| 118 |
gap: 6px;
|
| 119 |
margin-right: 8px;
|
| 120 |
margin-bottom: 8px;
|
| 121 |
+
}
|
| 122 |
</style>
|
| 123 |
""", unsafe_allow_html=True)
|
pages/1_⚡_Code_Studio.py
CHANGED
|
@@ -30,8 +30,8 @@ if "processed_files" not in st.session_state or not st.session_state.processed_f
|
|
| 30 |
|
| 31 |
# --- Layout ---
|
| 32 |
# We use a 2-column layout: Side Panel (with Tabs) | Main Editor
|
| 33 |
-
# Ratio: 3
|
| 34 |
-
col_panel, col_editor = st.columns([3
|
| 35 |
|
| 36 |
# --- Side Panel (Tabs) ---
|
| 37 |
with col_panel:
|
|
@@ -74,6 +74,9 @@ with col_editor:
|
|
| 74 |
if selected_file:
|
| 75 |
# We use a container to ensure height consistency
|
| 76 |
with st.container():
|
|
|
|
|
|
|
|
|
|
| 77 |
# Breadcrumbs / File Header
|
| 78 |
filename = os.path.basename(selected_file)
|
| 79 |
st.caption(f"Editing: {filename}")
|
|
|
|
| 30 |
|
| 31 |
# --- Layout ---
|
| 32 |
# We use a 2-column layout: Side Panel (with Tabs) | Main Editor
|
| 33 |
+
# Ratio: 3 : 7 - Narrower side panel for better proportion
|
| 34 |
+
col_panel, col_editor = st.columns([3, 7])
|
| 35 |
|
| 36 |
# --- Side Panel (Tabs) ---
|
| 37 |
with col_panel:
|
|
|
|
| 74 |
if selected_file:
|
| 75 |
# We use a container to ensure height consistency
|
| 76 |
with st.container():
|
| 77 |
+
# Alignment Spacer: Matches the height of st.tabs headers (~50px)
|
| 78 |
+
st.markdown("<div style='height: 50px;'></div>", unsafe_allow_html=True)
|
| 79 |
+
|
| 80 |
# Breadcrumbs / File Header
|
| 81 |
filename = os.path.basename(selected_file)
|
| 82 |
st.caption(f"Editing: {filename}")
|