HansTran commited on
Commit
a706a46
·
verified ·
1 Parent(s): bee8440

Upload 11 files

Browse files
app.py CHANGED
@@ -88,6 +88,18 @@ def fetch_cards_once() -> None:
88
  set_status(f"Unable to load saved cards: {exc}", "error")
89
 
90
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  def add_card() -> None:
92
  st.session_state.cards.append(build_card_payload())
93
  clear_status()
@@ -162,7 +174,7 @@ parsed_browser_time = parse_browser_time(browser_time_value)
162
  if parsed_browser_time:
163
  st.session_state.browser_time = parsed_browser_time
164
  fetch_cards_once()
165
- render_top_buttons(add_card, check_time)
166
  render_header()
167
 
168
  if st.session_state.status_message:
 
88
  set_status(f"Unable to load saved cards: {exc}", "error")
89
 
90
 
91
+ def reload_cards() -> None:
92
+ try:
93
+ st.session_state.cards = normalize_cards(load_cards())
94
+ st.session_state.cards_loaded = True
95
+ clear_status()
96
+ st.session_state.time_checked = False
97
+ st.session_state.checked_at = None
98
+ set_status("Cards refreshed.", "success")
99
+ except Exception as exc: # noqa: BLE001
100
+ set_status(f"Refresh failed: {exc}", "error")
101
+
102
+
103
  def add_card() -> None:
104
  st.session_state.cards.append(build_card_payload())
105
  clear_status()
 
174
  if parsed_browser_time:
175
  st.session_state.browser_time = parsed_browser_time
176
  fetch_cards_once()
177
+ render_top_buttons(add_card, check_time, reload_cards)
178
  render_header()
179
 
180
  if st.session_state.status_message:
assets/style.css CHANGED
@@ -245,6 +245,12 @@
245
  border-color: rgba(18, 32, 51, 0.12) !important;
246
  }
247
 
 
 
 
 
 
 
248
  .primary-action > button:hover {
249
  background: linear-gradient(135deg, var(--primary-strong), var(--primary)) !important;
250
  }
 
245
  border-color: rgba(18, 32, 51, 0.12) !important;
246
  }
247
 
248
+ .reset-action > button {
249
+ background: rgba(255, 184, 77, 0.16) !important;
250
+ color: #8b5a00 !important;
251
+ border-color: rgba(255, 184, 77, 0.28) !important;
252
+ }
253
+
254
  .primary-action > button:hover {
255
  background: linear-gradient(135deg, var(--primary-strong), var(--primary)) !important;
256
  }
components/__pycache__/buttons.cpython-312.pyc CHANGED
Binary files a/components/__pycache__/buttons.cpython-312.pyc and b/components/__pycache__/buttons.cpython-312.pyc differ
 
components/buttons.py CHANGED
@@ -1,15 +1,19 @@
1
  import streamlit as st
2
 
3
 
4
- def render_top_buttons(on_add_click, on_check_click) -> None:
5
- left_col, center_col, right_col = st.columns([0.12, 0.72, 0.16])
6
  with left_col:
7
  st.markdown('<div class="primary-action">', unsafe_allow_html=True)
8
  st.button("+ Add Card", use_container_width=True, on_click=on_add_click)
9
  st.markdown("</div>", unsafe_allow_html=True)
10
  with center_col:
11
  st.empty()
12
- with right_col:
13
  st.markdown('<div class="check-action">', unsafe_allow_html=True)
14
  st.button("Check Time", use_container_width=True, on_click=on_check_click)
15
  st.markdown("</div>", unsafe_allow_html=True)
 
 
 
 
 
1
  import streamlit as st
2
 
3
 
4
+ def render_top_buttons(on_add_click, on_check_click, on_reset_click) -> None:
5
+ left_col, center_col, check_col, reset_col = st.columns([0.12, 0.6, 0.14, 0.14])
6
  with left_col:
7
  st.markdown('<div class="primary-action">', unsafe_allow_html=True)
8
  st.button("+ Add Card", use_container_width=True, on_click=on_add_click)
9
  st.markdown("</div>", unsafe_allow_html=True)
10
  with center_col:
11
  st.empty()
12
+ with check_col:
13
  st.markdown('<div class="check-action">', unsafe_allow_html=True)
14
  st.button("Check Time", use_container_width=True, on_click=on_check_click)
15
  st.markdown("</div>", unsafe_allow_html=True)
16
+ with reset_col:
17
+ st.markdown('<div class="reset-action">', unsafe_allow_html=True)
18
+ st.button("Reset", use_container_width=True, on_click=on_reset_click)
19
+ st.markdown("</div>", unsafe_allow_html=True)