SmartySmile commited on
Commit
853dfe6
·
verified ·
1 Parent(s): 26c01af

Update src/App.js

Browse files
Files changed (1) hide show
  1. src/App.js +43 -7
src/App.js CHANGED
@@ -67,10 +67,10 @@ const App = () => {
67
  }
68
  }
69
 
70
- // Hide permissions panel if both ready
71
- if (bluetoothStatus === 'ready' && locationStatus === 'ready') {
72
- setShowPermissions(false);
73
- }
74
  };
75
 
76
  const requestBluetoothPermission = async () => {
@@ -90,7 +90,9 @@ const App = () => {
90
  if (device) {
91
  setBluetoothStatus('ready');
92
  // Disconnect immediately
93
- if (device.gatt) device.gatt.disconnect();
 
 
94
  checkPermissions(); // Re-check
95
  } else {
96
  setBluetoothStatus('needed');
@@ -316,7 +318,7 @@ const App = () => {
316
  <div className="permission-row">
317
  <div className="permission-item">
318
  <span className="status-icon">{getStatusIcon(bluetoothStatus)}</span>
319
- <span className="status-label">Bluetooth: {bluetoothStatus}</span>
320
  {bluetoothStatus === 'needed' && (
321
  <button onClick={requestBluetoothPermission} className="permission-button bluetooth-btn">
322
  Enable Bluetooth
@@ -329,7 +331,7 @@ const App = () => {
329
  <div className="permission-row">
330
  <div className="permission-item">
331
  <span className="status-icon">{getStatusIcon(locationStatus)}</span>
332
- <span className="status-label">Location: {locationStatus}</span>
333
  {locationStatus === 'needed' && (
334
  <button onClick={requestLocationPermission} className="permission-button location-btn">
335
  Grant Location Access
@@ -425,3 +427,37 @@ const App = () => {
425
  if (['deviceName', 'deviceId', 'senseType', 'status', 'timestamp', 'connection', 'pairingTip'].includes(key)) {
426
  return null;
427
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  }
68
  }
69
 
70
+ // Update showPermissions based on both statuses (re-check after updates)
71
+ setTimeout(() => {
72
+ setShowPermissions(bluetoothStatus !== 'ready' || locationStatus !== 'ready');
73
+ }, 100);
74
  };
75
 
76
  const requestBluetoothPermission = async () => {
 
90
  if (device) {
91
  setBluetoothStatus('ready');
92
  // Disconnect immediately
93
+ if (device.gatt?.connected) {
94
+ device.gatt.disconnect();
95
+ }
96
  checkPermissions(); // Re-check
97
  } else {
98
  setBluetoothStatus('needed');
 
318
  <div className="permission-row">
319
  <div className="permission-item">
320
  <span className="status-icon">{getStatusIcon(bluetoothStatus)}</span>
321
+ <span className="status-label">Bluetooth: {bluetoothStatus.charAt(0).toUpperCase() + bluetoothStatus.slice(1)}</span>
322
  {bluetoothStatus === 'needed' && (
323
  <button onClick={requestBluetoothPermission} className="permission-button bluetooth-btn">
324
  Enable Bluetooth
 
331
  <div className="permission-row">
332
  <div className="permission-item">
333
  <span className="status-icon">{getStatusIcon(locationStatus)}</span>
334
+ <span className="status-label">Location: {locationStatus.charAt(0).toUpperCase() + locationStatus.slice(1)}</span>
335
  {locationStatus === 'needed' && (
336
  <button onClick={requestLocationPermission} className="permission-button location-btn">
337
  Grant Location Access
 
427
  if (['deviceName', 'deviceId', 'senseType', 'status', 'timestamp', 'connection', 'pairingTip'].includes(key)) {
428
  return null;
429
  }
430
+ return (
431
+ <div key={key} className="sensor-reading">
432
+ <span className="sensor-label">{key.replace(/([A-Z])/g, ' $1').trim()}:</span>
433
+ <span className="sensor-value">{value}</span>
434
+ </div>
435
+ );
436
+ })}
437
+ </div>
438
+
439
+ <div className="result-actions">
440
+ <button onClick={clearResults} className="clear-button">
441
+ Clear Results
442
+ </button>
443
+ <button onClick={() => scanBluetoothHeadset(selectedSense)} className="rescan-button">
444
+ Rescan Headset
445
+ </button>
446
+ </div>
447
+ </div>
448
+ </div>
449
+ )}
450
+ </main>
451
+
452
+ <footer className="App-footer">
453
+ <div className="footer-content">
454
+ <p><strong>Copyright © nanoSOFT TECH</strong></p>
455
+ <p>Operating System: <strong>nCONNECT OS</strong> | BLE Headset Compatible</p>
456
+ <p className="version">Version 2.0 | For Audio & Bio-Sensor Headsets</p>
457
+ </div>
458
+ </footer>
459
+ </div>
460
+ );
461
+ };
462
+
463
+ export default App;