mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-22 03:49:18 +02:00
Improve SpoolBuddy update UX: auto-check and remove beta toggle
The SpoolBuddy layout now auto-checks for daemon updates every 5
minutes and shows "Update available: v{version}" in the status bar.
Removed the beta toggle since SpoolBuddy follows Bambuddy's release
channel. The daemon version is now read from backend APP_VERSION
instead of a stale hardcoded string.
This commit is contained in:
@@ -58,14 +58,25 @@ export function SpoolBuddyLayout() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
// Update alert based on device state
|
||||
// Auto-check for SpoolBuddy daemon updates
|
||||
const { data: updateCheck } = useQuery({
|
||||
queryKey: ['spoolbuddy-update-check', device?.device_id],
|
||||
queryFn: () => device ? spoolbuddyApi.checkDaemonUpdate(device.device_id, true) : Promise.resolve(null),
|
||||
enabled: !!device,
|
||||
refetchInterval: 5 * 60 * 1000, // re-check every 5 minutes
|
||||
staleTime: 4 * 60 * 1000,
|
||||
});
|
||||
|
||||
// Update alert based on device state and available updates
|
||||
useEffect(() => {
|
||||
if (!sbState.deviceOnline) {
|
||||
setAlert({ type: 'warning', message: 'SpoolBuddy device disconnected' });
|
||||
} else if (updateCheck?.update_available && updateCheck.latest_version) {
|
||||
setAlert({ type: 'info', message: `Update available: v${updateCheck.latest_version}` });
|
||||
} else {
|
||||
setAlert(null);
|
||||
}
|
||||
}, [sbState.deviceOnline]);
|
||||
}, [sbState.deviceOnline, updateCheck]);
|
||||
|
||||
// Track user activity for screen blank
|
||||
const resetActivity = useCallback(() => {
|
||||
|
||||
Reference in New Issue
Block a user