import { useRouter } from "next/router"; import { useState } from "react"; import { Controller, useForm } from "react-hook-form"; import z from "zod"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Avatar, Button, Form, ImageUploader, Alert, Label, TextAreaField } from "@calcom/ui"; import { ArrowRight, Plus } from "@calcom/ui/components/icon"; const querySchema = z.object({ id: z.string(), }); export const AboutOrganizationForm = () => { const { t } = useLocale(); const router = useRouter(); const { id: orgId } = querySchema.parse(router.query); const [serverErrorMessage, setServerErrorMessage] = useState(null); const [image, setImage] = useState(""); const aboutOrganizationFormMethods = useForm<{ logo: string; bio: string; }>(); const updateOrganizationMutation = trpc.viewer.organizations.update.useMutation({ onSuccess: (data) => { if (data.update) { router.push(`/settings/organizations/${orgId}/onboard-admins`); } }, onError: (err) => { setServerErrorMessage(err.message); }, }); return ( <>
{ if (!updateOrganizationMutation.isLoading) { setServerErrorMessage(null); updateOrganizationMutation.mutate({ ...v, orgId }); } }}> {serverErrorMessage && (
)}
( <>
} asChild className="items-center" imageSrc={image} size="lg" />
{ setImage(newAvatar); aboutOrganizationFormMethods.setValue("logo", newAvatar); }} imageSrc={image} />
)} />
( <> { aboutOrganizationFormMethods.setValue("bio", e?.target.value); }} />

{t("organization_about_description")}

)} />
); };