chore: removed sync engine since we go for filesystem based syncing

This commit is contained in:
2026-02-14 18:15:28 +01:00
parent daac97824d
commit 34eb0d3781
17 changed files with 766 additions and 838 deletions

View File

@@ -29,9 +29,6 @@ const App: React.FC = () => {
removeMedia,
setTasks,
updateTask,
setSyncStatus,
setSyncConfigured,
setPendingChanges,
setLoading,
toggleSidebar,
togglePanel,
@@ -74,16 +71,6 @@ const App: React.FC = () => {
}
}
// Check sync status
const syncConfigured = await window.electronAPI?.sync.isConfigured();
setSyncConfigured(syncConfigured || false);
// Get pending changes count
const pending = await window.electronAPI?.sync.getPendingCount();
if (pending) {
setPendingChanges(pending);
}
// Load tasks
const tasks = await window.electronAPI?.tasks.getAll();
if (tasks) {
@@ -162,36 +149,6 @@ const App: React.FC = () => {
}) || (() => {})
);
// Sync events
unsubscribers.push(
window.electronAPI?.on('sync:started', () => {
setSyncStatus('syncing');
showToast.loading('Syncing...');
}) || (() => {})
);
unsubscribers.push(
window.electronAPI?.on('sync:completed', async () => {
setSyncStatus('idle');
showToast.dismiss();
showToast.success('Sync completed');
const pending = await window.electronAPI?.sync.getPendingCount();
if (pending) {
setPendingChanges(pending);
}
}) || (() => {})
);
unsubscribers.push(
window.electronAPI?.on('sync:failed', (errorMsg: unknown) => {
setSyncStatus('error');
showToast.dismiss();
const message = typeof errorMsg === 'string' && errorMsg ? errorMsg : 'Unknown error';
showToast.error(`Sync failed: ${message}`);
console.error('Sync failed:', message);
}) || (() => {})
);
// Task events
unsubscribers.push(
window.electronAPI?.on('task:started', (task: unknown) => {
@@ -267,30 +224,6 @@ const App: React.FC = () => {
}) || (() => {})
);
unsubscribers.push(
window.electronAPI?.on('menu:syncNow', () => {
window.electronAPI?.sync.start('bidirectional');
}) || (() => {})
);
unsubscribers.push(
window.electronAPI?.on('menu:pushChanges', () => {
window.electronAPI?.sync.start('push');
}) || (() => {})
);
unsubscribers.push(
window.electronAPI?.on('menu:pullChanges', () => {
window.electronAPI?.sync.start('pull');
}) || (() => {})
);
unsubscribers.push(
window.electronAPI?.on('menu:configureSync', () => {
openTab({ type: 'settings', id: 'settings', isTransient: false });
}) || (() => {})
);
// Rebuild events - clear store on start, reload on complete
unsubscribers.push(
window.electronAPI?.on('posts:rebuildStarted', () => {

View File

@@ -43,16 +43,8 @@ const ImportIcon = () => (
</svg>
);
const SyncIcon = () => (
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4v3z"/>
</svg>
);
export const ActivityBar: React.FC = () => {
const { activeView, setActiveView, sidebarVisible, toggleSidebar, syncStatus, pendingChanges, openTab, tabs, activeTabId } = useAppStore();
const totalPending = pendingChanges.posts + pendingChanges.media;
const { activeView, setActiveView, sidebarVisible, toggleSidebar, openTab, tabs, activeTabId } = useAppStore();
// Check if settings tab is currently active
const isSettingsTabActive = tabs.some(t => t.type === 'settings' && t.id === activeTabId);
@@ -157,16 +149,6 @@ export const ActivityBar: React.FC = () => {
</div>
<div className="activity-bar-bottom">
<button
className={`activity-bar-item ${syncStatus === 'syncing' ? 'syncing' : ''}`}
onClick={() => window.electronAPI?.sync.start()}
title={`Sync (${totalPending} pending)`}
>
<SyncIcon />
{totalPending > 0 && (
<span className="activity-bar-badge">{totalPending}</span>
)}
</button>
<button
className={`activity-bar-item ${isSettingsActive ? 'active' : ''}`}
onClick={handleSettingsClick}

View File

@@ -5,9 +5,6 @@ import './StatusBar.css';
export const StatusBar: React.FC = () => {
const {
syncStatus,
syncConfigured,
pendingChanges,
media,
tasks,
selectedPostId,
@@ -28,7 +25,6 @@ export const StatusBar: React.FC = () => {
}, [selectedPostId]);
const runningTasks = tasks.filter(t => t.status === 'running');
const totalPending = pendingChanges.posts + pendingChanges.media;
return (
<div className="status-bar">
@@ -36,20 +32,6 @@ export const StatusBar: React.FC = () => {
{/* Project Selector */}
<ProjectSelector />
{/* Sync Status */}
<div className={`status-bar-item ${!syncConfigured ? 'warning' : ''}`}>
<span className={`sync-indicator ${syncStatus}`} />
{!syncConfigured ? (
<span>Sync not configured</span>
) : syncStatus === 'syncing' ? (
<span>Syncing...</span>
) : totalPending > 0 ? (
<span>{totalPending} pending</span>
) : (
<span>Synced</span>
)}
</div>
{/* Running Tasks */}
{runningTasks.length > 0 && (
<div className="status-bar-item">

View File

@@ -117,11 +117,6 @@ interface AppState {
// Confirm delete modal
confirmDeleteModal: ConfirmDeleteDetails | null;
// Sync
syncStatus: 'idle' | 'syncing' | 'error';
syncConfigured: boolean;
pendingChanges: { posts: number; media: number };
// Loading states
isLoading: boolean;
@@ -178,10 +173,7 @@ interface AppState {
setTasks: (tasks: TaskProgress[]) => void;
updateTask: (taskId: string, task: Partial<TaskProgress>) => void;
setSyncStatus: (status: 'idle' | 'syncing' | 'error') => void;
setSyncConfigured: (configured: boolean) => void;
setPendingChanges: (changes: { posts: number; media: number }) => void;
// Loading Actions
setLoading: (loading: boolean) => void;
setError: (error: string | null) => void;
}
@@ -222,11 +214,6 @@ export const useAppStore = create<AppState>()(
// Confirm delete modal
confirmDeleteModal: null,
// Initial Sync State
syncStatus: 'idle',
syncConfigured: false,
pendingChanges: { posts: 0, media: 0 },
// Initial Loading State
isLoading: false,
@@ -397,11 +384,6 @@ export const useAppStore = create<AppState>()(
return { tasks: [...state.tasks, { taskId, status: 'running', progress: 0, message: '', startTime: new Date().toISOString(), ...task } as TaskProgress] };
}),
// Sync Actions
setSyncStatus: (syncStatus) => set({ syncStatus }),
setSyncConfigured: (syncConfigured) => set({ syncConfigured }),
setPendingChanges: (pendingChanges) => set({ pendingChanges }),
// Loading Actions
setLoading: (isLoading) => set({ isLoading }),
setError: (error) => set({ error }),