Files
cal.diy/packages/features/ee/teams/components/v2/CreateNewTeam.tsx
T
+15 0c78dbea27 Create New Team (#4450)
* Add link to new teams

* Create new team

* Invite team members

* Bug fix

* Tidy up settings calendars (#4430)

* feat: 4232 - new theme toggle design. (#4371)

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>

* fix: Select dropdown styling (#4358)

* fix: select dropdown styling

* change check icon

* Revert select component, update v2 select

* Updates the background color to match figma design

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Syed Ali Shahbaz <[email protected]>
Co-authored-by: sean-brydon <[email protected]>

* Fix input height 36px (#4425)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Fix crash due to some props being undefined (#4427)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Improve event type item description visibility (#4404)

* Make event type description more visible

* Delete unneeded import

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Updating language in settings needs a reload to be translated (#4431)

Co-authored-by: gitstart <[email protected]>
Co-authored-by: Nitesh Singh <[email protected]>
Co-authored-by: Thiago Nascimbeni <[email protected]>
Co-authored-by: Grace Nshokano <[email protected]>
Co-authored-by: Matheus Muniz <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix: remove i18n from title and description (#4354)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Hariom Balhara <[email protected]>

* Fix styles and remove temporarily elements (#4448)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Fix deletion of route (#4466)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* feat: make toggle button default (#4437)

* feat: make switch default

* fix: refetch invalidated query

* React-query caching the previous isDefault state.

* fix: switch label color

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Refactor skeleton loader files to v2 folders (#4447)

* create v2 skeleton loaders

* add depreciation notice to old skeleton loader files

Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Adds rescheduling dropdown to past unconfirmed bookings (#3726)

Co-authored-by: Omar López <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix: add a consistent key to the day ranges list (#4401)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* remove "Weve changed billing for teams" banner in teams (#4432)

Co-authored-by: gitstart <[email protected]>
Co-authored-by: gitstart <[email protected]>
Co-authored-by: Grace Nshokano <[email protected]>
Co-authored-by: Nitesh Singh <[email protected]>
Co-authored-by: Matheus Muniz <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix: remove name prop from NumberWidget (#4346)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* Fix bug

* Fix bug

* Squashed commit of the following:

commit c3cb839027
Author: Bailey Pumfleet <[email protected]>
Date:   Wed Sep 14 17:13:13 2022 +0100

    Remove outline from user dropdown trigger (#4470)

commit 91c39a0306
Author: Sascha Schworm <[email protected]>
Date:   Wed Sep 14 18:09:00 2022 +0200

    feat: Exchange with NTLM support (#4127)

    * add exchange package

    * fix conflicts

    * add setup page for v2

    * refactor setup page for v1

    * return exchange error messages to user if applicable

    Co-authored-by: Peer Richelsen <[email protected]>
    Co-authored-by: Joe Au-Yeung <[email protected]>

commit f1c15f4e8a
Author: alannnc <[email protected]>
Date:   Wed Sep 14 10:57:20 2022 -0500

    4382 onboarding fix the disabled state of the username in step 1 (#4451)

    * Convert username availability premium to v2

    * Update Username Availability to v2 design

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 3f29df16ad
Author: Alex van Andel <[email protected]>
Date:   Wed Sep 14 16:40:56 2022 +0100

    KBar included @calcom/ui/v2/core -> Shell -> KBar -> Shell -> ... (#4469)

commit 3a06947c8a
Author: Syed Ali Shahbaz <[email protected]>
Date:   Wed Sep 14 19:14:42 2022 +0530

    fixes active state of select options (#4456)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit f486b0242f
Author: Nafees Nazik <[email protected]>
Date:   Wed Sep 14 17:28:59 2022 +0530

    fix: remove name prop from NumberWidget (#4346)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 9bc2676822
Author: GitStart <[email protected]>
Date:   Wed Sep 14 12:41:47 2022 +0100

    remove "Weve changed billing for teams" banner in teams (#4432)

    Co-authored-by: gitstart <[email protected]>
    Co-authored-by: gitstart <[email protected]>
    Co-authored-by: Grace Nshokano <[email protected]>
    Co-authored-by: Nitesh Singh <[email protected]>
    Co-authored-by: Matheus Muniz <[email protected]>
    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 5c72aa3497
Author: Nafees Nazik <[email protected]>
Date:   Wed Sep 14 17:00:25 2022 +0530

    fix: add a consistent key to the day ranges list (#4401)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 09da911bf9
Author: Dallen Pyrah <[email protected]>
Date:   Wed Sep 14 05:02:26 2022 -0600

    Adds rescheduling dropdown to past unconfirmed bookings (#3726)

    Co-authored-by: Omar López <[email protected]>
    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 2fbaec41c9
Author: Carina Wollendorfer <[email protected]>
Date:   Wed Sep 14 06:35:40 2022 -0400

    Refactor skeleton loader files to v2 folders (#4447)

    * create v2 skeleton loaders

    * add depreciation notice to old skeleton loader files

    Co-authored-by: CarinaWolli <[email protected]>
    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 3bada22900
Author: Nafees Nazik <[email protected]>
Date:   Wed Sep 14 15:54:41 2022 +0530

    feat: make toggle button default (#4437)

    * feat: make switch default

    * fix: refetch invalidated query

    * React-query caching the previous isDefault state.

    * fix: switch label color

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 45059554b6
Author: Hariom Balhara <[email protected]>
Date:   Wed Sep 14 15:40:52 2022 +0530

    Fix deletion of route (#4466)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 8b69359ccb
Author: alannnc <[email protected]>
Date:   Wed Sep 14 04:55:49 2022 -0500

    Fix styles and remove temporarily elements (#4448)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit b457125915
Author: Udit Takkar <[email protected]>
Date:   Wed Sep 14 15:12:48 2022 +0530

    fix: remove i18n from title and description (#4354)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
    Co-authored-by: Hariom Balhara <[email protected]>

commit 01e0fed3c5
Author: GitStart <[email protected]>
Date:   Wed Sep 14 10:28:23 2022 +0100

    Updating language in settings needs a reload to be translated (#4431)

    Co-authored-by: gitstart <[email protected]>
    Co-authored-by: Nitesh Singh <[email protected]>
    Co-authored-by: Thiago Nascimbeni <[email protected]>
    Co-authored-by: Grace Nshokano <[email protected]>
    Co-authored-by: Matheus Muniz <[email protected]>
    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit c09107cec8
Author: Noah <[email protected]>
Date:   Wed Sep 14 11:08:50 2022 +0200

    Improve event type item description visibility (#4404)

    * Make event type description more visible

    * Delete unneeded import

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 2f9905e548
Author: Hariom Balhara <[email protected]>
Date:   Wed Sep 14 14:16:42 2022 +0530

    Fix crash due to some props being undefined (#4427)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit ab4d910564
Author: sean-brydon <[email protected]>
Date:   Wed Sep 14 09:18:40 2022 +0100

    Fix input height 36px (#4425)

    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

commit 34bca4984f
Author: John Afolabi <[email protected]>
Date:   Wed Sep 14 08:27:00 2022 +0100

    fix: Select dropdown styling (#4358)

    * fix: select dropdown styling

    * change check icon

    * Revert select component, update v2 select

    * Updates the background color to match figma design

    Co-authored-by: Peer Richelsen <[email protected]>
    Co-authored-by: Syed Ali Shahbaz <[email protected]>
    Co-authored-by: sean-brydon <[email protected]>

commit 0907d154c7
Author: Jeroen Reumkens <[email protected]>
Date:   Wed Sep 14 09:15:13 2022 +0200

    feat: 4232 - new theme toggle design. (#4371)

    Co-authored-by: Peer Richelsen <[email protected]>
    Co-authored-by: Joe Au-Yeung <[email protected]>

commit 6f807930f6
Author: sean-brydon <[email protected]>
Date:   Tue Sep 13 21:13:24 2022 +0100

    Tidy up settings calendars (#4430)

* Fix types

* Cleanup

Co-authored-by: sean-brydon <[email protected]>
Co-authored-by: Jeroen Reumkens <[email protected]>
Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: John Afolabi <[email protected]>
Co-authored-by: Syed Ali Shahbaz <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Hariom Balhara <[email protected]>
Co-authored-by: Noah <[email protected]>
Co-authored-by: GitStart <[email protected]>
Co-authored-by: gitstart <[email protected]>
Co-authored-by: Nitesh Singh <[email protected]>
Co-authored-by: Thiago Nascimbeni <[email protected]>
Co-authored-by: Grace Nshokano <[email protected]>
Co-authored-by: Matheus Muniz <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: alannnc <[email protected]>
Co-authored-by: Nafees Nazik <[email protected]>
Co-authored-by: Carina Wollendorfer <[email protected]>
Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: Dallen Pyrah <[email protected]>
Co-authored-by: Omar López <[email protected]>
Co-authored-by: gitstart <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
Co-authored-by: Bailey Pumfleet <[email protected]>
2022-09-15 09:47:59 +00:00

103 lines
3.1 KiB
TypeScript

import { useForm, Controller } from "react-hook-form";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
import { Icon } from "@calcom/ui";
import { Button, Avatar } from "@calcom/ui/v2";
import ImageUploader from "@calcom/ui/v2/core/ImageUploader";
import { Form, TextField } from "@calcom/ui/v2/core/form/fields";
const CreateANewTeamForm = (props: { nextStep: () => void; setTeamId: (teamId: number) => void }) => {
const { t } = useLocale();
const utils = trpc.useContext();
const createTeamMutation = trpc.useMutation("viewer.teams.create", {
onSuccess(data) {
utils.invalidateQueries(["viewer.teams.list"]);
props.setTeamId(data.id);
props.nextStep();
},
});
const formMethods = useForm();
return (
<Form
form={formMethods}
handleSubmit={(values) => {
createTeamMutation.mutate({
name: values.name,
slug: values.slug || null,
logo: values.logo || null,
});
}}>
<div className="mb-8">
<Controller
name="name"
control={formMethods.control}
rules={{ required: { value: true, message: t("team_name_required") } }}
render={({ field: { value } }) => (
<TextField
className="mt-2"
name="name"
label={t("team_name")}
value={value}
onChange={(e) => {
formMethods.setValue("name", e?.target.value);
}}
/>
)}
/>
</div>
<div className="mb-8">
<Controller
name="slug"
control={formMethods.control}
render={({ field: { value } }) => (
<TextField
className="mt-2"
name="slug"
label={t("team_url")}
addOnLeading={`${WEBAPP_URL}/`}
value={value}
onChange={(e) => {
formMethods.setValue("slug", e?.target.value);
}}
/>
)}
/>
</div>
<div className="mb-8">
<Controller
control={formMethods.control}
name="avatar"
render={({ field: { value } }) => (
<div className="flex items-center">
<Avatar alt="" imageSrc={value || null} gravatarFallbackMd5="newTeam" size="lg" />
<div className="ml-4">
<ImageUploader
target="avatar"
id="avatar-upload"
buttonMsg={t("update")}
handleAvatarChange={(newAvatar: string) => {
formMethods.setValue("avatar", newAvatar);
}}
imageSrc={value}
/>
</div>
</div>
)}
/>
</div>
<Button type="submit" EndIcon={Icon.FiArrowRight} className="w-full justify-center">
{t("continue")}
</Button>
{createTeamMutation.isError && <p className="mt-4 text-red-700">{createTeamMutation.error.message}</p>}
</Form>
);
};
export default CreateANewTeamForm;