Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -126,42 +126,35 @@ if st.session_state.page == "๋๋ฉ์ธ ์ค์ ":
|
|
| 126 |
# ------------------------------
|
| 127 |
# PAGE 2. ์
๋ฌด ๋ฐ์ฐ
|
| 128 |
# ------------------------------
|
| 129 |
-
|
| 130 |
st.title("2๏ธโฃ ์
๋ฌด ์์ ๋ฐ์ฐ")
|
| 131 |
st.markdown("""
|
| 132 |
๊ฐ ๋๋ฉ์ธ๋ณ๋ก ํ์์ ์ค์ ํ๊ณ ์๋ ์ผ์ ๊ฐ๋ฅํ ํ ๋ง์ด ์ ์ด๋ณด์ธ์.
|
| 133 |
ํ์์ ์์ ๋กญ์ต๋๋ค. ๋์ค์ ๋ฌถ๊ณ ์ ๋ฆฌํ ์ ์์ต๋๋ค.
|
| 134 |
""")
|
| 135 |
-
|
| 136 |
-
unique_domains = list(dict.fromkeys(st.session_state.domains))
|
| 137 |
-
if "๊ธฐํ" not in unique_domains:
|
| 138 |
-
unique_domains.append("๊ธฐํ")
|
| 139 |
-
|
| 140 |
-
for d in unique_domains:
|
| 141 |
-
safe_key = f"tasks_{d}".replace(" ", "_").replace("/", "_")
|
| 142 |
st.subheader(f"๐ {d}")
|
| 143 |
-
|
| 144 |
f"{d} ๋๋ฉ์ธ์ ์
๋ฌด๋ค",
|
| 145 |
-
key=
|
| 146 |
height=150,
|
| 147 |
-
placeholder="์: ๋ฆฌ๋์ญ ์ง๋จ ๋ฆฌํฌํธ ์์ฑ\n์กฐ์ง๋ฌธํ ๊ต์ก ๊ธฐํ\n๋ฐ์ดํฐ ์ ๋ฆฌ ์๋ํ ๋ฑ"
|
| 148 |
)
|
| 149 |
-
if
|
| 150 |
-
st.session_state.grouped_tasks[d] = [
|
| 151 |
-
|
|
|
|
| 152 |
if st.button("โก๏ธ ๋ค์: ๊ทธ๋ฃน ์กฐ์ "):
|
| 153 |
goto("๊ทธ๋ฃน ์กฐ์ ")
|
| 154 |
|
| 155 |
-
from streamlit_dnd_list import dnd_list
|
| 156 |
-
import json
|
| 157 |
|
| 158 |
# ------------------------------
|
| 159 |
-
# PAGE 3. ๊ทธ๋ฃน ์กฐ์
|
| 160 |
# ------------------------------
|
| 161 |
elif st.session_state.page == "๊ทธ๋ฃน ์กฐ์ ":
|
| 162 |
st.title("3๏ธโฃ ์
๋ฌด ๊ทธ๋ฃน ์ ๋ฆฌํ๊ธฐ")
|
| 163 |
st.markdown("""
|
| 164 |
-
๊ฐ ๋๋ฉ์ธ๋ณ๋ก ์ ๋ฆฌ๋ ์
๋ฌด๋ฅผ
|
| 165 |
- **๋๋๊ทธ ์ค ๋๋กญ**์ผ๋ก ์์๋ฅผ ๋ฐ๊ฟ ์ ์์ต๋๋ค.
|
| 166 |
- **๐ ๋ฒํผ**์ผ๋ก ์ญ์ ํ ์ ์์ต๋๋ค.
|
| 167 |
- **โ ์ ํ๋ฐ์ค**๋ฅผ ํตํด ๋ค๋ฅธ ๋๋ฉ์ธ์ผ๋ก ์ด๋ํ ์ ์์ต๋๋ค.
|
|
@@ -169,18 +162,16 @@ elif st.session_state.page == "๊ทธ๋ฃน ์กฐ์ ":
|
|
| 169 |
""")
|
| 170 |
|
| 171 |
st.divider()
|
| 172 |
-
|
| 173 |
-
# ํ์ฌ ์ ์ฅ๋ ๋๋ฉ์ธ ๋ฐ ์
๋ฌด ๋ถ๋ฌ์ค๊ธฐ
|
| 174 |
domains = st.session_state.domains + ["๊ธฐํ"]
|
| 175 |
updated_grouped = {
|
| 176 |
d: list(st.session_state.grouped_tasks.get(d, [])) for d in domains
|
| 177 |
}
|
| 178 |
|
| 179 |
-
#
|
| 180 |
palette = ["#E3F2FD", "#E8F5E9", "#FFF8E1", "#FCE4EC", "#E0F7FA"]
|
| 181 |
domain_colors = {d: palette[i % len(palette)] for i, d in enumerate(domains)}
|
| 182 |
|
| 183 |
-
#
|
| 184 |
st.markdown("""
|
| 185 |
<style>
|
| 186 |
.task-card {
|
|
@@ -190,23 +181,15 @@ elif st.session_state.page == "๊ทธ๋ฃน ์กฐ์ ":
|
|
| 190 |
padding: 6px 10px;
|
| 191 |
margin-bottom: 6px;
|
| 192 |
font-size: 14px;
|
| 193 |
-
box-shadow: 0 1px 2px rgba(0,0,0,0.05);
|
| 194 |
}
|
| 195 |
.domain-box {
|
| 196 |
border-radius: 10px;
|
| 197 |
padding: 10px;
|
| 198 |
margin: 4px;
|
| 199 |
}
|
| 200 |
-
.domain-header {
|
| 201 |
-
text-align: center;
|
| 202 |
-
font-weight: 600;
|
| 203 |
-
font-size: 16px;
|
| 204 |
-
margin-bottom: 8px;
|
| 205 |
-
}
|
| 206 |
</style>
|
| 207 |
""", unsafe_allow_html=True)
|
| 208 |
|
| 209 |
-
# ๋๋ฉ์ธ๋ณ ์ด ๊ตฌ์ฑ
|
| 210 |
cols = st.columns(len(domains))
|
| 211 |
for i, d in enumerate(domains):
|
| 212 |
with cols[i]:
|
|
@@ -215,22 +198,20 @@ elif st.session_state.page == "๊ทธ๋ฃน ์กฐ์ ":
|
|
| 215 |
f"<div class='domain-box' style='background-color:{bg_color};'>",
|
| 216 |
unsafe_allow_html=True,
|
| 217 |
)
|
| 218 |
-
st.markdown(f"
|
| 219 |
|
| 220 |
tasks = updated_grouped.get(d, [])
|
| 221 |
new_task_list = []
|
| 222 |
|
| 223 |
-
#
|
| 224 |
sorted_tasks = sort_items(tasks, direction="vertical", key=f"sort_{d}")
|
| 225 |
|
| 226 |
-
# --- ์
๋ฌด ํ์ + ์ญ์ + ์ด๋ ---
|
| 227 |
for t in sorted_tasks:
|
| 228 |
c1, c2, c3 = st.columns([4, 1, 1])
|
| 229 |
with c1:
|
| 230 |
st.markdown(f"<div class='task-card'>{t}</div>", unsafe_allow_html=True)
|
| 231 |
with c2:
|
| 232 |
if st.button("๐", key=f"del_{d}_{t}"):
|
| 233 |
-
# ์ญ์ : ํด๋น ํญ๋ชฉ ์ ๊ฑฐํ๊ณ rerun
|
| 234 |
st.session_state.grouped_tasks[d] = [
|
| 235 |
x for x in sorted_tasks if x != t
|
| 236 |
]
|
|
@@ -242,16 +223,14 @@ elif st.session_state.page == "๊ทธ๋ฃน ์กฐ์ ":
|
|
| 242 |
key=f"move_{d}_{t}",
|
| 243 |
)
|
| 244 |
if move_target != "(์ด๋)":
|
| 245 |
-
# ๋๋ฉ์ธ ๊ฐ ์ด๋
|
| 246 |
st.session_state.grouped_tasks.setdefault(move_target, []).append(t)
|
| 247 |
st.session_state.grouped_tasks[d] = [
|
| 248 |
x for x in sorted_tasks if x != t
|
| 249 |
]
|
| 250 |
st.rerun()
|
| 251 |
-
|
| 252 |
new_task_list.append(t)
|
| 253 |
|
| 254 |
-
#
|
| 255 |
new_task = st.text_input(f"{d} ์ ์
๋ฌด", key=f"add_{i}")
|
| 256 |
if st.button(f"โ ์ถ๊ฐ ({d})", key=f"btn_add_{i}") and new_task.strip():
|
| 257 |
new_task_list.append(new_task.strip())
|
|
@@ -259,13 +238,10 @@ elif st.session_state.page == "๊ทธ๋ฃน ์กฐ์ ":
|
|
| 259 |
st.rerun()
|
| 260 |
|
| 261 |
updated_grouped[d] = new_task_list
|
| 262 |
-
|
| 263 |
st.markdown("</div>", unsafe_allow_html=True)
|
| 264 |
|
| 265 |
-
# ์
๋ฐ์ดํธ ๋ฐ์
|
| 266 |
st.session_state.grouped_tasks = updated_grouped
|
| 267 |
|
| 268 |
-
# --- ํ๋จ ์ด๋ ๋ฒํผ ---
|
| 269 |
st.divider()
|
| 270 |
c1, c2 = st.columns(2)
|
| 271 |
if c1.button("โฌ
๏ธ ์ด์ : ์
๋ฌด ๋ฐ์ฐ ๋ค์๋ณด๊ธฐ"):
|
|
@@ -273,7 +249,6 @@ elif st.session_state.page == "๊ทธ๋ฃน ์กฐ์ ":
|
|
| 273 |
if c2.button("โก๏ธ ๋ค์: ์์กด์ฑ ํ๋จ"):
|
| 274 |
goto("์์กด์ฑ ํ๋จ")
|
| 275 |
|
| 276 |
-
|
| 277 |
# ------------------------------
|
| 278 |
# PAGE 4. ์์กด์ฑ ํ๋จ
|
| 279 |
# ------------------------------
|
|
|
|
| 126 |
# ------------------------------
|
| 127 |
# PAGE 2. ์
๋ฌด ๋ฐ์ฐ
|
| 128 |
# ------------------------------
|
| 129 |
+
if st.session_state.page == "์
๋ฌด ๋ฐ์ฐ":
|
| 130 |
st.title("2๏ธโฃ ์
๋ฌด ์์ ๋ฐ์ฐ")
|
| 131 |
st.markdown("""
|
| 132 |
๊ฐ ๋๋ฉ์ธ๋ณ๋ก ํ์์ ์ค์ ํ๊ณ ์๋ ์ผ์ ๊ฐ๋ฅํ ํ ๋ง์ด ์ ์ด๋ณด์ธ์.
|
| 133 |
ํ์์ ์์ ๋กญ์ต๋๋ค. ๋์ค์ ๋ฌถ๊ณ ์ ๋ฆฌํ ์ ์์ต๋๋ค.
|
| 134 |
""")
|
| 135 |
+
for d in st.session_state.domains + ["๊ธฐํ"]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
st.subheader(f"๐ {d}")
|
| 137 |
+
task_text = st.text_area(
|
| 138 |
f"{d} ๋๋ฉ์ธ์ ์
๋ฌด๋ค",
|
| 139 |
+
key=f"tasks_{d}",
|
| 140 |
height=150,
|
| 141 |
+
placeholder="์: ๋ฆฌ๋์ญ ์ง๋จ ๊ฒฐ๊ณผ ๋ฆฌํฌํธ ์์ฑ\n์กฐ์ง๋ฌธํ ๊ต์ก ๊ธฐํ\n๋ฐ์ดํฐ ์ ๋ฆฌ ์๋ํ ๋ฑ"
|
| 142 |
)
|
| 143 |
+
if task_text:
|
| 144 |
+
st.session_state.grouped_tasks[d] = [
|
| 145 |
+
t.strip() for t in task_text.split("\n") if t.strip()
|
| 146 |
+
]
|
| 147 |
if st.button("โก๏ธ ๋ค์: ๊ทธ๋ฃน ์กฐ์ "):
|
| 148 |
goto("๊ทธ๋ฃน ์กฐ์ ")
|
| 149 |
|
|
|
|
|
|
|
| 150 |
|
| 151 |
# ------------------------------
|
| 152 |
+
# PAGE 3. ๊ทธ๋ฃน ์กฐ์
|
| 153 |
# ------------------------------
|
| 154 |
elif st.session_state.page == "๊ทธ๋ฃน ์กฐ์ ":
|
| 155 |
st.title("3๏ธโฃ ์
๋ฌด ๊ทธ๋ฃน ์ ๋ฆฌํ๊ธฐ")
|
| 156 |
st.markdown("""
|
| 157 |
+
๊ฐ ๋๋ฉ์ธ๋ณ๋ก ์ ๋ฆฌ๋ ์
๋ฌด๋ฅผ ๊ด๋ฆฌํ์ธ์.
|
| 158 |
- **๋๋๊ทธ ์ค ๋๋กญ**์ผ๋ก ์์๋ฅผ ๋ฐ๊ฟ ์ ์์ต๋๋ค.
|
| 159 |
- **๐ ๋ฒํผ**์ผ๋ก ์ญ์ ํ ์ ์์ต๋๋ค.
|
| 160 |
- **โ ์ ํ๋ฐ์ค**๋ฅผ ํตํด ๋ค๋ฅธ ๋๋ฉ์ธ์ผ๋ก ์ด๋ํ ์ ์์ต๋๋ค.
|
|
|
|
| 162 |
""")
|
| 163 |
|
| 164 |
st.divider()
|
|
|
|
|
|
|
| 165 |
domains = st.session_state.domains + ["๊ธฐํ"]
|
| 166 |
updated_grouped = {
|
| 167 |
d: list(st.session_state.grouped_tasks.get(d, [])) for d in domains
|
| 168 |
}
|
| 169 |
|
| 170 |
+
# ์์ ์ ์
|
| 171 |
palette = ["#E3F2FD", "#E8F5E9", "#FFF8E1", "#FCE4EC", "#E0F7FA"]
|
| 172 |
domain_colors = {d: palette[i % len(palette)] for i, d in enumerate(domains)}
|
| 173 |
|
| 174 |
+
# ์คํ์ผ
|
| 175 |
st.markdown("""
|
| 176 |
<style>
|
| 177 |
.task-card {
|
|
|
|
| 181 |
padding: 6px 10px;
|
| 182 |
margin-bottom: 6px;
|
| 183 |
font-size: 14px;
|
|
|
|
| 184 |
}
|
| 185 |
.domain-box {
|
| 186 |
border-radius: 10px;
|
| 187 |
padding: 10px;
|
| 188 |
margin: 4px;
|
| 189 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
</style>
|
| 191 |
""", unsafe_allow_html=True)
|
| 192 |
|
|
|
|
| 193 |
cols = st.columns(len(domains))
|
| 194 |
for i, d in enumerate(domains):
|
| 195 |
with cols[i]:
|
|
|
|
| 198 |
f"<div class='domain-box' style='background-color:{bg_color};'>",
|
| 199 |
unsafe_allow_html=True,
|
| 200 |
)
|
| 201 |
+
st.markdown(f"### ๐ฆ {d}")
|
| 202 |
|
| 203 |
tasks = updated_grouped.get(d, [])
|
| 204 |
new_task_list = []
|
| 205 |
|
| 206 |
+
# ์ ๋ ฌ
|
| 207 |
sorted_tasks = sort_items(tasks, direction="vertical", key=f"sort_{d}")
|
| 208 |
|
|
|
|
| 209 |
for t in sorted_tasks:
|
| 210 |
c1, c2, c3 = st.columns([4, 1, 1])
|
| 211 |
with c1:
|
| 212 |
st.markdown(f"<div class='task-card'>{t}</div>", unsafe_allow_html=True)
|
| 213 |
with c2:
|
| 214 |
if st.button("๐", key=f"del_{d}_{t}"):
|
|
|
|
| 215 |
st.session_state.grouped_tasks[d] = [
|
| 216 |
x for x in sorted_tasks if x != t
|
| 217 |
]
|
|
|
|
| 223 |
key=f"move_{d}_{t}",
|
| 224 |
)
|
| 225 |
if move_target != "(์ด๋)":
|
|
|
|
| 226 |
st.session_state.grouped_tasks.setdefault(move_target, []).append(t)
|
| 227 |
st.session_state.grouped_tasks[d] = [
|
| 228 |
x for x in sorted_tasks if x != t
|
| 229 |
]
|
| 230 |
st.rerun()
|
|
|
|
| 231 |
new_task_list.append(t)
|
| 232 |
|
| 233 |
+
# ์ถ๊ฐ
|
| 234 |
new_task = st.text_input(f"{d} ์ ์
๋ฌด", key=f"add_{i}")
|
| 235 |
if st.button(f"โ ์ถ๊ฐ ({d})", key=f"btn_add_{i}") and new_task.strip():
|
| 236 |
new_task_list.append(new_task.strip())
|
|
|
|
| 238 |
st.rerun()
|
| 239 |
|
| 240 |
updated_grouped[d] = new_task_list
|
|
|
|
| 241 |
st.markdown("</div>", unsafe_allow_html=True)
|
| 242 |
|
|
|
|
| 243 |
st.session_state.grouped_tasks = updated_grouped
|
| 244 |
|
|
|
|
| 245 |
st.divider()
|
| 246 |
c1, c2 = st.columns(2)
|
| 247 |
if c1.button("โฌ
๏ธ ์ด์ : ์
๋ฌด ๋ฐ์ฐ ๋ค์๋ณด๊ธฐ"):
|
|
|
|
| 249 |
if c2.button("โก๏ธ ๋ค์: ์์กด์ฑ ํ๋จ"):
|
| 250 |
goto("์์กด์ฑ ํ๋จ")
|
| 251 |
|
|
|
|
| 252 |
# ------------------------------
|
| 253 |
# PAGE 4. ์์กด์ฑ ํ๋จ
|
| 254 |
# ------------------------------
|