Subh775 commited on
Commit
d0f2cef
Β·
1 Parent(s): 07c3913

changes to feedback receive & submission

Browse files
backend/server.py CHANGED
@@ -205,16 +205,45 @@ def send_feedback_email(api_key, feedback):
205
  details = feedback.get('details') or "No text provided"
206
  usecase = feedback.get('usecase') or "Not specified"
207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  html_body = f"""
209
- <div style="font-family: sans-serif; color: #333; max-width: 600px; border: 1px solid #eee; padding: 20px; border-radius: 10px;">
210
- <h2 style="color: #8b5e3c;">New UrbanFlow Feedback</h2>
211
- <p><strong>Category:</strong> {fb_type}</p>
212
- <p><strong>Rating:</strong> {'β˜…' * rating}{'β˜†' * (5-rating)} ({rating}/5)</p>
213
- <p><strong>Usecase:</strong> {usecase}</p>
 
 
 
 
214
  <hr style="border: 0; border-top: 1px solid #eee; margin: 20px 0;">
215
- <p style="white-space: pre-wrap;">{details}</p>
 
 
 
 
 
 
216
  <hr style="border: 0; border-top: 1px solid #eee; margin: 20px 0;">
217
- <p style="font-size: 12px; color: #999;">This email was sent automatically from the UrbanFlow Demo Platform.</p>
218
  </div>
219
  """
220
 
 
205
  details = feedback.get('details') or "No text provided"
206
  usecase = feedback.get('usecase') or "Not specified"
207
 
208
+ emojis = feedback.get('emojis', {})
209
+ priorities = feedback.get('priorities', [])
210
+
211
+ emoji_section = ""
212
+ if emojis:
213
+ emoji_section = "<p><strong>Experience Metrics:</strong></p><ul style='font-size: 13px;'>"
214
+ for key, val in emojis.items():
215
+ if val:
216
+ label = key.replace('fb-', '').replace('-', ' ').title()
217
+ emoji_section += f"<li>{label}: <span style='color:#c89a6c;'>{val.capitalize()}</span></li>"
218
+ emoji_section += "</ul>"
219
+
220
+ priority_section = ""
221
+ if priorities:
222
+ priority_section = "<p><strong>Priorities:</strong></p><ul style='font-size: 13px;'>"
223
+ for p in priorities:
224
+ priority_section += f"<li>{p.replace('-', ' ').capitalize()}</li>"
225
+ priority_section += "</ul>"
226
+
227
  html_body = f"""
228
+ <div style="font-family: sans-serif; color: #333; max-width: 600px; border: 1px solid #eee; padding: 25px; border-radius: 12px; line-height: 1.5;">
229
+ <h2 style="color: #8b5e3c; margin-top: 0;">New UrbanFlow Feedback</h2>
230
+
231
+ <table style="width: 100%; border-collapse: collapse; font-size: 14px;">
232
+ <tr><td style="padding: 5px 0;"><strong>Category:</strong></td><td>{fb_type}</td></tr>
233
+ <tr><td style="padding: 5px 0;"><strong>Rating:</strong></td><td>{'β˜…' * rating}{'β˜†' * (5-rating)} ({rating}/5)</td></tr>
234
+ <tr><td style="padding: 5px 0;"><strong>Usecase:</strong></td><td>{usecase}</td></tr>
235
+ </table>
236
+
237
  <hr style="border: 0; border-top: 1px solid #eee; margin: 20px 0;">
238
+
239
+ {emoji_section}
240
+ {priority_section}
241
+
242
+ <p><strong>Detailed Feedback:</strong></p>
243
+ <div style="background: #f9f9f9; padding: 15px; border-radius: 8px; font-size: 14px; color: #555; white-space: pre-wrap;">{details}</div>
244
+
245
  <hr style="border: 0; border-top: 1px solid #eee; margin: 20px 0;">
246
+ <p style="font-size: 11px; color: #999; text-align: center;">Sent via UrbanFlow Demo Platform Engine</p>
247
  </div>
248
  """
