Spaces:
Runtime error

ditgun commited on
Commit
405bfe1
ยท
verified ยท
1 Parent(s): 08bf53b

Update src/app.py

Browse files
Files changed (1) hide show
  1. src/app.py +23 -39
src/app.py CHANGED
@@ -157,21 +157,8 @@ div.stButton > button:not([title]):hover {
157
  box-shadow: 0 2px 12px rgba(255,255,255,0.05);
158
  transform: translateY(-1px);
159
  }
160
- /* ํŠธ๋ฆฌ๊ฑฐ ๋ฒ„ํŠผ ์™„์ „ ์ˆจ๊น€ */
161
- div.stButton button[aria-label="e"],
162
- div.stButton button[aria-label="s"],
163
- div.stButton button[aria-label="d"] {
164
- opacity: 0 !important;
165
- height: 0px !important;
166
- min-height: 0px !important;
167
- padding: 0 !important;
168
- margin: 0 !important;
169
- border: none !important;
170
- box-shadow: none !important;
171
- pointer-events: all !important;
172
- position: absolute !important;
173
- overflow: hidden !important;
174
- }
175
  /* ์นด๋“œ ์ข…๋ชฉ๋ช… ํด๋ฆญ ๋ฒ„ํŠผ */
176
  div.stButton button[title="์นด๋“œ์ด๋™"] {
177
  background: #161616 !important;
@@ -2966,14 +2953,29 @@ elif st.session_state.main_menu == "โ–ค ์ž์‚ฐ ์ƒ์„ธ ์ง„๋‹จ":
2966
  pa = "โ–ฒ" if pct>=0 else "โ–ผ"
2967
  buy_reason = str(row.get('๋งค์ˆ˜๊ทผ๊ฑฐ', '') or '').strip()
2968
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2969
  with st.container(border=True):
2970
- # โ”€โ”€ ํ—ค๋”: ์ข…๋ชฉ๋ช… + ์šฐ์ƒ๋‹จ ์ˆœ์ˆ˜ HTML ์•„์ด์ฝ˜ (๋ฐ•์Šค ์—†์Œ)
2971
  tv_tag = (
2972
  f'<span style="font-size:9px;color:{tv_color};background:{tv_color}15;'
2973
  f'border:1px solid {tv_color}33;padding:1px 6px;border-radius:3px;margin-left:6px;">{tv}</span>'
2974
  ) if tv else ""
2975
- edit_c = "#FFFFFF" if st.session_state.get(f"edit_mode_{idx}") else "#484848"
2976
- sell_c = "#FFFFFF" if st.session_state.get(f"log_mode_{idx}") else "#484848"
2977
  st.markdown(
2978
  f'<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px;">'
2979
  f'<div style="font-size:15px;font-weight:800;color:#EBEBEB;line-height:1.3;flex:1;">'
@@ -2982,30 +2984,12 @@ elif st.session_state.main_menu == "โ–ค ์ž์‚ฐ ์ƒ์„ธ ์ง„๋‹จ":
2982
  f'padding:2px 6px;border-radius:4px;border:1px solid rgba(255,255,255,0.10);">{t}</span>'
2983
  f'{tv_tag}</div>'
2984
  f'<div style="display:flex;align-items:center;flex-shrink:0;">'
2985
- f'<span style="font-size:18px;color:{edit_c};cursor:pointer;padding:4px 7px;user-select:none;" '
2986
- f'onclick="(function(){{var btns=window.parent.document.querySelectorAll(\'button\');for(var b of btns){{if(b.innerText===\'e\'&&b.closest(\'[data-testid]\')){{b.click();break;}}}}}})()" >โœŽ</span>'
2987
- f'<span style="font-size:18px;color:{sell_c};cursor:pointer;padding:4px 7px;user-select:none;" '
2988
- f'onclick="(function(){{var btns=window.parent.document.querySelectorAll(\'button\');for(var b of btns){{if(b.innerText===\'s\'&&b.closest(\'[data-testid]\')){{b.click();break;}}}}}})()" >โ†‘</span>'
2989
- f'<span style="font-size:18px;color:#484848;cursor:pointer;padding:4px 7px;user-select:none;" '
2990
- f'onclick="(function(){{var btns=window.parent.document.querySelectorAll(\'button\');for(var b of btns){{if(b.innerText===\'d\'&&b.closest(\'[data-testid]\')){{b.click();break;}}}}}})()" >โœ•</span>'
2991
  f'</div></div>',
2992
  unsafe_allow_html=True
2993
  )
2994
- col_e, col_s, col_d = st.columns(3)
2995
- with col_e:
2996
- if st.button("e", key=f"edit_btn_{idx}"):
2997
- st.session_state[f"edit_mode_{idx}"] = not st.session_state.get(f"edit_mode_{idx}", False)
2998
- st.session_state[f"log_mode_{idx}"] = False
2999
- st.rerun()
3000
- with col_s:
3001
- if st.button("s", key=f"log_btn_{idx}"):
3002
- st.session_state[f"log_mode_{idx}"] = not st.session_state.get(f"log_mode_{idx}", False)
3003
- st.session_state[f"edit_mode_{idx}"] = False
3004
- st.rerun()
3005
- with col_d:
3006
- if st.button("d", key=f"del_btn_{idx}"):
3007
- st.session_state.df = st.session_state.df.drop(idx).reset_index(drop=True)
3008
- save_assets(); st.session_state.price_cache_ts = 0; st.rerun()
3009
 
3010
  # โ”€โ”€ ์นด๋“œ ๋ณธ๋ฌธ
3011
  tgp_html = f"&nbsp;ยท&nbsp;<span style='color:#D8D8D8;'>๋ชฉํ‘œ {tgp}</span>" if tgp != "-" else ""
 
157
  box-shadow: 0 2px 12px rgba(255,255,255,0.05);
158
  transform: translateY(-1px);
159
  }
