'use client' import React, { useEffect, useRef, useState } from 'react' import { useRouter } from "next/navigation"; import { cn } from '@/lib/utils' import { ExternalLink } from '@/components/external-link' import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' // import { Button } from './ui/button' import { Textarea } from './ui/textarea' import Link from "next/link"; import { Container } from "@/components/landing/container"; import { FadeIn } from "@/components/landing/fade-in"; import { NewsletterForm } from "@/components/landing/newsletter"; import service from '@/lib/http/service'; import { useLocalStorage } from '@/lib/hooks/use-local-storage'; import { UserData } from './user-menu'; import toast from 'react-hot-toast'; import { Button, Form, Input } from 'antd'; import LanguageChanger from './LanguageChanger'; import { useTranslation } from 'react-i18next'; // import { socialMediaProfiles } from "@/components/landing/social-media"; export function FooterText({ className, ...props }: React.ComponentProps<'p'>) { return (

Made by{' '} Markeljan {' '} with{' '} Vercel AI .

) } export function Footer({ className, ...props }: React.ComponentProps<'p'>) { const inputRef = useRef(null) const [input, setInput] = useState(""); const [isLoading, setIsLoading] = React.useState(false); const [isSubscribe, setIsSubscribe] = React.useState(false); const [form] = Form.useForm(); const [clientReady, setClientReady] = useState(false); const router = useRouter(); const { t, i18n } = useTranslation() const language = i18n.language // To disable submit button at the beginning. useEffect(() => { setClientReady(true); }, []); const onFinish = async (values: any) => { console.log('Finish:', values); // toast.success("OK") // const token = userData.auth_token // if (!token) { // router.push('/auth/sign-in') // return // } // /api/v1/customer/subscribe if (isLoading) return setIsLoading(true); await service.post('/api/v1/customer/subscribe', { "first_name": values.first_name, "email": values.email, language, "tags": [ "#AI", "#Blockchain", "#ChatGPT" ] }, { headers: { // 'Authorization': token } }).then(function (result: any) { setTimeout(() => { setIsLoading(false); setIsSubscribe(true) }, 800); console.log("result:", result) if (result && result.header.code != 0) { toast.error(result.header.message) return } // localStorage.removeItem("UserData"); // // router.refresh() // // router.push('/') // location.reload(); toast.success(t('footer.subscribe_success')) }).catch((err) => { setIsLoading(false); console.log(err); }); }; const [userData, setUserData] = useLocalStorage( 'UserData', { auth_token: "", id: 1, login_ip: "", login_time: 0, role: "", user_name: "", version: "" } as UserData ) interface WindowSize { windowWidth: number; windowHeight: number; } const isWindow = typeof window !== "undefined" console.log("isWindow ", isWindow) const [windowSize, setWindowSize] = useState({ windowWidth: window.innerWidth, windowHeight: window.innerHeight }); useEffect(() => { if (isWindow) { const handleResize = () => { console.log(window.innerWidth, window.innerHeight) setWindowSize({ windowWidth: window.innerWidth, windowHeight: window.innerHeight }); }; window.addEventListener('resize', handleResize); return () => { window.removeEventListener('resize', handleResize); }; } }, []); // const { windowWidth, windowHeight } = windowSize; return ( {/* */}
{/*
*/}

{t("footer.h3")}

{!userData.auth_token ?
{() => ( )}
:

{t("footer.thank_subscription")}

}
{ !userData.auth_token && (isSubscribe ?

{t("footer.p_ok")}

:

{t("footer.p")}

) }
) } const navigation = [ { title: "Company", links: [ { title: "About", href: "/about" }, { title: "Blog", href: "/blog" }, { title: "Careers", href: "/careers" }, { title: "Changelog", href: "/changelog" }, { title: "Analytics", href: "https://us.posthog.com/shared/HwZNjaKOLtgtpj6djuSo3fgOqrQm0Q?whitelabel", }, { title: "Source Code", href: "https://github.com/unkeyed/unkey", }, { title: "Documentation", href: "https://unkey.dev/docs", }, ], }, { title: "Legal", links: [ { title: "Privacy Policy", href: "/policies/privacy" }, { title: "Terms", href: "/policies/terms" }, ], }, { title: "Connect", links: [ // ...socialMediaProfiles, { title: Book us with Cal.com, href: "https://cal.com/team/unkey/unkey-chat??utm_source=banner&utm_campaign=oss", }, ], }, ]; function Navigation() { return ( ); } export function Footer_bak() { return (
{/* */}
{/*

© Unkeyed, Inc. {new Date().getFullYear()}

*/}
); }