jostlebot commited on
Commit
15e57a1
·
1 Parent(s): 0088e95

Update UI with warm, calm aesthetic using new color palette and improved typography

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +132 -107
src/streamlit_app.py CHANGED
@@ -12,154 +12,176 @@ st.set_page_config(
12
  initial_sidebar_state="expanded"
13
  )
14
 
15
- # Simplified CSS for earth tones and better readability
16
  st.markdown("""
17
  <style>
18
- /* Custom fonts */
19
- @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');
20
 
21
  /* Main container styling */
22
  .stApp {
23
- background-color: #FFFAF5; /* Very light warm background */
 
24
  }
25
 
26
  /* Headers */
27
  h1, h2, h3 {
28
- font-family: 'Inter', sans-serif;
29
- color: #2D2D2D; /* Darker text for better contrast */
30
  font-weight: 600;
31
- margin-bottom: 1.2rem;
 
 
 
 
 
 
 
 
 
32
  }
33
 
34
  /* Text areas and inputs */
35
  .stTextArea, .stTextInput {
36
  background-color: #FFFFFF;
37
- border: 1px solid #E0D5C8; /* Soft clay */
38
- padding: 1.2rem;
39
- border-radius: 8px;
40
- box-shadow: none;
 
 
41
  }
42
 
43
  /* Buttons */
44
  .stButton > button {
45
- background-color: #8B9D83; /* Sage green */
46
- color: white;
 
 
47
  border: none;
48
- padding: 0.6rem 1.8rem;
49
- border-radius: 8px;
50
- font-family: 'Inter', sans-serif;
51
- font-weight: 500;
52
- box-shadow: none;
53
  }
54
 
55
- .stButton > button:hover {
56
- background-color: #7A8B73; /* Darker sage */
57
- border: none;
 
58
  }
59
 
60
- /* Markdown text */
61
- p, li {
62
- font-family: 'Inter', sans-serif;
63
- color: #2D2D2D; /* Darker text for better contrast */
64
- line-height: 1.8;
65
- font-size: 1rem;
66
  }
67
 
68
- /* Sidebar styling */
69
- .css-1d391kg, .css-1p05t8e { /* Sidebar containers */
70
- background-color: #FFFFFF !important;
71
  }
72
 
73
- .css-1d391kg p, .css-1p05t8e p { /* Sidebar text */
74
- color: #666666;
 
75
  }
76
 
77
- .css-1d391kg a, .css-1p05t8e a { /* Sidebar links */
78
- color: #666666;
79
- text-decoration: underline;
80
  }
81
 
82
- .css-1d391kg h1, .css-1p05t8e h1 { /* Sidebar headers */
83
- color: #666666;
 
 
 
 
 
84
  }
85
 
86
- .css-1d391kg .stMarkdown, .css-1p05t8e .stMarkdown { /* Sidebar markdown */
87
- color: #666666;
 
 
 
 
88
  }
89
 
90
- /* Custom containers */
91
- .warm-container {
92
- background-color: #FFFFFF;
93
- padding: 2rem;
94
- border: 1px solid #E0D5C8;
95
- border-radius: 8px;
96
- margin: 1.5rem 0;
97
  }
98
-
99
- /* Alert styling */
100
- .alert {
101
- padding: 1.2rem;
102
- border-radius: 8px;
103
- margin: 1.2rem 0;
104
- background-color: #FFF8E8;
105
- border-left: 4px solid #F4A261;
106
- color: #2D2D2D;
107
  }
108
-
109
- /* Resource styling */
110
- .resource-item {
111
- margin-bottom: 2rem;
112
- padding-bottom: 1rem;
113
- border-bottom: 1px solid #E0D5C8;
114
- color: #666666;
115
  }
116
 
117
- .resource-item:last-child {
118
- border-bottom: none;
 
 
 
119
  }
120
 
121
- .resource-title {
122
- font-weight: 600;
123
  color: #666666;
124
  margin-bottom: 0.5rem;
125
  }
126
 
127
- .resource-link {
128
- color: #666666;
129
- text-decoration: underline;
130
- font-weight: 500;
 
131
  }
132
 
133
- .resource-link:hover {
134
- color: #7A8B73;
 
 
135
  }
136
-
 
 
 
 
 
 
 
 
 
 
137
  /* Expander styling */
138
  .streamlit-expanderHeader {
139
  background-color: #FFFFFF;
140
- color: #2D2D2D;
141
- }
142
-
143
- /* Remove default Streamlit themes */
144
- .st-emotion-cache-1gulkj5, .st-emotion-cache-1rat1s6 {
145
- background-color: #FFFFFF !important;
146
  }
147
-
148
- /* Override any theme-specific text colors */
149
- .st-emotion-cache-1rat1s6 * {
150
- color: #2D2D2D !important;
151
- }
152
-
153
- /* Override any theme-specific text colors in sidebar */
154
- .st-emotion-cache-1rat1s6 .stMarkdown,
155
- .st-emotion-cache-1rat1s6 p,
156
- .st-emotion-cache-1rat1s6 h1,
157
- .st-emotion-cache-1rat1s6 h2,
158
- .st-emotion-cache-1rat1s6 h3,
159
- .st-emotion-cache-1rat1s6 h4,
160
- .st-emotion-cache-1rat1s6 li,
161
- .st-emotion-cache-1rat1s6 a {
162
- color: #666666 !important;
163
  }
164
  </style>
165
  """, unsafe_allow_html=True)
