Skip to content

Commit 23afe7c

Browse files
JuligsVmMad
andauthored
refactor(dapp): update connect address dialog (#845)
Co-authored-by: JCNoguera <[email protected]>
1 parent 40f98be commit 23afe7c

File tree

1 file changed

+56
-47
lines changed

1 file changed

+56
-47
lines changed

dapp/src/components/dialogs/ConnectToAddressDialog.tsx

Lines changed: 56 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -258,42 +258,51 @@ export function ConnectToAddressDialog({ name, setOpen }: ConnectToAddressDialog
258258
</div>
259259
)}
260260
</div>
261-
<Panel bgColor="bg-names-neutral-10 state-layer relative">
262-
<div className="flex flex-col rounded-lg p-md gap-y-md">
263-
<div
264-
className={`flex flex-row items-start gap-x-md ${
265-
!disableEdit && isTargetingCurrentAddress
266-
? 'cursor-pointer'
267-
: 'cursor-not-allowed'
268-
}`}
269-
onClick={() => {
270-
if (!disableEdit && isTargetingCurrentAddress) {
271-
setEditIsDefaultName(!editIsDefaultName);
272-
}
273-
}}
274-
>
275-
<div className=" flex flex-col gap-y-xxs">
276-
<span className="text-title-md text-names-neutral-100">
277-
Set as Display name
278-
</span>
279-
<span className="text-body-md text-names-neutral-90">
280-
Use Name publicly across the web instead of
281-
current address.
282-
</span>
261+
{isTargetingCurrentAddress && (
262+
<Panel bgColor="bg-names-neutral-10 state-layer relative">
263+
<div className="flex flex-col rounded-lg p-md gap-y-md">
264+
<div
265+
className={`flex flex-row items-start gap-x-md ${
266+
!disableEdit && isTargetingCurrentAddress
267+
? 'cursor-pointer'
268+
: 'cursor-not-allowed'
269+
}`}
270+
onClick={() => {
271+
if (
272+
!disableEdit &&
273+
isTargetingCurrentAddress
274+
) {
275+
setEditIsDefaultName(
276+
!editIsDefaultName,
277+
);
278+
}
279+
}}
280+
>
281+
<div className=" flex flex-col gap-y-xxs">
282+
<span className="text-title-md text-names-neutral-100">
283+
Set as Display name
284+
</span>
285+
<span className="text-body-md text-names-neutral-90">
286+
Use Name publicly across the web instead
287+
of current address.
288+
</span>
289+
</div>
290+
<Checkbox
291+
isChecked={editIsDefaultName}
292+
isDisabled={
293+
disableEdit ||
294+
!isTargetingCurrentAddress
295+
}
296+
onCheckedChange={(checked) => {
297+
const value = !!checked.target.checked;
298+
console.log(
299+
'Checkbox Set as Display Name →',
300+
value,
301+
);
302+
setEditIsDefaultName(value);
303+
}}
304+
/>
283305
</div>
284-
<Checkbox
285-
isChecked={editIsDefaultName}
286-
isDisabled={
287-
disableEdit || !isTargetingCurrentAddress
288-
}
289-
onCheckedChange={(checked) =>
290-
setEditIsDefaultName(
291-
!!checked.target.checked,
292-
)
293-
}
294-
/>
295-
</div>
296-
{editIsDefaultName && (
297306
<Panel hasBorder bgColor="bg-names-neutral-10">
298307
<div className="flex flex-col items-center gap-y-xxs py-md px-xs">
299308
<span className="text-title-lg text-names-neutral-100 w-full text-center">
@@ -316,19 +325,19 @@ export function ConnectToAddressDialog({ name, setOpen }: ConnectToAddressDialog
316325
/>
317326
</div>
318327
</Panel>
319-
)}
320328

321-
{showAddressWarning && (
322-
<InfoBox
323-
type={InfoBoxType.Warning}
324-
style={InfoBoxStyle.Default}
325-
icon={<Warning />}
326-
title="Address has a linked name!"
327-
supportingText="Continuing will override the previous address's name"
328-
/>
329-
)}
330-
</div>
331-
</Panel>
329+
{showAddressWarning && (
330+
<InfoBox
331+
type={InfoBoxType.Warning}
332+
style={InfoBoxStyle.Default}
333+
icon={<Warning />}
334+
title="Address has a linked name!"
335+
supportingText="Continuing will override the previous address's name"
336+
/>
337+
)}
338+
</div>
339+
</Panel>
340+
)}
332341
</>
333342
)}
334343
</div>

0 commit comments

Comments
 (0)