Skip to content

Commit 8156788

Browse files
fix(environments): draw the machine icon everywhere an environment is named
The last pass covered the sidebar, the composer's mobile Run on menu, and the pull request pages, but several surfaces still drew a generic server, cloud, or desktop for an environment: the desktop Run on selector, command palette project rows and thread indicators, the provider settings device tabs, and on mobile the add-project and new-task environment pickers, the composer environment control, the archive, and the storage settings rows. All of them now resolve the same machine kind as everything else. Co-Authored-By: Claude Fable 5 <[email protected]>
1 parent b5f4e81 commit 8156788

10 files changed

Lines changed: 130 additions & 70 deletions

‎apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx‎

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import type {
33
EnvironmentThreadShell,
44
} from "@t3tools/client-runtime/state/shell";
55
import { LegendList } from "@legendapp/list/react-native";
6-
import type { EnvironmentId } from "@t3tools/contracts";
6+
import {
7+
type EnvironmentId,
8+
type EnvironmentMachineKind,
9+
resolveEnvironmentMachineKind,
10+
} from "@t3tools/contracts";
711
import type { MenuAction } from "@react-native-menu/menu";
812
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
913
import { SymbolView } from "../../components/AppSymbol";
@@ -24,10 +28,12 @@ import type { SwipeableMethods } from "react-native-gesture-handler/ReanimatedSw
2428
import { AppText as Text } from "../../components/AppText";
2529
import { ControlPillMenu } from "../../components/ControlPill";
2630
import { EmptyState } from "../../components/EmptyState";
31+
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
2732
import { ProjectFavicon } from "../../components/ProjectFavicon";
2833
import { useSafeAreaInsets } from "react-native-safe-area-context";
2934
import { relativeTime } from "../../lib/time";
3035
import { useUniwindTheme } from "../../lib/useUniwindTheme";
36+
import { useServerConfigs } from "../../state/entities";
3137
import { ThreadSwipeable } from "../home/thread-swipe-actions";
3238
import {
3339
createNativeMailSearchToolbarItem,
@@ -45,6 +51,7 @@ type ArchivedThreadListItem =
4551
readonly kind: "project";
4652
readonly key: string;
4753
readonly environmentLabel: string | null;
54+
readonly environmentMachine: EnvironmentMachineKind;
4855
readonly project: EnvironmentProject;
4956
}
5057
| {
@@ -360,6 +367,7 @@ function ArchivedThreadsHeader(props: {
360367

361368
function ProjectGroupLabel(props: {
362369
readonly environmentLabel: string | null;
370+
readonly environmentMachine: EnvironmentMachineKind;
363371
readonly project: EnvironmentProject;
364372
}) {
365373
return (
@@ -378,9 +386,16 @@ function ProjectGroupLabel(props: {
378386
{props.project.title}
379387
</Text>
380388
{props.environmentLabel ? (
381-
<Text className="max-w-[42%] text-2xs text-foreground-tertiary" numberOfLines={1}>
382-
{props.environmentLabel}
383-
</Text>
389+
<View className="max-w-[42%] flex-row items-center gap-1">
390+
<EnvironmentMachineSymbol
391+
kind={props.environmentMachine}
392+
size={10}
393+
tintColorClassName="accent-foreground-tertiary"
394+
/>
395+
<Text className="shrink text-2xs text-foreground-tertiary" numberOfLines={1}>
396+
{props.environmentLabel}
397+
</Text>
398+
</View>
384399
) : null}
385400
</View>
386401
);
@@ -517,6 +532,7 @@ export function ArchivedThreadsScreen(props: {
517532
),
518533
[props.environments],
519534
);
535+
const serverConfigs = useServerConfigs();
520536
const listItems = useMemo<ReadonlyArray<ArchivedThreadListItem>>(() => {
521537
const items: ArchivedThreadListItem[] = [];
522538
for (const group of props.groups) {
@@ -525,6 +541,9 @@ export function ArchivedThreadsScreen(props: {
525541
kind: "project",
526542
key: `${group.key}:project`,
527543
environmentLabel,
544+
environmentMachine: resolveEnvironmentMachineKind(
545+
serverConfigs.get(group.project.environmentId) ?? null,
546+
),
528547
project: group.project,
529548
});
530549

@@ -540,7 +559,7 @@ export function ArchivedThreadsScreen(props: {
540559
});
541560
}
542561
return items;
543-
}, [environmentLabelsById, props.groups]);
562+
}, [environmentLabelsById, props.groups, serverConfigs]);
544563
const handleSwipeableWillOpen = useCallback((methods: SwipeableMethods) => {
545564
if (openSwipeableRef.current && openSwipeableRef.current !== methods) {
546565
openSwipeableRef.current.close();
@@ -559,7 +578,11 @@ export function ArchivedThreadsScreen(props: {
559578
if (item.kind === "project") {
560579
return (
561580
<View className="pt-4">
562-
<ProjectGroupLabel environmentLabel={item.environmentLabel} project={item.project} />
581+
<ProjectGroupLabel
582+
environmentLabel={item.environmentLabel}
583+
environmentMachine={item.environmentMachine}
584+
project={item.project}
585+
/>
563586
</View>
564587
);
565588
}

‎apps/mobile/src/features/projects/AddProjectScreen.tsx‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ import {
3131
inferProjectTitleFromPath,
3232
isWindowsPlatform,
3333
} from "@t3tools/client-runtime/state/projects";
34-
import { CommandId, type EnvironmentId, ProjectId } from "@t3tools/contracts";
34+
import {
35+
CommandId,
36+
type EnvironmentId,
37+
type EnvironmentMachineKind,
38+
ProjectId,
39+
resolveEnvironmentMachineKind,
40+
} from "@t3tools/contracts";
3541
import { CommonActions, StackActions, useNavigation } from "@react-navigation/native";
3642
import { SymbolView } from "../../components/AppSymbol";
3743
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
@@ -49,6 +55,7 @@ import { projectEnvironment } from "../../state/projects";
4955
import { useEnvironmentQuery } from "../../state/query";
5056
import { sourceControlEnvironment } from "../../state/sourceControl";
5157
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
58+
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
5259
import { ErrorBanner } from "../../components/ErrorBanner";
5360
import { SourceControlIcon } from "../../components/SourceControlIcon";
5461
import { uuidv4 } from "../../lib/uuid";
@@ -65,6 +72,7 @@ interface EnvironmentOption {
6572
readonly environmentId: EnvironmentId;
6673
readonly label: string;
6774
readonly platform: string;
75+
readonly machine: EnvironmentMachineKind;
6876
readonly baseDirectory: string | null;
6977
readonly connectionState: EnvironmentConnectionPhase;
7078
readonly connectionError: string | null;
@@ -352,6 +360,7 @@ function useEnvironmentOptions(): ReadonlyArray<EnvironmentOption> {
352360
environmentId: connection.environmentId,
353361
label: connection.environmentLabel,
354362
platform: platformFromOs(config?.environment.platform.os ?? null),
363+
machine: resolveEnvironmentMachineKind(config ?? null),
355364
baseDirectory: config?.settings.addProjectBaseDirectory ?? null,
356365
connectionState: runtime?.connectionState ?? "available",
357366
connectionError: runtime?.connectionError ?? null,
@@ -490,11 +499,10 @@ export function AddProjectSourceScreen() {
490499
})
491500
}
492501
icon={
493-
<SymbolView
494-
name="server.rack"
502+
<EnvironmentMachineSymbol
503+
kind={environment.machine}
495504
size={17}
496-
tintColorClassName={"accent-icon"}
497-
type="monochrome"
505+
tintColorClassName="accent-icon"
498506
/>
499507
}
500508
selected={environment.environmentId === selectedEnvironment?.environmentId}

‎apps/mobile/src/features/settings/SettingsClientStorageRouteScreen.tsx‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
import { useAtomSet, useAtomValue } from "@effect/atom-react";
2+
import { type EnvironmentMachineKind, resolveEnvironmentMachineKind } from "@t3tools/contracts";
23
import { AsyncResult } from "effect/unstable/reactivity";
34
import { useMemo } from "react";
45
import { ActivityIndicator, Alert, Pressable, ScrollView, View } from "react-native";
56
import { useSafeAreaInsets } from "react-native-safe-area-context";
67

78
import { AppText as Text } from "../../components/AppText";
89
import { SymbolView } from "../../components/AppSymbol";
10+
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
911
import {
1012
clearClientCacheAtom,
1113
clientCacheSummaryAtom,
1214
type EnvironmentClientCacheSummary,
1315
} from "../../state/client-cache-state";
16+
import { useServerConfigs } from "../../state/entities";
1417
import { useSavedRemoteConnections } from "../../state/use-remote-environment-registry";
1518
import { SettingsSection } from "./components/SettingsSection";
1619

@@ -20,6 +23,7 @@ export function SettingsClientStorageRouteScreen() {
2023
const clearResult = useAtomValue(clearClientCacheAtom);
2124
const clearCache = useAtomSet(clearClientCacheAtom);
2225
const { savedConnectionsById } = useSavedRemoteConnections();
26+
const serverConfigs = useServerConfigs();
2327
const isClearing = clearResult.waiting;
2428
const summary = AsyncResult.isSuccess(summaryResult) ? summaryResult.value : null;
2529
const environmentSummaries = useMemo(
@@ -106,6 +110,9 @@ export function SettingsClientStorageRouteScreen() {
106110
savedConnectionsById[environment.environmentId]?.environmentLabel ??
107111
environment.environmentId
108112
}
113+
machine={resolveEnvironmentMachineKind(
114+
serverConfigs.get(environment.environmentId) ?? null,
115+
)}
109116
disabled={isClearing}
110117
first={index === 0}
111118
onClear={() => confirmClearEnvironment(environment)}
@@ -169,6 +176,7 @@ export function SettingsClientStorageRouteScreen() {
169176
function CacheEnvironmentRow(props: {
170177
readonly environment: EnvironmentClientCacheSummary;
171178
readonly environmentLabel: string;
179+
readonly machine: EnvironmentMachineKind;
172180
readonly disabled: boolean;
173181
readonly first: boolean;
174182
readonly onClear: () => void;
@@ -181,13 +189,7 @@ function CacheEnvironmentRow(props: {
181189
: "border-t border-border flex-row items-center gap-3 p-4"
182190
}
183191
>
184-
<SymbolView
185-
name="desktopcomputer"
186-
size={22}
187-
tintColorClassName={"accent-icon"}
188-
type="monochrome"
189-
weight="regular"
190-
/>
192+
<EnvironmentMachineSymbol kind={props.machine} size={22} tintColorClassName="accent-icon" />
191193
<Text className="min-w-0 flex-1 text-base text-foreground" numberOfLines={1}>
192194
{props.environmentLabel}
193195
</Text>

‎apps/mobile/src/features/threads/NewTaskContextPickerScreens.tsx‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { VcsRef } from "@t3tools/client-runtime/state/vcs";
2+
import { resolveEnvironmentMachineKind } from "@t3tools/contracts";
23
import { LegendList } from "@legendapp/list/react-native";
34
import {
45
isAtomCommandInterrupted,
@@ -21,9 +22,11 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
2122
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
2223
import { SymbolView } from "../../components/AppSymbol";
2324
import { AppText as Text } from "../../components/AppText";
25+
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
2426
import { ThemedSwitch } from "../../components/ThemedSwitch";
2527
import { cn } from "../../lib/cn";
2628
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
29+
import { useServerConfigs } from "../../state/entities";
2730
import { useAtomCommand } from "../../state/use-atom-command";
2831
import { vcsEnvironment } from "../../state/vcs";
2932
import {
@@ -35,7 +38,7 @@ import { branchBadgeLabel, useNewTaskFlow } from "./new-task-flow-provider";
3538
import { shouldCheckoutNewTaskBranch } from "./new-task-context-presentation";
3639

3740
function SelectionRow(props: {
38-
readonly icon?: "arrow.triangle.branch" | "desktopcomputer";
41+
readonly icon?: "arrow.triangle.branch" | ReactNode;
3942
readonly onPress: () => void;
4043
readonly disabled?: boolean;
4144
readonly selected: boolean;
@@ -56,14 +59,16 @@ function SelectionRow(props: {
5659
onPress={props.onPress}
5760
style={{ opacity: props.disabled ? 0.45 : 1 }}
5861
>
59-
{props.icon ? (
62+
{props.icon === "arrow.triangle.branch" ? (
6063
<SymbolView
61-
name={props.icon}
64+
name="arrow.triangle.branch"
6265
size={17}
6366
tintColorClassName={"accent-icon-muted"}
6467
type="monochrome"
6568
/>
66-
) : null}
69+
) : (
70+
(props.icon ?? null)
71+
)}
6772
<View className="min-w-0 flex-1 gap-0.5">
6873
<Text className="text-base font-t3-medium text-foreground" numberOfLines={1}>
6974
{props.title}
@@ -145,6 +150,7 @@ export function NewTaskEnvironmentPickerRouteScreen() {
145150
const flow = useNewTaskFlow();
146151
const navigation = useNavigation();
147152
const insets = useSafeAreaInsets();
153+
const serverConfigs = useServerConfigs();
148154

149155
return (
150156
<View className="flex-1 bg-sheet" collapsable={false}>
@@ -170,7 +176,15 @@ export function NewTaskEnvironmentPickerRouteScreen() {
170176
{flow.environments.map((environment, index) => (
171177
<SelectionRow
172178
key={String(environment.environmentId)}
173-
icon="desktopcomputer"
179+
icon={
180+
<EnvironmentMachineSymbol
181+
kind={resolveEnvironmentMachineKind(
182+
serverConfigs.get(environment.environmentId) ?? null,
183+
)}
184+
size={17}
185+
tintColorClassName="accent-icon-muted"
186+
/>
187+
}
174188
isLast={index === flow.environments.length - 1}
175189
onPress={() => {
176190
void Haptics.selectionAsync();

‎apps/mobile/src/features/threads/NewTaskDraftScreen.tsx‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ import {
2424
isAtomCommandInterrupted,
2525
squashAtomCommandFailure,
2626
} from "@t3tools/client-runtime/state/runtime";
27-
import { PROVIDER_SEND_TURN_MAX_ATTACHMENTS } from "@t3tools/contracts";
27+
import {
28+
PROVIDER_SEND_TURN_MAX_ATTACHMENTS,
29+
resolveEnvironmentMachineKind,
30+
} from "@t3tools/contracts";
2831

2932
import { ComposerEditor, type ComposerEditorHandle } from "../../components/ComposerEditor";
3033
import {
@@ -36,6 +39,7 @@ import {
3639
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
3740
import { ComposerAttachmentButton } from "../../components/ComposerAttachmentButton";
3841
import { ComposerAttachmentStrip } from "../../components/ComposerAttachmentStrip";
42+
import { EnvironmentMachineSymbol } from "../../components/EnvironmentMachineSymbol";
3943
import {
4044
composerAttachmentUploadBlockReason,
4145
composerAttachmentUploadsAtom,
@@ -1129,7 +1133,13 @@ export function NewTaskDraftScreen(props: {
11291133
accessibilityLabel={`Environment: ${selectedEnvironmentLabel}`}
11301134
chevronDirection="right"
11311135
disabled={isComposerInteractionLocked || voiceInput.isBusy}
1132-
icon="desktopcomputer"
1136+
iconNode={
1137+
<EnvironmentMachineSymbol
1138+
kind={resolveEnvironmentMachineKind(selectedEnvironmentServerConfig)}
1139+
size={16}
1140+
tintColorClassName="accent-icon-muted"
1141+
/>
1142+
}
11331143
label={`on ${selectedEnvironmentLabel}`}
11341144
maxWidth={260}
11351145
onPress={

‎apps/web/src/components/BranchToolbarEnvironmentSelector.tsx‎

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { EnvironmentId } from "@t3tools/contracts";
2-
import { CloudIcon, MonitorIcon } from "lucide-react";
32
import { memo, useMemo } from "react";
43

54
import type { EnvironmentOption } from "./BranchToolbar.logic";
5+
import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon";
66
import {
77
Select,
88
SelectGroup,
@@ -52,11 +52,10 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
5252
className="inline-flex h-7 min-w-0 max-w-full items-center gap-1 border border-transparent px-[calc(--spacing(3)-1px)] text-sm font-medium text-muted-foreground/70 sm:h-6 sm:text-xs"
5353
data-composer-context-control
5454
>
55-
{activeEnvironment?.isPrimary ? (
56-
<MonitorIcon className="size-3 shrink-0" />
57-
) : (
58-
<CloudIcon className="size-3 shrink-0" />
59-
)}
55+
<EnvironmentMachineIcon
56+
kind={activeEnvironment?.machine ?? "server"}
57+
className="size-3 shrink-0"
58+
/>
6059
<span
6160
data-composer-label
6261
className="min-w-0 max-w-[240px] group-data-[compact]/composer-context:max-w-0"
@@ -86,11 +85,10 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
8685
aria-label="Run on"
8786
data-composer-context-control
8887
>
89-
{activeEnvironment?.isPrimary ? (
90-
<MonitorIcon className="size-3 shrink-0" />
91-
) : (
92-
<CloudIcon className="size-3 shrink-0" />
93-
)}
88+
<EnvironmentMachineIcon
89+
kind={activeEnvironment?.machine ?? "server"}
90+
className="size-3 shrink-0"
91+
/>
9492
<span
9593
data-composer-label
9694
className="min-w-0 max-w-[240px] group-data-[compact]/composer-context:max-w-0"
@@ -109,11 +107,7 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
109107
{availableEnvironments.map((env) => (
110108
<SelectItem key={env.environmentId} value={env.environmentId}>
111109
<span className="inline-flex items-center gap-1.5">
112-
{env.isPrimary ? (
113-
<MonitorIcon className="size-3" />
114-
) : (
115-
<CloudIcon className="size-3" />
116-
)}
110+
<EnvironmentMachineIcon kind={env.machine} className="size-3" />
117111
{env.label}
118112
</span>
119113
</SelectItem>

0 commit comments

Comments
 (0)