feat: cal ai promo design (#23651)
Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
28 files changed
+884
-214
No files matched your search
@@ -0,0 +1,59 @@
|
||||
"use client";
|
||||
|
||||
import { usePathname } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { localStorage } from "@calcom/lib/webstorage";
|
||||
import { Icon } from "@calcom/ui/components/icon";
|
||||
|
||||
export function CalAiBanner() {
|
||||
const { t } = useLocale();
|
||||
const pathname = usePathname();
|
||||
const [isVisible, setIsVisible] = useState(() => {
|
||||
if (typeof window === "undefined") return true;
|
||||
return !localStorage.getItem("calai-banner-dismissed");
|
||||
});
|
||||
|
||||
const handleDismiss = () => {
|
||||
localStorage.setItem("calai-banner-dismissed", "true");
|
||||
setIsVisible(false);
|
||||
};
|
||||
|
||||
const handleTryNow = () => {
|
||||
window.open("/workflow/new?action=calAi&templateWorkflowId=wf-11", "_blank");
|
||||
};
|
||||
|
||||
if (!isVisible) return null;
|
||||
|
||||
if (!(pathname === "/workflows" || pathname === "/event-types" || pathname === "/bookings/upcoming"))
|
||||
return null;
|
||||
|
||||
return (
|
||||
<div className="bg-launch-dark relative mb-6 w-full overflow-hidden rounded-lg text-white">
|
||||
<button
|
||||
onClick={handleDismiss}
|
||||
className="bg-brand-default absolute right-2 top-2 z-10 rounded-[10px] p-2"
|
||||
aria-label="Close banner">
|
||||
<Icon name="x" className="h-4 w-4 text-white" />
|
||||
</button>
|
||||
|
||||
<div className="flex flex-col md:flex-row">
|
||||
<div className="flex-1 p-6 pr-6 lg:p-8">
|
||||
<h2 className="font-cal font-subtle text-lg">{t("supercharge_your_workflows_with_cal_ai")}</h2>
|
||||
<p className="text-subtle mb-4 text-sm">
|
||||
{t("supercharge_your_workflows_with_cal_ai_description")}
|
||||
</p>
|
||||
|
||||
<button
|
||||
onClick={handleTryNow}
|
||||
className="rounded-[10px] bg-gradient-to-b from-[#6349EA] to-[#875FE0] px-5 py-2 text-sm font-medium text-white hover:from-[#5A42D1] hover:to-[#7B6FD7]">
|
||||
{t("try_now")}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<img src="/cal-ai-banner.svg" alt="Cal.ai Banner" className="mt-auto hidden h-40 md:block" />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import { Button } from "@calcom/ui/components/button";
|
||||
import { ErrorBoundary } from "@calcom/ui/components/errorBoundary";
|
||||
import { SkeletonText } from "@calcom/ui/components/skeleton";
|
||||
|
||||
import { CalAiBanner } from "./CalAiBanner";
|
||||
import { SideBarContainer } from "./SideBar";
|
||||
import { TopNavContainer } from "./TopNav";
|
||||
import { BannerContainer } from "./banners/LayoutBanner";
|
||||
@@ -205,6 +206,7 @@ function MainContainer({
|
||||
{/* show top navigation for md and smaller (tablet and phones) */}
|
||||
{TopNavContainerProp}
|
||||
<div className="max-w-full p-2 sm:py-4 lg:px-6">
|
||||
<CalAiBanner />
|
||||
<ErrorBoundary>
|
||||
{!props.withoutMain ? <ShellMain {...props}>{props.children}</ShellMain> : props.children}
|
||||
</ErrorBoundary>
|
||||
|
||||
@@ -5,6 +5,7 @@ import React, { Fragment, useState, useEffect } from "react";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import useMediaQuery from "@calcom/lib/hooks/useMediaQuery";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
import { Badge } from "@calcom/ui/components/badge";
|
||||
import { Icon } from "@calcom/ui/components/icon";
|
||||
import type { IconName } from "@calcom/ui/components/icon";
|
||||
import { SkeletonText } from "@calcom/ui/components/skeleton";
|
||||
@@ -215,6 +216,11 @@ export const NavigationItem: React.FC<{
|
||||
) : (
|
||||
<SkeletonText className="h-[20px] w-full" />
|
||||
)}
|
||||
{item.name === "workflows" && (
|
||||
<Badge startIcon="sparkles" variant="purple">
|
||||
Cal.ai
|
||||
</Badge>
|
||||
)}
|
||||
</Link>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user