Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1144,6 +1144,7 @@ body::before {
|
|
| 1144 |
text-align: center !important;
|
| 1145 |
text-shadow: 3px 3px 0px rgba(150, 120, 200, 0.6), 6px 6px 0px rgba(0, 0, 0, 0.2) !important;
|
| 1146 |
font-weight: 600 !important;
|
|
|
|
| 1147 |
}
|
| 1148 |
|
| 1149 |
.top-right-login {
|
|
@@ -1164,6 +1165,7 @@ body::before {
|
|
| 1164 |
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
|
| 1165 |
border: 3px solid rgba(100, 100, 100, 0.8) !important;
|
| 1166 |
backdrop-filter: blur(10px) !important;
|
|
|
|
| 1167 |
}
|
| 1168 |
|
| 1169 |
.nav-button {
|
|
@@ -1266,7 +1268,7 @@ div.markdown h3 {
|
|
| 1266 |
|
| 1267 |
.hamburger-btn-open {
|
| 1268 |
position: fixed !important;
|
| 1269 |
-
top:
|
| 1270 |
left: 20px !important;
|
| 1271 |
z-index: 999 !important;
|
| 1272 |
background: rgba(50, 50, 50, 0.95) !important;
|
|
@@ -1308,13 +1310,6 @@ div.markdown h3 {
|
|
| 1308 |
# ============================================================================
|
| 1309 |
with gr.Blocks(css=custom_css, theme=gr.themes.Soft(primary_hue="amber")) as demo:
|
| 1310 |
|
| 1311 |
-
gr.HTML("""
|
| 1312 |
-
<h1 class="main-title">π¨ Sistem VQA STEM Sekolah Rendah π€</h1>
|
| 1313 |
-
<p class="main-title" style="font-size: 3.5rem;">
|
| 1314 |
-
Tanya, Muat Naik & Dapatkan Jawapan. Belajar Lebih Seronok !
|
| 1315 |
-
</p>
|
| 1316 |
-
""")
|
| 1317 |
-
|
| 1318 |
# Top-right login area
|
| 1319 |
with gr.Row():
|
| 1320 |
with gr.Column(scale=10):
|
|
@@ -1324,34 +1319,41 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft(primary_hue="amber")) as dem
|
|
| 1324 |
user_display = gr.Markdown("")
|
| 1325 |
logout_btn = gr.Button("πͺ Log Keluar", variant="secondary", visible=False)
|
| 1326 |
|
| 1327 |
-
#
|
| 1328 |
-
|
| 1329 |
-
|
| 1330 |
-
|
| 1331 |
-
|
|
|
|
|
|
|
|
|
|
| 1332 |
|
| 1333 |
-
|
| 1334 |
-
|
| 1335 |
-
gr.
|
| 1336 |
-
|
| 1337 |
-
|
| 1338 |
-
|
| 1339 |
-
|
| 1340 |
-
|
| 1341 |
-
|
| 1342 |
-
|
| 1343 |
-
|
| 1344 |
-
|
| 1345 |
-
|
| 1346 |
-
|
| 1347 |
-
|
| 1348 |
-
|
| 1349 |
-
|
| 1350 |
-
|
| 1351 |
-
|
| 1352 |
-
|
| 1353 |
-
|
| 1354 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1355 |
# Content column - FIXED TO scale=4
|
| 1356 |
with gr.Column(scale=4) as content_column:
|
| 1357 |
|
|
@@ -1690,28 +1692,24 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft(primary_hue="amber")) as dem
|
|
| 1690 |
def toggle_sidebar_hide():
|
| 1691 |
return (
|
| 1692 |
gr.update(visible=False),
|
| 1693 |
-
gr.update(visible=True)
|
| 1694 |
-
gr.update(scale=0),
|
| 1695 |
-
gr.update(scale=5)
|
| 1696 |
-
)
|
| 1697 |
-
|
| 1698 |
-
def toggle_sidebar_show():
|
| 1699 |
-
return (
|
| 1700 |
-
gr.update(visible=True),
|
| 1701 |
-
gr.update(visible=False),
|
| 1702 |
-
gr.update(scale=1),
|
| 1703 |
-
gr.update(scale=4)
|
| 1704 |
)
|
| 1705 |
-
|
| 1706 |
-
|
| 1707 |
-
|
| 1708 |
-
|
| 1709 |
-
|
| 1710 |
-
|
| 1711 |
-
|
| 1712 |
-
|
| 1713 |
-
|
| 1714 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1715 |
|
| 1716 |
# Authentication
|
| 1717 |
#student_register_btn.click(fn=register_student, inputs=[student_reg_name, student_reg_username, student_reg_password, student_reg_class, student_reg_guardian, student_reg_dob, student_reg_gender], outputs=student_register_status)
|
|
|
|
| 1144 |
text-align: center !important;
|
| 1145 |
text-shadow: 3px 3px 0px rgba(150, 120, 200, 0.6), 6px 6px 0px rgba(0, 0, 0, 0.2) !important;
|
| 1146 |
font-weight: 600 !important;
|
| 1147 |
+
margin-top: 20px !important;
|
| 1148 |
}
|
| 1149 |
|
| 1150 |
.top-right-login {
|
|
|
|
| 1165 |
box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
|
| 1166 |
border: 3px solid rgba(100, 100, 100, 0.8) !important;
|
| 1167 |
backdrop-filter: blur(10px) !important;
|
| 1168 |
+
margin-bottom: 20px !important;
|
| 1169 |
}
|
| 1170 |
|
| 1171 |
.nav-button {
|
|
|
|
| 1268 |
|
| 1269 |
.hamburger-btn-open {
|
| 1270 |
position: fixed !important;
|
| 1271 |
+
top: 20px !important;
|
| 1272 |
left: 20px !important;
|
| 1273 |
z-index: 999 !important;
|
| 1274 |
background: rgba(50, 50, 50, 0.95) !important;
|
|
|
|
| 1310 |
# ============================================================================
|
| 1311 |
with gr.Blocks(css=custom_css, theme=gr.themes.Soft(primary_hue="amber")) as demo:
|
| 1312 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1313 |
# Top-right login area
|
| 1314 |
with gr.Row():
|
| 1315 |
with gr.Column(scale=10):
|
|
|
|
| 1319 |
user_display = gr.Markdown("")
|
| 1320 |
logout_btn = gr.Button("πͺ Log Keluar", variant="secondary", visible=False)
|
| 1321 |
|
| 1322 |
+
# Sidebar at the top
|
| 1323 |
+
toggle_sidebar_open = gr.Button("β° Menu", elem_classes="hamburger-btn-open", size="sm", visible=False)
|
| 1324 |
+
|
| 1325 |
+
with gr.Column(elem_classes="sidebar-nav", visible=True) as sidebar_nav:
|
| 1326 |
+
toggle_sidebar_close = gr.Button("β Tutup Menu", elem_classes="hamburger-btn-close", size="sm")
|
| 1327 |
+
with gr.Row():
|
| 1328 |
+
gr.Markdown("### π Menu Utama")
|
| 1329 |
+
btn_vqa = gr.Button("π¨ Tanya Soalan", variant="primary", elem_classes="nav-button", scale=1)
|
| 1330 |
|
| 1331 |
+
student_restricted_group = gr.Group(visible=False)
|
| 1332 |
+
with student_restricted_group:
|
| 1333 |
+
with gr.Row():
|
| 1334 |
+
btn_library = gr.Button("π Perpustakaan", variant="secondary", elem_classes="nav-button", scale=1)
|
| 1335 |
+
btn_bookmark = gr.Button("π Kandungan Ditanda", variant="secondary", elem_classes="nav-button", scale=1)
|
| 1336 |
+
btn_student_progress = gr.Button("π Kemajuan Saya", variant="secondary", elem_classes="nav-button", scale=1)
|
| 1337 |
+
btn_challenge = gr.Button("π― Cabaran Harian STEM", variant="secondary", elem_classes="nav-button", scale=1)
|
| 1338 |
+
|
| 1339 |
+
teacher_restricted_group = gr.Group(visible=False)
|
| 1340 |
+
with teacher_restricted_group:
|
| 1341 |
+
with gr.Row():
|
| 1342 |
+
btn_teacher_progress = gr.Button("π Penjejak Kemajuan Pelajar", variant="secondary", elem_classes="nav-button", scale=1)
|
| 1343 |
+
btn_add_challenge = gr.Button("π― Tambah Cabaran", variant="secondary", elem_classes="nav-button", scale=1)
|
| 1344 |
+
btn_add_tutorial = gr.Button("β Tambah Tutorial", variant="secondary", elem_classes="nav-button", scale=1)
|
| 1345 |
+
|
| 1346 |
+
btn_tutorial = gr.Button("β Bantuan & Tutorial", variant="secondary", elem_classes="nav-button", scale=1)
|
| 1347 |
+
btn_feedback = gr.Button("π¬ Maklum Balas & Penilaian", variant="secondary", elem_classes="nav-button", scale=1)
|
| 1348 |
+
btn_info = gr.Button("βΉοΈ Info", variant="secondary", elem_classes="nav-button", scale=1)
|
| 1349 |
+
|
| 1350 |
+
# Title AFTER sidebar
|
| 1351 |
+
gr.HTML("""
|
| 1352 |
+
<h1 class="main-title">π¨ Sistem VQA STEM Sekolah Rendah π€</h1>
|
| 1353 |
+
<p class="main-title" style="font-size: 3.5rem;">
|
| 1354 |
+
Tanya, Muat Naik & Dapatkan Jawapan. Belajar Lebih Seronok !
|
| 1355 |
+
</p>
|
| 1356 |
+
""")
|
| 1357 |
# Content column - FIXED TO scale=4
|
| 1358 |
with gr.Column(scale=4) as content_column:
|
| 1359 |
|
|
|
|
| 1692 |
def toggle_sidebar_hide():
|
| 1693 |
return (
|
| 1694 |
gr.update(visible=False),
|
| 1695 |
+
gr.update(visible=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1696 |
)
|
| 1697 |
+
|
| 1698 |
+
def toggle_sidebar_show():
|
| 1699 |
+
return (
|
| 1700 |
+
gr.update(visible=True),
|
| 1701 |
+
gr.update(visible=False)
|
| 1702 |
+
)
|
| 1703 |
+
|
| 1704 |
+
toggle_sidebar_close.click(
|
| 1705 |
+
fn=toggle_sidebar_hide,
|
| 1706 |
+
outputs=[sidebar_nav, toggle_sidebar_open]
|
| 1707 |
+
)
|
| 1708 |
+
|
| 1709 |
+
toggle_sidebar_open.click(
|
| 1710 |
+
fn=toggle_sidebar_show,
|
| 1711 |
+
outputs=[sidebar_nav, toggle_sidebar_open]
|
| 1712 |
+
)
|
| 1713 |
|
| 1714 |
# Authentication
|
| 1715 |
#student_register_btn.click(fn=register_student, inputs=[student_reg_name, student_reg_username, student_reg_password, student_reg_class, student_reg_guardian, student_reg_dob, student_reg_gender], outputs=student_register_status)
|