mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 07:15:47 +00:00
442ed9d191
- Write psysonic-sync.json to device after sync/deletions; auto-import on folder select when localStorage is empty (cross-platform handoff) - Add cancel button during active sync: AtomicBool flag per job, tasks bail after acquiring semaphore, cancelled state in UI - Fix sync status staying "pending": normalize template path separators to OS separator (Windows: '/' → '\') so compute_sync_paths and list_device_dir_files produce matching strings for Set comparison - Add Geist and JetBrains Mono as variable fonts; font picker collapsible - Fix device mount detection on Windows: removable drive letters (E:\) were incorrectly skipped alongside system roots; strip \?\ prefix from canonicalized paths before mount-point comparison Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { create } from 'zustand';
|
|
|
|
export interface DeviceSyncJobState {
|
|
jobId: string | null;
|
|
total: number;
|
|
done: number;
|
|
skipped: number;
|
|
failed: number;
|
|
status: 'idle' | 'running' | 'done' | 'cancelled';
|
|
|
|
startSync: (jobId: string, total: number) => void;
|
|
updateProgress: (done: number, skipped: number, failed: number) => void;
|
|
complete: (done: number, skipped: number, failed: number) => void;
|
|
cancel: () => void;
|
|
reset: () => void;
|
|
}
|
|
|
|
export const useDeviceSyncJobStore = create<DeviceSyncJobState>()((set) => ({
|
|
jobId: null,
|
|
total: 0,
|
|
done: 0,
|
|
skipped: 0,
|
|
failed: 0,
|
|
status: 'idle',
|
|
|
|
startSync: (jobId, total) =>
|
|
set({ jobId, total, done: 0, skipped: 0, failed: 0, status: 'running' }),
|
|
|
|
updateProgress: (done, skipped, failed) =>
|
|
set({ done, skipped, failed }),
|
|
|
|
complete: (done, skipped, failed) =>
|
|
set({ done, skipped, failed, status: 'done' }),
|
|
|
|
cancel: () =>
|
|
set({ status: 'cancelled' }),
|
|
|
|
reset: () =>
|
|
set({ jobId: null, total: 0, done: 0, skipped: 0, failed: 0, status: 'idle' }),
|
|
}));
|