Soufianesejjari commited on
Commit
daf2c98
Β·
1 Parent(s): d604850

Enhance success message display with portfolio options and improved sharing features

Browse files
Files changed (1) hide show
  1. app.py +98 -43
app.py CHANGED
@@ -125,22 +125,38 @@ def collect_missing_data(profile):
125
  return profile
126
 
127
  def display_success_message(inserted_id, frontend_url):
128
- """Displays a focused success message highlighting the portfolio link"""
129
 
130
  st.balloons() # Add some celebration!
131
 
132
- # Create a centered, visually striking container that works in both light and dark mode
133
  st.markdown("""
134
  <style>
135
- .success-container {
136
- background-color: rgba(40, 167, 69, 0.1);
137
- border-left: 6px solid #28a745;
 
 
 
 
 
 
 
 
 
138
  padding: 20px;
139
- border-radius: 5px;
140
- box-shadow: 0 4px 8px rgba(0,0,0,0.1);
141
- margin: 20px 0;
142
  text-align: center;
 
 
 
 
 
 
 
 
 
143
  color: inherit;
 
144
  }
145
  .portfolio-link {
146
  display: inline-block;
@@ -149,9 +165,15 @@ def display_success_message(inserted_id, frontend_url):
149
  padding: 10px 20px;
150
  border-radius: 5px;
151
  text-decoration: none;
152
- margin: 20px 0;
153
  font-weight: bold;
154
- font-size: 1.2rem;
 
 
 
 
 
 
155
  }
156
  .share-button {
157
  border: 1px solid rgba(150, 150, 150, 0.3);
@@ -159,59 +181,92 @@ def display_success_message(inserted_id, frontend_url):
159
  border-radius: 5px;
160
  text-align: center;
161
  transition: all 0.3s;
 
 
162
  }
163
  .share-button:hover {
164
  background-color: rgba(100, 100, 100, 0.1);
 
165
  }
166
  </style>
167
  """, unsafe_allow_html=True)
168
 
169
- # Display the main success message with inheriting text color
 
 
 
 
170
  st.markdown("""
171
- <div class="success-container">
172
  <h1 style="color: #28a745;">πŸŽ‰ Your Portfolio is Ready!</h1>
173
- <p style="color: inherit;">Your professional portfolio has been created successfully and is now available online.</p>
 
174
  """, unsafe_allow_html=True)
175
 
176
- # Portfolio link - make this the most prominent part with the correct URL format
177
- portfolio_url = f"https://iportfo.netlify.app/{inserted_id}"
178
  st.markdown(f"""
179
- <div style="text-align: center; margin: 30px 0;">
180
- <a href="{portfolio_url}" target="_blank" class="portfolio-link">
181
- View Your Portfolio πŸš€
182
- </a>
183
- <p style="margin-top: 10px; color: inherit;">Portfolio ID: <code>{inserted_id}</code></p>
184
- </div>
 
 
 
 
 
 
 
 
 
185
  </div>
186
  """, unsafe_allow_html=True)
187
 
188
- # Clean, simple sharing options
189
- st.subheader("Share Your Portfolio")
190
- col1, col2 = st.columns(2)
191
- with col1:
192
- st.markdown(f"""
193
- <a href="https://twitter.com/intent/tweet?text=Check%20out%20my%20professional%20portfolio!&url={portfolio_url}" target="_blank" style="text-decoration: none;">
194
- <div class="share-button">
195
- <span style="font-size: 1.2rem;">Share on Twitter</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  </div>
197
  </a>
198
- """, unsafe_allow_html=True)
199
- with col2:
200
- st.markdown(f"""
201
- <a href="https://www.linkedin.com/sharing/share-offsite/?url={portfolio_url}" target="_blank" style="text-decoration: none;">
202
- <div class="share-button">
203
- <span style="font-size: 1.2rem;">Share on LinkedIn</span>
204
  </div>
205
  </a>
206
- """, unsafe_allow_html=True)
 
207
 
208
- # Option to view the portfolio directly
209
  st.markdown(f"""
210
  <div style="margin-top: 30px; text-align: center;">
211
- <p>Bookmark this link to access your portfolio anytime:</p>
212
- <p style="background-color: rgba(100, 100, 100, 0.1); padding: 10px; border-radius: 5px; font-family: monospace; word-break: break-all;">
213
- {portfolio_url}
214
- </p>
215
  </div>
216
  """, unsafe_allow_html=True)
217
 
@@ -623,10 +678,10 @@ def main():
623
 
624
  # Final state - display success and options for new profile
625
  else:
626
- # Show only the focused success message with portfolio link
627
  display_success_message(
628
  inserted_id=st.session_state.get('inserted_id'),
629
- frontend_url=None # Using direct iportfo.netlify.app URL instead
630
  )
631
 
632
  # Option to create another profile
 
125
  return profile
126
 
127
  def display_success_message(inserted_id, frontend_url):
128
+ """Displays a focused success message highlighting both portfolio options"""
129
 
130
  st.balloons() # Add some celebration!
131
 
