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()