diff --git a/src/interface/web/app/components/loginPrompt/loginPrompt.tsx b/src/interface/web/app/components/loginPrompt/loginPrompt.tsx index 06ab681c..8e10dc63 100644 --- a/src/interface/web/app/components/loginPrompt/loginPrompt.tsx +++ b/src/interface/web/app/components/loginPrompt/loginPrompt.tsx @@ -4,6 +4,7 @@ import styles from "./loginPrompt.module.css"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; +import Autoplay from "embla-carousel-autoplay"; import { ArrowLeft, ArrowsClockwise, @@ -11,14 +12,20 @@ import { PaperPlaneTilt, PencilSimple, Spinner, - CaretLeft, - CaretRight, } from "@phosphor-icons/react"; import Link from "next/link"; -import { useEffect, useState } from "react"; +import { useEffect, useRef, useState } from "react"; import useSWR from "swr"; import { GoogleSignIn } from "./GoogleSignIn"; import { Drawer, DrawerContent } from "@/components/ui/drawer"; +import { + Carousel, + CarouselContent, + CarouselItem, + CarouselNext, + CarouselPrevious, +} from "@/components/ui/carousel"; +import { Card, CardContent } from "@/components/ui/card"; export interface LoginPromptProps { loginRedirectMessage: string; @@ -46,19 +53,6 @@ export default function LoginPrompt(props: LoginPromptProps) { const [checkEmail, setCheckEmail] = useState(false); const [recheckEmail, setRecheckEmail] = useState(false); - const [currentTip, setCurrentTip] = useState(0); - const [autoRotate, setAutoRotate] = useState(true); - - // Add these handler functions in your component - const nextSlide = () => { - setCurrentTip((prev) => (prev + 1) % tips.length); - setAutoRotate(false); - }; - const prevSlide = () => { - setCurrentTip((prev) => (prev - 1 + tips.length) % tips.length); - setAutoRotate(false); - }; - useEffect(() => { const google = (window as any).google; @@ -121,22 +115,6 @@ export default function LoginPrompt(props: LoginPromptProps) { }); }; - const tips = [ - { src: "/documents_tip.png", alt: "Documents tip" }, - { src: "/personalize_tip.png", alt: "Personalize tip" }, - { src: "/automate_tip.png", alt: "Automate tip" }, - ]; - - useEffect(() => { - if (!autoRotate) return; - - const timer = setInterval(() => { - setCurrentTip((prev) => (prev + 1) % tips.length); - }, 3000); // Rotate every 3 seconds - - return () => clearInterval(timer); - }, [autoRotate]); - function handleMagicLinkSignIn() { fetch("/auth/magic", { method: "POST", @@ -183,10 +161,6 @@ export default function LoginPrompt(props: LoginPromptProps) { )} {!useEmailSignIn && ( void; - prevSlide: () => void; handleGoogleScriptLoad: () => void; handleGoogleSignIn: () => void; isLoading: boolean; @@ -349,37 +311,43 @@ function MainSignInContext({ setUseEmailSignIn: (useEmailSignIn: boolean) => void; isMobileWidth: boolean; }) { + const plugin = useRef(Autoplay({ delay: 2000, stopOnInteraction: true })); + + const tips = [ + { src: "/documents_tip.png", alt: "Documents tip" }, + { src: "/personalize_tip.png", alt: "Personalize tip" }, + { src: "/automate_tip.png", alt: "Automate tip" }, + ]; + return (
{!isMobileWidth && ( -
- {tips.map((tip, index) => ( - {tip.alt} - ))} - - -
+ + + {tips.map((tip, index) => ( + +
+ + + {tip.alt} + + +
+
+ ))} +
+ + +
)}
@@ -436,7 +404,7 @@ function MainSignInContext({ + ); + }, +); +CarouselPrevious.displayName = "CarouselPrevious"; + +const CarouselNext = React.forwardRef>( + ({ className, variant = "outline", size = "icon", ...props }, ref) => { + const { orientation, scrollNext, canScrollNext } = useCarousel(); + + return ( + + ); + }, +); +CarouselNext.displayName = "CarouselNext"; + +export { + type CarouselApi, + Carousel, + CarouselContent, + CarouselItem, + CarouselPrevious, + CarouselNext, +}; diff --git a/src/interface/web/package.json b/src/interface/web/package.json index 10832f71..5183064e 100644 --- a/src/interface/web/package.json +++ b/src/interface/web/package.json @@ -45,6 +45,8 @@ "cmdk": "^1.0.0", "cronstrue": "^2.50.0", "dompurify": "^3.1.6", + "embla-carousel-autoplay": "^8.5.1", + "embla-carousel-react": "^8.5.1", "eslint": "^8", "eslint-config-next": "14.2.3", "input-otp": "^1.2.4", diff --git a/src/interface/web/yarn.lock b/src/interface/web/yarn.lock index a41f9ea6..0a8783f8 100644 --- a/src/interface/web/yarn.lock +++ b/src/interface/web/yarn.lock @@ -1897,6 +1897,29 @@ electron-to-chromium@^1.5.41: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.63.tgz#69444d592fbbe628d129866c2355691ea93eda3e" integrity sha512-ddeXKuY9BHo/mw145axlyWjlJ1UBt4WK3AlvkT7W2AbqfRQoacVoRUCF6wL3uIx/8wT9oLKXzI+rFqHHscByaA== +embla-carousel-autoplay@^8.5.1: + version "8.5.1" + resolved "https://registry.yarnpkg.com/embla-carousel-autoplay/-/embla-carousel-autoplay-8.5.1.tgz#d0213ab6d7beeafcfcb8f7b1fa023a4d3882f0a2" + integrity sha512-FnZklFpePfp8wbj177UwVaGFehgs+ASVcJvYLWTtHuYKURynCc3IdDn2qrn0E5Qpa3g9yeGwCS4p8QkrZmO8xg== + +embla-carousel-react@^8.5.1: + version "8.5.1" + resolved "https://registry.yarnpkg.com/embla-carousel-react/-/embla-carousel-react-8.5.1.tgz#e06ff28cb53698d453ffad89423c23d725e9b010" + integrity sha512-z9Y0K84BJvhChXgqn2CFYbfEi6AwEr+FFVVKm/MqbTQ2zIzO1VQri6w67LcfpVF0AjbhwVMywDZqY4alYkjW5w== + dependencies: + embla-carousel "8.5.1" + embla-carousel-reactive-utils "8.5.1" + +embla-carousel-reactive-utils@8.5.1: + version "8.5.1" + resolved "https://registry.yarnpkg.com/embla-carousel-reactive-utils/-/embla-carousel-reactive-utils-8.5.1.tgz#3059ab2f72f04988a96694f700a772a72bb75ffb" + integrity sha512-n7VSoGIiiDIc4MfXF3ZRTO59KDp820QDuyBDGlt5/65+lumPHxX2JLz0EZ23hZ4eg4vZGUXwMkYv02fw2JVo/A== + +embla-carousel@8.5.1: + version "8.5.1" + resolved "https://registry.yarnpkg.com/embla-carousel/-/embla-carousel-8.5.1.tgz#8d83217e831666f6df573b0d3727ff0ae9208002" + integrity sha512-JUb5+FOHobSiWQ2EJNaueCNT/cQU9L6XWBbWmorWPQT9bkbk+fhsuLr8wWrzXKagO3oWszBO7MSx+GfaRk4E6A== + emoji-regex@^10.3.0: version "10.4.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-10.4.0.tgz#03553afea80b3975749cfcb36f776ca268e413d4"