diff --git a/apps/web/pages/event-types/index.tsx b/apps/web/pages/event-types/index.tsx index b8557c93c8..d32503a14f 100644 --- a/apps/web/pages/event-types/index.tsx +++ b/apps/web/pages/event-types/index.tsx @@ -7,7 +7,6 @@ import React, { Fragment, useEffect, useState } from "react"; import CreateEventTypeButton from "@calcom/features/eventtypes/components/CreateEventTypeButton"; import { APP_NAME, CAL_URL, WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; -import isCalcom from "@calcom/lib/isCalcom"; import { RouterOutputs, trpc, TRPCClientError } from "@calcom/trpc/react"; import { Badge, @@ -29,7 +28,6 @@ import { showToast, Switch, Tooltip, - TipBanner, } from "@calcom/ui"; import { withQuery } from "@lib/QueryCell"; @@ -589,7 +587,6 @@ const EventTypesPage = () => { customLoader={} success={({ data }) => ( <> - {isCalcom && } {data.eventTypeGroups.map((group, index) => ( {/* hide list heading when there is only one (current user) */} @@ -608,6 +605,7 @@ const EventTypesPage = () => { /> ))} + {data.eventTypeGroups.length === 0 && } diff --git a/apps/web/public/team-banner-background-small.jpg b/apps/web/public/team-banner-background-small.jpg deleted file mode 100644 index f9ce29dac0..0000000000 Binary files a/apps/web/public/team-banner-background-small.jpg and /dev/null differ diff --git a/packages/ui/index.tsx b/packages/ui/index.tsx index cbc4a76c69..aec28c6831 100644 --- a/packages/ui/index.tsx +++ b/packages/ui/index.tsx @@ -55,7 +55,6 @@ export { Swatch, Switch, VerticalTabs, - TipBanner, } from "./v2"; export type { AlertProps } from "./v2"; export { Segment, SegmentOption } from "./v2/core"; @@ -120,4 +119,4 @@ export { default as SAMLLogin } from "./v2/modules/auth/SAMLLogin"; export { default as DatePicker } from "./v2/modules/booker/DatePicker"; export { EventTypeDescriptionLazy } from "./v2/modules/event-types"; export { EventTypeDescription } from "./v2/modules/event-types/EventTypeDescription"; -export { default as Tips } from "./v2/core/Tips"; +export { default as Tips } from "./v2/modules/tips/Tips"; diff --git a/packages/ui/v2/core/index.ts b/packages/ui/v2/core/index.ts index 06c1fc4379..4665f51dc5 100644 --- a/packages/ui/v2/core/index.ts +++ b/packages/ui/v2/core/index.ts @@ -46,4 +46,3 @@ export { default as Switch } from "./Switch"; export { default as Tooltip } from "./Tooltip"; export { default as VerticalDivider } from "./VerticalDivider"; export { default as WizardForm } from "./WizardForm"; -export { TipBanner } from "./Tips"; diff --git a/packages/ui/v2/core/Tips.tsx b/packages/ui/v2/modules/tips/Tips.tsx similarity index 54% rename from packages/ui/v2/core/Tips.tsx rename to packages/ui/v2/modules/tips/Tips.tsx index ae51429faf..4a903d4ae6 100644 --- a/packages/ui/v2/core/Tips.tsx +++ b/packages/ui/v2/modules/tips/Tips.tsx @@ -1,12 +1,10 @@ import { useAutoAnimate } from "@formkit/auto-animate/react"; import { useEffect, useState } from "react"; -import { WEBAPP_URL } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { localStorage } from "@calcom/lib/webstorage"; -import { Button, Icon } from "@calcom/ui"; -import Card from "./Card"; +import Card from "../../core/Card"; export const tips = [ { @@ -59,30 +57,20 @@ export const tips = [ }, ]; -function useLocalList(storageKey: string, initialValue: T[]) { - const [list, setList] = useState(initialValue); +export default function Tips() { + const [animationRef] = useAutoAnimate(); - /** - This use effect is used to filter out the items that have been removed from the list - we get this from local storage and then we reverse the list so that the newest items - are at the top. This is done so that the items are displayed in the order they were - added - **/ - useEffect(() => { - const reversedList = initialValue.slice(0).reverse(); - const removedListString = localStorage.getItem(storageKey) || ""; - const removedListIds = removedListString.split(",").map((id) => parseInt(id, 10)); - const filteredList = reversedList.filter((tip) => removedListIds.indexOf(tip.id) === -1); - setList(() => [...filteredList]); - }, [initialValue, storageKey]); + const { t } = useLocale(); + + const [list, setList] = useState([]); const handleRemoveItem = (id: number) => { setList((currentItems) => { - const items = localStorage.getItem(storageKey) || ""; + const items = localStorage.getItem("removedTipsIds") || ""; const itemToRemoveIndex = currentItems.findIndex((item) => item.id === id); localStorage.setItem( - storageKey, + "removedTipsIds", `${currentItems[itemToRemoveIndex].id.toString()}${items.length > 0 ? `,${items.split(",")}` : ""}` ); currentItems.splice(itemToRemoveIndex, 1); @@ -90,20 +78,14 @@ function useLocalList(storageKey: string, initialValue }); }; - return { - list, - handleRemoveItem, - }; -} -export default function Tips() { - //const [animationRef] = useAutoAnimate(); - - const { t } = useLocale(); - - const { list, handleRemoveItem } = useLocalList("removedTipsIds", tips); - + useEffect(() => { + const reversedTips = tips.slice(0).reverse(); + const removedTipsString = localStorage.getItem("removedTipsIds") || ""; + const removedTipsIds = removedTipsString.split(",").map((id) => parseInt(id, 10)); + const filteredTips = reversedTips.filter((tip) => removedTipsIds.indexOf(tip.id) === -1); + setList(() => [...filteredTips]); + }, []); const baseOriginalList = list.slice(0).reverse(); - return (
); } - -export function TipBanner() { - const { t } = useLocale(); - const [animationRef] = useAutoAnimate(); - - const bannerTips = [ - { - id: 1, - img: "/team-banner-background-small.jpg", - title: t("calcom_is_better_with_team"), - subtitle: t("add_your_team_members"), - href: `${WEBAPP_URL}/settings/teams/new`, - learnMoreHref: "https://go.cal.com/teams-video", - }, - ]; - const { list, handleRemoveItem } = useLocalList("removedBannerIds", bannerTips); - - return ( -
- {list.map((tip) => { - return ( -
-
-

{tip.title}

-

{tip.subtitle}

-
- - {tip.learnMoreHref && ( - - )} -
- -
-
- ); - })} -
- ); -} diff --git a/packages/ui/v2/modules/tips/index.ts b/packages/ui/v2/modules/tips/index.ts new file mode 100644 index 0000000000..a9d8373d86 --- /dev/null +++ b/packages/ui/v2/modules/tips/index.ts @@ -0,0 +1 @@ +export { default as Tips } from "./Tips";