Skip to content
Merged
Show file tree
Hide file tree
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
41 changes: 18 additions & 23 deletions app/components/ExternalIps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,25 @@ export function ExternalIps({ project, instance }: InstanceSelector) {
if (isPending) return <SkeletonCell />

const ips = data?.items
? intersperse(
data.items.map((eip) => <IpLink ip={eip.ip} key={eip.ip} />),
<span className="text-quinary"> / </span>
)
: undefined

if (!ips || ips.length === 0) return <EmptyCell />
return (
<div className="flex items-center gap-1 text-secondary">
{ips && ips.length > 0 ? ips : <EmptyCell />}
{/* If there's exactly one IP here, render a copy to clipboard button */}
{data?.items.length === 1 && <CopyToClipboard text={data.items[0].ip} />}
<div className="flex items-center gap-1">
{intersperse(
ips.map((eip) => (
<span className="flex items-center gap-1" key={eip.ip}>
<a
className="link-with-underline text-sans-semi-md"
href={`https://${eip.ip}`}
target="_blank"
rel="noreferrer"
>
{eip.ip}
</a>
<CopyToClipboard text={eip.ip} />

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs an ml-1 to do what the gap-1 was doing when this was at top level. I was afraid it would then look too close to the slash on the right, but it seems fine to me.

before

image

after

image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep +1

</span>
)),
<span className="text-quinary"> / </span>
)}
</div>
)
}

function IpLink({ ip }: { ip: string }) {
return (
<a
className="link-with-underline text-sans-semi-md"
href={`https://${ip}`}
target="_blank"
rel="noreferrer"
>
{ip}
</a>
)
}
2 changes: 1 addition & 1 deletion app/pages/project/instances/instance/InstancePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export function InstancePage() {
{instance.id}
</span>
</PropertiesTable.Row>
<PropertiesTable.Row label="external IP">
<PropertiesTable.Row label="external IPs">
{<ExternalIps {...instanceSelector} />}
</PropertiesTable.Row>
</PropertiesTable>
Expand Down