From 4cd24843742e115e8b6d8fcebe46e205ce06d515 Mon Sep 17 00:00:00 2001 From: th-kim0823 Date: Mon, 27 Apr 2026 20:08:41 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20stage=20vote=20=E2=80=94=20QR=20+=20?= =?UTF-8?q?=EC=B9=B4=EC=9A=B4=ED=84=B0=20+=20autorefresh=203=EC=B4=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- app.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 6b6e117..946ca66 100644 --- a/app.py +++ b/app.py @@ -17,6 +17,7 @@ from pathlib import Path import qrcode import streamlit as st +from streamlit_autorefresh import st_autorefresh DATA_PATH = os.environ.get( "DATA_PATH", str(Path(__file__).parent / "hackathon.json") @@ -446,8 +447,34 @@ def render_stage_topics(data): def render_stage_vote(data): - st.markdown('
πŸ—³ νˆ¬ν‘œ μ‹œμž‘
', unsafe_allow_html=True) - st.info("Task 11μ—μ„œ κ΅¬ν˜„") + st_autorefresh(interval=3000, key="vote_poll") + + st.markdown('
πŸ—³ νˆ¬ν‘œ
', unsafe_allow_html=True) + st.markdown( + '
πŸ“± νœ΄λŒ€ν°μœΌλ‘œ QR μŠ€μΊ” β†’ 본인 이름 선택 β†’ νˆ¬ν‘œ
', + unsafe_allow_html=True, + ) + + vote_url = compute_vote_url() + qr_png = make_qr_png(vote_url) + + c1, c2, c3 = st.columns([1, 2, 1]) + with c2: + st.image(qr_png, use_container_width=False, width=500) + st.markdown( + f'
{vote_url}
', + unsafe_allow_html=True, + ) + + votes = data.get("votes", []) + total = len(data.get("people", [])) + voted = len(votes) + pct = int(100 * voted / total) if total else 0 + st.markdown( + f'
{voted} / {total}
', + unsafe_allow_html=True, + ) + st.progress(pct / 100 if total else 0) def render_voter():