Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

SettingsRouteScreen.logic.ts

23 lines829 Bytes

1import type { EnvironmentId } from "@t3tools/contracts";
2​
3export function resolveAutoSettleReferenceEnvironmentId(
4 environments: ReadonlyArray<{
5 readonly environmentId: EnvironmentId;
6 readonly canWriteSettings: boolean | null;
7 }>,
8): EnvironmentId | null {
9 for (const environment of environments) {
10 if (environment.canWriteSettings === null) return null;
11 if (environment.canWriteSettings) return environment.environmentId;
12 }
13 return environments[0]?.environmentId ?? null;
15​
16export function resolveAgentAwarenessPlatformPresentation(platform: string): {
17 readonly supported: boolean;
18 readonly subtitle: string | undefined;
19} {
20 return platform === "ios" || platform === "android"
21 ? { supported: true, subtitle: undefined }
22 : { supported: false, subtitle: "Unavailable on this platform" };