Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

1.1 KB
Raw Blame
import type { ProjectGroupingSettings } from "@akeru/client-runtime/state/project-grouping";
import type { SidebarProjectGroupingMode } from "@akeru/contracts";

import type { Preferences } from "../persistence/mobile-preferences";

export const DEFAULT_MOBILE_PROJECT_GROUPING_SETTINGS: ProjectGroupingSettings = {
  sidebarProjectGroupingMode: "repository",
  sidebarProjectGroupingOverrides: {},
};

export function resolveMobileProjectGroupingSettings(
  preferences: Preferences,
): ProjectGroupingSettings {
  return {
    sidebarProjectGroupingMode:
      preferences.projectGroupingMode ??
      (preferences.projectGroupingEnabled === false ? "separate" : "repository"),
    sidebarProjectGroupingOverrides: {},
  };
}

/**
 * Dual-writes the legacy boolean for one release so an OTA rollback to an
 * older mobile bundle preserves the user's grouping choice.
 */
export function mobileProjectGroupingModePatch(
  mode: SidebarProjectGroupingMode,
): Partial<Preferences> {
  return {
    projectGroupingMode: mode,
    projectGroupingEnabled: mode !== "separate",
  };
}