feat: org team app install (#15704)
* feat: remove dropdown from app-store and redirect to new-app-install-flow * removed extra code * fix: account select loading issue * removed getPaymentCredential (unused) * fix: only redirect after the app has been added to all the event-types * remove overflowIndicatorStyles * refactor getUserAdminTeams * send teamId instead of id * seperate locations component * for conferencing apps skip select account page * refactor InstallAppButtonChild * installing conferencing apps shows locations dropdown in configure step * send location data to the handler * send location data to the handler * add the newly installed to the locations dropdown (prefillLocation) * fix: type errors * fix: handle es-lint errors * fix: app is added again on submit * only add app if not already added * fix: type erros * filter out managed events for now * fix: show installed count badge * remove 2 toast message * feat: added tests for conferencing apps * fix: loading indicator * Update apps/web/pages/apps/installation/[[...step]].tsx Co-authored-by: Joe Au-Yeung <[email protected]> * Update apps/web/pages/apps/installation/[[...step]].tsx Co-authored-by: Joe Au-Yeung <[email protected]> * move `getUserAdminTeams` to `UserRepository` * fix: zoom and jelly not redirecting to the new app install flow * fix: typo * add `installableOnTeams` prop * split `configureStepCard` into smaller components * fix: step count * fix: show loading indicator until the new page is loaded * fix: organizer_default_conferencing_app not visible in a team * Introduce QueryClient to app card tests * fix: typo * add installableOnTeams prop * fix: tests * seated events shouldn't have multiple locations #15174 * fix: o365 callback * fix: office365_video not redirecting to event-types step * Revert "fix: o365 callback" This reverts commit bba841035ea34f8c31201b64c77221b8d8c3e626. * add TEAM_SELECT_STEP * add apps to orgs and their sub-teams initial commit * undo team select step * small ui fix * fix: wrong step numbers * fix: dont allow app installation without cretendialId * fix: don't show acme team as it cannot have any events * refactor useAddAppMutation * removed console.log * added comment * added comment * move locationOptions from getServerSideProps a trpc query * fix: failing tests * Update conferencingApps.e2e.ts * refactor useAddAppMutation * refactor useAddAppMutation 2 * fix: test failing * fix: unit test * Revert "fix: unit test" This reverts commit 6d74032211d094478c6d7cf9aedbce696dfb768d. * fix: failing test * Increase test timeout for conferencing app tests * fix: write separate tests for each conferencing app to prevent hitting 6000 ms timeout * improved tests naming * fix: correct message and translation key #15657 * fix: write separate tests for each analytics app to prevent hitting 6000 ms timeout * fix: analytics apps test * attempt to fix failing tests * fix typo * refactor * update: replace text-gray with text-stuble - works with light mode too * update: use userRepository.getUserAdminTeams * Merge branch 'main' into feat/org-team-app-install-2 * fix: after merge conflict from app router migration * remove consoles --------- Co-authored-by: Omar López <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
16 files changed
+658
-474
No files matched your search
@@ -4,14 +4,27 @@ import React, { useState } from "react";
|
||||
import { classNames } from "@calcom/lib";
|
||||
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { Team, User } from "@calcom/prisma/client";
|
||||
import { Avatar, StepCard } from "@calcom/ui";
|
||||
import type { User } from "@calcom/prisma/client";
|
||||
import { StepCard } from "@calcom/ui";
|
||||
import { Avatar } from "@calcom/ui";
|
||||
|
||||
import type { TTeams } from "~/apps/installation/[[...step]]/step-view";
|
||||
|
||||
export type PersonalAccountProps = Pick<User, "id" | "avatarUrl" | "name"> & { alreadyInstalled: boolean };
|
||||
|
||||
type AccountStepCardProps = {
|
||||
teams?: TTeams;
|
||||
personalAccount: PersonalAccountProps;
|
||||
onSelect: (id?: number) => void;
|
||||
loading: boolean;
|
||||
installableOnTeams: boolean;
|
||||
};
|
||||
|
||||
type AccountSelectorProps = {
|
||||
avatar?: string;
|
||||
name: string;
|
||||
alreadyInstalled: boolean;
|
||||
onClick: () => void;
|
||||
onClick?: () => void;
|
||||
loading: boolean;
|
||||
testId: string;
|
||||
};
|
||||
@@ -29,13 +42,13 @@ const AccountSelector: FC<AccountSelectorProps> = ({
|
||||
return (
|
||||
<div
|
||||
className={classNames(
|
||||
"hover:bg-muted flex cursor-pointer flex-row items-center gap-2 p-1 transition",
|
||||
"hover:bg-muted flex cursor-pointer flex-row items-center gap-2 p-1",
|
||||
(alreadyInstalled || loading) && "cursor-not-allowed",
|
||||
selected && loading && "bg-muted animate-pulse"
|
||||
)}
|
||||
data-testid={testId}
|
||||
onClick={() => {
|
||||
if (!alreadyInstalled && !loading) {
|
||||
if (!alreadyInstalled && !loading && onClick) {
|
||||
setSelected(true);
|
||||
onClick();
|
||||
}
|
||||
@@ -45,28 +58,14 @@ const AccountSelector: FC<AccountSelectorProps> = ({
|
||||
imageSrc={getPlaceholderAvatar(avatar, name)} // if no image, use default avatar
|
||||
size="sm"
|
||||
/>
|
||||
<div className="text-md pt-0.5 font-medium text-gray-500">
|
||||
<div className="text-md text-subtle pt-0.5 font-medium">
|
||||
{name}
|
||||
{alreadyInstalled ? <span className="ml-1 text-sm text-gray-400">{t("already_installed")}</span> : ""}
|
||||
{alreadyInstalled ? <span className="text-subtle ml-2 text-sm">({t("already_installed")})</span> : ""}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export type PersonalAccountProps = Pick<User, "id" | "avatarUrl" | "name"> & { alreadyInstalled: boolean };
|
||||
|
||||
export type TeamsProp = (Pick<Team, "id" | "name" | "logoUrl"> & {
|
||||
alreadyInstalled: boolean;
|
||||
})[];
|
||||
|
||||
type AccountStepCardProps = {
|
||||
teams?: TeamsProp;
|
||||
personalAccount: PersonalAccountProps;
|
||||
onSelect: (id?: number) => void;
|
||||
loading: boolean;
|
||||
installableOnTeams: boolean;
|
||||
};
|
||||
|
||||
export const AccountsStepCard: FC<AccountStepCardProps> = ({
|
||||
teams,
|
||||
personalAccount,
|
||||
@@ -77,7 +76,7 @@ export const AccountsStepCard: FC<AccountStepCardProps> = ({
|
||||
const { t } = useLocale();
|
||||
return (
|
||||
<StepCard>
|
||||
<div className="text-sm font-medium text-gray-400">{t("install_app_on")}</div>
|
||||
<div className="text-subtle text-sm font-medium">{t("install_app_on")}</div>
|
||||
<div className={classNames("mt-2 flex flex-col gap-2 ")}>
|
||||
<AccountSelector
|
||||
testId="install-app-button-personal"
|
||||
|
||||
@@ -12,12 +12,12 @@ import { locationsResolver } from "@calcom/lib/event-types/utils/locationsResolv
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { AppCategories } from "@calcom/prisma/enums";
|
||||
import type { EventTypeMetaDataSchema, eventTypeBookingFields } from "@calcom/prisma/zod-utils";
|
||||
import { Button, Form, Icon } from "@calcom/ui";
|
||||
import { Button, Form, Icon, Avatar } from "@calcom/ui";
|
||||
|
||||
import EventTypeAppSettingsWrapper from "@components/apps/installation/EventTypeAppSettingsWrapper";
|
||||
import EventTypeConferencingAppSettings from "@components/apps/installation/EventTypeConferencingAppSettings";
|
||||
|
||||
import type { TEventType, TEventTypesForm } from "~/apps/installation/[[...step]]/step-view";
|
||||
import type { TEventType, TEventTypesForm, TEventTypeGroup } from "~/apps/installation/[[...step]]/step-view";
|
||||
|
||||
export type TFormType = {
|
||||
id: number;
|
||||
@@ -35,7 +35,7 @@ export type ConfigureStepCardProps = {
|
||||
loading?: boolean;
|
||||
isConferencing: boolean;
|
||||
formPortalRef: React.RefObject<HTMLDivElement>;
|
||||
eventTypes: TEventType[] | undefined;
|
||||
eventTypeGroups: TEventTypeGroup[];
|
||||
setConfigureStep: Dispatch<SetStateAction<boolean>>;
|
||||
handleSetUpLater: () => void;
|
||||
};
|
||||
@@ -56,6 +56,7 @@ type EventTypeAppSettingsFormProps = Pick<
|
||||
locations?: LocationObject[];
|
||||
}) => void;
|
||||
};
|
||||
type TUpdatedEventTypesStatus = { id: number; updated: boolean }[][];
|
||||
|
||||
const EventTypeAppSettingsForm = forwardRef<HTMLButtonElement, EventTypeAppSettingsFormProps>(
|
||||
function EventTypeAppSettingsForm(props, ref) {
|
||||
@@ -116,82 +117,139 @@ const EventTypeAppSettingsForm = forwardRef<HTMLButtonElement, EventTypeAppSetti
|
||||
}
|
||||
);
|
||||
|
||||
export const ConfigureStepCard: FC<ConfigureStepCardProps> = ({
|
||||
loading,
|
||||
formPortalRef,
|
||||
eventTypes,
|
||||
setConfigureStep,
|
||||
handleSetUpLater,
|
||||
const EventTypeGroup = ({
|
||||
groupIndex,
|
||||
eventTypeGroups,
|
||||
setUpdatedEventTypesStatus,
|
||||
submitRefs,
|
||||
...props
|
||||
}: ConfigureStepCardProps & {
|
||||
groupIndex: number;
|
||||
setUpdatedEventTypesStatus: Dispatch<SetStateAction<TUpdatedEventTypesStatus>>;
|
||||
submitRefs: Array<React.RefObject<HTMLButtonElement>>;
|
||||
}) => {
|
||||
const { t } = useLocale();
|
||||
const { control, getValues } = useFormContext<TEventTypesForm>();
|
||||
const { control } = useFormContext<TEventTypesForm>();
|
||||
const { fields, update } = useFieldArray({
|
||||
control,
|
||||
name: "eventTypes",
|
||||
name: `eventTypeGroups.${groupIndex}.eventTypes`,
|
||||
keyName: "fieldId",
|
||||
});
|
||||
return (
|
||||
<div className="ml-2 flex flex-col space-y-6">
|
||||
{fields.map(
|
||||
(field, index) =>
|
||||
field.selected && (
|
||||
<EventTypeAppSettingsForm
|
||||
key={field.fieldId}
|
||||
eventType={field}
|
||||
loading={props.loading}
|
||||
handleDelete={() => {
|
||||
const eventTypeDb = eventTypeGroups[groupIndex].eventTypes?.find(
|
||||
(eventType) => eventType.id == field.id
|
||||
);
|
||||
update(index, {
|
||||
...field,
|
||||
selected: false,
|
||||
metadata: eventTypeDb?.metadata,
|
||||
bookingFields: eventTypeDb?.bookingFields,
|
||||
...(eventTypeDb?.locations && { locations: eventTypeDb.locations }),
|
||||
});
|
||||
|
||||
const submitRefs = useRef<Array<React.RefObject<HTMLButtonElement>>>([]);
|
||||
submitRefs.current = fields.map(
|
||||
(_ref, index) => (submitRefs.current[index] = React.createRef<HTMLButtonElement>())
|
||||
setUpdatedEventTypesStatus((prev) => {
|
||||
const res = [...prev];
|
||||
res[groupIndex] = res[groupIndex].filter((item) => !(item.id === field.id));
|
||||
if (!res.some((item) => item.length > 0)) {
|
||||
props.setConfigureStep(false);
|
||||
}
|
||||
return res;
|
||||
});
|
||||
}}
|
||||
onSubmit={(data) => {
|
||||
update(index, { ...field, ...data });
|
||||
setUpdatedEventTypesStatus((prev) => {
|
||||
const res = [...prev];
|
||||
res[groupIndex] = res[groupIndex].map((item) =>
|
||||
item.id === field.id ? { ...item, updated: true } : item
|
||||
);
|
||||
return res;
|
||||
});
|
||||
}}
|
||||
ref={submitRefs[index]}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const ConfigureStepCard: FC<ConfigureStepCardProps> = (props) => {
|
||||
const { loading, formPortalRef, handleSetUpLater } = props;
|
||||
const { t } = useLocale();
|
||||
const { control, watch } = useFormContext<TEventTypesForm>();
|
||||
const { fields } = useFieldArray({
|
||||
control,
|
||||
name: "eventTypeGroups",
|
||||
keyName: "fieldId",
|
||||
});
|
||||
const eventTypeGroups = watch("eventTypeGroups");
|
||||
const submitRefs = useRef<Array<Array<React.RefObject<HTMLButtonElement>>>>([]);
|
||||
|
||||
submitRefs.current = eventTypeGroups.reduce(
|
||||
(arr: Array<Array<React.RefObject<HTMLButtonElement>>>, field) => {
|
||||
const res = field.eventTypes
|
||||
.filter((eventType) => eventType.selected)
|
||||
.map((_ref) => React.createRef<HTMLButtonElement>());
|
||||
return [...arr, res];
|
||||
},
|
||||
[]
|
||||
);
|
||||
const mainForSubmitRef = useRef<HTMLButtonElement>(null);
|
||||
const [updatedEventTypesStatus, setUpdatedEventTypesStatus] = useState(
|
||||
fields.filter((field) => field.selected).map((field) => ({ id: field.id, updated: false }))
|
||||
);
|
||||
const [submit, setSubmit] = useState(false);
|
||||
const allUpdated = updatedEventTypesStatus.every((item) => item.updated);
|
||||
const [updatedEventTypesStatus, setUpdatedEventTypesStatus] = useState<TUpdatedEventTypesStatus>(
|
||||
eventTypeGroups.reduce((arr: Array<{ id: number; updated: boolean }[]>, field) => {
|
||||
const selectedEventTypes = field.eventTypes
|
||||
.filter((eventType) => eventType.selected)
|
||||
.map((eventType) => ({ id: eventType.id as number, updated: false }));
|
||||
|
||||
useEffect(() => {
|
||||
setUpdatedEventTypesStatus((prev) =>
|
||||
prev.filter((state) => fields.some((field) => field.id === state.id && field.selected))
|
||||
);
|
||||
if (!fields.some((field) => field.selected)) {
|
||||
setConfigureStep(false);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [fields]);
|
||||
return [...arr, selectedEventTypes];
|
||||
}, [])
|
||||
);
|
||||
|
||||
const [submit, setSubmit] = useState(false);
|
||||
const allUpdated = updatedEventTypesStatus.every((item) => item.every((iitem) => iitem.updated));
|
||||
|
||||
useEffect(() => {
|
||||
if (submit && allUpdated && mainForSubmitRef.current) {
|
||||
mainForSubmitRef.current?.click();
|
||||
setSubmit(false);
|
||||
}
|
||||
}, [submit, allUpdated, getValues, mainForSubmitRef]);
|
||||
}, [submit, allUpdated, mainForSubmitRef]);
|
||||
|
||||
return (
|
||||
formPortalRef?.current &&
|
||||
createPortal(
|
||||
<div className="mt-8">
|
||||
<div className="flex flex-col space-y-6">
|
||||
{fields.map((field, index) => {
|
||||
return (
|
||||
field.selected && (
|
||||
<EventTypeAppSettingsForm
|
||||
key={field.fieldId}
|
||||
eventType={field}
|
||||
loading={loading}
|
||||
handleDelete={() => {
|
||||
const eventMetadataDb = eventTypes?.find(
|
||||
(eventType) => eventType.id == field.id
|
||||
)?.metadata;
|
||||
update(index, { ...field, selected: false, metadata: eventMetadataDb });
|
||||
}}
|
||||
onSubmit={(data) => {
|
||||
update(index, { ...field, ...data });
|
||||
setUpdatedEventTypesStatus((prev) =>
|
||||
prev.map((item) => (item.id === field.id ? { ...item, updated: true } : item))
|
||||
);
|
||||
}}
|
||||
ref={submitRefs.current[index]}
|
||||
{...props}
|
||||
{fields.map((group, groupIndex) => (
|
||||
<div key={group.fieldId}>
|
||||
{eventTypeGroups[groupIndex].eventTypes.some((eventType) => eventType.selected === true) && (
|
||||
<div className="mb-2 mt-4 flex items-center">
|
||||
<Avatar
|
||||
alt=""
|
||||
imageSrc={group.image} // if no image, use default avatar
|
||||
size="md"
|
||||
className="inline-flex justify-center"
|
||||
/>
|
||||
)
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<p className="text-subtle block">{group.slug}</p>
|
||||
</div>
|
||||
)}
|
||||
<EventTypeGroup
|
||||
groupIndex={groupIndex}
|
||||
setUpdatedEventTypesStatus={setUpdatedEventTypesStatus}
|
||||
submitRefs={submitRefs.current[groupIndex]}
|
||||
{...props}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
<button form="outer-event-type-form" type="submit" className="hidden" ref={mainForSubmitRef}>
|
||||
Save
|
||||
</button>
|
||||
@@ -200,7 +258,7 @@ export const ConfigureStepCard: FC<ConfigureStepCardProps> = ({
|
||||
type="button"
|
||||
data-testid="configure-step-save"
|
||||
onClick={() => {
|
||||
submitRefs.current.reverse().map((ref) => ref.current?.click());
|
||||
submitRefs.current.map((group) => group?.map((ref) => ref.current?.click()));
|
||||
setSubmit(true);
|
||||
}}
|
||||
loading={loading}>
|
||||
|
||||
@@ -5,9 +5,9 @@ import { useFieldArray, useFormContext } from "react-hook-form";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
|
||||
import { ScrollableArea, Badge, Button } from "@calcom/ui";
|
||||
import { ScrollableArea, Badge, Button, Avatar } from "@calcom/ui";
|
||||
|
||||
import type { TEventType, TEventTypesForm } from "~/apps/installation/[[...step]]/step-view";
|
||||
import type { TEventType, TEventTypesForm, TEventTypeGroup } from "~/apps/installation/[[...step]]/step-view";
|
||||
|
||||
type EventTypesCardProps = {
|
||||
userName: string;
|
||||
@@ -15,61 +15,7 @@ type EventTypesCardProps = {
|
||||
handleSetUpLater: () => void;
|
||||
};
|
||||
|
||||
export const EventTypesStepCard: FC<EventTypesCardProps> = ({
|
||||
setConfigureStep,
|
||||
userName,
|
||||
handleSetUpLater,
|
||||
}) => {
|
||||
const { t } = useLocale();
|
||||
const { control } = useFormContext<TEventTypesForm>();
|
||||
const { fields, update } = useFieldArray({
|
||||
control,
|
||||
name: "eventTypes",
|
||||
keyName: "fieldId",
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="sm:border-subtle bg-default mt-10 border dark:bg-black sm:rounded-md">
|
||||
<ScrollableArea className="rounded-md">
|
||||
<ul className="border-subtle max-h-97 !static w-full divide-y">
|
||||
{fields.map((field, index) => (
|
||||
<EventTypeCard
|
||||
handleSelect={() => update(index, { ...field, selected: !field.selected })}
|
||||
userName={userName}
|
||||
key={field.fieldId}
|
||||
{...field}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
</ScrollableArea>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
className="text-md mt-6 w-full justify-center"
|
||||
data-testid="save-event-types"
|
||||
onClick={() => {
|
||||
setConfigureStep(true);
|
||||
}}
|
||||
disabled={!fields.some((field) => field.selected === true)}>
|
||||
{t("save")}
|
||||
</Button>
|
||||
|
||||
<div className="flex w-full flex-row justify-center">
|
||||
<Button
|
||||
color="minimal"
|
||||
data-testid="set-up-later"
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
handleSetUpLater();
|
||||
}}
|
||||
className="mt-8 cursor-pointer px-4 py-2 font-sans text-sm font-medium">
|
||||
{t("set_up_later")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
type EventTypeGroupProps = { groupIndex: number; userName: string } & TEventTypeGroup;
|
||||
|
||||
type EventTypeCardProps = TEventType & { userName: string; handleSelect: () => void };
|
||||
|
||||
@@ -95,7 +41,7 @@ const EventTypeCard: FC<EventTypeCardProps> = ({
|
||||
return (
|
||||
<div
|
||||
data-testid={`select-event-type-${id}`}
|
||||
className="hover:bg-muted min-h-20 box-border flex w-full cursor-pointer select-none items-center space-x-4 px-4 py-3 transition"
|
||||
className="hover:bg-muted min-h-20 box-border flex w-full cursor-pointer select-none items-center space-x-4 px-4 py-3"
|
||||
onClick={() => handleSelect()}>
|
||||
<input
|
||||
id={`${id}`}
|
||||
@@ -129,3 +75,98 @@ const EventTypeCard: FC<EventTypeCardProps> = ({
|
||||
</div>
|
||||
);
|
||||
};
|
||||
const EventTypeGroup: FC<EventTypeGroupProps> = ({ groupIndex, userName, ...props }) => {
|
||||
const { control } = useFormContext<TEventTypesForm>();
|
||||
const { fields, update } = useFieldArray({
|
||||
control,
|
||||
name: `eventTypeGroups.${groupIndex}.eventTypes`,
|
||||
keyName: "fieldId",
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="mt-10">
|
||||
<div className="mb-2 flex items-center">
|
||||
<Avatar
|
||||
alt=""
|
||||
imageSrc={props.image} // if no image, use default avatar
|
||||
size="md"
|
||||
className="mt-1 inline-flex justify-center"
|
||||
/>
|
||||
<p className="block pl-2 text-sm">{props.slug}</p>
|
||||
</div>
|
||||
|
||||
<div className="sm:border-subtle bg-default border dark:bg-black sm:rounded-md">
|
||||
<ScrollableArea className="rounded-md">
|
||||
<ul className="border-subtle max-h-97 !static w-full divide-y">
|
||||
{fields.length > 0 ? (
|
||||
fields.map((field, index) => (
|
||||
<EventTypeCard
|
||||
key={`${field.fieldId}`}
|
||||
handleSelect={() => {
|
||||
update(index, { ...field, selected: !field.selected });
|
||||
}}
|
||||
userName={userName}
|
||||
{...field}
|
||||
/>
|
||||
))
|
||||
) : (
|
||||
<div className="text-subtle bg-muted w-full p-2 text-center text-sm">Team has no Events</div>
|
||||
)}
|
||||
</ul>
|
||||
</ScrollableArea>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export const EventTypesStepCard: FC<EventTypesCardProps> = ({
|
||||
setConfigureStep,
|
||||
userName,
|
||||
handleSetUpLater,
|
||||
}) => {
|
||||
const { t } = useLocale();
|
||||
const { control, watch } = useFormContext<TEventTypesForm>();
|
||||
const { fields } = useFieldArray({
|
||||
control,
|
||||
name: "eventTypeGroups",
|
||||
keyName: "fieldId",
|
||||
});
|
||||
|
||||
const eventTypeGroups = watch("eventTypeGroups") || [];
|
||||
|
||||
return (
|
||||
<div>
|
||||
{fields.map(
|
||||
(field, index) =>
|
||||
!field.isOrganisation && (
|
||||
<EventTypeGroup key={field.fieldId} groupIndex={index} userName={userName} {...field} />
|
||||
)
|
||||
)}
|
||||
|
||||
<Button
|
||||
className="text-md mt-6 w-full justify-center"
|
||||
data-testid="save-event-types"
|
||||
onClick={() => {
|
||||
setConfigureStep(true);
|
||||
}}
|
||||
disabled={
|
||||
!eventTypeGroups.some((field) => field.eventTypes.some((eventType) => eventType.selected === true))
|
||||
}>
|
||||
{t("save")}
|
||||
</Button>
|
||||
|
||||
<div className="flex w-full flex-row justify-center">
|
||||
<Button
|
||||
color="minimal"
|
||||
data-testid="set-up-later"
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
handleSetUpLater();
|
||||
}}
|
||||
className="mt-8 cursor-pointer px-4 py-2 font-sans text-sm font-medium">
|
||||
{t("set_up_later")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user