yaseminozkut commited on
Commit
0d1a49d
·
1 Parent(s): d83d441

modify UI

Browse files
judgy_reachy_no_phone/static/index.html CHANGED
@@ -20,6 +20,14 @@
20
  <span id="status-text">Not monitoring</span>
21
  </div>
22
 
 
 
 
 
 
 
 
 
23
  <!-- Stats Grid -->
24
  <div class="stats-grid">
25
  <div class="stat-card red">
 
20
  <span id="status-text">Not monitoring</span>
21
  </div>
22
 
23
+ <!-- Camera Feed -->
24
+ <div class="video-container">
25
+ <img id="video-feed" src="" alt="Camera feed will appear here when monitoring starts">
26
+ <div id="video-placeholder" class="video-placeholder">
27
+ 📷 Camera feed will appear here
28
+ </div>
29
+ </div>
30
+
31
  <!-- Stats Grid -->
32
  <div class="stats-grid">
33
  <div class="stat-card red">
judgy_reachy_no_phone/static/main.js CHANGED
@@ -12,6 +12,28 @@ function formatDuration(seconds) {
12
  return hours + 'h' + mins + 'm';
13
  }
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  // Update display from API data
16
  async function updateDisplay() {
17
  try {
@@ -95,8 +117,12 @@ document.getElementById('cooldown').addEventListener('input', (e) => {
95
  document.getElementById('toggle-btn').addEventListener('click', toggleMonitoring);
96
  document.getElementById('test-btn').addEventListener('click', testShame);
97
 
98
- // Auto-update every 500ms - only updates text content, no DOM manipulation
99
- setInterval(updateDisplay, 500);
 
 
 
100
 
101
  // Initial update
102
  updateDisplay();
 
 
12
  return hours + 'h' + mins + 'm';
13
  }
14
 
15
+ // Update video feed
16
+ async function updateVideo() {
17
+ try {
18
+ const response = await fetch('/api/video-frame');
19
+ const data = await response.json();
20
+
21
+ const videoFeed = document.getElementById('video-feed');
22
+ const placeholder = document.getElementById('video-placeholder');
23
+
24
+ if (data.frame) {
25
+ videoFeed.src = 'data:image/jpeg;base64,' + data.frame;
26
+ videoFeed.classList.add('active');
27
+ placeholder.classList.add('hidden');
28
+ } else {
29
+ videoFeed.classList.remove('active');
30
+ placeholder.classList.remove('hidden');
31
+ }
32
+ } catch (e) {
33
+ console.error('Video update failed:', e);
34
+ }
35
+ }
36
+
37
  // Update display from API data
38
  async function updateDisplay() {
39
  try {
 
117
  document.getElementById('toggle-btn').addEventListener('click', toggleMonitoring);
118
  document.getElementById('test-btn').addEventListener('click', testShame);
119
 
120
+ // Auto-update every 100ms for smooth video
121
+ setInterval(() => {
122
+ updateVideo();
123
+ updateDisplay();
124
+ }, 100);
125
 
126
  // Initial update
127
  updateDisplay();
128
+ updateVideo();
judgy_reachy_no_phone/static/style.css CHANGED
@@ -56,6 +56,34 @@ body {
56
  color: #6b7280;
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  #status-text.monitoring {
60
  color: #22c55e;
61
  }
 
56
  color: #6b7280;
57
  }
58
 
59
+ .video-container {
60
+ padding: 0 20px 20px 20px;
61
+ position: relative;
62
+ }
63
+
64
+ #video-feed {
65
+ width: 100%;
66
+ border-radius: 10px;
67
+ display: none;
68
+ }
69
+
70
+ #video-feed.active {
71
+ display: block;
72
+ }
73
+
74
+ .video-placeholder {
75
+ background: #f3f4f6;
76
+ border-radius: 10px;
77
+ padding: 60px 20px;
78
+ text-align: center;
79
+ color: #6b7280;
80
+ font-size: 16px;
81
+ }
82
+
83
+ .video-placeholder.hidden {
84
+ display: none;
85
+ }
86
+
87
  #status-text.monitoring {
88
  color: #22c55e;
89
  }