show pricing dialog when credit usage is clicked
This commit is contained in:
parent
54557de762
commit
75e93a66b8
@ -34,6 +34,8 @@ export default function AvatarDropdown() {
|
|||||||
const { signOut } = useClerk();
|
const { signOut } = useClerk();
|
||||||
const authenticatedFetch = useAuthenticatedFetch();
|
const authenticatedFetch = useAuthenticatedFetch();
|
||||||
|
|
||||||
|
const openPricingDialog = () => setPricingDialogOpen(true);
|
||||||
|
|
||||||
async function open(isOpen: boolean) {
|
async function open(isOpen: boolean) {
|
||||||
setIsOpen(isOpen);
|
setIsOpen(isOpen);
|
||||||
|
|
||||||
@ -80,13 +82,13 @@ export default function AvatarDropdown() {
|
|||||||
{/* Free users */}
|
{/* Free users */}
|
||||||
{isFreeUser && (
|
{isFreeUser && (
|
||||||
<DropdownMenuItem asChild={true}>
|
<DropdownMenuItem asChild={true}>
|
||||||
<a onClick={() => setPricingDialogOpen(true)}>Get pro</a>
|
<a onClick={openPricingDialog}>Get pro</a>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
)}
|
)}
|
||||||
{/* Paying user */}
|
{/* Paying user */}
|
||||||
{!isFreeUser && (
|
{!isFreeUser && (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuLabel>
|
<DropdownMenuLabel onClick={openPricingDialog}>
|
||||||
{capitalize(subscriberTier) + " Subscriber"}
|
{capitalize(subscriberTier) + " Subscriber"}
|
||||||
</DropdownMenuLabel>
|
</DropdownMenuLabel>
|
||||||
|
|
||||||
@ -100,10 +102,13 @@ export default function AvatarDropdown() {
|
|||||||
{/* Credits usage */}
|
{/* Credits usage */}
|
||||||
{!isLoadingUsage && (
|
{!isLoadingUsage && (
|
||||||
<>
|
<>
|
||||||
<DropdownMenuItem>
|
<DropdownMenuItem onClick={openPricingDialog}>
|
||||||
<Progress value={(usedCredits / totalCredits) * 100} />
|
<Progress value={(usedCredits / totalCredits) * 100} />
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem className="text-xs text-gray-700">
|
<DropdownMenuItem
|
||||||
|
className="text-xs text-gray-700"
|
||||||
|
onClick={openPricingDialog}
|
||||||
|
>
|
||||||
{usedCredits} out of {totalCredits} credits used for{" "}
|
{usedCredits} out of {totalCredits} credits used for{" "}
|
||||||
{new Date().toLocaleString("default", { month: "long" })}.
|
{new Date().toLocaleString("default", { month: "long" })}.
|
||||||
{subscriberTier !== "pro" && (
|
{subscriberTier !== "pro" && (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user