From e044f963f8b7a988ca547d3befe3869f655a20b2 Mon Sep 17 00:00:00 2001 From: GitStart <1501599+gitstart@users.noreply.github.com> Date: Fri, 21 Oct 2022 14:24:18 +0530 Subject: [PATCH] [CAL-216] Confirming a booking shows old toast. Also removes old notification component. (#5146) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: gitstart Co-authored-by: MuriloAmarals Co-authored-by: Murilo Amaral <87545137+MuriloAmarals@users.noreply.github.com> Co-authored-by: Rubens Rafael <70234898+RubensRafael@users.noreply.github.com> Co-authored-by: Thiago Nascimbeni Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com> Co-authored-by: gitstart Co-authored-by: Rafael Co-authored-by: Grace Nshokano Co-authored-by: Matheus Muniz Co-authored-by: JĂșlio Piubello da Silva Cabral Co-authored-by: Matheus Muniz <87545749+matheusmuniz03@users.noreply.github.com> Co-authored-by: Matheus Benini Ferreira <88898100+MatheusBeniniF@users.noreply.github.com> Co-authored-by: Nitesh Singh Co-authored-by: C000Ldude Co-authored-by: Klinger Matheus <50892465+KlingerMatheus@users.noreply.github.com> Co-authored-by: Eman --- apps/web/components/App.tsx | 2 +- .../availability/NewScheduleButton.tsx | 2 +- .../components/booking/BookingListItem.tsx | 2 +- .../components/dialog/RescheduleDialog.tsx | 2 +- .../components/eventtype/CreateEventType.tsx | 2 +- .../components/CalendarSwitch.tsx | 2 +- .../integrations/CalendarListContainer.tsx | 2 +- .../integrations/DisconnectIntegration.tsx | 2 +- .../DisconnectStripeIntegration.tsx | 2 +- .../security/ChangePasswordSection.tsx | 2 +- .../security/DisableUserImpersonation.tsx | 2 +- .../team/DisableTeamImpersonation.tsx | 2 +- apps/web/components/team/MemberListItem.tsx | 2 +- apps/web/components/team/TeamSettings.tsx | 2 +- .../team/TeamSettingsRightSidebar.tsx | 2 +- .../team/UpgradeToFlexibleProModal.tsx | 2 +- .../v2/apps/CalendarListContainer.tsx | 2 +- apps/web/pages/auth/verify.tsx | 2 +- apps/web/pages/old-getting-started.tsx | 2 +- .../pages/setup/index.tsx | 2 +- .../pages/routing-link/[...appPages].tsx | 2 +- .../rainbow/components/RainbowKit.tsx | 2 +- .../vital/components/AppConfiguration.tsx | 2 +- .../components/confirmDialog.tsx | 2 +- .../app-store/zapier/pages/setup/index.tsx | 2 +- .../api-keys/components/ApiKeyDialogForm.tsx | 2 +- .../components/v2/ApiKeyDialogForm.tsx | 2 +- .../ee/support/components/HelpMenuItem.tsx | 2 +- .../components/NewWorkflowButton.tsx | 2 +- .../components/WorkflowDetailsPage.tsx | 2 +- .../workflows/components/WorkflowListPage.tsx | 2 +- .../components/WorkflowStepContainer.tsx | 2 +- .../components/v2/WorkflowStepContainer.tsx | 2 +- .../components/WebhookTestDisclosure.tsx | 2 +- packages/lib/notification.ts | 50 ------------------- packages/ui/form/fields.tsx | 2 +- 36 files changed, 35 insertions(+), 85 deletions(-) delete mode 100644 packages/lib/notification.ts diff --git a/apps/web/components/App.tsx b/apps/web/components/App.tsx index 21802c13a9..5908ca8106 100644 --- a/apps/web/components/App.tsx +++ b/apps/web/components/App.tsx @@ -6,13 +6,13 @@ import useAddAppMutation from "@calcom/app-store/_utils/useAddAppMutation"; import { InstallAppButton } from "@calcom/app-store/components"; import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { App as AppType } from "@calcom/types/App"; import { Button, SkeletonButton } from "@calcom/ui"; import { Icon } from "@calcom/ui/Icon"; import Shell from "@calcom/ui/Shell"; import Badge from "@calcom/ui/v2/core/Badge"; +import showToast from "@calcom/ui/v2/core/notifications"; import DisconnectIntegration from "@components/integrations/DisconnectIntegration"; diff --git a/apps/web/components/availability/NewScheduleButton.tsx b/apps/web/components/availability/NewScheduleButton.tsx index baedecdad9..be1dcc967d 100644 --- a/apps/web/components/availability/NewScheduleButton.tsx +++ b/apps/web/components/availability/NewScheduleButton.tsx @@ -2,12 +2,12 @@ import { useRouter } from "next/router"; import { useForm } from "react-hook-form"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui"; import { Dialog, DialogClose, DialogContent, DialogTrigger } from "@calcom/ui/Dialog"; import { Icon } from "@calcom/ui/Icon"; import { Form } from "@calcom/ui/form/fields"; +import showToast from "@calcom/ui/v2/core/notifications"; import { HttpError } from "@lib/core/http/error"; diff --git a/apps/web/components/booking/BookingListItem.tsx b/apps/web/components/booking/BookingListItem.tsx index d4672046dc..7c62698369 100644 --- a/apps/web/components/booking/BookingListItem.tsx +++ b/apps/web/components/booking/BookingListItem.tsx @@ -7,7 +7,6 @@ import dayjs from "@calcom/dayjs"; import classNames from "@calcom/lib/classNames"; import { formatTime } from "@calcom/lib/date-fns"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { getEveryFreqFor } from "@calcom/lib/recurringStrings"; import { inferQueryInput, inferQueryOutput, trpc } from "@calcom/trpc/react"; import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/Dialog"; @@ -17,6 +16,7 @@ import { TextArea } from "@calcom/ui/form/fields"; import Badge from "@calcom/ui/v2/core/Badge"; import Button from "@calcom/ui/v2/core/Button"; import MeetingTimeInTimezones from "@calcom/ui/v2/core/MeetingTimeInTimezones"; +import showToast from "@calcom/ui/v2/core/notifications"; import useMeQuery from "@lib/hooks/useMeQuery"; diff --git a/apps/web/components/dialog/RescheduleDialog.tsx b/apps/web/components/dialog/RescheduleDialog.tsx index 741da6ce62..f5ce72002c 100644 --- a/apps/web/components/dialog/RescheduleDialog.tsx +++ b/apps/web/components/dialog/RescheduleDialog.tsx @@ -1,12 +1,12 @@ import React, { useState, Dispatch, SetStateAction } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Dialog, DialogClose, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/Dialog"; import { Icon } from "@calcom/ui/Icon"; import { TextArea } from "@calcom/ui/form/fields"; import Button from "@calcom/ui/v2/core/Button"; +import showToast from "@calcom/ui/v2/core/notifications"; interface IRescheduleDialog { isOpenDialog: boolean; diff --git a/apps/web/components/eventtype/CreateEventType.tsx b/apps/web/components/eventtype/CreateEventType.tsx index 17fbf45356..62096ffaec 100644 --- a/apps/web/components/eventtype/CreateEventType.tsx +++ b/apps/web/components/eventtype/CreateEventType.tsx @@ -9,7 +9,6 @@ import type { z } from "zod"; import classNames from "@calcom/lib/classNames"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { createEventTypeInput } from "@calcom/prisma/zod/custom/eventtype"; import { trpc } from "@calcom/trpc/react"; import { Alert } from "@calcom/ui/Alert"; @@ -24,6 +23,7 @@ import Dropdown, { } from "@calcom/ui/Dropdown"; import { Icon } from "@calcom/ui/Icon"; import { Form, InputLeading, TextAreaField, TextField } from "@calcom/ui/form/fields"; +import showToast from "@calcom/ui/v2/core/notifications"; import { HttpError } from "@lib/core/http/error"; import { slugify } from "@lib/slugify"; diff --git a/apps/web/components/getting-started/components/CalendarSwitch.tsx b/apps/web/components/getting-started/components/CalendarSwitch.tsx index a2cff0e937..aa2f8154ca 100644 --- a/apps/web/components/getting-started/components/CalendarSwitch.tsx +++ b/apps/web/components/getting-started/components/CalendarSwitch.tsx @@ -1,8 +1,8 @@ import { useMutation } from "@tanstack/react-query"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Switch } from "@calcom/ui/v2"; +import showToast from "@calcom/ui/v2/core/notifications"; import classNames from "@lib/classNames"; diff --git a/apps/web/components/integrations/CalendarListContainer.tsx b/apps/web/components/integrations/CalendarListContainer.tsx index 6eb7c9f935..dd5e25dcab 100644 --- a/apps/web/components/integrations/CalendarListContainer.tsx +++ b/apps/web/components/integrations/CalendarListContainer.tsx @@ -3,7 +3,6 @@ import { Fragment } from "react"; import { InstallAppButton } from "@calcom/app-store/components"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { inferQueryOutput, trpc } from "@calcom/trpc/react"; import { Alert } from "@calcom/ui/Alert"; import Button from "@calcom/ui/Button"; @@ -11,6 +10,7 @@ import { List } from "@calcom/ui/List"; import { ShellSubHeading } from "@calcom/ui/Shell"; import Switch from "@calcom/ui/Switch"; import SkeletonLoader from "@calcom/ui/apps/SkeletonLoader"; +import showToast from "@calcom/ui/v2/core/notifications"; import { QueryCell } from "@lib/QueryCell"; diff --git a/apps/web/components/integrations/DisconnectIntegration.tsx b/apps/web/components/integrations/DisconnectIntegration.tsx index 316e932548..5ad1730ab8 100644 --- a/apps/web/components/integrations/DisconnectIntegration.tsx +++ b/apps/web/components/integrations/DisconnectIntegration.tsx @@ -1,11 +1,11 @@ import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { ButtonBaseProps } from "@calcom/ui/Button"; import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent"; import { Dialog } from "@calcom/ui/Dialog"; +import showToast from "@calcom/ui/v2/core/notifications"; export default function DisconnectIntegration(props: { /** Integration credential id */ diff --git a/apps/web/components/integrations/DisconnectStripeIntegration.tsx b/apps/web/components/integrations/DisconnectStripeIntegration.tsx index bf0c3e338a..734229bd2c 100644 --- a/apps/web/components/integrations/DisconnectStripeIntegration.tsx +++ b/apps/web/components/integrations/DisconnectStripeIntegration.tsx @@ -1,9 +1,9 @@ import { useMutation } from "@tanstack/react-query"; import { useState } from "react"; -import showToast from "@calcom/lib/notification"; import { ButtonBaseProps } from "@calcom/ui/Button"; import { Dialog } from "@calcom/ui/Dialog"; +import showToast from "@calcom/ui/v2/core/notifications"; import DeleteStripeDialogContent from "@components/dialog/DeleteStripeDialogContent"; diff --git a/apps/web/components/security/ChangePasswordSection.tsx b/apps/web/components/security/ChangePasswordSection.tsx index e0cc2f2100..1e01411cea 100644 --- a/apps/web/components/security/ChangePasswordSection.tsx +++ b/apps/web/components/security/ChangePasswordSection.tsx @@ -2,8 +2,8 @@ import React, { SyntheticEvent, useState } from "react"; import { ErrorCode } from "@calcom/lib/auth"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import Button from "@calcom/ui/Button"; +import showToast from "@calcom/ui/v2/core/notifications"; const ChangePasswordSection = () => { const [oldPassword, setOldPassword] = useState(""); diff --git a/apps/web/components/security/DisableUserImpersonation.tsx b/apps/web/components/security/DisableUserImpersonation.tsx index 18269b3b13..b7eb269f3a 100644 --- a/apps/web/components/security/DisableUserImpersonation.tsx +++ b/apps/web/components/security/DisableUserImpersonation.tsx @@ -1,8 +1,8 @@ import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import Badge from "@calcom/ui/Badge"; import Button from "@calcom/ui/Button"; +import showToast from "@calcom/ui/v2/core/notifications"; const DisableUserImpersonation = ({ disableImpersonation }: { disableImpersonation: boolean }) => { const utils = trpc.useContext(); diff --git a/apps/web/components/team/DisableTeamImpersonation.tsx b/apps/web/components/team/DisableTeamImpersonation.tsx index e2569d7cb6..95c9b0aa19 100644 --- a/apps/web/components/team/DisableTeamImpersonation.tsx +++ b/apps/web/components/team/DisableTeamImpersonation.tsx @@ -1,8 +1,8 @@ import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import Badge from "@calcom/ui/Badge"; import Button from "@calcom/ui/Button"; +import showToast from "@calcom/ui/v2/core/notifications"; /** @deprecated Use `packages/features/ee/teams/components/DisableTeamImpersonation.tsx` */ const DisableTeamImpersonation = ({ teamId, memberId }: { teamId: number; memberId: number }) => { diff --git a/apps/web/components/team/MemberListItem.tsx b/apps/web/components/team/MemberListItem.tsx index b5e38cdeaa..c729803637 100644 --- a/apps/web/components/team/MemberListItem.tsx +++ b/apps/web/components/team/MemberListItem.tsx @@ -6,7 +6,6 @@ import { useState } from "react"; import TeamAvailabilityModal from "@calcom/features/ee/teams/components/TeamAvailabilityModal"; import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { inferQueryOutput, trpc } from "@calcom/trpc/react"; import Button from "@calcom/ui/Button"; import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent"; @@ -19,6 +18,7 @@ import Dropdown, { } from "@calcom/ui/Dropdown"; import { Icon } from "@calcom/ui/Icon"; import { Tooltip } from "@calcom/ui/Tooltip"; +import showToast from "@calcom/ui/v2/core/notifications"; import useCurrentUserId from "@lib/hooks/useCurrentUserId"; diff --git a/apps/web/components/team/TeamSettings.tsx b/apps/web/components/team/TeamSettings.tsx index ffb7886d3f..c659c9dc20 100644 --- a/apps/web/components/team/TeamSettings.tsx +++ b/apps/web/components/team/TeamSettings.tsx @@ -1,7 +1,6 @@ import React, { useRef, useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { objectKeys } from "@calcom/lib/objectKeys"; import { TeamWithMembers } from "@calcom/lib/server/queries/teams"; import { trpc } from "@calcom/trpc/react"; @@ -9,6 +8,7 @@ import { Alert } from "@calcom/ui/Alert"; import Button from "@calcom/ui/Button"; import { Icon } from "@calcom/ui/Icon"; import { TextField } from "@calcom/ui/form/fields"; +import showToast from "@calcom/ui/v2/core/notifications"; import ImageUploader from "@components/ImageUploader"; import SettingInputContainer from "@components/ui/SettingInputContainer"; diff --git a/apps/web/components/team/TeamSettingsRightSidebar.tsx b/apps/web/components/team/TeamSettingsRightSidebar.tsx index ac4fb2c00c..f1d3289179 100644 --- a/apps/web/components/team/TeamSettingsRightSidebar.tsx +++ b/apps/web/components/team/TeamSettingsRightSidebar.tsx @@ -3,12 +3,12 @@ import Link from "next/link"; import { useRouter } from "next/router"; import React from "react"; -import showToast from "@calcom/lib/notification"; import { TeamWithMembers } from "@calcom/lib/server/queries/teams"; import { trpc } from "@calcom/trpc/react"; import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent"; import { Dialog, DialogTrigger } from "@calcom/ui/Dialog"; import { Icon } from "@calcom/ui/Icon"; +import showToast from "@calcom/ui/v2/core/notifications"; import { useLocale } from "@lib/hooks/useLocale"; diff --git a/apps/web/components/team/UpgradeToFlexibleProModal.tsx b/apps/web/components/team/UpgradeToFlexibleProModal.tsx index 502ca94b51..10450f7c1c 100644 --- a/apps/web/components/team/UpgradeToFlexibleProModal.tsx +++ b/apps/web/components/team/UpgradeToFlexibleProModal.tsx @@ -1,6 +1,5 @@ import { useState } from "react"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Alert } from "@calcom/ui/Alert"; import Button from "@calcom/ui/Button"; @@ -12,6 +11,7 @@ import { DialogFooter, DialogHeader, } from "@calcom/ui/Dialog"; +import showToast from "@calcom/ui/v2/core/notifications"; import { useLocale } from "@lib/hooks/useLocale"; diff --git a/apps/web/components/v2/apps/CalendarListContainer.tsx b/apps/web/components/v2/apps/CalendarListContainer.tsx index 240b7c8cff..165b5ce54a 100644 --- a/apps/web/components/v2/apps/CalendarListContainer.tsx +++ b/apps/web/components/v2/apps/CalendarListContainer.tsx @@ -5,7 +5,6 @@ import { Fragment } from "react"; import { InstallAppButton } from "@calcom/app-store/components"; import DestinationCalendarSelector from "@calcom/features/calendars/DestinationCalendarSelector"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Icon } from "@calcom/ui/Icon"; import SkeletonLoader from "@calcom/ui/apps/SkeletonLoader"; @@ -13,6 +12,7 @@ import { Alert, Button, EmptyScreen } from "@calcom/ui/v2"; import { List } from "@calcom/ui/v2/core/List"; import { ShellSubHeading } from "@calcom/ui/v2/core/Shell"; import Switch from "@calcom/ui/v2/core/Switch"; +import showToast from "@calcom/ui/v2/core/notifications"; import DisconnectIntegration from "@calcom/ui/v2/modules/integrations/DisconnectIntegration"; import { QueryCell } from "@lib/QueryCell"; diff --git a/apps/web/pages/auth/verify.tsx b/apps/web/pages/auth/verify.tsx index 586fb5f731..39fb5a2e10 100644 --- a/apps/web/pages/auth/verify.tsx +++ b/apps/web/pages/auth/verify.tsx @@ -7,9 +7,9 @@ import { useEffect, useState, useRef } from "react"; import z from "zod"; import { WEBAPP_URL } from "@calcom/lib/constants"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/v2/"; +import showToast from "@calcom/ui/v2/core/notifications"; import Loader from "@components/Loader"; diff --git a/apps/web/pages/old-getting-started.tsx b/apps/web/pages/old-getting-started.tsx index 47a37a6c58..c78eb8ba13 100644 --- a/apps/web/pages/old-getting-started.tsx +++ b/apps/web/pages/old-getting-started.tsx @@ -18,7 +18,6 @@ import { DEFAULT_SCHEDULE } from "@calcom/lib/availability"; import { DOCS_URL } from "@calcom/lib/constants"; import { fetchUsername } from "@calcom/lib/fetchUsername"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@calcom/lib/telemetry"; import prisma from "@calcom/prisma"; import { TRPCClientErrorLike } from "@calcom/trpc/client"; @@ -29,6 +28,7 @@ import Button from "@calcom/ui/Button"; import { Icon } from "@calcom/ui/Icon"; import TimezoneSelect from "@calcom/ui/form/TimezoneSelect"; import { Form } from "@calcom/ui/form/fields"; +import showToast from "@calcom/ui/v2/core/notifications"; import { getSession } from "@lib/auth"; import { inferSSRProps } from "@lib/types/inferSSRProps"; diff --git a/packages/app-store/closecomothercalendar/pages/setup/index.tsx b/packages/app-store/closecomothercalendar/pages/setup/index.tsx index 17802a6ae7..5689eaacd5 100644 --- a/packages/app-store/closecomothercalendar/pages/setup/index.tsx +++ b/packages/app-store/closecomothercalendar/pages/setup/index.tsx @@ -7,9 +7,9 @@ import { Toaster } from "react-hot-toast"; import z from "zod"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import Button from "@calcom/ui/v2/core/Button"; import { Form, TextField } from "@calcom/ui/v2/core/form/fields"; +import showToast from "@calcom/ui/v2/core/notifications"; const formSchema = z.object({ api_key: z.string(), diff --git a/packages/app-store/ee/routing-forms/pages/routing-link/[...appPages].tsx b/packages/app-store/ee/routing-forms/pages/routing-link/[...appPages].tsx index 3f8f5a94d3..6a9d9a9cdf 100644 --- a/packages/app-store/ee/routing-forms/pages/routing-link/[...appPages].tsx +++ b/packages/app-store/ee/routing-forms/pages/routing-link/[...appPages].tsx @@ -10,11 +10,11 @@ import CustomBranding from "@calcom/lib/CustomBranding"; import classNames from "@calcom/lib/classNames"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import useTheme from "@calcom/lib/hooks/useTheme"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { AppGetServerSidePropsContext, AppPrisma } from "@calcom/types/AppGetServerSideProps"; import { inferSSRProps } from "@calcom/types/inferSSRProps"; import { Button } from "@calcom/ui/v2/"; +import showToast from "@calcom/ui/v2/core/notifications"; import { useExposePlanGlobally } from "@lib/hooks/useExposePlanGlobally"; diff --git a/packages/app-store/rainbow/components/RainbowKit.tsx b/packages/app-store/rainbow/components/RainbowKit.tsx index 3ee15efa08..20a3866888 100644 --- a/packages/app-store/rainbow/components/RainbowKit.tsx +++ b/packages/app-store/rainbow/components/RainbowKit.tsx @@ -14,10 +14,10 @@ import { configureChains, createClient, WagmiConfig } from "wagmi"; import { useAccount, useSignMessage } from "wagmi"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { SkeletonText } from "@calcom/ui"; import { Icon } from "@calcom/ui/Icon"; +import showToast from "@calcom/ui/v2/core/notifications"; import { getProviders, ETH_MESSAGE, SUPPORTED_CHAINS } from "../utils/ethereum"; diff --git a/packages/app-store/vital/components/AppConfiguration.tsx b/packages/app-store/vital/components/AppConfiguration.tsx index 4b89bc8ed9..ae74613dd7 100644 --- a/packages/app-store/vital/components/AppConfiguration.tsx +++ b/packages/app-store/vital/components/AppConfiguration.tsx @@ -2,8 +2,8 @@ import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import classNames from "@calcom/lib/classNames"; -import showToast from "@calcom/lib/notification"; import { Button, Select } from "@calcom/ui"; +import showToast from "@calcom/ui/v2/core/notifications"; export interface IAppConfigurationProps { credentialIds: number[]; diff --git a/packages/app-store/wipemycalother/components/confirmDialog.tsx b/packages/app-store/wipemycalother/components/confirmDialog.tsx index 74b0302dc3..9a0e7a27cc 100644 --- a/packages/app-store/wipemycalother/components/confirmDialog.tsx +++ b/packages/app-store/wipemycalother/components/confirmDialog.tsx @@ -5,10 +5,10 @@ import { Dispatch, SetStateAction, useState } from "react"; import dayjs from "@calcom/dayjs"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import logger from "@calcom/lib/logger"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/Dialog"; import Button from "@calcom/ui/v2/core/Button"; +import showToast from "@calcom/ui/v2/core/notifications"; interface IConfirmDialogWipe { isOpenDialog: boolean; diff --git a/packages/app-store/zapier/pages/setup/index.tsx b/packages/app-store/zapier/pages/setup/index.tsx index f1f7ac3b94..1dbe7a2163 100644 --- a/packages/app-store/zapier/pages/setup/index.tsx +++ b/packages/app-store/zapier/pages/setup/index.tsx @@ -5,9 +5,9 @@ import { useState } from "react"; import { Toaster } from "react-hot-toast"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Button, Loader, Tooltip } from "@calcom/ui"; +import showToast from "@calcom/ui/v2/core/notifications"; export interface IZapierSetupProps { inviteLink: string; diff --git a/packages/features/ee/api-keys/components/ApiKeyDialogForm.tsx b/packages/features/ee/api-keys/components/ApiKeyDialogForm.tsx index e1ddc47168..2114264313 100644 --- a/packages/features/ee/api-keys/components/ApiKeyDialogForm.tsx +++ b/packages/features/ee/api-keys/components/ApiKeyDialogForm.tsx @@ -3,7 +3,6 @@ import { Controller, useForm } from "react-hook-form"; import dayjs from "@calcom/dayjs"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import Button from "@calcom/ui/Button"; import { DialogFooter } from "@calcom/ui/Dialog"; @@ -12,6 +11,7 @@ import Switch from "@calcom/ui/Switch"; import { Tooltip } from "@calcom/ui/Tooltip"; import { Form, TextField } from "@calcom/ui/form/fields"; import { DatePicker } from "@calcom/ui/v2"; +import showToast from "@calcom/ui/v2/core/notifications"; import LicenseRequired from "../../common/components/LicenseRequired"; import type { TApiKeys } from "./ApiKeyListItem"; diff --git a/packages/features/ee/api-keys/components/v2/ApiKeyDialogForm.tsx b/packages/features/ee/api-keys/components/v2/ApiKeyDialogForm.tsx index 0217d72cd7..ff571254cc 100644 --- a/packages/features/ee/api-keys/components/v2/ApiKeyDialogForm.tsx +++ b/packages/features/ee/api-keys/components/v2/ApiKeyDialogForm.tsx @@ -5,7 +5,6 @@ import dayjs from "@calcom/dayjs"; import { TApiKeys } from "@calcom/ee/api-keys/components/ApiKeyListItem"; import LicenseRequired from "@calcom/ee/common/components/v2/LicenseRequired"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { DialogFooter } from "@calcom/ui/Dialog"; import { ClipboardCopyIcon } from "@calcom/ui/Icon"; @@ -14,6 +13,7 @@ import { DatePicker } from "@calcom/ui/v2"; import Button from "@calcom/ui/v2/core/Button"; import Switch from "@calcom/ui/v2/core/Switch"; import { Form, TextField } from "@calcom/ui/v2/core/form/fields"; +import showToast from "@calcom/ui/v2/core/notifications"; export default function ApiKeyDialogForm({ defaultValues, diff --git a/packages/features/ee/support/components/HelpMenuItem.tsx b/packages/features/ee/support/components/HelpMenuItem.tsx index 96c4ba384b..7bb422013c 100644 --- a/packages/features/ee/support/components/HelpMenuItem.tsx +++ b/packages/features/ee/support/components/HelpMenuItem.tsx @@ -3,10 +3,10 @@ import { useChat } from "react-live-chat-loader"; import classNames from "@calcom/lib/classNames"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Icon } from "@calcom/ui/Icon"; import Button from "@calcom/ui/v2/core/Button"; +import showToast from "@calcom/ui/v2/core/notifications"; import ContactMenuItem from "./ContactMenuItem"; diff --git a/packages/features/ee/workflows/components/NewWorkflowButton.tsx b/packages/features/ee/workflows/components/NewWorkflowButton.tsx index 8f12ded583..5ad5072485 100644 --- a/packages/features/ee/workflows/components/NewWorkflowButton.tsx +++ b/packages/features/ee/workflows/components/NewWorkflowButton.tsx @@ -8,7 +8,6 @@ import { z } from "zod"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { HttpError } from "@calcom/lib/http-error"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui"; import { Dialog, DialogClose, DialogContent, DialogTrigger } from "@calcom/ui/Dialog"; @@ -16,6 +15,7 @@ import { Icon } from "@calcom/ui/Icon"; import PhoneInput from "@calcom/ui/form/PhoneInputLazy"; import Select from "@calcom/ui/form/Select"; import { Form, TextField } from "@calcom/ui/form/fields"; +import showToast from "@calcom/ui/v2/core/notifications"; import { TIME_UNIT, WORKFLOW_ACTIONS, WORKFLOW_TRIGGER_EVENTS } from "../lib/constants"; import { diff --git a/packages/features/ee/workflows/components/WorkflowDetailsPage.tsx b/packages/features/ee/workflows/components/WorkflowDetailsPage.tsx index 182d9e97b1..ed6e397b03 100644 --- a/packages/features/ee/workflows/components/WorkflowDetailsPage.tsx +++ b/packages/features/ee/workflows/components/WorkflowDetailsPage.tsx @@ -6,11 +6,11 @@ import { Controller, UseFormReturn } from "react-hook-form"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { HttpError } from "@calcom/lib/http-error"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui"; import MultiSelectCheckboxes, { Option } from "@calcom/ui/form/MultiSelectCheckboxes"; import { Form } from "@calcom/ui/form/fields"; +import showToast from "@calcom/ui/v2/core/notifications"; import type { FormValues } from "../pages/workflow"; import { AddActionDialog } from "./AddActionDialog"; diff --git a/packages/features/ee/workflows/components/WorkflowListPage.tsx b/packages/features/ee/workflows/components/WorkflowListPage.tsx index 8b9d791da3..e3e5f018e9 100644 --- a/packages/features/ee/workflows/components/WorkflowListPage.tsx +++ b/packages/features/ee/workflows/components/WorkflowListPage.tsx @@ -3,7 +3,6 @@ import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { HttpError } from "@calcom/lib/http-error"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Button, Tooltip } from "@calcom/ui"; import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent"; @@ -11,6 +10,7 @@ import { Dialog } from "@calcom/ui/Dialog"; import Dropdown, { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@calcom/ui/Dropdown"; import EmptyScreen from "@calcom/ui/EmptyScreen"; import { Icon } from "@calcom/ui/Icon"; +import showToast from "@calcom/ui/v2/core/notifications"; import { WorkflowType } from "./v2/WorkflowListPage"; diff --git a/packages/features/ee/workflows/components/WorkflowStepContainer.tsx b/packages/features/ee/workflows/components/WorkflowStepContainer.tsx index 4670592e84..20570c1f04 100644 --- a/packages/features/ee/workflows/components/WorkflowStepContainer.tsx +++ b/packages/features/ee/workflows/components/WorkflowStepContainer.tsx @@ -15,7 +15,6 @@ import "react-phone-number-input/style.css"; import classNames from "@calcom/lib/classNames"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { HttpError } from "@calcom/lib/http-error"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui"; import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent"; @@ -24,6 +23,7 @@ import Dropdown, { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } import { Icon } from "@calcom/ui/Icon"; import Select from "@calcom/ui/form/Select"; import { TextArea } from "@calcom/ui/form/fields"; +import showToast from "@calcom/ui/v2/core/notifications"; import { AddVariablesDropdown } from "../components/AddVariablesDropdown"; import { diff --git a/packages/features/ee/workflows/components/v2/WorkflowStepContainer.tsx b/packages/features/ee/workflows/components/v2/WorkflowStepContainer.tsx index 6bd18dd8b5..59ab67f3d6 100644 --- a/packages/features/ee/workflows/components/v2/WorkflowStepContainer.tsx +++ b/packages/features/ee/workflows/components/v2/WorkflowStepContainer.tsx @@ -11,7 +11,6 @@ import "react-phone-number-input/style.css"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { HttpError } from "@calcom/lib/http-error"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Dialog } from "@calcom/ui/Dialog"; import Dropdown, { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@calcom/ui/Dropdown"; @@ -22,6 +21,7 @@ import ConfirmationDialogContent from "@calcom/ui/v2/core/ConfirmationDialogCont import CheckboxField from "@calcom/ui/v2/core/form/Checkbox"; import { EmailField, Label, TextArea } from "@calcom/ui/v2/core/form/fields"; import Select from "@calcom/ui/v2/core/form/select"; +import showToast from "@calcom/ui/v2/core/notifications"; import { AddVariablesDropdown } from "../../components/v2/AddVariablesDropdown"; import { diff --git a/packages/features/webhooks/components/WebhookTestDisclosure.tsx b/packages/features/webhooks/components/WebhookTestDisclosure.tsx index 3581788bf4..8ef384bb75 100644 --- a/packages/features/webhooks/components/WebhookTestDisclosure.tsx +++ b/packages/features/webhooks/components/WebhookTestDisclosure.tsx @@ -1,11 +1,11 @@ import { useWatch } from "react-hook-form"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { Icon } from "@calcom/ui/Icon"; import Badge from "@calcom/ui/v2/core/Badge"; import Button from "@calcom/ui/v2/core/Button"; +import showToast from "@calcom/ui/v2/core/notifications"; export default function WebhookTestDisclosure() { const subscriberUrl: string = useWatch({ name: "subscriberUrl" }); diff --git a/packages/lib/notification.ts b/packages/lib/notification.ts deleted file mode 100644 index be18315350..0000000000 --- a/packages/lib/notification.ts +++ /dev/null @@ -1,50 +0,0 @@ -import toast from "react-hot-toast"; - -export default function showToast(message: string, variant: "success" | "warning" | "error") { - switch (variant) { - case "success": - toast.success(message, { - duration: 6000, - style: { - borderRadius: "2px", - background: "#333", - color: "#fff", - boxShadow: "none", - }, - className: "data-testid-toast-success", - }); - break; - case "error": - toast.error(message, { - duration: 6000, - style: { - borderRadius: "2px", - background: "#FEE2E2", - color: "#B91C1C", - boxShadow: "none", - }, - }); - break; - case "warning": - toast(message, { - duration: 6000, - style: { - borderRadius: "2px", - background: "#FFEDD5", - color: "#C2410C", - boxShadow: "none", - }, - }); - break; - default: - toast.success(message, { - duration: 6000, - style: { - borderRadius: "2px", - background: "#333", - color: "#fff", - boxShadow: "none", - }, - }); - } -} diff --git a/packages/ui/form/fields.tsx b/packages/ui/form/fields.tsx index af8c3431b0..3d0777361f 100644 --- a/packages/ui/form/fields.tsx +++ b/packages/ui/form/fields.tsx @@ -5,7 +5,7 @@ import { FieldValues, FormProvider, SubmitHandler, useFormContext, UseFormReturn import classNames from "@calcom/lib/classNames"; import { getErrorFromUnknown } from "@calcom/lib/errors"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import showToast from "@calcom/lib/notification"; +import showToast from "@calcom/ui/v2/core/notifications"; import { Alert } from "../Alert";