feat: admin stage 진행 section (이전/직접/다음)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
th-kim0823
2026-04-27 20:10:59 +09:00
parent 4cd2484374
commit 4c414b37a6

34
app.py
View File

@@ -612,6 +612,40 @@ def render_admin():
except FileNotFoundError: except FileNotFoundError:
st.warning(f"파일 없음: {DATA_PATH}") st.warning(f"파일 없음: {DATA_PATH}")
st.divider()
st.subheader("🎬 Stage 진행")
cur = get_stage()
st.markdown(f"**현재 stage:** `{cur}`")
stage_order = list(VALID_STAGES) # ("intro", "topics", "vote")
idx = stage_order.index(cur) if cur in stage_order else 0
sc1, sc2, sc3 = st.columns(3)
with sc1:
if st.button("← 이전 stage", disabled=(idx == 0)):
set_stage(stage_order[idx - 1])
st.rerun()
with sc2:
chosen = st.radio(
"직접 선택",
stage_order,
index=idx,
horizontal=True,
label_visibility="collapsed",
key="stage_radio",
)
if chosen != cur:
if st.button("적용", key="stage_apply"):
set_stage(chosen)
st.rerun()
with sc3:
if st.button("다음 stage →", disabled=(idx == len(stage_order) - 1)):
set_stage(stage_order[idx + 1])
st.rerun()
if cur == "vote":
st.caption(" vote stage 진입 시 투표가 자동 open 됨. 마감은 아래 '투표 마감' 버튼으로.")
voting_open = is_voting_open() voting_open = is_voting_open()
cur_label = "🟢 투표 진행 중" if voting_open else "🔴 투표 마감됨" cur_label = "🟢 투표 진행 중" if voting_open else "🔴 투표 마감됨"
st.markdown(f"### 투표 상태: {cur_label}") st.markdown(f"### 투표 상태: {cur_label}")