From 5abe5f65191a39856b9cc224fbea4cbbae96c43d Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 9 Oct 2026 11:20:09 +0200 Subject: [PATCH] refactor(docsync): move the sync direction type into the docsync model The pure model imported its direction type from the flow view. The type now lives in the model, which takes it as the direction parameter, and the flow view re-exports it for its existing importers. --- client/src/components/Files/docsync/DocSyncFlow.tsx | 4 ++-- client/src/components/Files/docsync/docSyncModel.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) 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;