reduce # generations to 10
This commit is contained in:
parent
80547e9ae1
commit
fa6a92b9b4
@ -181,7 +181,7 @@ export default {
|
|||||||
if (!dbUser) {
|
if (!dbUser) {
|
||||||
return new Response("User not found.", { status: 400 });
|
return new Response("User not found.", { status: 400 });
|
||||||
}
|
}
|
||||||
if (dbUser.generations !== null && dbUser.generations >= 30) {
|
if (dbUser.generations !== null && dbUser.generations >= 10) {
|
||||||
return new Response("You reached the maximum # of generations.", { status: 400 });
|
return new Response("You reached the maximum # of generations.", { status: 400 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,10 +529,6 @@ export default function CodeEditor({
|
|||||||
setFiles(response);
|
setFiles(response);
|
||||||
setDeletingFolderId("");
|
setDeletingFolderId("");
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
setDeletingFolderId("");
|
|
||||||
}, 3000);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isAwaitingConnection)
|
if (isAwaitingConnection)
|
||||||
|
@ -59,7 +59,7 @@ export default function GenerateInput({
|
|||||||
}: {
|
}: {
|
||||||
regenerate?: boolean;
|
regenerate?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
if (user.generations >= 30) {
|
if (user.generations >= 10) {
|
||||||
toast.error(
|
toast.error(
|
||||||
"You reached the maximum # of generations. Contact @ishaandey_ on X/Twitter to reset :)"
|
"You reached the maximum # of generations. Contact @ishaandey_ on X/Twitter to reset :)"
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"use client"
|
"use client";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
@ -7,23 +7,24 @@ import {
|
|||||||
DropdownMenuLabel,
|
DropdownMenuLabel,
|
||||||
DropdownMenuSeparator,
|
DropdownMenuSeparator,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@/components/ui/dropdown-menu"
|
} from "@/components/ui/dropdown-menu";
|
||||||
import { User } from "@/lib/types"
|
import { User } from "@/lib/types";
|
||||||
import { useClerk } from "@clerk/nextjs"
|
import { useClerk } from "@clerk/nextjs";
|
||||||
import { LogOut, Pencil, Sparkles } from "lucide-react"
|
import { LogOut, Pencil, Sparkles } from "lucide-react";
|
||||||
import { useRouter } from "next/navigation"
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
export default function UserButton({ userData }: { userData: User }) {
|
export default function UserButton({ userData }: { userData: User }) {
|
||||||
if (!userData) return null
|
if (!userData) return null;
|
||||||
|
|
||||||
const { signOut } = useClerk()
|
const { signOut } = useClerk();
|
||||||
const router = useRouter()
|
const router = useRouter();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger>
|
<DropdownMenuTrigger>
|
||||||
<div className="w-9 h-9 font-mono rounded-full overflow-hidden bg-gradient-to-t from-neutral-800 to-neutral-600 flex items-center justify-center text-sm font-medium">
|
<div className="w-9 h-9 font-mono rounded-full overflow-hidden bg-gradient-to-t from-neutral-800 to-neutral-600 flex items-center justify-center text-sm font-medium">
|
||||||
{userData.name && userData.name
|
{userData.name &&
|
||||||
|
userData.name
|
||||||
.split(" ")
|
.split(" ")
|
||||||
.slice(0, 2)
|
.slice(0, 2)
|
||||||
.map((name) => name[0].toUpperCase())}
|
.map((name) => name[0].toUpperCase())}
|
||||||
@ -41,13 +42,13 @@ export default function UserButton({ userData }: { userData: User }) {
|
|||||||
<div className="py-1.5 px-2 w-full flex flex-col items-start text-sm">
|
<div className="py-1.5 px-2 w-full flex flex-col items-start text-sm">
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<Sparkles className={`h-4 w-4 mr-2 text-indigo-500`} />
|
<Sparkles className={`h-4 w-4 mr-2 text-indigo-500`} />
|
||||||
AI Usage: {userData.generations}/30
|
AI Usage: {userData.generations}/10
|
||||||
</div>
|
</div>
|
||||||
<div className="rounded-full w-full mt-2 h-2 overflow-hidden bg-secondary">
|
<div className="rounded-full w-full mt-2 h-2 overflow-hidden bg-secondary">
|
||||||
<div
|
<div
|
||||||
className="h-full bg-indigo-500 rounded-full"
|
className="h-full bg-indigo-500 rounded-full"
|
||||||
style={{
|
style={{
|
||||||
width: `${(userData.generations * 100) / 30}%`,
|
width: `${(userData.generations * 100) / 10}%`,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -66,5 +67,5 @@ export default function UserButton({ userData }: { userData: User }) {
|
|||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user