"use client"; import { motion } from "motion/react"; import { Button } from "../ui/button"; import { Input } from "../ui/input"; import { ArrowRight } from "lucide-react"; import Link from "next/link"; import { useEffect, useState } from "react"; import { useToast } from "@/hooks/use-toast"; import { getStars } from "@/lib/fetchGhStars"; interface HeroProps { signupCount: number; } export function Hero({ signupCount }: HeroProps) { const [star, setStar] = useState(); const [email, setEmail] = useState(""); const [isSubmitting, setIsSubmitting] = useState(false); const { toast } = useToast(); useEffect(() => { const fetchStars = async () => { try { const data = await getStars(); setStar(data); } catch (err) { console.error("Failed to fetch GitHub stars", err); } }; fetchStars(); }, []); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (!email.trim()) { toast({ title: "Email required", description: "Please enter your email address.", variant: "destructive", }); return; } setIsSubmitting(true); try { const response = await fetch("/api/waitlist", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ email: email.trim() }), }); const data = await response.json(); if (response.ok) { toast({ title: "Welcome to the waitlist! 🎉", description: "You'll be notified when we launch.", }); setEmail(""); } else { toast({ title: "Oops!", description: data.error || "Something went wrong. Please try again.", variant: "destructive", }); } } catch (error) { toast({ title: "Network error", description: "Please check your connection and try again.", variant: "destructive", }); } finally { setIsSubmitting(false); } }; return (

The open source

video editor

A simple but powerful video editor that gets the job done. Works on any platform.
setEmail(e.target.value)} disabled={isSubmitting} required />
{signupCount > 0 && (
{signupCount.toLocaleString()} people already joined )} Currently in beta • Open source on{" "} GitHub {star}+
); }