-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into extensionanirban
- Loading branch information
Showing
11 changed files
with
345 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
"use client"; | ||
|
||
import { LoadingSpinner } from "@dub/ui"; | ||
import { cn } from "@dub/utils"; | ||
import { useFormStatus } from "react-dom"; | ||
import { toast } from "sonner"; | ||
|
||
export default function SendThanks() { | ||
return ( | ||
<div className="flex flex-col space-y-5"> | ||
<form | ||
action={async (formData) => { | ||
if ( | ||
!confirm( | ||
`This will send an email to ${formData.get("email")} with a thank you message. Are you sure?`, | ||
) | ||
) { | ||
return; | ||
} | ||
await fetch("/api/admin/send-thanks", { | ||
method: "POST", | ||
body: JSON.stringify({ | ||
email: formData.get("email"), | ||
}), | ||
}).then(async (res) => { | ||
if (res.ok) { | ||
toast.success("Successfully sent email"); | ||
} else { | ||
const error = await res.text(); | ||
toast.error(error); | ||
} | ||
}); | ||
}} | ||
> | ||
<Form /> | ||
</form> | ||
</div> | ||
); | ||
} | ||
|
||
const Form = () => { | ||
const { pending } = useFormStatus(); | ||
|
||
return ( | ||
<div className="relative flex w-full rounded-md shadow-sm"> | ||
<input | ||
name="email" | ||
id="email" | ||
type="email" | ||
required | ||
disabled={pending} | ||
autoComplete="off" | ||
className={cn( | ||
"block w-full rounded-md border-gray-300 text-sm text-gray-900 placeholder-gray-400 focus:border-gray-500 focus:outline-none focus:ring-gray-500", | ||
pending && "bg-gray-100", | ||
)} | ||
placeholder="stey@vercel.com" | ||
aria-invalid="true" | ||
/> | ||
{pending && ( | ||
<LoadingSpinner className="absolute inset-y-0 right-2 my-auto h-full w-5 text-gray-400" /> | ||
)} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { withAdmin } from "@/lib/auth"; | ||
import { sendEmail } from "emails"; | ||
import UpgradeEmail from "emails/upgrade-email"; | ||
import { NextResponse } from "next/server"; | ||
|
||
// POST /api/admin/send-thanks | ||
export const POST = withAdmin(async ({ req }) => { | ||
const { email } = await req.json(); | ||
|
||
await sendEmail({ | ||
email, | ||
subject: "Thank you for upgrading to Dub.co Pro!", | ||
react: UpgradeEmail({ | ||
name: null, | ||
email, | ||
plan: "pro", | ||
}), | ||
marketing: true, | ||
bcc: process.env.TRUSTPILOT_BCC_EMAIL, | ||
}); | ||
|
||
return NextResponse.json({ success: true }); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { cn } from "@dub/utils"; | ||
import { Link2 } from "lucide-react"; | ||
import LinkLogo from "../links/link-logo"; | ||
|
||
export default function RefererIcon({ | ||
display, | ||
className, | ||
}: { | ||
display: string; | ||
className?: string; | ||
}) { | ||
return display === "(direct)" ? ( | ||
<Link2 className={cn("h-4 w-4", className)} /> | ||
) : ( | ||
<LinkLogo | ||
apexDomain={display} | ||
className={cn("h-4 w-4 sm:h-4 sm:w-4", className)} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.