refactor(docsync): share the scope picker, lane switch and folder name between desktop and phone

useScopePicker holds the provider's containers, binding one, and making
and binding a new one under the suggested name; the desktop dialog keeps
its search filter. docSyncModel holds the direction a lane switch leads to
and the folder name made from the trip title, which the panel and the
phone sheet each carried a copy of.
This commit is contained in:
Maurice
2026-10-09 11:01:14 +02:00
parent dd7cfca0b2
commit 74e1853c39
8 changed files with 304 additions and 138 deletions
@@ -3,6 +3,7 @@ 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'
export type SyncDirection = 'both' | 'pull' | 'push'
@@ -58,10 +59,8 @@ export default function DocSyncFlow({
/** Turning a lane off leaves the other one; turning the last one off is refused. */
const toggle = (lane: 'push' | 'pull') => {
if (disabled) return
const nextPush = lane === 'push' ? !pushOn : pushOn
const nextPull = lane === 'pull' ? !pullOn : pullOn
if (!nextPush && !nextPull) return
onChange(nextPush && nextPull ? 'both' : nextPush ? 'push' : 'pull')
const next = toggledDirection(direction, lane)
if (next) onChange(next)
}
return (