Files
calendar/apps/web/modules/ee/organizations/components/AboutOrganizationForm.tsx
T
Benny JooGitHubbenny@cal.com <sldisek783@gmail.com>benny@cal.com <sldisek783@gmail.com>Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
0774a41119 refactor: move hooks and stores from packages/features to apps/web/modules (#27221)
* refactor: move booking-audit client components from packages/features to apps/web/modules

This is part of the larger effort to move tRPC-dependent UI components from packages/features to apps/web/modules to eliminate circular dependencies.

Changes:
- Move BookingHistory.tsx and BookingHistoryPage.tsx to apps/web/modules/booking-audit/components/
- Update imports in apps/web to use the new location

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>

* refactor: move formbricks client from packages/features to apps/web/modules

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>

* refactor: move hooks and stores from packages/features to apps/web/modules

- Move useAppsData hook from packages/features/apps/hooks to apps/web/modules/apps/hooks
- Move onboardingStore from packages/features/ee/organizations/lib to apps/web/modules/ee/organizations/lib
- Move useWelcomeModal hook from packages/features/ee/organizations/hooks to apps/web/modules/ee/organizations/hooks
- Move useAgentsData hook from packages/features/ee/workflows/hooks to apps/web/modules/ee/workflows/hooks
- Update all import paths in consuming files

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>

* refactor: move onboardingStore test file to apps/web/modules

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-01-26 13:11:14 +00:00

109 lines
3.5 KiB
TypeScript

"use client";
import { useRouter } from "next/navigation";
import { Controller, useForm } from "react-hook-form";
import { useOnboarding } from "@calcom/web/modules/ee/organizations/lib/onboardingStore";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { ImageUploader } from "@calcom/ui/components/image-uploader";
import { TextAreaField } from "@calcom/ui/components/form";
import { Avatar } from "@calcom/ui/components/avatar";
import { Button } from "@calcom/ui/components/button";
import { Form } from "@calcom/ui/components/form";
import { Label } from "@calcom/ui/components/form";
import { Icon } from "@calcom/ui/components/icon";
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="stack-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>
</>
);
};