Managed event-types (#6876)

* WIP

* Locked fields manager

* Leftovers

* Bad merge fix

* Type import fix

* Moving away from classes

* Progress refactoring locked logic

* Covering apps, webhooks and workflows

* Supporting webhooks and workflows (TBT)

* Restoring yarn.lock

* Progress

* Refactoring code, adding default values

* Fixing CRUD for children

* Connect app link and case-sensitive lib renaming

* Translation missing

* Locked indicators, empty screens, locations

* Member card and hidden status + missing i18n

* Missing existent children shown

* Showing preview for already created children

* Email notification almost in place

* Making progress over notif email

* Fixing nodemailer by mixed FE/BE mixup

* Delete dialog

* Adding tests

* New test

* Reverting unneeded change

* Removed console.log

* Tweaking email

* Reverting not applicable webhook changes

* Reverting dev email api

* Fixing last changes due to tests

* Changing user-evType relationship

* Availability and slug replacement tweaks

* Fixing event type delete

* Sometimes slug is not there...

* Removing old webhooks references
Changed slug hint

* Fixing types

* Fixing hiding event types actions

* Changing delete dialog text

* Removing unneeded code

* Applying feedback

* Update yarn.lock

* Making sure locked fields values are static

* Applying feedback

* Feedback + relying on children list, not users

* Removing console.log

* PR Feedback

* Telemetry for slug replacement action

* More unit tests

* Relying on schedule and editor tweaks

* Fixing conteiner classname

* PR Feedback

* PR Feedback

* Updating unit tests

* Moving stuff to ee, added feature flag

* type fix

* Including e2e

* Reverting unneeded changes in EmptyScreen

* Fixing some UI issues after merging tokens

* Fixing missing disabled locked fields

* Theme fixes + e2e potential fix

* Fixing e2e

* Fixing login relying on network

* Tweaking e2e

* Removing unneeded code

---------

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: zomars <[email protected]>
This commit is contained in:
authored and GitHub committed 2023-04-12 23:10:23 -03:00
1 parent 7349fb9f6d
commit 5170fc2424
66 files changed
+2798 -655

No files matched your search

@@ -25,6 +25,8 @@ export const AvatarGroup = function AvatarGroup(props: AvatarGroupProps) {
const displayedAvatars = props.items.filter((avatar) => avatar.image).slice(0, truncateAfter);
const numTruncatedAvatars = LENGTH - displayedAvatars.length;
if (!displayedAvatars.length) return <></>;
return (
<ul className={classNames("flex items-center", props.className)}>
{displayedAvatars.map((item, idx) => (
@@ -83,6 +83,7 @@ export function CreateButton(props: CreateBtnProps) {
<Button
variant={props.disableMobileButton ? "button" : "fab"}
StartIcon={Plus}
data-testid="new-event-type-dropdown"
loading={props.isLoading}>
{props.buttonText ? props.buttonText : t("new")}
</Button>
@@ -91,10 +92,11 @@ export function CreateButton(props: CreateBtnProps) {
<DropdownMenuLabel>
<div className="w-48 text-left text-xs">{props.subtitle}</div>
</DropdownMenuLabel>
{props.options.map((option) => (
{props.options.map((option, idx) => (
<DropdownMenuItem key={option.label}>
<DropdownItem
type="button"
data-testid={`option${option.teamId ? "-team" : ""}-${idx}`}
StartIcon={(props) => (
<Avatar
alt={option.label || ""}
+11 -4
View File
@@ -11,6 +11,8 @@ import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
import { HeadingNode, QuoteNode } from "@lexical/rich-text";
import { TableCellNode, TableNode, TableRowNode } from "@lexical/table";
import { classNames } from "@calcom/lib";
import ExampleTheme from "./ExampleTheme";
import AutoLinkPlugin from "./plugins/AutoLinkPlugin";
import ToolbarPlugin from "./plugins/ToolbarPlugin";
@@ -31,6 +33,7 @@ export type TextEditorProps = {
height?: string;
placeholder?: string;
disableLists?: boolean;
editable?: boolean;
};
const editorConfig = {
@@ -55,17 +58,21 @@ const editorConfig = {
};
export const Editor = (props: TextEditorProps) => {
const editable = props.editable ?? true;
return (
<div className="editor">
<LexicalComposer initialConfig={editorConfig}>
<div className="editor-container">
<div className="editor rounded-md">
<LexicalComposer initialConfig={{ ...editorConfig, editable }}>
<div className="editor-container rounded-md p-0">
<ToolbarPlugin
getText={props.getText}
setText={props.setText}
editable={editable}
excludedToolbarItems={props.excludedToolbarItems}
variables={props.variables}
/>
<div className="editor-inner" style={{ height: props.height }}>
<div
className={classNames("editor-inner", !editable && "bg-muted")}
style={{ height: props.height }}>
<RichTextPlugin
contentEditable={<ContentEditable style={{ height: props.height }} className="editor-input" />}
placeholder={<div className="text-muted -mt-11 p-3 text-sm">{props.placeholder || ""}</div>}
@@ -384,6 +384,8 @@ export default function ToolbarPlugin(props: TextEditorProps) {
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
}
}, [editor, isLink]);
if (!props.editable) return <></>;
return (
<div className="toolbar flex" ref={toolbarRef}>
<>
+15 -6
View File
@@ -23,7 +23,7 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
{...props}
ref={ref}
className={classNames(
"hover:border-emphasis border-default bg-default placeholder:text-muted text-emphasis disabled:hover:border-default mb-2 block h-9 rounded-md border py-2 px-3 text-sm focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-neutral-800 focus:ring-offset-1 disabled:cursor-not-allowed",
"hover:border-emphasis border-default bg-default placeholder:text-muted text-emphasis disabled:hover:border-default min-h-9 disabled:bg-subtle mb-2 block rounded-md border py-2 px-3 text-sm focus:border-neutral-300 focus:outline-none focus:ring-2 focus:ring-neutral-800 focus:ring-offset-1 disabled:cursor-not-allowed",
isFullWidth && "w-full",
props.className
)}
@@ -41,6 +41,7 @@ export function InputLeading(props: JSX.IntrinsicElements["div"]) {
type InputFieldProps = {
label?: ReactNode;
LockedIcon?: React.ReactNode;
hint?: ReactNode;
hintErrors?: string[];
addOnLeading?: ReactNode;
@@ -67,16 +68,16 @@ type AddonProps = {
const Addon = ({ isFilled, children, className, error }: AddonProps) => (
<div
className={classNames(
"addon-wrapper border-default h-9 border px-3",
"addon-wrapper border-default min-h-9 border px-3",
isFilled && "bg-subtle",
className
)}>
<div
className={classNames(
"flex h-full flex-col justify-center text-sm",
"min-h-9 flex flex-col justify-center text-sm",
error ? "text-error" : "text-default"
)}>
<span className="whitespace-nowrap py-2.5">{children}</span>
<span className="flex whitespace-nowrap">{children}</span>
</div>
</div>
);
@@ -90,6 +91,8 @@ export const InputField = forwardRef<HTMLInputElement, InputFieldProps>(function
label = t(name),
labelProps,
labelClassName,
disabled,
LockedIcon,
placeholder = isLocaleReady && i18n.exists(name + "_placeholder") ? t(name + "_placeholder") : "",
className,
addOnLeading,
@@ -120,6 +123,7 @@ export const InputField = forwardRef<HTMLInputElement, InputFieldProps>(function
{...labelProps}
className={classNames(labelClassName, labelSrOnly && "sr-only", props.error && "text-error")}>
{label}
{LockedIcon}
</Skeleton>
)}
{addOnLeading || addOnSuffix ? (
@@ -141,6 +145,7 @@ export const InputField = forwardRef<HTMLInputElement, InputFieldProps>(function
isFullWidth={inputIsFullWidth}
className={classNames(
className,
"disabled:bg-muted disabled:hover:border-subtle disabled:cursor-not-allowed",
addOnLeading && "ltr:rounded-l-none rtl:rounded-r-none",
addOnSuffix && "ltr:rounded-r-none rtl:rounded-l-none",
type === "search" && "pr-8",
@@ -154,7 +159,7 @@ export const InputField = forwardRef<HTMLInputElement, InputFieldProps>(function
},
value: inputValue,
})}
readOnly={readOnly}
disabled={readOnly || disabled}
ref={ref}
/>
{addOnSuffix && (
@@ -182,11 +187,15 @@ export const InputField = forwardRef<HTMLInputElement, InputFieldProps>(function
id={id}
type={type}
placeholder={placeholder}
className={className}
className={classNames(
className,
"disabled:bg-muted disabled:hover:border-subtle disabled:cursor-not-allowed"
)}
{...passThrough}
readOnly={readOnly}
ref={ref}
isFullWidth={inputIsFullWidth}
disabled={readOnly || disabled}
/>
)}
<HintsOrErrors hintErrors={hintErrors} fieldName={name} t={t} />
@@ -59,6 +59,7 @@ export const Select = <
? "p-1"
: "px-3 py-2"
: "py-2 px-3",
props.isDisabled && "bg-gray-100",
props.classNames?.control
),
singleValue: () => classNames("text-emphasis placeholder:text-muted", props.classNames?.singleValue),
@@ -10,6 +10,7 @@ type Props = {
description?: string;
checked: boolean;
disabled?: boolean;
LockedIcon?: React.ReactNode;
onCheckedChange?: (checked: boolean) => void;
"data-testid"?: string;
tooltip?: string;
@@ -19,6 +20,7 @@ function SettingsToggle({
checked,
onCheckedChange,
description,
LockedIcon,
title,
children,
disabled,
@@ -42,7 +44,10 @@ function SettingsToggle({
/>
<div>
<Label className="text-emphasis text-sm font-semibold leading-none">{title}</Label>
<Label className="text-emphasis text-sm font-semibold leading-none">
{title}
{LockedIcon}
</Label>
{description && <p className="text-default -mt-1.5 text-sm leading-normal">{description}</p>}
</div>
</div>
@@ -17,6 +17,7 @@ const Switch = (
props: React.ComponentProps<typeof PrimitiveSwitch.Root> & {
label?: string;
fitToHeight?: boolean;
disabled?: boolean;
tooltip?: string;
classNames?: {
container?: string;