@@ -468,21 +490,24 @@ if submit and journal_entry: # Only process if there's text and button is click
468
  # Display chat history in reverse chronological order
469
  st.markdown("### Conversation")
470
  for exchange in reversed(st.session_state.chat_history):
471
- # User message in a light container
472
- st.markdown("""
473
- <div style="background-color: #F8F9FA; padding: 1rem; border-radius: 8px; margin: 0.5rem 0;">
474
- <p style="color: #666666; margin-bottom: 0.5rem;"><em>You</em></p>
475
- <p style="margin: 0;">{}</p>
476
  </div>
477
- """.format(exchange["user_message"]), unsafe_allow_html=True)
478
 
479
- # AI response in a warm container
480
- st.markdown("""
481
- <div style="background-color: #FFF8F3; padding: 1rem; border-radius: 8px; margin: 0.5rem 0;">
482
- <p style="color: #666666; margin-bottom: 0.5rem;"><em>NurtureNest • {}</em></p>
483
- <p style="margin: 0;">{}</p>
 
 
 
484
  </div>
485
- """.format(exchange["tone"], exchange["ai_response"]), unsafe_allow_html=True)
486
 
487
  # Save conversation button at the bottom
488
  if st.session_state.chat_history:
 
12
  initial_sidebar_state="expanded"
13
  )
14
 
