The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type { ProjectGroupingSettings } from "@t3tools/client-runtime/state/project-grouping"; |
| 2 | import type { SidebarProjectGroupingMode } from "@t3tools/contracts"; |
| 3 | |
| 4 | import type { Preferences } from "../persistence/mobile-preferences"; |
| 5 | |
| 6 | export const DEFAULT_MOBILE_PROJECT_GROUPING_SETTINGS: ProjectGroupingSettings = { |
| 7 | sidebarProjectGroupingMode: "repository", |
| 8 | sidebarProjectGroupingOverrides: {}, |
| 9 | }; |
| 10 | |
| 11 | export function resolveMobileProjectGroupingSettings( |
| 12 | preferences: Preferences, |
| 13 | ): ProjectGroupingSettings { |
| 14 | return { |
| 15 | sidebarProjectGroupingMode: |
| 16 | preferences.projectGroupingMode ?? |
| 17 | (preferences.projectGroupingEnabled === false ? "separate" : "repository"), |
| 18 | sidebarProjectGroupingOverrides: {}, |
| 19 | }; |
| 20 | } |
| 21 | |
| 22 | /** Dual-write the legacy boolean for one release so OTA rollback preserves grouping choice. */ |
| 23 | export function mobileProjectGroupingModePatch( |
| 24 | mode: SidebarProjectGroupingMode, |
| 25 | ): Partial<Preferences> { |
| 26 | return { |
| 27 | projectGroupingMode: mode, |
| 28 | projectGroupingEnabled: mode !== "separate", |
| 29 | }; |
| 30 | } |