chore: add env var and fixup
This commit is contained in:
@@ -2,6 +2,6 @@
|
||||
|
||||
import CountUp from "react-countup";
|
||||
|
||||
export default ({ count }: { count: number }) => {
|
||||
export default function ({ count }: { count: number }) {
|
||||
return <CountUp end={count} duration={3} />;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useForm } from "react-hook-form";
|
||||
import { toast } from "sonner";
|
||||
import * as z from "zod";
|
||||
|
||||
import { siteConfig } from "@/config/site";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { userAuthSchema } from "@/lib/validations/auth";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
@@ -82,7 +83,12 @@ export function UserAuthForm({ className, type, ...props }: UserAuthFormProps) {
|
||||
</div>
|
||||
<button
|
||||
className={cn(buttonVariants(), "mt-3")}
|
||||
disabled={isLoading || isGoogleLoading || isGithubLoading}
|
||||
disabled={
|
||||
!siteConfig.openSignup ||
|
||||
isLoading ||
|
||||
isGoogleLoading ||
|
||||
isGithubLoading
|
||||
}
|
||||
>
|
||||
{isLoading && (
|
||||
<Icons.spinner className="mr-2 size-4 animate-spin" />
|
||||
@@ -110,7 +116,12 @@ export function UserAuthForm({ className, type, ...props }: UserAuthFormProps) {
|
||||
setIsGoogleLoading(true);
|
||||
signIn("google");
|
||||
}}
|
||||
disabled={isLoading || isGoogleLoading || isGithubLoading}
|
||||
disabled={
|
||||
!siteConfig.openSignup ||
|
||||
isLoading ||
|
||||
isGoogleLoading ||
|
||||
isGithubLoading
|
||||
}
|
||||
>
|
||||
{isGoogleLoading ? (
|
||||
<Icons.spinner className="mr-2 size-4 animate-spin" />
|
||||
@@ -126,7 +137,12 @@ export function UserAuthForm({ className, type, ...props }: UserAuthFormProps) {
|
||||
setIsGithubLoading(true);
|
||||
signIn("github");
|
||||
}}
|
||||
disabled={isLoading || isGithubLoading || isGoogleLoading}
|
||||
disabled={
|
||||
!siteConfig.openSignup ||
|
||||
isLoading ||
|
||||
isGithubLoading ||
|
||||
isGoogleLoading
|
||||
}
|
||||
>
|
||||
{isGithubLoading ? (
|
||||
<Icons.spinner className="mr-2 size-4 animate-spin" />
|
||||
|
||||
@@ -4,6 +4,7 @@ import { env } from "@/env.mjs";
|
||||
const site_url = env.NEXT_PUBLIC_APP_URL;
|
||||
const free_recored_quota = env.NEXT_PUBLIC_FREE_RECORD_QUOTA;
|
||||
const free_url_quota = env.NEXT_PUBLIC_FREE_URL_QUOTA;
|
||||
const open_signup = env.NEXT_PUBLIC_OPEN_SIGNUP;
|
||||
|
||||
export const siteConfig: SiteConfig = {
|
||||
name: "WRDO",
|
||||
@@ -19,6 +20,7 @@ export const siteConfig: SiteConfig = {
|
||||
record: Number(free_recored_quota),
|
||||
url: Number(free_url_quota),
|
||||
},
|
||||
openSignup: open_signup === "1" ? true : false,
|
||||
};
|
||||
|
||||
export const footerLinks: SidebarNavItem[] = [
|
||||
|
||||
@@ -19,8 +19,9 @@ export const env = createEnv({
|
||||
},
|
||||
client: {
|
||||
NEXT_PUBLIC_APP_URL: z.string().min(1),
|
||||
NEXT_PUBLIC_FREE_RECORD_QUOTA: z.string().min(1),
|
||||
NEXT_PUBLIC_FREE_URL_QUOTA: z.string().min(1),
|
||||
NEXT_PUBLIC_FREE_RECORD_QUOTA: z.string().min(1).default("3"),
|
||||
NEXT_PUBLIC_FREE_URL_QUOTA: z.string().min(1).default("100"),
|
||||
NEXT_PUBLIC_OPEN_SIGNUP: z.string().min(1).default("1"),
|
||||
},
|
||||
runtimeEnv: {
|
||||
NEXTAUTH_URL: process.env.NEXTAUTH_URL,
|
||||
@@ -34,6 +35,7 @@ export const env = createEnv({
|
||||
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
|
||||
NEXT_PUBLIC_FREE_RECORD_QUOTA: process.env.NEXT_PUBLIC_FREE_RECORD_QUOTA,
|
||||
NEXT_PUBLIC_FREE_URL_QUOTA: process.env.NEXT_PUBLIC_FREE_URL_QUOTA,
|
||||
NEXT_PUBLIC_OPEN_SIGNUP: process.env.NEXT_PUBLIC_OPEN_SIGNUP,
|
||||
CLOUDFLARE_ZONE_ID: process.env.CLOUDFLARE_ZONE_ID,
|
||||
CLOUDFLARE_API_KEY: process.env.CLOUDFLARE_API_KEY,
|
||||
CLOUDFLARE_EMAIL: process.env.CLOUDFLARE_EMAIL,
|
||||
|
||||
Vendored
+1
@@ -17,6 +17,7 @@ export type SiteConfig = {
|
||||
record: number;
|
||||
url: number;
|
||||
};
|
||||
openSignup: boolean;
|
||||
};
|
||||
|
||||
export type NavItem = {
|
||||
|
||||
Reference in New Issue
Block a user