Skip to content

Commit e699918

Browse files
authored
fix(launchpad): address copied to clipboard not matching display data (#6675)
Signed-off-by: Nixieboluo <me@sagirii.me>
1 parent b876932 commit e699918

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

frontend/providers/applaunchpad/src/pages/app/edit/components/NetworkSection.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,22 @@ export function NetworkSection({
180180
[getValues, appendNetworks, removeNetworks, updateNetworks]
181181
);
182182

183+
const getAccessDisplayText = useCallback(
184+
(network: AppEditType['networks'][0]) => {
185+
if (network.customDomain) return network.customDomain;
186+
187+
if (network.openNodePort) {
188+
const prefix = `${network.protocol.toLowerCase()}.${network.domain}`;
189+
return network?.nodePort
190+
? `${prefix}:${network.nodePort}`
191+
: `${prefix}:${t('pending_to_allocated')}`;
192+
}
193+
194+
return `${network.publicDomain}.${network.domain}`;
195+
},
196+
[t]
197+
);
198+
183199
return (
184200
<>
185201
<Box id={'network'} {...boxStyles}>
@@ -328,20 +344,10 @@ export function NetworkSection({
328344
userSelect={'all'}
329345
className="textEllipsis"
330346
onClick={() => {
331-
copyData(`${network.publicDomain}.${network.domain}`);
347+
copyData(getAccessDisplayText(network));
332348
}}
333349
>
334-
{network.customDomain
335-
? network.customDomain
336-
: network.openNodePort
337-
? network?.nodePort
338-
? `${network.protocol.toLowerCase()}.${network.domain}:${
339-
network.nodePort
340-
}`
341-
: `${network.protocol.toLowerCase()}.${network.domain}:${t(
342-
'pending_to_allocated'
343-
)}`
344-
: `${network.publicDomain}.${network.domain}`}
350+
{getAccessDisplayText(network)}
345351
</Box>
346352
</Tooltip>
347353

0 commit comments

Comments
 (0)