Skip to content

Commit

Permalink
Add keyboard shortcut for toggling the Backup Camera
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesalmeida committed Oct 2, 2024
1 parent 65c4aa2 commit 890b1fc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function App() {
const dots = useDots();
const [leftTurnSignal, setLeftTurnSignal] = useState(false);
const [rightTurnSignal, setRightTurnSignal] = useState(false);
const [isRearViewCameraActive, setIsRearViewCameraActive] = useState(false);

const appsTopShelf = [
'wipers',
Expand Down Expand Up @@ -265,6 +266,22 @@ function App() {
setRightTurnSignal(prev => !prev);
setLeftTurnSignal(false);
break;
case 'C':
console.log('Rear View Camera toggled');
event.preventDefault();
setIsRearViewCameraActive(prev => {
const newState = !prev;
console.log(`Rear View Camera is now ${newState ? 'active' : 'inactive'}`);
if (newState) {
setActiveNavIcon('camera');
setIsSliderOpen(true);
} else {
setActiveNavIcon(null);
setIsSliderOpen(false);
}
return newState;
});
break;
case 'H':
console.log('Hazard lights toggled');
event.preventDefault();
Expand Down

0 comments on commit 890b1fc

Please sign in to comment.