HansTran commited on
Commit
2926eba
·
verified ·
1 Parent(s): 4f6cc65

Upload 18 files

Browse files
__pycache__/app.cpython-312.pyc CHANGED
Binary files a/__pycache__/app.cpython-312.pyc and b/__pycache__/app.cpython-312.pyc differ
 
app.py CHANGED
@@ -105,13 +105,12 @@ def handle_save(index: int) -> None:
105
  load_css()
106
  initialize_state()
107
  fetch_cards_once()
 
108
  render_header()
109
 
110
  if st.session_state.status_message:
111
  getattr(st, st.session_state.status_type)(st.session_state.status_message)
112
 
113
- render_add_card_button(add_card)
114
-
115
  if not st.session_state.cards:
116
  st.markdown(
117
  """
 
105
  load_css()
106
  initialize_state()
107
  fetch_cards_once()
108
+ render_add_card_button(add_card)
109
  render_header()
110
 
111
  if st.session_state.status_message:
112
  getattr(st, st.session_state.status_type)(st.session_state.status_message)
113
 
 
 
114
  if not st.session_state.cards:
115
  st.markdown(
116
  """
assets/style.css CHANGED
@@ -71,25 +71,6 @@
71
  margin: 0;
72
  }
73
 
74
- .card-tone-marker {
75
- display: block;
76
- height: 0;
77
- }
78
-
79
- [data-testid="element-container"]:has(.card-tone-danger) + div [data-testid="stVerticalBlockBorderWrapper"] {
80
- background: linear-gradient(180deg, rgba(255, 235, 235, 0.96), rgba(255, 255, 255, 0.96));
81
- border-color: rgba(214, 69, 69, 0.28) !important;
82
- }
83
-
84
- [data-testid="element-container"]:has(.card-tone-success) + div [data-testid="stVerticalBlockBorderWrapper"] {
85
- background: linear-gradient(180deg, rgba(235, 251, 242, 0.96), rgba(255, 255, 255, 0.96));
86
- border-color: rgba(20, 125, 114, 0.24) !important;
87
- }
88
-
89
- [data-testid="element-container"]:has(.card-tone-default) + div [data-testid="stVerticalBlockBorderWrapper"] {
90
- background: rgba(255, 255, 255, 0.9);
91
- }
92
-
93
  [data-testid="stVerticalBlockBorderWrapper"] {
94
  border-radius: 14px;
95
  border-color: rgba(18, 32, 51, 0.08) !important;
@@ -103,6 +84,52 @@
103
  background: transparent !important;
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  .card-status {
107
  display: inline-flex;
108
  align-items: center;
@@ -119,6 +146,20 @@
119
  .end-time-inline {
120
  padding-top: 0.05rem;
121
  text-align: right;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  }
123
 
124
  .end-time-inline-label {
 
71
  margin: 0;
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  [data-testid="stVerticalBlockBorderWrapper"] {
75
  border-radius: 14px;
76
  border-color: rgba(18, 32, 51, 0.08) !important;
 
84
  background: transparent !important;
85
  }
86
 
87
+ .tone-strip {
88
+ display: flex;
89
+ align-items: center;
90
+ gap: 0.35rem;
91
+ border-radius: 999px;
92
+ padding: 0.2rem 0.55rem;
93
+ font-size: 0.64rem;
94
+ font-weight: 800;
95
+ margin-bottom: 0.28rem;
96
+ width: fit-content;
97
+ }
98
+
99
+ .tone-strip-default {
100
+ background: rgba(18, 32, 51, 0.06);
101
+ color: var(--muted);
102
+ }
103
+
104
+ .tone-strip-success {
105
+ background: rgba(20, 125, 114, 0.12);
106
+ color: var(--primary-strong);
107
+ }
108
+
109
+ .tone-strip-danger {
110
+ background: rgba(214, 69, 69, 0.12);
111
+ color: var(--danger);
112
+ }
113
+
114
+ .tone-dot {
115
+ width: 0.42rem;
116
+ height: 0.42rem;
117
+ border-radius: 999px;
118
+ display: inline-block;
119
+ }
120
+
121
+ .tone-dot-default {
122
+ background: rgba(18, 32, 51, 0.28);
123
+ }
124
+
125
+ .tone-dot-success {
126
+ background: var(--primary);
127
+ }
128
+
129
+ .tone-dot-danger {
130
+ background: var(--danger);
131
+ }
132
+
133
  .card-status {
134
  display: inline-flex;
135
  align-items: center;
 
146
  .end-time-inline {
147
  padding-top: 0.05rem;
148
  text-align: right;
149
+ border-radius: 10px;
150
+ padding: 0.22rem 0.38rem;
151
+ }
152
+
153
+ .end-time-inline-default {
154
+ background: rgba(18, 32, 51, 0.05);
155
+ }
156
+
157
+ .end-time-inline-success {
158
+ background: rgba(20, 125, 114, 0.12);
159
+ }
160
+
161
+ .end-time-inline-danger {
162
+ background: rgba(214, 69, 69, 0.12);
163
  }
164
 
165
  .end-time-inline-label {
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/__pycache__/card.cpython-312.pyc CHANGED
Binary files a/components/__pycache__/card.cpython-312.pyc and b/components/__pycache__/card.cpython-312.pyc differ
 
components/buttons.py CHANGED
@@ -2,11 +2,10 @@ import streamlit as st
2
 
3
 
4
  def render_add_card_button(on_click) -> None:
5
- left_col, right_col = st.columns([0.14, 0.86])
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_click)
9
  st.markdown("</div>", unsafe_allow_html=True)
10
  with right_col:
11
  st.empty()
12
-
 
2
 
3
 
4
  def render_add_card_button(on_click) -> None:
5
+ left_col, right_col = st.columns([0.12, 0.88])
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_click)
9
  st.markdown("</div>", unsafe_allow_html=True)
10
  with right_col:
11
  st.empty()
 
components/card.py CHANGED
@@ -1,6 +1,6 @@
1
  import streamlit as st
2
 
3
- from utils.time_utils import compute_end_time, format_time, get_card_tone
4
 
5
 
6
  def render_card(index: int, on_save, on_delete) -> None:
@@ -15,9 +15,18 @@ def render_card(index: int, on_save, on_delete) -> None:
15
  card["endHour"] = end_hour
16
  card["endMinute"] = end_minute
17
  tone = get_card_tone(end_hour, end_minute)
 
18
 
19
- st.markdown(f'<div class="card-tone-marker card-tone-{tone}"></div>', unsafe_allow_html=True)
20
  with st.container(border=True):
 
 
 
 
 
 
 
 
 
21
  title_col, status_col = st.columns([1.8, 0.42])
22
  with title_col:
23
  card["title"] = st.text_input(
@@ -64,7 +73,7 @@ def render_card(index: int, on_save, on_delete) -> None:
64
  with end_col:
65
  st.markdown(
66
  f"""
67
- <div class="end-time-inline">
68
  <div class="end-time-inline-label">End</div>
69
  <div class="end-time-inline-value">{format_time(end_hour, end_minute)}</div>
70
  </div>
 
1
  import streamlit as st
2
 
3
+ from utils.time_utils import compute_end_time, format_time, get_card_tone, get_tone_message
4
 
5
 
6
  def render_card(index: int, on_save, on_delete) -> None:
 
15
  card["endHour"] = end_hour
16
  card["endMinute"] = end_minute
17
  tone = get_card_tone(end_hour, end_minute)
18
+ tone_message = get_tone_message(tone)
19
 
 
20
  with st.container(border=True):
21
+ st.markdown(
22
+ f"""
23
+ <div class="tone-strip tone-strip-{tone}">
24
+ <span class="tone-dot tone-dot-{tone}"></span>
25
+ <span>{tone_message}</span>
26
+ </div>
27
+ """,
28
+ unsafe_allow_html=True,
29
+ )
30
  title_col, status_col = st.columns([1.8, 0.42])
31
  with title_col:
32
  card["title"] = st.text_input(
 
73
  with end_col:
74
  st.markdown(
75
  f"""
76
+ <div class="end-time-inline end-time-inline-{tone}">
77
  <div class="end-time-inline-label">End</div>
78
  <div class="end-time-inline-value">{format_time(end_hour, end_minute)}</div>
79
  </div>
utils/__pycache__/time_utils.cpython-312.pyc CHANGED
Binary files a/utils/__pycache__/time_utils.cpython-312.pyc and b/utils/__pycache__/time_utils.cpython-312.pyc differ
 
utils/time_utils.py CHANGED
@@ -34,6 +34,14 @@ def get_card_tone(end_hour: str, end_minute: str) -> str:
34
  return "default"
35
 
36
 
 
 
 
 
 
 
 
 
37
  def build_card_payload() -> dict[str, str]:
38
  end_hour, end_minute = compute_end_time("08", "00")
39
  return {
 
34
  return "default"
35
 
36
 
37
+ def get_tone_message(tone: str) -> str:
38
+ if tone == "danger":
39
+ return "Less than 5 minutes left"
40
+ if tone == "success":
41
+ return "Less than 10 minutes left"
42
+ return "More than 10 minutes left"
43
+
44
+
45
  def build_card_payload() -> dict[str, str]:
46
  end_hour, end_minute = compute_end_time("08", "00")
47
  return {