Skip to content

Commit 9d1d9aa

Browse files
atrakhConvex, Inc.
authored andcommitted
dashboard: improvements to deployment name indicators (#36086)
- Adds a separate color for local dev deployments in the main display (cyan instead of green) - Shows deployment names in the list of deployments GitOrigin-RevId: 7209fd5523743331b73e9619678a6312d7e6fc04
1 parent 1882578 commit 9d1d9aa

File tree

2 files changed

+39
-11
lines changed

2 files changed

+39
-11
lines changed

npm-packages/dashboard/src/components/header/ProjectSelector/DeploymentMenuOptions.tsx

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,14 @@ export function DeploymentMenuOptions({
8686
eventName="switch to production deployment"
8787
>
8888
<SignalIcon className="h-4 w-4" />
89-
Production
89+
<p>
90+
Production{" "}
91+
{prod && (
92+
<span className="text-xs text-content-secondary">
93+
({prod?.name})
94+
</span>
95+
)}
96+
</p>
9097
</SelectorItem>
9198
<AllPersonalDeployments team={team} project={project} close={close} />
9299
{previews.length === 0 && (
@@ -124,7 +131,7 @@ export function DeploymentMenuOptions({
124131
onClick={() => logEvent("toggle preview deployments")}
125132
>
126133
<div className="flex w-full items-center justify-between gap-2">
127-
<div className="p-2 text-xs text-content-secondary">
134+
<div className="p-2 text-xs font-semibold text-content-secondary">
128135
Preview Deployments ({previews.length})
129136
</div>
130137
{open ? <ChevronUpIcon /> : <ChevronDownIcon />}
@@ -145,6 +152,7 @@ export function DeploymentMenuOptions({
145152
previewDeployment.previewIdentifier ??
146153
previewDeployment.name
147154
}
155+
name={previewDeployment.name}
148156
/>
149157
</SelectorItem>
150158
))}
@@ -162,7 +170,7 @@ export function DeploymentMenuOptions({
162170
onClick={() => logEvent("toggle other deployments")}
163171
>
164172
<div className="flex w-full items-center justify-between gap-2">
165-
<div className="p-2 text-xs text-content-secondary">
173+
<div className="p-2 text-xs font-semibold text-content-secondary">
166174
Other Deployments ({teamMemberDeployments.length})
167175
</div>
168176
{open ? <ChevronUpIcon /> : <ChevronDownIcon />}
@@ -176,7 +184,10 @@ export function DeploymentMenuOptions({
176184
selected={router.query.deploymentName === d.name}
177185
eventName="switch to other deployment"
178186
>
179-
<DeploymentOption identifier={`${d.creator}'s Dev`} />
187+
<DeploymentOption
188+
identifier={`${d.creator}'s Dev`}
189+
name={d.name}
190+
/>
180191
</SelectorItem>
181192
))}
182193
</Disclosure.Panel>
@@ -255,7 +266,8 @@ function AllPersonalDeployments({
255266
<GlobeIcon className="h-4 w-4" />
256267
)}
257268
<DeploymentOption
258-
identifier={`${d.kind === "local" ? `${d.deviceName} ${hasMultipleActiveLocalDeployments ? `(Port ${d.port})` : ""}` : "Development (Cloud)"}`}
269+
identifier={`${d.kind === "local" ? `${d.deviceName} ${hasMultipleActiveLocalDeployments ? `(Port ${d.port})` : ""}` : "Cloud Dev"}`}
270+
name={d.name}
259271
/>
260272
</SelectorItem>
261273
))}
@@ -289,7 +301,13 @@ function sortDevDeployments(deployments: DeploymentResponse[]) {
289301
});
290302
}
291303

292-
function DeploymentOption({ identifier }: { identifier: string }) {
304+
function DeploymentOption({
305+
identifier,
306+
name,
307+
}: {
308+
identifier: string;
309+
name: string;
310+
}) {
293311
const ref = useRef<HTMLDivElement>(null);
294312
const isOverflowing = useIsOverflowing(ref);
295313

@@ -303,8 +321,11 @@ function DeploymentOption({ identifier }: { identifier: string }) {
303321
side="right"
304322
wrapsButton
305323
>
306-
<p className="max-w-[14rem] truncate" ref={ref}>
307-
{identifier}
324+
<p className="max-w-[20rem] truncate" ref={ref}>
325+
{identifier}{" "}
326+
{name && (
327+
<span className="text-xs text-content-secondary">({name})</span>
328+
)}
308329
</p>
309330
</Tooltip>
310331
);

npm-packages/dashboard/src/elements/DeploymentDisplay.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export function DeploymentLabel({
7272
<div
7373
className={cn(
7474
"flex items-center gap-2 rounded-md",
75-
!inline && getBackgroundColor(deployment.deploymentType),
75+
!inline &&
76+
getBackgroundColor(deployment.deploymentType, deployment.kind),
7677
!inline && "p-1",
7778
)}
7879
>
@@ -96,7 +97,13 @@ export function DeploymentLabel({
9697
);
9798
}
9899

99-
function getBackgroundColor(type: DeploymentType): string {
100+
function getBackgroundColor(
101+
type: DeploymentType,
102+
kind: "local" | "cloud",
103+
): string {
104+
if (kind === "local") {
105+
return "border border-cyan-700 bg-cyan-200/50 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-500";
106+
}
100107
switch (type) {
101108
case "prod":
102109
return "border border-purple-600 dark:border-purple-900 bg-purple-100/50 text-purple-600 dark:bg-purple-900/50 dark:text-purple-400";
@@ -131,7 +138,7 @@ function getDeploymentLabel({
131138
}
132139
return whoseName === null
133140
? "Development (Cloud)"
134-
: `${whoseName}’s Dev (Cloud)`;
141+
: `${whoseName}’s Cloud Dev`;
135142
}
136143
default: {
137144
const _typecheck: never = deployment.deploymentType;

0 commit comments

Comments
 (0)