Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

accounted for expired invitation

Steven Tey7cc639a7dbf9
diff --git a/components/app/modals/accept-invite-modal.tsx b/components/app/modals/accept-invite-modal.tsx
index fa672393af..2136f786d3 100644
--- a/components/app/modals/accept-invite-modal.tsx
+++ b/components/app/modals/accept-invite-modal.tsx
@@ -1,4 +1,5 @@
import { useRouter } from "next/router";
+import Link from "next/link";
import {
Dispatch,
SetStateAction,
@@ -30,48 +31,77 @@ function AcceptInviteModal({
showModal={showAcceptInviteModal}
setShowModal={setShowAcceptInviteModal}
>
- <div className="inline-block w-full transform overflow-hidden bg-white align-middle shadow-xl transition-all sm:max-w-md sm:rounded-2xl sm:border sm:border-gray-200">
- <div className="flex flex-col items-center justify-center space-y-3 border-b border-gray-200 px-4 py-4 pt-8 sm:px-16">
- <BlurImage
- src={`/_static/logo.png`}
- alt={"Invite Teammate"}
- className="h-10 w-10 rounded-full"
- width={20}
- height={20}
- />
- <h3 className="text-lg font-medium">Project Invitation</h3>
- <p className="text-center text-sm text-gray-500">
- You've been invited to join and collaborate on the{" "}
- <span className="font-mono text-purple-600">
- {slug || "......"}
- </span>{" "}
- team on Dub
- </p>
+ {error.status === 409 ? (
+ <div className="inline-block w-full transform overflow-hidden bg-white align-middle shadow-xl transition-all sm:max-w-md sm:rounded-2xl sm:border sm:border-gray-200">
+ <div className="flex flex-col items-center justify-center space-y-3 border-b border-gray-200 px-4 py-4 pt-8 sm:px-16">
+ <BlurImage
+ src={`/_static/logo.png`}
+ alt={"Invite Teammate"}
+ className="h-10 w-10 rounded-full"
+ width={20}
+ height={20}
+ />
+ <h3 className="text-lg font-medium">Project Invitation</h3>
+ <p className="text-center text-sm text-gray-500">
+ You've been invited to join and collaborate on the{" "}
+ <span className="font-mono text-purple-600">
+ {slug || "......"}
+ </span>{" "}
+ team on Dub
+ </p>
+ </div>
+ <div className="flex flex-col space-y-6 bg-gray-50 px-4 py-8 text-left sm:px-16">
+ <button
+ onClick={() => {
+ setAccepting(true);
+ fetch(`/api/projects/${slug}/invite/accept`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ }).then(() => {
+ toast.success("You now are a part of this project!");
+ mutate(`/api/projects/${slug}`);
+ mutate(`/api/projects/${slug}/users`);
+ });
+ }}
+ disabled={accepting}
+ className={`${
+ accepting
+ ? "cursor-not-allowed border-gray-200 bg-gray-100 text-gray-400"
+ : "border-black bg-black text-white hover:bg-white hover:text-black"
+ } flex h-10 w-full items-center justify-center rounded-md border text-sm transition-all focus:outline-none`}
+ >
+ {accepting ? (
+ <LoadingDots color="#808080" />
+ ) : (
+ <p>Accept invite</p>
+ )}
+ </button>
+ </div>
</div>
- <div className="flex flex-col space-y-6 bg-gray-50 px-4 py-8 text-left sm:px-16">
- <button
- onClick={() => {
- setAccepting(true);
- fetch(`/api/projects/${slug}/invite/accept`, {
- method: "POST",
- headers: { "Content-Type": "application/json" },
- }).then(() => {
- toast.success("You now are a part of this project!");
- mutate(`/api/projects/${slug}`);
- mutate(`/api/projects/${slug}/users`);
- });
- }}
- disabled={accepting}
- className={`${
- accepting
- ? "cursor-not-allowed border-gray-200 bg-gray-100 text-gray-400"
- : "border-black bg-black text-white hover:bg-white hover:text-black"
- } flex h-10 w-full items-center justify-center rounded-md border text-sm transition-all focus:outline-none`}
- >
- {accepting ? <LoadingDots color="#808080" /> : <p>Accept invite</p>}
- </button>
+ ) : (
+ <div className="inline-block w-full transform overflow-hidden bg-white align-middle shadow-xl transition-all sm:max-w-md sm:rounded-2xl sm:border sm:border-gray-200">
+ <div className="flex flex-col items-center justify-center space-y-3 border-b border-gray-200 px-4 py-4 pt-8 sm:px-16">
+ <BlurImage
+ src={`/_static/logo.png`}
+ alt={"Invite Teammate"}
+ className="h-10 w-10 rounded-full"
+ width={20}
+ height={20}
+ />
+ <h3 className="text-lg font-medium">Project Invitation Expired</h3>
+ <p className="text-center text-sm text-gray-500">
+ This invite has expired or is no longer valid.
+ </p>
+ </div>
+ <div className="flex flex-col space-y-6 bg-gray-50 px-4 py-8 text-left sm:px-16">
+ <Link href="/">
+ <a className="flex h-10 w-full items-center justify-center rounded-md border border-black bg-black text-sm text-white transition-all hover:bg-white hover:text-black focus:outline-none">
+ Back to dashboard
+ </a>
+ </Link>
+ </div>
</div>
- </div>
+ )}
</Modal>
);
}
diff --git a/components/app/modals/invite-teammate-modal.tsx b/components/app/modals/invite-teammate-modal.tsx
index c2c234776d..9f9884ad90 100644
--- a/components/app/modals/invite-teammate-modal.tsx
+++ b/components/app/modals/invite-teammate-modal.tsx
@@ -43,7 +43,8 @@ function InviteTeammateModal({
/>
<h3 className="text-lg font-medium">Invite Teammate</h3>
<p className="text-center text-sm text-gray-500">
- Invite a teammate to join your project.
+ Invite a teammate to join your project. Invitations will be valid
+ for 7 days.
</p>
</div>