15
+ # Enhanced CSS for warm, calm aesthetic
16
  st.markdown("""
17
  <style>
18
+ /* Import fonts */
19
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Nunito:wght@400;500;600;700&display=swap');
20
 
21
  /* Main container styling */
22
  .stApp {
23
+ background-color: #F5F5F0; /* Soft parchment background */
24
+ font-family: 'Inter', 'Nunito', sans-serif;
25
  }
26
 
27
  /* Headers */
28
  h1, h2, h3 {
29
+ font-family: 'Nunito', 'Inter', sans-serif;
30
+ color: #2E2E2E; /* Charcoal */
31
  font-weight: 600;
32
+ margin-bottom: 1.5rem;
33
+ line-height: 1.6;
34
+ }
35
+
36
+ /* Base text styling */
37
+ p, li, label {
38
+ font-family: 'Inter', 'Nunito', sans-serif;
39
+ color: #2E2E2E;
40
+ line-height: 1.8;
41
+ font-size: 16px;
42
  }
43
 
44
  /* Text areas and inputs */
45
  .stTextArea, .stTextInput {
46
  background-color: #FFFFFF;
47
+ border: 1px solid #E0E0E0;
48
+ padding: 1.25rem;
49
+ border-radius: 1rem;
50
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
51
+ font-size: 16px;
52
+ line-height: 1.8;
53
  }
54
 
55
  /* Buttons */
56
  .stButton > button {
57
+ font-family: 'Nunito', 'Inter', sans-serif;
58
+ font-weight: 600;
59
+ padding: 0.75rem 2rem;
60
+ border-radius: 1rem;
61
  border: none;
62
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
63
+ transition: all 0.3s ease;
 
 
 
64
  }
65
 
66
+ /* Tone-specific button colors */
67
+ .warm-tone button {
68
+ background-color: #FFDD99;
69
+ color: #2E2E2E;
70
  }
71
 
72
+ .reflective-tone button {
73
+ background-color: #B8E0D2;
74
+ color: #2E2E2E;
 
 
 
75
  }
76
 
77
+ .encouraging-tone button {
78
+ background-color: #C9D8F2;
79
+ color: #2E2E2E;
80
  }
81
 
82
+ .direct-tone button {
83
+ background-color: #D3D3D3;
84
+ color: #2E2E2E;
85
  }
86
 
87
+ .stButton > button:hover {
88
+ transform: translateY(-1px);
89
+ box-shadow: 0 4px 12px rgba(0,0,0,0.1);
90
  }
91
 
92
+ /* Chat containers */
93
+ .user-message {
94
+ background-color: #FFFFFF;
95
+ padding: 1.5rem;
96
+ border-radius: 1rem;
97
+ margin: 1rem 0;
98
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
99
  }
100
 
101
+ .ai-message-warm {
102
+ background-color: #FFFAE6;
103
+ padding: 1.5rem;
104
+ border-radius: 1rem;
105
+ margin: 1rem 0;
106
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
107
  }
108
 
109
+ .ai-message-reflective {
110
+ background-color: #F0F8F5;
111
+ padding: 1.5rem;
112
+ border-radius: 1rem;
113
+ margin: 1rem 0;
114
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
 
115
  }
116
+
117
+ .ai-message-encouraging {
118
+ background-color: #F5F8FC;
119
+ padding: 1.5rem;
120
+ border-radius: 1rem;
121
+ margin: 1rem 0;
122
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
 
 
123
  }
124
+
125
+ .ai-message-direct {
126
+ background-color: #F8F8F8;
127
+ padding: 1.5rem;
128
+ border-radius: 1rem;
129
+ margin: 1rem 0;
130
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
131
  }
132
 
133
+ /* Message text */
134
+ .message-text {
135
+ font-size: 18px;
136
+ line-height: 1.8;
137
+ color: #2E2E2E;
138
  }
139
 
140
+ .message-meta {
141
+ font-size: 14px;
142
  color: #666666;
143
  margin-bottom: 0.5rem;
144
  }
145
 
146
+ /* Sidebar styling */
147
+ .css-1d391kg, .css-1p05t8e {
148
+ background-color: #FFFFFF !important;
149
+ padding: 2rem;
150
+ font-family: 'Inter', 'Nunito', sans-serif;
151
  }
152
 
153
+ .sidebar-text {
154
+ color: #2E2E2E;
155
+ line-height: 1.8;
156
+ font-size: 16px;
157
  }
158
+
159
+ /* Alert styling */
160
+ .alert {
161
+ background-color: #FFF8E1;
162
+ border-left: 4px solid #FFDD99;
163
+ padding: 1.5rem;
164
+ border-radius: 1rem;
165
+ margin: 1.5rem 0;
166
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
167
+ }
168
+
169
  /* Expander styling */
170
  .streamlit-expanderHeader {
171
  background-color: #FFFFFF;
172
+ border-radius: 1rem;
173
+ padding: 1rem;
174
+ box-shadow: 0 2px 8px rgba(0,0,0,0.05);
 
 
 
175
  }
176
+
177
+ /* Psychoeducation snippets */
178
+ .psychoed-text {
179
+ font-style: italic;
180
+ color: #4A4A4A;
181
+ padding: 1rem;
182
+ background-color: #FAFAFA;
183
+ border-radius: 0.5rem;
184
+ margin: 1rem 0;
 
 
 
 
 
 
 
185
  }
186
  </style>
187
  """, unsafe_allow_html=True)
 
490
  # Display chat history in reverse chronological order
491
  st.markdown("### Conversation")
492
  for exchange in reversed(st.session_state.chat_history):
493
+ # User message
494
+ st.markdown(f"""
495
+ <div class="user-message">
496
+ <div class="message-meta"><em>You</em></div>
497
+ <div class="message-text">{exchange["user_message"]}</div>
498
  </div>
499
+ """, unsafe_allow_html=True)
500
 
501
+ # AI response with tone-specific styling
502
+ tone_class = f"ai-message-{exchange['tone'].split()[0].lower()}"
503
+ st.markdown(f"""
504
+ <div class="{tone_class}">
505
+ <div class="message-meta">
506
+ <strong>{exchange["tone"]}</strong> • NurtureNest
507
+ </div>
508
+ <div class="message-text">{exchange["ai_response"]}</div>
509
  </div>
510
+ """, unsafe_allow_html=True)
511
 
512
  # Save conversation button at the bottom
513
  if st.session_state.chat_history: