* create seed for org upgrade * migrate about/new pages * pages refactor + use persistant zustand store * invited members view + confirm button * add check to org slug * check reserved subdomain * remove quotes from subdomain env var * intro to creation + billing * create price * fix types * createWithPaymentIntent + permission check on teams * open stripe link in popup * intro to tests * organization price and seat override tests * move permissions to a new permission service * update env and permission check * intro to paid invoice trigger * dont use subId * wip * Get e2e working with migration of teams and members * fix ts errors * Get flow working again * Fix various issues and refactor * Some more fixes * Fix wrong page route link * Platform onboarding fix and moving members of team to org rix * Platform onboarding fix and moving members of team to org rix * Fix tests, found a bug * Get custom price flow working * Get admin impersonation flow working for a non-existent user * Fix unit test * Admin onboarding handover * fix admin onboarding tests * fix ts error * Get updateQuantity working * More fixes * fix test * fix schema name * Add tests * Add missing file * More tests * Add more tests * fix mt-2 moving down input into overflow * fix handover layout removing HOC * Update PR_TODO.md * fix ts error due to merge conflict --------- Co-authored-by: Hariom Balhara <[email protected]> Co-authored-by: Hariom <[email protected]> Co-authored-by: Omar López <[email protected]>
103 lines
3.2 KiB
TypeScript
103 lines
3.2 KiB
TypeScript
"use client";
|
|
|
|
import { useRouter } from "next/navigation";
|
|
import { Controller, useForm } from "react-hook-form";
|
|
|
|
import { useOnboarding } from "@calcom/features/ee/organizations/lib/onboardingStore";
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { Avatar, Button, Form, Icon, ImageUploader, Label, TextAreaField } from "@calcom/ui";
|
|
|
|
export const AboutOrganizationForm = () => {
|
|
const { t } = useLocale();
|
|
const router = useRouter();
|
|
|
|
const { useOnboardingStore } = useOnboarding();
|
|
const { setLogo, setBio, bio: bioFromStore, logo: logoFromStore } = useOnboardingStore();
|
|
|
|
const aboutOrganizationFormMethods = useForm<{
|
|
logo: string;
|
|
bio: string;
|
|
}>({
|
|
defaultValues: {
|
|
logo: logoFromStore ?? "",
|
|
bio: bioFromStore ?? "",
|
|
},
|
|
});
|
|
|
|
return (
|
|
<>
|
|
<Form
|
|
form={aboutOrganizationFormMethods}
|
|
className="space-y-5"
|
|
handleSubmit={(values) => {
|
|
setLogo(values.logo);
|
|
setBio(values.bio);
|
|
router.push(`/settings/organizations/new/add-teams`);
|
|
}}>
|
|
<div>
|
|
<Controller
|
|
control={aboutOrganizationFormMethods.control}
|
|
name="logo"
|
|
render={({ field: { value } }) => (
|
|
<>
|
|
<Label>{t("organization_logo")}</Label>
|
|
<div className="flex items-center">
|
|
<Avatar
|
|
alt=""
|
|
fallback={<Icon name="plus" className="text-subtle h-6 w-6" />}
|
|
className="items-center"
|
|
imageSrc={value}
|
|
size="lg"
|
|
/>
|
|
<div className="ms-4">
|
|
<ImageUploader
|
|
target="avatar"
|
|
id="avatar-upload"
|
|
buttonMsg={t("upload")}
|
|
handleAvatarChange={(newAvatar: string) => {
|
|
aboutOrganizationFormMethods.setValue("logo", newAvatar);
|
|
}}
|
|
imageSrc={value}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</>
|
|
)}
|
|
/>
|
|
</div>
|
|
|
|
<div>
|
|
<Controller
|
|
control={aboutOrganizationFormMethods.control}
|
|
name="bio"
|
|
render={({ field: { value } }) => (
|
|
<>
|
|
<TextAreaField
|
|
name="about"
|
|
defaultValue={value}
|
|
onChange={(e) => {
|
|
aboutOrganizationFormMethods.setValue("bio", e?.target.value);
|
|
}}
|
|
/>
|
|
<p className="text-subtle text-sm">{t("organization_about_description")}</p>
|
|
</>
|
|
)}
|
|
/>
|
|
</div>
|
|
|
|
<div className="flex">
|
|
<Button
|
|
// Form submitted means navigation is happening and new Form would render when that occurs, so keep it in loading state
|
|
loading={aboutOrganizationFormMethods.formState.isSubmitted}
|
|
color="primary"
|
|
EndIcon="arrow-right"
|
|
type="submit"
|
|
className="w-full justify-center">
|
|
{t("continue")}
|
|
</Button>
|
|
</div>
|
|
</Form>
|
|
</>
|
|
);
|
|
};
|