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