Spaces:
Sleeping
Sleeping
Update UI with warm, calm aesthetic using new color palette and improved typography
Browse files- 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 |
-
#
|
16 |
st.markdown("""
|
17 |
<style>
|
18 |
-
/*
|
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: #
|
|
|
24 |
}
|
25 |
|
26 |
/* Headers */
|
27 |
h1, h2, h3 {
|
28 |
-
font-family: 'Inter', sans-serif;
|
29 |
-
color: #
|
30 |
font-weight: 600;
|
31 |
-
margin-bottom: 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
|
34 |
/* Text areas and inputs */
|
35 |
.stTextArea, .stTextInput {
|
36 |
background-color: #FFFFFF;
|
37 |
-
border: 1px solid #
|
38 |
-
padding: 1.
|
39 |
-
border-radius:
|
40 |
-
box-shadow:
|
|
|
|
|
41 |
}
|
42 |
|
43 |
/* Buttons */
|
44 |
.stButton > button {
|
45 |
-
|
46 |
-
|
|
|
|
|
47 |
border: none;
|
48 |
-
|
49 |
-
|
50 |
-
font-family: 'Inter', sans-serif;
|
51 |
-
font-weight: 500;
|
52 |
-
box-shadow: none;
|
53 |
}
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
58 |
}
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
color: #2D2D2D; /* Darker text for better contrast */
|
64 |
-
line-height: 1.8;
|
65 |
-
font-size: 1rem;
|
66 |
}
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
}
|
72 |
|
73 |
-
.
|
74 |
-
color: #
|
|
|
75 |
}
|
76 |
|
77 |
-
.
|
78 |
-
|
79 |
-
|
80 |
}
|
81 |
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
|
86 |
-
.
|
87 |
-
color: #
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
margin: 1.5rem 0;
|
97 |
}
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
padding: 1.
|
102 |
-
border-radius:
|
103 |
-
margin:
|
104 |
-
|
105 |
-
border-left: 4px solid #F4A261;
|
106 |
-
color: #2D2D2D;
|
107 |
}
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
}
|
116 |
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
119 |
}
|
120 |
|
121 |
-
.
|
122 |
-
font-
|
123 |
color: #666666;
|
124 |
margin-bottom: 0.5rem;
|
125 |
}
|
126 |
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
|
|
131 |
}
|
132 |
|
133 |
-
.
|
134 |
-
color: #
|
|
|
|
|
135 |
}
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
/* Expander styling */
|
138 |
.streamlit-expanderHeader {
|
139 |
background-color: #FFFFFF;
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
/* Remove default Streamlit themes */
|
144 |
-
.st-emotion-cache-1gulkj5, .st-emotion-cache-1rat1s6 {
|
145 |
-
background-color: #FFFFFF !important;
|
146 |
}
|
147 |
-
|
148 |
-
/*
|
149 |
-
.
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
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
|
472 |
-
st.markdown("""
|
473 |
-
<div
|
474 |
-
<
|
475 |
-
<
|
476 |
</div>
|
477 |
-
"""
|
478 |
|
479 |
-
# AI response
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
<
|
|
|
|
|
|
|
484 |
</div>
|
485 |
-
"""
|
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:
|