Spaces:
Sleeping
Sleeping
| # ------------------------------- | |
| # ์ฉ์ด ๋ฐ์ดํฐ (์นดํ ๊ณ ๋ฆฌ๋ณ, ํ๊ธ+์๋ฌธ ๋ณ๊ธฐ) | |
| # ------------------------------- | |
| from dashboard_theme.theme import inject | |
| inject("graphite_gold") | |
| import streamlit as st | |
| st.set_page_config(page_title="Information", layout="wide") | |
| # ์ธ์ฆ ์ฒดํฌ | |
| if "authenticated" not in st.session_state or not st.session_state["authenticated"]: | |
| st.error("โ ์ ๊ทผ ๋ถ๊ฐ: ๋จผ์ ๋ฉ์ธ ํ๋ฉด์์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ๋ ฅํ์ธ์.") | |
| st.stop() | |
| # ------------------------------- | |
| # ์ฉ์ด ๋ฐ์ดํฐ (์นดํ ๊ณ ๋ฆฌ๋ณ, ํ๊ธ+์๋ฌธ ๋ณ๊ธฐ) | |
| # ------------------------------- | |
| terms = { | |
| "๊ธํ ๋ถํ": { | |
| "Die (๋ค์ด)": { | |
| "description": "ํ๋ ์ค ๊ณต๊ตฌ์ ํ๋ถ์ ์์น...", | |
| "image": "assets/Drawing.png" | |
| }, | |
| "Punch (ํ์น)": { | |
| "description": "์๋ถ ๊ธํ์ผ๋ก ...", | |
| "image": "assets/Drawing.png" | |
| }, | |
| "Pad (ํจ๋)": { | |
| "description": "์ ์ง ์๋ ฅ์ ๋ฐ๋ ๊ธํ ๋ถํ ์ด์นญ", | |
| "image": None | |
| }, | |
| }, | |
| "์์ฌ": { | |
| "Blank (๋ธ๋ญํฌ)": { | |
| "description": "Punch์ Die๊ฐ ์ฌ๋ฃํ์ ์์ฉํ์ฌ ๋ถ๋ฆฌ๋ ๊ฒฐ๊ณผ๋ฌผ", | |
| "image": "assets/Drawing.png" | |
| }, | |
| }, | |
| "๊ณต์ ": { | |
| "Blank holder (๋ธ๋ญํฌ ํ๋)": { | |
| "description": "๋๋ก์ ๊ธํ ๋๋ ํฌ๋ฐ ๊ธํ์ ๋ถํ...", | |
| "image": "assets/Drawing.png" | |
| }, | |
| } | |
| } | |
| # ์ ์ฒด ์ฉ์ด flat dict | |
| all_terms = {term: data for cat in terms.values() for term, data in cat.items()} | |
| # ------------------------------- | |
| # (์ค์) ์ค๋ช ๋ฐ์ค ์ ์ฉ ์คํ์ผ | |
| # - ํ ๋ง ํจ๋์ ์ฐ๋, ๋ด๋ถ ๋ฌธ๋จ ์ฌ๋ฐฑ๋ง ์ฝ๊ฐ ํ๋ | |
| # ------------------------------- | |
| st.markdown( | |
| """ | |
| <style> | |
| .info-panel { margin: 0 0 16px 0; } | |
| .info-panel p { margin: 0; line-height: 1.7; font-size: 16px; } | |
| /* ๋ง์ฝ ๋ฐ์ ์นด๋๊ฐ ํ์ํ๋ฉด ์๋ ํด๋์ค๋ก ์ฌ์ฉ (ํ์ฌ๋ ๋ฏธ์ฌ์ฉ) | |
| .light-card { | |
| background:#f9f9f9 !important; color:#1f2937 !important; | |
| border:1px solid rgba(0,0,0,.08) !important; border-radius:12px; | |
| padding:20px; | |
| } | |
| .light-card * { color:#1f2937 !important; } | |
| */ | |
| </style> | |
| """, | |
| unsafe_allow_html=True | |
| ) | |
| # ------------------------------- | |
| # ์ธ์ ์ด๊ธฐํ | |
| # ------------------------------- | |
| if "selected_term" not in st.session_state: | |
| st.session_state["selected_term"] = None | |
| # ------------------------------- | |
| # ํค๋ (์ ๋ชฉ + ๊ฒ์) | |
| # ------------------------------- | |
| col1, col2 = st.columns([3, 2]) | |
| with col1: | |
| st.title("๐ ์ฑํ ๊ด๋ จ ์ฉ์ด ์ฌ์ ") | |
| with col2: | |
| search_query = st.selectbox( | |
| " ", # ๋ผ๋ฒจ ์จ๊น | |
| options=[""] + list(all_terms.keys()), | |
| index=0, | |
| placeholder="๊ฒ์ (์: Die, ๋ค์ด, Punch, ๋ธ๋ญํฌ ...)" | |
| ) | |
| if search_query: | |
| st.session_state["selected_term"] = search_query | |
| # ------------------------------- | |
| # ์นดํ ๊ณ ๋ฆฌ๋ณ ์ฉ์ด (ํญ + ์นด๋) | |
| # ------------------------------- | |
| st.markdown("---") | |
| st.subheader("๐ ์นดํ ๊ณ ๋ฆฌ๋ณ ์ฉ์ด") | |
| tabs = st.tabs(list(terms.keys())) | |
| for tab, (category, items) in zip(tabs, terms.items()): | |
| with tab: | |
| cols = st.columns(3) | |
| for i, (term, data) in enumerate(items.items()): | |
| with cols[i % 3]: | |
| st.markdown(f"#### {term}") | |
| if st.button("์์ธํ ๋ณด๊ธฐ", key=f"btn_{term}"): | |
| st.session_state["selected_term"] = term | |
| # ------------------------------- | |
| # ๊ณต์ฉ ์์ธ ํจ๋ (๊ฒ์/๋ฒํผ ํตํฉ, ์ข์ฐ ๋ ์ด์์) | |
| # ------------------------------- | |
| if st.session_state["selected_term"]: | |
| term = st.session_state["selected_term"] | |
| data = all_terms[term] | |
| st.markdown("---") | |
| st.markdown(f"## ๐ {term}") | |
| # ์ข(์ค๋ช ) : ์ฐ(์ด๋ฏธ์ง) | |
| col1, col2 = st.columns([2, 1]) | |
| with col1: | |
| # โ ํ ๋ง์ ํจ๋(.panel)์ ๊ทธ๋๋ก ์ฌ์ฉ โ ๋คํฌ ๋ฐฐ๊ฒฝ + ๋ฐ์ ๊ธ์ | |
| st.markdown( | |
| f""" | |
| <div class="panel info-panel"> | |
| <p>{data["description"]}</p> | |
| </div> | |
| """, | |
| unsafe_allow_html=True | |
| ) | |
| with col2: | |
| if data["image"]: | |
| st.image(data["image"], use_container_width=True) | |