249
 
frontend/js/vehicles.js CHANGED
@@ -187,6 +187,36 @@
187
 
188
  _fbRating = 0;
189
  setRating(0);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  } else {
191
  showToast('Failed to submit β€” please try again', 'error');
192
  }
 
187
 
188
  _fbRating = 0;
189
  setRating(0);
190
+
191
+ // Start Cooldown (60 seconds)
192
+ const btn = document.getElementById('fb-submit-btn');
193
+ const wrap = document.getElementById('fb-cooldown-wrap');
194
+ const bar = document.getElementById('fb-cooldown-bar');
195
+ const timerEl = document.getElementById('fb-cooldown-timer');
196
+
197
+ btn.disabled = true;
198
+ btn.style.opacity = '0.5';
199
+ btn.style.cursor = 'not-allowed';
200
+ btn.innerText = 'Feedback Received';
201
+ wrap.classList.remove('hidden');
202
+
203
+ let timeLeft = 60;
204
+ const total = 60;
205
+ const interval = setInterval(() => {
206
+ timeLeft -= 1;
207
+ timerEl.innerText = timeLeft;
208
+ bar.style.width = (timeLeft / total * 100) + '%';
209
+
210
+ if (timeLeft <= 0) {
211
+ clearInterval(interval);
212
+ btn.disabled = false;
213
+ btn.style.opacity = '1';
214
+ btn.style.cursor = 'pointer';
215
+ btn.innerText = 'Transmit Feedback';
216
+ wrap.classList.add('hidden');
217
+ bar.style.width = '100%';
218
+ }
219
+ }, 1000);
220
  } else {
221
  showToast('Failed to submit β€” please try again', 'error');
222
  }
frontend/vehicles.html CHANGED
@@ -828,9 +828,18 @@
828
  <textarea class="fb-textarea w-full flex-1 min-h-[180px]" id="fb-text" placeholder="Please take a moment to provide a meaningful response. Describe your specific workflow needs or any limitations you encountered..."></textarea>
829
  </div>
830
 
831
- <button onclick="submitFeedback()" class="w-full py-4 font-bold text-sm rounded-full transition hover:scale-[1.01] active:scale-95 shadow-lg flex items-center justify-center gap-3 mt-4" style="background:#111;border:1px solid var(--cocoa);color:var(--cocoa-l)">
832
  Transmit Feedback
833
  </button>
 
 
 
 
 
 
 
 
 
834
  </div>
835
  </div>
836
  </div>
 
828
  <textarea class="fb-textarea w-full flex-1 min-h-[180px]" id="fb-text" placeholder="Please take a moment to provide a meaningful response. Describe your specific workflow needs or any limitations you encountered..."></textarea>
829
  </div>
830
 
831
+ <button id="fb-submit-btn" onclick="submitFeedback()" class="w-full py-4 font-bold text-sm rounded-full transition hover:scale-[1.01] active:scale-95 shadow-lg flex items-center justify-center gap-3 mt-4" style="background:#111;border:1px solid var(--cocoa);color:var(--cocoa-l)">
832
  Transmit Feedback
833
  </button>
834
+
835
+ <!-- Cooldown Progress Bar -->
836
+ <div id="fb-cooldown-wrap" class="w-full mt-4 hidden">
837
+ <div class="w-full h-1 bg-neutral-900 rounded-full overflow-hidden">
838
+ <div id="fb-cooldown-bar" class="h-full w-full transition-all duration-100 ease-linear rounded-full" style="background:var(--cocoa-l)"></div>
839
+ </div>
840
+ <p class="text-[9px] font-bold text-center mt-2 uppercase tracking-[0.2em]" style="color:#555">Anti-Spam Cooldown: <span id="fb-cooldown-timer">60</span>s</p>
841
+ </div>
842
+
843
  </div>
844
  </div>
845
  </div>