132
+ # Create styles for the portfolio cards
133
  st.markdown("""
134
  <style>
135
+ .portfolio-container {
136
+ display: flex;
137
+ gap: 20px;
138
+ margin: 30px 0;
139
+ flex-wrap: wrap;
140
+ }
141
+ .portfolio-card {
142
+ flex: 1;
143
+ min-width: 300px;
144
+ background-color: rgba(255, 255, 255, 0.05);
145
+ border: 1px solid rgba(150, 150, 150, 0.2);
146
+ border-radius: 10px;
147
  padding: 20px;
 
 
 
148
  text-align: center;
149
+ }
150
+ .portfolio-title {
151
+ font-size: 1.5rem;
152
+ margin-bottom: 10px;
153
+ color: inherit;
154
+ }
155
+ .portfolio-desc {
156
+ font-size: 0.9rem;
157
+ margin-bottom: 20px;
158
  color: inherit;
159
+ opacity: 0.8;
160
  }
161
  .portfolio-link {
162
  display: inline-block;
 
165
  padding: 10px 20px;
166
  border-radius: 5px;
167
  text-decoration: none;
168
+ margin: 10px 0;
169
  font-weight: bold;
170
+ font-size: 1.1rem;
171
+ }
172
+ .share-grid {
173
+ display: grid;
174
+ grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
175
+ gap: 10px;
176
+ margin-top: 20px;
177
  }
178
  .share-button {
179
  border: 1px solid rgba(150, 150, 150, 0.3);
 
181
  border-radius: 5px;
182
  text-align: center;
183
  transition: all 0.3s;
184
+ text-decoration: none;
185
+ color: inherit;
186
  }
187
  .share-button:hover {
188
  background-color: rgba(100, 100, 100, 0.1);
189
+ transform: translateY(-2px);
190
  }
191
  </style>
192
  """, unsafe_allow_html=True)
193
 
194
+ # Define portfolio URLs
195
+ classic_url = f"https://iportfo.netlify.app/{inserted_id}"
196
+ modern_url = f"https://v0-modern-portfolio-react.vercel.app/{inserted_id}"
197
+
198
+ # Success header
199
  st.markdown("""
200
+ <div style="text-align: center; margin-bottom: 30px;">
201
  <h1 style="color: #28a745;">πŸŽ‰ Your Portfolio is Ready!</h1>
202
+ <p style="color: inherit;">Choose from two beautiful portfolio designs</p>
203
+ </div>
204
  """, unsafe_allow_html=True)
205
 
206
+ # Portfolio cards
 
207
  st.markdown(f"""
208
+ <div class="portfolio-container">
209
+ <div class="portfolio-card">
210
+ <h2 class="portfolio-title">🎨 Classic Portfolio</h2>
211
+ <p class="portfolio-desc">Clean and professional design showcasing your experience in a traditional layout</p>
212
+ <a href="{classic_url}" target="_blank" class="portfolio-link">
213
+ View Classic Design πŸš€
214
+ </a>
215
+ </div>
216
+ <div class="portfolio-card">
217
+ <h2 class="portfolio-title">✨ Modern Portfolio (Beta)</h2>
218
+ <p class="portfolio-desc">Contemporary and dynamic design with enhanced visual elements</p>
219
+ <a href="{modern_url}" target="_blank" class="portfolio-link">
220
+ Try Modern Design 🎯
221
+ </a>
222
+ </div>
223
  </div>
224
  """, unsafe_allow_html=True)
225
 
226
+ # Share section
227
+ st.subheader("πŸ“€ Share Your Portfolio")
228
+
229
+ # Define share messages
230
+ linkedin_msg = "Excited to share my professional portfolio! Check out my experience and projects"
231
+ twitter_msg = "Check out my professional portfolio showcasing my work and experience!"
232
+ whatsapp_msg = "Hi! I wanted to share my professional portfolio with you. Take a look!"
233
+
234
+ # Create share URLs
235
+ linkedin_share_url = f"https://www.linkedin.com/sharing/share-offsite/?url={classic_url}&summary={linkedin_msg}"
236
+ twitter_share_url = f"https://twitter.com/intent/tweet?text={twitter_msg}&url={classic_url}"
237
+ whatsapp_share_url = f"https://wa.me/?text={whatsapp_msg}%20{classic_url}"
238
+
239
+ # Share buttons
240
+ st.markdown(f"""
241
+ <div class="share-grid">
242
+ <a href="{linkedin_share_url}" target="_blank" class="share-button">
243
+ <div>
244
+ <span style="font-size: 1.2rem;">LinkedIn</span>
245
+ <br/>
246
+ <small>Share with professionals</small>
247
+ </div>
248
+ </a>
249
+ <a href="{twitter_share_url}" target="_blank" class="share-button">
250
+ <div>
251
+ <span style="font-size: 1.2rem;">Twitter</span>
252
+ <br/>
253
+ <small>Share with your network</small>
254
  </div>
255
  </a>
256
+ <a href="{whatsapp_share_url}" target="_blank" class="share-button">
257
+ <div>
258
+ <span style="font-size: 1.2rem;">WhatsApp</span>
259
+ <br/>
260
+ <small>Share with friends</small>
 
261
  </div>
262
  </a>
263
+ </div>
264
+ """, unsafe_allow_html=True)
265
 
266
+ # Portfolio IDs
267
  st.markdown(f"""
268
  <div style="margin-top: 30px; text-align: center;">
269
+ <p style="color: inherit;">Your Portfolio ID: <code>{inserted_id}</code></p>
 
 
 
270
  </div>
271
  """, unsafe_allow_html=True)
272
 
 
678
 
679
  # Final state - display success and options for new profile
680
  else:
681
+ # Show only the focused success message with portfolio links
682
  display_success_message(
683
  inserted_id=st.session_state.get('inserted_id'),
684
+ frontend_url=None # Not needed anymore as we're using direct URLs
685
  )
686
 
687
  # Option to create another profile