Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions apps/web/src/components/BranchToolbarEnvironmentSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ComposerContextLabel } from "./ComposerContextLabel";
import { Tooltip, TooltipTrigger, TooltipPopup } from "./ui/tooltip";
import type { EnvironmentId } from "@t3tools/contracts";
import { ScaleIcon } from "lucide-react";
import { memo, useMemo } from "react";
import { memo } from "react";

import type { EnvironmentOption } from "./BranchToolbar.logic";
import { EnvironmentMachineIcon } from "./EnvironmentMachineIcon";
Expand Down Expand Up @@ -35,22 +35,18 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir
onEnvironmentChange,
}: BranchToolbarEnvironmentSelectorProps) {
const composerFloatingLayerProps = useComposerMenuProps();
const activeEnvironment = useMemo(() => {
return availableEnvironments.find((env) => env.environmentId === environmentId) ?? null;
}, [availableEnvironments, environmentId]);
const activeEnvironment =
availableEnvironments.find((env) => env.environmentId === environmentId) ?? null;

const environmentItems = useMemo(
() => [
...(onAutoEnvironment
? [{ value: "auto", label: autoEnvironmentLabel ?? "Auto balance" }]
: []),
...availableEnvironments.map((env) => ({
value: env.environmentId,
label: env.label,
})),
],
[availableEnvironments, autoEnvironmentLabel, onAutoEnvironment],
);
const environmentItems = [
...(onAutoEnvironment
? [{ value: "auto", label: autoEnvironmentLabel ?? "Auto balance" }]
: []),
...availableEnvironments.map((env) => ({
value: env.environmentId,
label: env.label,
})),
];

// The static label carries the xs control's height (h-7 sm:h-6) as well as
// its padding: the composer context strip has no min-height of its own, and
Expand Down
Loading