160
+ /* ์นด๋“œ ์•„์ด์ฝ˜ ๋งํฌ (โœŽ โ†‘ โœ•) */
161
+ /* ์ˆœ์ˆ˜ <a> ํƒœ๊ทธ ์‚ฌ์šฉ์œผ๋กœ ๋ฒ„ํŠผ ์—†์Œ */
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  /* ์นด๋“œ ์ข…๋ชฉ๋ช… ํด๋ฆญ ๋ฒ„ํŠผ */
163
  div.stButton button[title="์นด๋“œ์ด๋™"] {
164
  background: #161616 !important;
 
2953
  pa = "โ–ฒ" if pct>=0 else "โ–ผ"
2954
  buy_reason = str(row.get('๋งค์ˆ˜๊ทผ๊ฑฐ', '') or '').strip()
2955
 
2956
+ # query_params๋กœ ์•„์ด์ฝ˜ ํด๋ฆญ ๊ฐ์ง€
2957
+ _pa = st.query_params.get("pa", "")
2958
+ _pi = st.query_params.get("pi", "")
2959
+ if _pa and _pi == str(idx):
2960
+ st.query_params.clear()
2961
+ if _pa == "edit":
2962
+ st.session_state[f"edit_mode_{idx}"] = not st.session_state.get(f"edit_mode_{idx}", False)
2963
+ st.session_state[f"log_mode_{idx}"] = False
2964
+ elif _pa == "sell":
2965
+ st.session_state[f"log_mode_{idx}"] = not st.session_state.get(f"log_mode_{idx}", False)
2966
+ st.session_state[f"edit_mode_{idx}"] = False
2967
+ elif _pa == "del":
2968
+ st.session_state.df = st.session_state.df.drop(idx).reset_index(drop=True)
2969
+ save_assets(); st.session_state.price_cache_ts = 0; st.rerun()
2970
+
2971
  with st.container(border=True):
2972
+ # โ”€โ”€ ํ—ค๋”: ์ข…๋ชฉ๋ช… + ์šฐ์ƒ๋‹จ ์ˆœ์ˆ˜ HTML ์•„์ด์ฝ˜
2973
  tv_tag = (
2974
  f'<span style="font-size:9px;color:{tv_color};background:{tv_color}15;'
2975
  f'border:1px solid {tv_color}33;padding:1px 6px;border-radius:3px;margin-left:6px;">{tv}</span>'
2976
  ) if tv else ""
2977
+ edit_c = "#FFFFFF" if st.session_state.get(f"edit_mode_{idx}") else "#555555"
2978
+ sell_c = "#FFFFFF" if st.session_state.get(f"log_mode_{idx}") else "#555555"
2979
  st.markdown(
2980
  f'<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:4px;">'
2981
  f'<div style="font-size:15px;font-weight:800;color:#EBEBEB;line-height:1.3;flex:1;">'
 
2984
  f'padding:2px 6px;border-radius:4px;border:1px solid rgba(255,255,255,0.10);">{t}</span>'
2985
  f'{tv_tag}</div>'
2986
  f'<div style="display:flex;align-items:center;flex-shrink:0;">'
2987
+ f'<a href="?pa=edit&pi={idx}" target="_self" style="font-size:18px;color:{edit_c};padding:4px 7px;text-decoration:none;line-height:1;">โœŽ</a>'
2988
+ f'<a href="?pa=sell&pi={idx}" target="_self" style="font-size:18px;color:{sell_c};padding:4px 7px;text-decoration:none;line-height:1;">โ†‘</a>'
2989
+ f'<a href="?pa=del&pi={idx}" target="_self" style="font-size:18px;color:#555555;padding:4px 7px;text-decoration:none;line-height:1;">โœ•</a>'
 
 
 
2990
  f'</div></div>',
2991
  unsafe_allow_html=True
2992
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2993
 
2994
  # โ”€โ”€ ์นด๋“œ ๋ณธ๋ฌธ
2995
  tgp_html = f"&nbsp;ยท&nbsp;<span style='color:#D8D8D8;'>๋ชฉํ‘œ {tgp}</span>" if tgp != "-" else ""