♻️ Handle self-hosting environment with updated authentication (#918)

This commit is contained in:
Luke Vella 2023-10-30 10:23:43 +00:00 committed by GitHub
parent 221ae62d8e
commit 3e90c302d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 133 additions and 222 deletions

View file

@ -15,8 +15,6 @@ import { useCopyToClipboard } from "react-use";
import { useParticipants } from "@/components/participants-provider";
import { Trans } from "@/components/trans";
import { usePoll } from "@/contexts/poll";
import { shortUrl } from "@/utils/absolute-url";
import { isSelfHosted } from "@/utils/constants";
export const InviteDialog = () => {
const { participants } = useParticipants();
@ -31,10 +29,6 @@ export const InviteDialog = () => {
}
}, [state]);
const inviteLink = isSelfHosted
? window.location.origin + `/invite/${poll?.id}`
: shortUrl(`/invite/${poll?.id}`);
const [didCopy, setDidCopy] = React.useState(false);
return (
@ -72,7 +66,7 @@ export const InviteDialog = () => {
<Button
className="w-full min-w-0 bg-gray-50 px-2.5"
onClick={() => {
copyToClipboard(inviteLink);
copyToClipboard(poll.inviteLink);
setDidCopy(true);
setTimeout(() => {
setDidCopy(false);
@ -82,7 +76,7 @@ export const InviteDialog = () => {
{didCopy ? (
<Trans i18nKey="copied" />
) : (
<span className="flex truncate">{inviteLink}</span>
<span className="flex truncate">{poll.inviteLink}</span>
)}
</Button>
<div className="shrink-0">