calcom/packages/app-store/wipemycalother/components/wipeMyCalActionButton.tsx
Leo Giovanetti 1a79e0624c
Recurring Events (#2562)
* Init dev

* UI changes for recurring event + prisma

* Revisiting schema + changes WIP

* UI done, BE WIP

* Feature completion

* Unused query param removed

* Invalid comment removed

* Removed unused translation

* Update apps/web/public/static/locales/en/common.json

Thanks!

Co-authored-by: Peer Richelsen <peeroke@gmail.com>

* Success page changes

* More progress

* Email text tweaks + test + seed

* Tweaking emails + Cal Apps support WIP

* No app integration for now
Final email and pages tweaks to avoid recurring info showed

* Missing comment for clarity

* Yet again, comment

* Last minute fix

* Missing tooltip for upcoming bookings

* Fixing seed

* Fixing import

* Increasing timeout for e2e

* Fixing any

* Apply suggestions from code review

Co-authored-by: Omar López <zomars@me.com>

* Update apps/web/pages/d/[link]/book.tsx

Co-authored-by: Omar López <zomars@me.com>

* Code improvements

* More code improvements

* Reverting back number input arrows

* Update BookingPage.tsx

* Update BookingPage.tsx

* Adds fallback for sendOrganizerPaymentRefundFailedEmail

* Type overkill

* Type fixes

* Type fixes

* Nitpicks

* Update success.tsx

* Update success.tsx

* Update success.tsx

* Fixing types

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Omar López <zomars@me.com>
2022-05-05 18:16:25 -03:00

39 lines
1.2 KiB
TypeScript

import { useState } from "react";
import Button from "@calcom/ui/Button";
import { ConfirmDialog } from "./confirmDialog";
interface IWipeMyCalActionButtonProps {
trpc: any;
bookingsEmpty: boolean;
bookingStatus: "upcoming" | "recurring" | "past" | "cancelled";
}
const WipeMyCalActionButton = (props: IWipeMyCalActionButtonProps) => {
const { trpc, bookingsEmpty, bookingStatus } = props;
const [openDialog, setOpenDialog] = useState(false);
const { isSuccess, isLoading, data } = trpc.useQuery(["viewer.integrations"]);
if (bookingStatus !== "upcoming" || bookingsEmpty) {
return <></>;
}
const wipeMyCalCredentials: { credentialIds: number[] } = data?.other?.items.find(
(item: { type: string }) => item.type === "wipemycal_other"
);
const [credentialId] = wipeMyCalCredentials?.credentialIds || [false];
return (
<div>
{data && isSuccess && !isLoading && credentialId && (
<>
<ConfirmDialog trpc={trpc} isOpenDialog={openDialog} setIsOpenDialog={setOpenDialog} />
<Button onClick={() => setOpenDialog(true)}>Wipe Today</Button>
</>
)}
</div>
);
};
export { WipeMyCalActionButton };