mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-04 05:01:37 +02:00
Auto-navigate SpoolBuddy to dashboard on tag scan
When an NFC tag is first detected while the UI is on a non-dashboard page, automatically navigate to the main dashboard. Uses edge detection (previous ref) so a persistently present tag doesn't block navigation to other pages. Also wakes the screen if the display was blanked.
This commit is contained in:
@@ -100,15 +100,17 @@ export function SpoolBuddyLayout() {
|
||||
};
|
||||
}, [resetActivity]);
|
||||
|
||||
// Auto-navigate to dashboard when a tag is detected on a non-dashboard page
|
||||
// Auto-navigate to dashboard when a NEW tag is detected (transition from no-tag to tag)
|
||||
const tagDetected = Boolean(sbState.matchedSpool || sbState.unknownTagUid);
|
||||
const prevTagDetected = useRef(false);
|
||||
useEffect(() => {
|
||||
if (tagDetected) {
|
||||
if (tagDetected && !prevTagDetected.current) {
|
||||
resetActivity();
|
||||
if (location.pathname !== '/spoolbuddy') {
|
||||
navigate('/spoolbuddy');
|
||||
}
|
||||
}
|
||||
prevTagDetected.current = tagDetected;
|
||||
}, [tagDetected, location.pathname, navigate, resetActivity]);
|
||||
|
||||
// Screen blank timer
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
@@ -23,7 +23,7 @@
|
||||
|
||||
<!-- Splash screens for iOS -->
|
||||
<link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
|
||||
<script type="module" crossorigin src="/assets/index-BruWyGaL.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-Bu1bGLqb.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CZLTApPU.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user