Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(component): implemented a copy link button for copying invited c… #645

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
55 changes: 54 additions & 1 deletion apps/dashboard/src/components/add-member-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ export default function AddMemberModal({
setValue: setClientLink,
onCopy
} = useClipboard("")
const {
hasCopied: hasCopiedInviteCode,
value: inviteCode,
setValue: setInviteCode,
onCopy: onCopyInviteCode
} = useClipboard("")
const { data: signer } = useSigner()

useEffect(() => {
Expand Down Expand Up @@ -154,7 +160,10 @@ ${memberIds.join("\n")}
}

setClientLink(inviteLink)
}, [group, setClientLink])
const index = inviteLink.lastIndexOf("=")
const inviteCodeLink = inviteLink.substring(index + 1)
setInviteCode(inviteCodeLink)
}, [group, setClientLink, setInviteCode])

return (
<Modal
Expand Down Expand Up @@ -214,6 +223,50 @@ ${memberIds.join("\n")}

{group.type === "off-chain" && (
<Box mb="30px">
{!group.credentials && (
<>
<Text mb="10px" color="balticSea.800">
Share invite code
</Text>

<InputGroup size="lg">
<Input
pr="50px"
placeholder="Invite code"
value={inviteCode}
isDisabled
/>
<InputRightElement mr="5px">
<Tooltip
label={
hasCopiedInviteCode
? "Copied!"
: "Copy"
}
closeOnClick={false}
hasArrow
>
<IconButton
variant="link"
aria-label="Copy invite link"
onClick={onCopyInviteCode}
onMouseDown={(e) =>
e.preventDefault()
}
icon={
<Icon
color="sunsetOrange.600"
boxSize="5"
as={FiCopy}
/>
}
/>
</Tooltip>
</InputRightElement>
</InputGroup>
</>
)}

<Text mb="10px" color="balticSea.800">
{!group.credentials
? "Share invite link"
Expand Down
1 change: 0 additions & 1 deletion apps/dashboard/src/pages/group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,6 @@ ${memberIds.join("\n")}
</Heading>
</Box>
</Stack>
(
<Box
bgColor="balticSea.50"
p="25px 30px 25px 30px"
Expand Down
Loading