Simplify home view and drop motion detection
- Top nav tabs (Home/Media/Cameras/Settings) replace the right-side button cluster - Home view now shows calendar 90% / todo 10% vertically; lights, locks, alarm, thermostats removed from the dashboard since the photo frame now owns the idle space and the nav covers the remaining sections - Motion detection deleted: the go2rtc-based Kitchen_Panel poll was only there to wake the screen before idle timeout, which photo-frame exit on touch replaces
This commit is contained in:
@@ -1,14 +1,9 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useUIStore } from '@/stores/uiStore';
|
||||
|
||||
type ElectronAPILike = {
|
||||
motion?: { onDetected: (cb: () => void) => () => void };
|
||||
};
|
||||
|
||||
/**
|
||||
* Tracks touch/mouse/keyboard activity. After `timeoutMs` of no activity,
|
||||
* flips the UI into idle mode (photo frame). Any activity exits idle.
|
||||
* Motion detected by Electron's MotionDetector also cancels idle.
|
||||
*/
|
||||
export function useIdle(timeoutMs: number) {
|
||||
const isIdle = useUIStore((s) => s.isIdle);
|
||||
@@ -34,15 +29,11 @@ export function useIdle(timeoutMs: number) {
|
||||
];
|
||||
for (const e of events) document.addEventListener(e, reset, { passive: true });
|
||||
|
||||
const api = (window as unknown as { electronAPI?: ElectronAPILike }).electronAPI;
|
||||
const unsubMotion = api?.motion?.onDetected?.(() => reset());
|
||||
|
||||
reset();
|
||||
|
||||
return () => {
|
||||
if (timer) clearTimeout(timer);
|
||||
for (const e of events) document.removeEventListener(e, reset);
|
||||
if (unsubMotion) unsubMotion();
|
||||
};
|
||||
}, [timeoutMs, setIdle]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user