* storybook v2 init * Merge config into storybook vite build * Remove path * Storybook config tweaks * Added styles and settings for storybook v2, and started working on button documentation and examples. * Badges + flex wrap on mobile * Breadcrumbs+button+avatar * Checkbox * Input + moving files around * WIP table * WIP table grid * Replaced imports for new components. * Added first steps for varianttable. * Small alignment fix. * Custom Args Table - With scrollbar * Adding table to components that need it + darkmode * Add intro * Fix types * Remove V1 storybook and replace with V2 * Fix badge type error * Fixed storybook dependencies * Added cover image to storybook * Remove vita from ts config, we dont use vite. * Fixed button import. * Explained postcss pseudo plugin. * Fixed badge import. * Add Avatar Stories * ButtonGroup Stories * Fixed imports * Add checkbox stories * Add exports for differnt types of inputs * Fix form and text area input * Fix mass import errors Co-authored-by: Jeroen Reumkens <hello@jeroenreumkens.nl> Co-authored-by: Alex van Andel <me@alexvanandel.com>
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
import { useState } from "react";
|
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { trpc } from "@calcom/trpc/react";
|
|
import { Icon } from "@calcom/ui";
|
|
import { Button, ButtonProps } from "@calcom/ui/components/button";
|
|
import { Dialog, DialogTrigger, DialogContent } from "@calcom/ui/v2/core/Dialog";
|
|
import showToast from "@calcom/ui/v2/core/notifications";
|
|
|
|
export default function DisconnectIntegration({
|
|
credentialId,
|
|
label,
|
|
trashIcon,
|
|
isGlobal,
|
|
onSuccess,
|
|
buttonProps,
|
|
}: {
|
|
credentialId: number;
|
|
label?: string;
|
|
trashIcon?: boolean;
|
|
isGlobal?: boolean;
|
|
onSuccess?: () => void;
|
|
buttonProps?: ButtonProps;
|
|
}) {
|
|
const { t } = useLocale();
|
|
const [modalOpen, setModalOpen] = useState(false);
|
|
|
|
const mutation = trpc.useMutation("viewer.deleteCredential", {
|
|
onSuccess: () => {
|
|
showToast(t("app_removed_successfully"), "success");
|
|
setModalOpen(false);
|
|
onSuccess && onSuccess();
|
|
},
|
|
onError: () => {
|
|
showToast(t("error_removing_app"), "error");
|
|
setModalOpen(false);
|
|
},
|
|
});
|
|
|
|
return (
|
|
<>
|
|
<Dialog open={modalOpen} onOpenChange={setModalOpen}>
|
|
<DialogTrigger asChild>
|
|
<Button
|
|
color={buttonProps?.color || "destructive"}
|
|
StartIcon={trashIcon ? Icon.FiTrash : undefined}
|
|
size={trashIcon && !label ? "icon" : "base"}
|
|
disabled={isGlobal}
|
|
{...buttonProps}>
|
|
{label && label}
|
|
</Button>
|
|
</DialogTrigger>
|
|
<DialogContent
|
|
title={t("remove_app")}
|
|
description={t("are_you_sure_you_want_to_remove_this_app")}
|
|
type="confirmation"
|
|
actionText={t("yes_remove_app")}
|
|
Icon={Icon.FiAlertCircle}
|
|
actionOnClick={() => mutation.mutate({ id: credentialId })}
|
|
/>
|
|
</Dialog>
|
|
</>
|
|
);
|
|
}
|