🐛 Show short url in invite dialog (#995)

This commit is contained in:
Luke Vella 2024-01-25 15:12:25 +07:00 committed by GitHub
parent 0384b5a33a
commit 040f223d00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,6 +20,7 @@ export function CopyInviteLinkButton() {
const [didCopy, setDidCopy] = React.useState(false);
const [state, copyToClipboard] = useCopyToClipboard();
const poll = usePoll();
const inviteLinkWithoutProtocol = poll.inviteLink.replace(/^https?:\/\//, "");
React.useEffect(() => {
if (state.error) {
@ -41,7 +42,7 @@ export function CopyInviteLinkButton() {
{didCopy ? (
<Trans i18nKey="copied" />
) : (
<span className="min-w-0 truncate">{`${window.location.hostname}/invite/${poll.id}`}</span>
<span className="min-w-0 truncate">{inviteLinkWithoutProtocol}</span>
)}
</Button>
);