mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
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.
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user