Subh775 commited on
Commit
2d0cf48
·
1 Parent(s): d55f352

feedback section enhancement..

Browse files
Files changed (1) hide show
  1. frontend/vehicles.html +109 -45
frontend/vehicles.html CHANGED
@@ -421,6 +421,27 @@
421
  transition: color 0.15s;
422
  }
423
  .fb-star.active, .fb-star:hover { color: var(--cocoa-l); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
  </style>
425
  </head>
426
 
@@ -1103,63 +1124,85 @@
1103
  </div>
1104
 
1105
  <!-- TAB: Feedback -->
1106
- <div id="tab-feedback" class="hidden flex-1 min-h-0 overflow-y-auto" style="padding:16px">
1107
- <div class="max-w-4xl mx-auto w-full">
1108
- <div class="bg-black border border-slate-800 rounded-xl p-8 shadow-2xl space-y-6">
1109
- <div class="text-center">
1110
- <h2 class="text-xl font-bold" style="color:#f0ece6">Share Your Feedback</h2>
1111
- <p class="text-xs mt-2" style="color:#777">We're in the requirements-gathering phase. Your input directly shapes what gets built.</p>
 
 
 
 
1112
  </div>
1113
 
1114
- <div class="space-y-6">
1115
- <div class="grid grid-cols-2 gap-6">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1116
  <div>
1117
- <label class="text-[10px] font-bold uppercase tracking-widest block mb-2" style="color:#a89f97">Overall Experience</label>
1118
- <div class="fb-stars" id="fb-stars">
1119
- <span class="fb-star" data-v="1" onclick="setRating(1)">&#9733;</span>
1120
- <span class="fb-star" data-v="2" onclick="setRating(2)">&#9733;</span>
1121
- <span class="fb-star" data-v="3" onclick="setRating(3)">&#9733;</span>
1122
- <span class="fb-star" data-v="4" onclick="setRating(4)">&#9733;</span>
1123
- <span class="fb-star" data-v="5" onclick="setRating(5)">&#9733;</span>
 
1124
  </div>
1125
  </div>
 
1126
 
 
1127
  <div>
1128
- <label class="text-[10px] font-bold uppercase tracking-widest block mb-2" style="color:#a89f97">Primary Use Case</label>
1129
- <select class="fb-select w-full" id="fb-usecase">
1130
- <option value="" disabled selected>Select your use case</option>
1131
- <option value="research">Academic / Traffic Research</option>
1132
- <option value="planning">Urban Planning & Capacity</option>
1133
- <option value="highway">Highway Authority (NHAI/State)</option>
1134
- <option value="smartcity">Smart City Integrator</option>
1135
- <option value="other">Other</option>
1136
  </select>
1137
  </div>
1138
- </div>
1139
 
1140
- <div>
1141
- <label class="text-[10px] font-bold uppercase tracking-widest block mb-2" style="color:#a89f97">Category</label>
1142
- <select class="fb-select w-full" id="fb-type">
1143
- <option value="general">General Feedback</option>
1144
- <option value="bug">Bug Report / Processing Failure</option>
1145
- <option value="feature">Feature Request / Enhancements</option>
1146
- <option value="accuracy">Detection Accuracy (Misses/False Positives)</option>
1147
- <option value="ux">User Experience / Interface</option>
1148
- </select>
1149
- </div>
1150
 
1151
- <div>
1152
- <label class="text-[10px] font-bold uppercase tracking-widest block mb-2" style="color:#a89f97">Details</label>
1153
- <textarea class="fb-textarea w-full min-h-[140px]" id="fb-text" placeholder="Please provide specific details. If reporting accuracy issues, mention vehicle types or lighting conditions..."></textarea>
 
1154
  </div>
1155
-
1156
- <button onclick="submitFeedback()" class="w-full py-4 font-bold text-sm rounded-xl transition hover:scale-[1.01] active:scale-95 shadow-lg"
1157
- style="background:#111;border:1px solid var(--cocoa);color:var(--cocoa-l)">
1158
- Submit Feedback <i class="fa-solid fa-paper-plane ml-2 text-[10px]"></i>
1159
- </button>
1160
  </div>
1161
 
1162
- <p class="text-[10px] text-center" style="color:#444">Or email us directly at <strong style="color:#c89a6c">support@urbanflow.in</strong></p>
 
 
1163
  </div>
1164
  </div>
1165
  </div>
@@ -1298,15 +1341,36 @@
1298
  async function submitFeedback() {
1299
  const type = document.getElementById('fb-type').value;
1300
  const text = document.getElementById('fb-text').value.trim();
1301
- if (!text && !_fbRating) { showToast('Please add a rating or comment', 'error'); return; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1302
  const res = await fetch('/api/feedback', {
1303
  method: 'POST',
1304
  headers: { 'Content-Type': 'application/json' },
1305
- body: JSON.stringify({ rating: _fbRating, type, text })
1306
  });
1307
  if (res.ok) {
1308
  showToast('Thank you for your feedback!', 'success');
1309
  document.getElementById('fb-text').value = '';
 
 
1310
  setRating(0);
1311
  } else {
1312
  showToast('Failed to submit — please try again', 'error');
 
421
  transition: color 0.15s;
422
  }
423
  .fb-star.active, .fb-star:hover { color: var(--cocoa-l); }
424
+ .fb-chip {
425
+ background: #050505;
426
+ border: 1px solid #222;
427
+ border-radius: 8px;
428
+ color: #666;
429
+ font-size: 10px;
430
+ font-weight: 700;
431
+ padding: 12px;
432
+ cursor: pointer;
433
+ transition: all 0.2s ease;
434
+ text-align: center;
435
+ text-transform: uppercase;
436
+ tracking-widest: 0.05em;
437
+ }
438
+ .fb-chip:hover { border-color: #444; color: #999; }
439
+ .fb-chip.active {
440
+ border-color: var(--cocoa-l);
441
+ background: #111;
442
+ color: #fff;
443
+ box-shadow: 0 0 15px rgba(200, 154, 108, 0.15);
444
+ }
445
  </style>
446
  </head>
447
 
 
1124
  </div>
1125
 
1126
  <!-- TAB: Feedback -->
1127
+ <div id="tab-feedback" class="hidden flex-1 min-h-0 overflow-y-auto" style="padding:24px">
1128
+ <div class="max-w-6xl mx-auto w-full">
1129
+ <div class="bg-black border border-slate-800 rounded-2xl p-10 shadow-2xl space-y-10">
1130
+ <div class="text-center space-y-3">
1131
+ <h2 class="text-2xl font-bold tracking-tight" style="color:#f0ece6">Share Your Feedback</h2>
1132
+ <p class="text-xs" style="color:#777">We are actively refining UrbanFlow. Your technical insights directly drive our roadmap.</p>
1133
+ <div class="inline-flex items-center gap-2 px-4 py-1.5 bg-[#111] border border-[#222] rounded-full">
1134
+ <i class="fa-regular fa-clock text-[#c89a6c] text-[10px]"></i>
1135
+ <span class="text-[10px] font-bold uppercase tracking-widest text-[#a89f97]">Takes about 2 minutes to complete</span>
1136
+ </div>
1137
  </div>
1138
 
1139
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-10">
1140
+ <div class="space-y-8">
1141
+ <div class="grid grid-cols-1 sm:grid-cols-2 gap-6">
1142
+ <div>
1143
+ <label class="text-[10px] font-bold uppercase tracking-widest block mb-3" style="color:#a89f97">Overall Experience</label>
1144
+ <div class="fb-stars" id="fb-stars">
1145
+ <span class="fb-star" data-v="1" onclick="setRating(1)">&#9733;</span>
1146
+ <span class="fb-star" data-v="2" onclick="setRating(2)">&#9733;</span>
1147
+ <span class="fb-star" data-v="3" onclick="setRating(3)">&#9733;</span>
1148
+ <span class="fb-star" data-v="4" onclick="setRating(4)">&#9733;</span>
1149
+ <span class="fb-star" data-v="5" onclick="setRating(5)">&#9733;</span>
1150
+ </div>
1151
+ </div>
1152
+
1153
+ <div>
1154
+ <label class="text-[10px] font-bold uppercase tracking-widest block mb-3" style="color:#a89f97">Primary Use Case</label>
1155
+ <select class="fb-select w-full" id="fb-usecase">
1156
+ <option value="" disabled selected>Select your use case</option>
1157
+ <option value="research">Academic / Traffic Research</option>
1158
+ <option value="planning">Urban Planning & Capacity</option>
1159
+ <option value="highway">Highway Authority (NHAI/State)</option>
1160
+ <option value="smartcity">Smart City Integrator</option>
1161
+ <option value="other">Other Institutional</option>
1162
+ </select>
1163
+ </div>
1164
+ </div>
1165
+
1166
  <div>
1167
+ <label class="text-[10px] font-bold uppercase tracking-widest block mb-4" style="color:#a89f97">Feature Prioritization (Select all that apply)</label>
1168
+ <div class="grid grid-cols-2 gap-3" id="fb-priorities">
1169
+ <div class="fb-chip" onclick="this.classList.toggle('active')" data-val="live-rtsp">Live RTSP Streams</div>
1170
+ <div class="fb-chip" onclick="this.classList.toggle('active')" data-val="api-access">REST API Access</div>
1171
+ <div class="fb-chip" onclick="this.classList.toggle('active')" data-val="multi-cam">Junction Stitching</div>
1172
+ <div class="fb-chip" onclick="this.classList.toggle('active')" data-val="violation">Traffic Violations</div>
1173
+ <div class="fb-chip" onclick="this.classList.toggle('active')" data-val="edge-deploy">Cloud-to-Edge Sync</div>
1174
+ <div class="fb-chip" onclick="this.classList.toggle('active')" data-val="anpr">ANPR Integration</div>
1175
  </div>
1176
  </div>
1177
+ </div>
1178
 
1179
+ <div class="space-y-6">
1180
  <div>
1181
+ <label class="text-[10px] font-bold uppercase tracking-widest block mb-3" style="color:#a89f97">Feedback Category</label>
1182
+ <select class="fb-select w-full" id="fb-type">
1183
+ <option value="general">General Professional Feedback</option>
1184
+ <option value="bug">Technical Issue / Bug Report</option>
1185
+ <option value="feature">Strategic Feature Request</option>
1186
+ <option value="accuracy">Inference Accuracy Review</option>
1187
+ <option value="ux">Dashboard Workflow / UX</option>
 
1188
  </select>
1189
  </div>
 
1190
 
1191
+ <div>
1192
+ <label class="text-[10px] font-bold uppercase tracking-widest block mb-3" style="color:#a89f97">Detailed Word Feedback</label>
1193
+ <textarea class="fb-textarea w-full 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>
1194
+ </div>
 
 
 
 
 
 
1195
 
1196
+ <button onclick="submitFeedback()" class="w-full py-4 font-bold text-sm rounded-xl transition hover:scale-[1.01] active:scale-95 shadow-lg flex items-center justify-center gap-3"
1197
+ style="background:#111;border:1px solid var(--cocoa);color:var(--cocoa-l)">
1198
+ Transmit Feedback <i class="fa-solid fa-paper-plane text-[10px]"></i>
1199
+ </button>
1200
  </div>
 
 
 
 
 
1201
  </div>
1202
 
1203
+ <div class="pt-6 border-t border-[#111]">
1204
+ <p class="text-[10px] text-center" style="color:#444">Institutional queries: <strong style="color:#c89a6c">support@urbanflow.in</strong></p>
1205
+ </div>
1206
  </div>
1207
  </div>
1208
  </div>
 
1341
  async function submitFeedback() {
1342
  const type = document.getElementById('fb-type').value;
1343
  const text = document.getElementById('fb-text').value.trim();
1344
+ const usecase = document.getElementById('fb-usecase').value;
1345
+
1346
+ const priorities = [];
1347
+ document.querySelectorAll('#fb-priorities .fb-chip.active').forEach(c => {
1348
+ priorities.push(c.getAttribute('data-val'));
1349
+ });
1350
+
1351
+ if (!text && _fbRating === 0) {
1352
+ showToast("Please provide a rating or some word feedback", "error");
1353
+ return;
1354
+ }
1355
+
1356
+ const payload = {
1357
+ rating: _fbRating,
1358
+ type: type,
1359
+ usecase: usecase,
1360
+ priorities: priorities,
1361
+ details: text,
1362
+ timestamp: new Date().toISOString()
1363
+ };
1364
  const res = await fetch('/api/feedback', {
1365
  method: 'POST',
1366
  headers: { 'Content-Type': 'application/json' },
1367
+ body: JSON.stringify(payload)
1368
  });
1369
  if (res.ok) {
1370
  showToast('Thank you for your feedback!', 'success');
1371
  document.getElementById('fb-text').value = '';
1372
+ document.querySelectorAll('#fb-priorities .fb-chip').forEach(c => c.classList.remove('active'));
1373
+ _fbRating = 0;
1374
  setRating(0);
1375
  } else {
1376
  showToast('Failed to submit — please try again', 'error');