Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

refactor(docsync): move the sync direction type into the docsync model

Maurice5abe5f65191a
diff --git a/client/src/components/Files/docsync/DocSyncFlow.tsx b/client/src/components/Files/docsync/DocSyncFlow.tsx
index ec9fe128e..7a658f9fe 100644
--- a/client/src/components/Files/docsync/DocSyncFlow.tsx
+++ b/client/src/components/Files/docsync/DocSyncFlow.tsx
@@ -3,9 +3,9 @@ import { useTranslation } from '../../../i18n/TranslationContext'
import { DOCUMENT_PROVIDER_ICONS } from '../../shared/DocumentProviderIcons'
import TrekIcon from '../../shared/TrekIcon'
import { Badge } from './DocSyncBits'
-import { toggledDirection } from './docSyncModel'
+import { toggledDirection, type SyncDirection } from './docSyncModel'
-export type SyncDirection = 'both' | 'pull' | 'push'
+export type { SyncDirection }
export interface FlowHoldings {
/** Documents this trip has in TREK. */
diff --git a/client/src/components/Files/docsync/docSyncModel.ts b/client/src/components/Files/docsync/docSyncModel.ts
index db037cca1..ef713a4fa 100644
--- a/client/src/components/Files/docsync/docSyncModel.ts
+++ b/client/src/components/Files/docsync/docSyncModel.ts
@@ -1,11 +1,12 @@
-import type { SyncDirection } from './DocSyncFlow';
+/** Which way a binding syncs: into the trip, out to the provider, or both. */
+export type SyncDirection = 'both' | 'pull' | 'push';
/**
* The direction after switching one lane of a binding on or off, or null when that would
* switch off the last one. The desktop flow bar and the phone's two lane buttons both
* ask this.
*/
-export function toggledDirection(direction: string, lane: 'push' | 'pull'): SyncDirection | null {
+export function toggledDirection(direction: SyncDirection, lane: 'push' | 'pull'): SyncDirection | null {
const pushOn = direction === 'both' || direction === 'push';
const pullOn = direction === 'both' || direction === 'pull';
const nextPush = lane === 'push' ? !pushOn : pushOn;