Skip to content

Commit e649e7b

Browse files
authored
make all external IPs in header copyable (#2170)
1 parent 0f4bed0 commit e649e7b

File tree

2 files changed

+19
-24
lines changed

2 files changed

+19
-24
lines changed

app/components/ExternalIps.tsx

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,25 @@ export function ExternalIps({ project, instance }: InstanceSelector) {
2222
if (isPending) return <SkeletonCell />
2323

2424
const ips = data?.items
25-
? intersperse(
26-
data.items.map((eip) => <IpLink ip={eip.ip} key={eip.ip} />),
27-
<span className="text-quinary"> / </span>
28-
)
29-
: undefined
30-
25+
if (!ips || ips.length === 0) return <EmptyCell />
3126
return (
32-
<div className="flex items-center gap-1 text-secondary">
33-
{ips && ips.length > 0 ? ips : <EmptyCell />}
34-
{/* If there's exactly one IP here, render a copy to clipboard button */}
35-
{data?.items.length === 1 && <CopyToClipboard text={data.items[0].ip} />}
27+
<div className="flex items-center gap-1">
28+
{intersperse(
29+
ips.map((eip) => (
30+
<span className="flex items-center gap-1" key={eip.ip}>
31+
<a
32+
className="link-with-underline text-sans-semi-md"
33+
href={`https://${eip.ip}`}
34+
target="_blank"
35+
rel="noreferrer"
36+
>
37+
{eip.ip}
38+
</a>
39+
<CopyToClipboard text={eip.ip} />
40+
</span>
41+
)),
42+
<span className="text-quinary"> / </span>
43+
)}
3644
</div>
3745
)
3846
}
39-
40-
function IpLink({ ip }: { ip: string }) {
41-
return (
42-
<a
43-
className="link-with-underline text-sans-semi-md"
44-
href={`https://${ip}`}
45-
target="_blank"
46-
rel="noreferrer"
47-
>
48-
{ip}
49-
</a>
50-
)
51-
}

app/pages/project/instances/instance/InstancePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export function InstancePage() {
190190
{instance.id}
191191
</span>
192192
</PropertiesTable.Row>
193-
<PropertiesTable.Row label="external IP">
193+
<PropertiesTable.Row label="external IPs">
194194
{<ExternalIps {...instanceSelector} />}
195195
</PropertiesTable.Row>
196196
</PropertiesTable>

0 commit comments

Comments
 (0)