+4


![kodiakhq[bot]](/avatar/78f03f45def735066748285e1c83c542df49e7b0562b0a8da815d5b24845d135?size=40)





d55ffe8d9d
* First commit * Additional changes to meet designs * Fixing app details disconnect button App Store category filtering fixed * Further changes for the fix * Progress on various fronts * Fixing e2e tests * second try fixing e2e tests * Yet again trying to fix e2e tests * Missing action for non-credential flow * Adding missing Add button * Final tweaks and fixes * Missing button in empty screen * fix border radius * EmptyScreen for calendar * Dynamic installed app return page with highlights + other fixes * Removing unneeded code * App Store V2 Improvements over feat/v2-installed-apps (#4379) * Removing unneeded text * Fixing app details disconnect button and number of apps (#4305) * V2 Settings Shell - Add Teams Section & UI fixes (#4347) * Add teams to sidebar and fix UI * Clean up * V2 Multi-select (Team Select) (#4324) * --init * design improved * further fine tuning * more fixes * removed extra JSX tag * added story * NIT * revert to use of CheckedTeamSelect * Removes comments Co-authored-by: Peer Richelsen <peeroke@gmail.com> * fix: toggle alligment (#4361) * fix: add checked tranform for switch (#4357) * fixed input size on mobile, fixed settings (#4360) * fixing type errors * Mobile fixes * Tests fixes Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: zomars <zomars@me.com> * Feat/team owner booking (#3999) * WIP: testing queries * feat: add badge * fix: get only id * refactor: get bookings query * WIP: display attendees added * fix: add type * Adds skeleton loader to workflows (#4402) * fix event types skeleton loader * fix margin in event types * fix skeleton loader in bookings * add skeleton loader for workflow list * add skeleton loader for editing page * fix border radius of skeleton loader * fix mobile view workflow list * add mobile view for skeleton list * make multi select full with in mobile view * mobile view for edit skeleton loader Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> * V2 settings teams (Profil, Members, Appearance View) (#4350) * add team profile * first version for team members page * finish up design of member list item * fix dialog buttons * add missing seats and upgrading information * add v2 dialog for changing role * finish basic version of member's schedule * remove modalContainer * design fixes team profile page * show only team info to non admins * allow all member to check availabilities * make time available heading sticky * add dropdown for mobile view * create team appearance view * finish appearance page * use settings layout and add danger zone for member * add fallback logo * Add teams to sidebar and fix UI * add team invitations * Clean up * code clean up * add impersontation and disable autofocus on calendar * improve team info * refactor teaminvitelist code and fix leaving a team * add team pages to settings shell * add link to create new team * small fixes * clean up comments * V2 Multi-select (Team Select) (#4324) * --init * design improved * further fine tuning * more fixes * removed extra JSX tag * added story * NIT * revert to use of CheckedTeamSelect * Removes comments Co-authored-by: Peer Richelsen <peeroke@gmail.com> * fix: toggle alligment (#4361) * fix: add checked tranform for switch (#4357) * fixed input size on mobile, fixed settings (#4360) * fix image uploader button in safari * code clean up * fixing type errors * Moved v2 team components to features Adds deprecation notices * Update SettingsLayout.tsx * Migrated to features and build fixes Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com> Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Co-authored-by: zomars <zomars@me.com> * add rainbowkit form to v2 event-types (#4349) Co-authored-by: Omar López <zomars@me.com> * v1.9.5 * Fix/daterangepicker css (#4418) * added styles from external stylesheet * fixed a border color * codacy improvements * more codacy fix * codacy why u be so dumb * dynamic import rainbow (only if installed) (#4409) * Tidyup app cards (#4428) * Moving API to trpc query Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com> Co-authored-by: hexcowboy <accounts@cowboy.dev> Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com> * Abstracting one level the redirectUrl for apps * Moving enum to a better/working place * Another try * Missing code * Correcting categories look in apps page * ui tweaks * Breadcrumb wrong font-weight * Toast is v1 component and copy updated * Fix TS error * Fix TS error * Update AppsLayout.tsx * Update InstalledAppsLayout.tsx * translations and disconnect button with icon * Reverting file * Test e2e fix on app-store * Missing testid in button * Fix to click categories that are visible * Going directly to category page as a patch * Fixing stripe e2e test * Disconnect is now empty with icon * Disabled stripe test for now as the navigation is completely changed Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: Omar López <zomars@me.com> Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com> Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Co-authored-by: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com> Co-authored-by: hexcowboy <accounts@cowboy.dev> Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Co-authored-by: Alex van Andel <me@alexvanandel.com>
177 lines
5.9 KiB
TypeScript
177 lines
5.9 KiB
TypeScript
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
import { useRouter } from "next/router";
|
|
import React, { ReactNode, useState } from "react";
|
|
import { Icon } from "react-feather";
|
|
|
|
import classNames from "@calcom/lib/classNames";
|
|
|
|
import Button from "./Button";
|
|
|
|
export type DialogProps = React.ComponentProps<typeof DialogPrimitive["Root"]> & {
|
|
name?: string;
|
|
clearQueryParamsOnClose?: string[];
|
|
};
|
|
export function Dialog(props: DialogProps) {
|
|
const router = useRouter();
|
|
const { children, name, ...dialogProps } = props;
|
|
// only used if name is set
|
|
const [open, setOpen] = useState(!!dialogProps.open);
|
|
|
|
if (name) {
|
|
const clearQueryParamsOnClose = ["dialog", ...(props.clearQueryParamsOnClose || [])];
|
|
dialogProps.onOpenChange = (open) => {
|
|
if (props.onOpenChange) {
|
|
props.onOpenChange(open);
|
|
}
|
|
// toggles "dialog" query param
|
|
if (open) {
|
|
router.query["dialog"] = name;
|
|
} else {
|
|
clearQueryParamsOnClose.forEach((queryParam) => {
|
|
delete router.query[queryParam];
|
|
});
|
|
}
|
|
router.push(
|
|
{
|
|
pathname: router.pathname,
|
|
query: {
|
|
...router.query,
|
|
},
|
|
},
|
|
undefined,
|
|
{ shallow: true }
|
|
);
|
|
setOpen(open);
|
|
};
|
|
// handles initial state
|
|
if (!open && router.query["dialog"] === name) {
|
|
setOpen(true);
|
|
}
|
|
// allow overriding
|
|
if (!("open" in dialogProps)) {
|
|
dialogProps.open = open;
|
|
}
|
|
}
|
|
|
|
return (
|
|
<DialogPrimitive.Root {...dialogProps}>
|
|
<DialogPrimitive.Overlay className="fadeIn fixed inset-0 z-40 bg-black bg-opacity-50 transition-opacity" />
|
|
{children}
|
|
</DialogPrimitive.Root>
|
|
);
|
|
}
|
|
type DialogContentProps = React.ComponentProps<typeof DialogPrimitive["Content"]> & {
|
|
size?: "xl" | "lg" | "md";
|
|
type: "creation" | "confirmation";
|
|
title?: string;
|
|
description?: string | JSX.Element | undefined;
|
|
closeText?: string;
|
|
actionDisabled?: boolean;
|
|
actionText?: string;
|
|
Icon?: Icon;
|
|
// If this is set it allows you to overide the action buttons. Usefull if you need to use formcontext
|
|
useOwnActionButtons?: boolean;
|
|
actionOnClick?: (e: Event | React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
actionOnClose?: () => void;
|
|
actionProps?: React.ComponentProps<typeof Button>;
|
|
};
|
|
|
|
export const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(
|
|
({ children, Icon, actionProps, ...props }, forwardedRef) => (
|
|
<DialogPrimitive.Portal>
|
|
<DialogPrimitive.Overlay className="fadeIn fixed inset-0 z-40 bg-gray-500 bg-opacity-75 transition-opacity" />
|
|
{/*zIndex one less than Toast */}
|
|
<DialogPrimitive.Content
|
|
{...props}
|
|
className={classNames(
|
|
"fadeIn fixed left-1/2 top-1/2 z-[9998] min-w-[360px] -translate-x-1/2 -translate-y-1/2 rounded bg-white text-left shadow-xl focus-visible:outline-none sm:w-full sm:align-middle",
|
|
props.size == "xl"
|
|
? "p-0.5 sm:max-w-[98vw]"
|
|
: props.size == "lg"
|
|
? "p-8 sm:max-w-[70rem]"
|
|
: props.size == "md"
|
|
? "p-8 sm:max-w-[40rem]"
|
|
: "p-8 sm:max-w-[35rem]",
|
|
"max-h-[560px] overflow-visible overscroll-auto md:h-auto md:max-h-[inherit]",
|
|
`${props.className || ""}`
|
|
)}
|
|
ref={forwardedRef}>
|
|
{props.type === "creation" && (
|
|
<div>
|
|
{props.title && <DialogHeader title={props.title} />}
|
|
{props.description && <p className="pb-5 text-sm text-gray-500">{props.description}</p>}
|
|
<div className="flex flex-col space-y-6">{children}</div>
|
|
</div>
|
|
)}
|
|
{props.type === "confirmation" && (
|
|
<div className="flex">
|
|
{Icon && (
|
|
<div className="mr-4 inline-flex h-10 w-10 items-center justify-center rounded-full bg-gray-300">
|
|
<Icon className="h-4 w-4 text-black" />
|
|
</div>
|
|
)}
|
|
<div>
|
|
{props.title && <DialogHeader title={props.title} />}
|
|
{props.description && <p className="mb-6 text-sm text-gray-500">{props.description}</p>}
|
|
</div>
|
|
</div>
|
|
)}
|
|
{!props.useOwnActionButtons && (
|
|
<DialogFooter>
|
|
<div className="mt-2 flex space-x-2">
|
|
<DialogClose asChild>
|
|
{/* This will require the i18n string passed in */}
|
|
<Button color="minimal" onClick={props.actionOnClose}>
|
|
{props.closeText ?? "Close"}
|
|
</Button>
|
|
</DialogClose>
|
|
{props.actionOnClick ? (
|
|
<Button
|
|
color="primary"
|
|
disabled={props.actionDisabled}
|
|
onClick={props.actionOnClick}
|
|
{...actionProps}>
|
|
{props.actionText}
|
|
</Button>
|
|
) : (
|
|
<Button color="primary" type="submit" disabled={props.actionDisabled} {...actionProps}>
|
|
{props.actionText}
|
|
</Button>
|
|
)}
|
|
</div>
|
|
</DialogFooter>
|
|
)}
|
|
</DialogPrimitive.Content>
|
|
</DialogPrimitive.Portal>
|
|
)
|
|
);
|
|
|
|
type DialogHeaderProps = {
|
|
title: React.ReactNode;
|
|
subtitle?: React.ReactNode;
|
|
};
|
|
|
|
export function DialogHeader(props: DialogHeaderProps) {
|
|
return (
|
|
<>
|
|
<h3 className="leading-20 text-semibold font-cal pb-1 text-xl text-gray-900" id="modal-title">
|
|
{props.title}
|
|
</h3>
|
|
{props.subtitle && <div className="text-sm text-gray-400">{props.subtitle}</div>}
|
|
</>
|
|
);
|
|
}
|
|
|
|
export function DialogFooter(props: { children: ReactNode }) {
|
|
return (
|
|
<div>
|
|
<div className="mt-5 flex justify-end space-x-2 rtl:space-x-reverse">{props.children}</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
DialogContent.displayName = "DialogContent";
|
|
|
|
export const DialogTrigger = DialogPrimitive.Trigger;
|
|
export const DialogClose = DialogPrimitive.Close;
|