From f9cc5be2f01edb09be56777020c6e0b954bed228 Mon Sep 17 00:00:00 2001
From: th-kim0823
Date: Mon, 27 Apr 2026 20:13:24 +0900
Subject: [PATCH] =?UTF-8?q?feat:=20admin=20=EC=A3=BC=EC=A0=9C=20=ED=8E=B8?=
=?UTF-8?q?=EC=A7=91=20=E2=80=94=20form=20mode=20(4=20=EC=B9=B4=ED=85=8C?=
=?UTF-8?q?=EA=B3=A0=EB=A6=AC=20expander)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-Authored-By: Claude Sonnet 4.6
---
app.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/app.py b/app.py
index b140e1a..6b58437 100644
--- a/app.py
+++ b/app.py
@@ -659,6 +659,61 @@ def render_admin():
set_voting_open(True)
st.rerun()
+ st.divider()
+ st.subheader("๐ ์ฃผ์ ํธ์ง")
+ cur_topics = get_topics()
+ if not cur_topics:
+ st.warning("์ฃผ์ ์๋ ๋น์ด์์. ์ปจํ
์ด๋ ์ฌ์์ ์ ์๋ ์๋ ์ ์ฉ๋จ.")
+ else:
+ edit_mode = st.radio(
+ "ํธ์ง ๋ชจ๋", ["Form", "JSON ์ง์ ํธ์ง"], horizontal=True, key="topics_mode"
+ )
+
+ if edit_mode == "Form":
+ with st.form("topics_form"):
+ new_cats = []
+ for cat in cur_topics:
+ cid = cat.get("id", "T?")
+ with st.expander(f"{cid}. {cat.get('title', '')}", expanded=False):
+ title = st.text_input(
+ "title", cat.get("title", ""), key=f"t_{cid}_title"
+ )
+ tagline = st.text_input(
+ "tagline", cat.get("tagline", ""), key=f"t_{cid}_tagline"
+ )
+ tone = st.text_input(
+ "tone", cat.get("tone", ""), key=f"t_{cid}_tone"
+ )
+ items = []
+ existing_items = cat.get("items", [])
+ # 10๊ฐ input ์๋ฆฌ (๋น ์๋ฆฌ ํฌํจ)
+ padded = list(existing_items) + [""] * (10 - len(existing_items))
+ for i in range(10):
+ items.append(
+ st.text_input(
+ f"์ฃผ์ {i + 1}",
+ padded[i] if i < len(padded) else "",
+ key=f"t_{cid}_item_{i}",
+ )
+ )
+ items = [x for x in items if x.strip()]
+ new_cats.append(
+ {
+ "id": cid,
+ "title": title.strip(),
+ "tagline": tagline.strip(),
+ "tone": tone.strip(),
+ "items": items,
+ }
+ )
+ if st.form_submit_button("์ฃผ์ ์ ์ฅ"):
+ update_topics(new_cats)
+ st.success("์ ์ฅ๋จ. ํฐ ํ๋ฉด ๋ค์ ๊ฐฑ์ ์ ๋ฐ์.")
+ st.rerun()
+ # JSON ๋ชจ๋๋ T14์์ ์ถ๊ฐ (else branch๋ placeholder)
+ else:
+ st.info("Task 14์์ JSON ์ง์ ํธ์ง ๋ชจ๋ ์ถ๊ฐ๋จ.")
+
st.divider()
PARTS = get_participants()