| 1 | import type { UiSettingsValues } from "@t3tools/contracts"; |
| 2 | import type { Preferences } from "../persistence/mobile-preferences"; |
| 3 | |
| 4 | /** Native typography and palettes have their own units and catalog; only equivalent controls travel. */ |
| 5 | export function portableMobileUiSettings(preferences: Preferences): UiSettingsValues { |
| 6 | return { |
| 7 | ...(preferences.followUpBehavior === undefined |
| 8 | ? {} |
| 9 | : { followUpBehavior: preferences.followUpBehavior }), |
| 10 | ...(preferences.workingShelfEnabled === undefined |
| 11 | ? {} |
| 12 | : { sidebarWorkingShelfEnabled: preferences.workingShelfEnabled }), |
| 13 | ...(preferences.projectGroupingMode === undefined |
| 14 | ? {} |
| 15 | : { sidebarProjectGroupingMode: preferences.projectGroupingMode }), |
| 16 | }; |
| 17 | } |
| 18 | export function mobileUiSettingsPatch(values: UiSettingsValues): Partial<Preferences> { |
| 19 | return { |
| 20 | ...(values.followUpBehavior === undefined ? {} : { followUpBehavior: values.followUpBehavior }), |
| 21 | ...(values.sidebarWorkingShelfEnabled === undefined |
| 22 | ? {} |
| 23 | : { workingShelfEnabled: values.sidebarWorkingShelfEnabled }), |
| 24 | ...(values.sidebarProjectGroupingMode === undefined |
| 25 | ? {} |
| 26 | : { projectGroupingMode: values.sidebarProjectGroupingMode }), |
| 27 | }; |
| 28 | } |