'use client'; import { LogoSquare } from '@/components/logo'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { useAppParams } from '@/hooks/useAppParams'; import { zodResolver } from '@hookform/resolvers/zod'; import { SaveIcon } from 'lucide-react'; import { useRouter } from 'next/navigation'; import type { SubmitHandler } from 'react-hook-form'; import { useForm } from 'react-hook-form'; import { toast } from 'sonner'; import { z } from 'zod'; import { api, handleError } from '../../_trpc/client'; const validation = z.object({ name: z.string().min(1), }); type IForm = z.infer; export function CreateProject() { const params = useAppParams(); const router = useRouter(); const form = useForm({ resolver: zodResolver(validation), }); const mutation = api.project.create.useMutation({ onError: handleError, onSuccess() { toast.success('Project created'); router.refresh(); }, }); const onSubmit: SubmitHandler = (values) => { mutation.mutate({ name: values.name, organizationId: params.organizationId, }); }; return ( <>

Create your first project

A project is just a container for your events. You can create as many as you want.
); }