'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 { 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 { z } from 'zod'; import { api, handleError } from '../_trpc/client'; const validation = z.object({ organization: z.string().min(4), project: z.string().optional(), }); type IForm = z.infer; export function CreateOrganization() { const router = useRouter(); const form = useForm({ resolver: zodResolver(validation), }); const mutation = api.onboarding.organziation.useMutation({ onError: handleError, onSuccess({ organization, project }) { let url = `/${organization.slug}`; if (project) { url += `/${project.id}`; } router.replace(url); }, }); const onSubmit: SubmitHandler = (values) => { mutation.mutate(values); }; return ( <>

Welcome to Openpanel

Create your organization below (can be personal or a company) and optionally your first project 🤠
); }