|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import { |
| 4 | + Activity, |
| 5 | + ArrowRight, |
| 6 | + Bot, |
| 7 | + Boxes, |
| 8 | + Cloud, |
| 9 | + Database, |
| 10 | + Layers, |
| 11 | + LayoutTemplate, |
| 12 | + Rocket, |
| 13 | + Shield, |
| 14 | + Terminal, |
| 15 | + Unlock, |
| 16 | + Users, |
| 17 | +} from "lucide-react"; |
| 18 | +import { useEffect, useRef, useState } from "react"; |
| 19 | +import { cn } from "@/lib/utils"; |
| 20 | + |
| 21 | +interface ShowcaseItem { |
| 22 | + icon: typeof Users; |
| 23 | + title: string; |
| 24 | + description: string; |
| 25 | +} |
| 26 | + |
| 27 | +const SLIDES: ShowcaseItem[][] = [ |
| 28 | + [ |
| 29 | + { |
| 30 | + icon: Users, |
| 31 | + title: "Team access", |
| 32 | + description: |
| 33 | + "Anyone in your team can deploy simply and securely in a safe, governed environment.", |
| 34 | + }, |
| 35 | + { |
| 36 | + icon: Layers, |
| 37 | + title: "Open source", |
| 38 | + description: |
| 39 | + "Deploy for free with the open-source alternative to Netlify, Vercel, and Heroku.", |
| 40 | + }, |
| 41 | + { |
| 42 | + icon: Bot, |
| 43 | + title: "AI sandbox", |
| 44 | + description: |
| 45 | + "Unleash the power of AI and test AI-generated code in a sandbox before deploying to a live URL.", |
| 46 | + }, |
| 47 | + { |
| 48 | + icon: Shield, |
| 49 | + title: "Enterprise ready", |
| 50 | + description: |
| 51 | + "Scale when you're ready with granular RBAC, SSO, audit logs, rollback and multi-tenancy.", |
| 52 | + }, |
| 53 | + ], |
| 54 | + [ |
| 55 | + { |
| 56 | + icon: Rocket, |
| 57 | + title: "Any stack", |
| 58 | + description: |
| 59 | + "Deploy any application using Nixpacks, Heroku Buildpacks, or your own Dockerfile.", |
| 60 | + }, |
| 61 | + { |
| 62 | + icon: Boxes, |
| 63 | + title: "Docker Compose", |
| 64 | + description: |
| 65 | + "Deploy complex applications natively with full Docker Compose integration.", |
| 66 | + }, |
| 67 | + { |
| 68 | + icon: Cloud, |
| 69 | + title: "Multi-server", |
| 70 | + description: |
| 71 | + "Effortlessly deploy your applications on remote servers, with zero configuration hassle.", |
| 72 | + }, |
| 73 | + { |
| 74 | + icon: LayoutTemplate, |
| 75 | + title: "Ready templates", |
| 76 | + description: |
| 77 | + "Get started quickly with pre-configured templates for Supabase, Cal.com, PocketBase, and more.", |
| 78 | + }, |
| 79 | + ], |
| 80 | + [ |
| 81 | + { |
| 82 | + icon: Database, |
| 83 | + title: "Managed databases", |
| 84 | + description: |
| 85 | + "Manage and back up MySQL, PostgreSQL, MongoDB, MariaDB, and Redis directly from Dokploy.", |
| 86 | + }, |
| 87 | + { |
| 88 | + icon: Terminal, |
| 89 | + title: "API & CLI", |
| 90 | + description: "Full API and CLI access to fit any custom workflow.", |
| 91 | + }, |
| 92 | + { |
| 93 | + icon: Activity, |
| 94 | + title: "Live monitoring", |
| 95 | + description: |
| 96 | + "Monitor CPU, memory, and network usage in real time across every deployment.", |
| 97 | + }, |
| 98 | + { |
| 99 | + icon: Unlock, |
| 100 | + title: "No lock-in", |
| 101 | + description: |
| 102 | + "Modify, scale, and customize Dokploy however your project needs.", |
| 103 | + }, |
| 104 | + ], |
| 105 | +]; |
| 106 | + |
| 107 | +const AUTO_ADVANCE_MS = 6000; |
| 108 | + |
| 109 | +export const SignupShowcase = () => { |
| 110 | + const [active, setActive] = useState(0); |
| 111 | + const [paused, setPaused] = useState(false); |
| 112 | + const [reduceMotion, setReduceMotion] = useState(false); |
| 113 | + |
| 114 | + useEffect(() => { |
| 115 | + const query = window.matchMedia("(prefers-reduced-motion: reduce)"); |
| 116 | + setReduceMotion(query.matches); |
| 117 | + const listener = (e: MediaQueryListEvent) => setReduceMotion(e.matches); |
| 118 | + query.addEventListener("change", listener); |
| 119 | + return () => query.removeEventListener("change", listener); |
| 120 | + }, []); |
| 121 | + |
| 122 | + const timerRef = useRef<ReturnType<typeof setInterval> | null>(null); |
| 123 | + |
| 124 | + useEffect(() => { |
| 125 | + if (paused || reduceMotion) { |
| 126 | + return; |
| 127 | + } |
| 128 | + timerRef.current = setInterval(() => { |
| 129 | + setActive((prev) => (prev + 1) % SLIDES.length); |
| 130 | + }, AUTO_ADVANCE_MS); |
| 131 | + return () => { |
| 132 | + if (timerRef.current) { |
| 133 | + clearInterval(timerRef.current); |
| 134 | + } |
| 135 | + }; |
| 136 | + }, [paused, reduceMotion]); |
| 137 | + |
| 138 | + const goTo = (index: number) => { |
| 139 | + setActive(((index % SLIDES.length) + SLIDES.length) % SLIDES.length); |
| 140 | + }; |
| 141 | + |
| 142 | + return ( |
| 143 | + <div |
| 144 | + className="relative" |
| 145 | + onMouseEnter={() => setPaused(true)} |
| 146 | + onMouseLeave={() => setPaused(false)} |
| 147 | + onFocus={() => setPaused(true)} |
| 148 | + onBlur={() => setPaused(false)} |
| 149 | + > |
| 150 | + <div |
| 151 | + key={active} |
| 152 | + className={cn( |
| 153 | + "grid grid-cols-2 gap-4", |
| 154 | + !reduceMotion && |
| 155 | + "animate-in fade-in slide-in-from-bottom-2 duration-500 ease-out", |
| 156 | + )} |
| 157 | + > |
| 158 | + {SLIDES[active]?.map((item) => ( |
| 159 | + <div |
| 160 | + key={item.title} |
| 161 | + className="group flex flex-col gap-3 rounded-lg border border-primary/10 bg-background/40 p-4 transition-all duration-300 hover:-translate-y-0.5 hover:border-primary/25 hover:bg-background/60" |
| 162 | + > |
| 163 | + <div className="flex size-9 items-center justify-center rounded-md bg-primary/10 text-primary transition-colors duration-300 group-hover:bg-primary/15"> |
| 164 | + <item.icon className="size-4.5" strokeWidth={1.75} /> |
| 165 | + </div> |
| 166 | + <div className="space-y-1"> |
| 167 | + <p className="text-sm font-medium text-primary">{item.title}</p> |
| 168 | + <p className="text-sm text-muted-foreground leading-snug"> |
| 169 | + {item.description} |
| 170 | + </p> |
| 171 | + </div> |
| 172 | + </div> |
| 173 | + ))} |
| 174 | + </div> |
| 175 | + |
| 176 | + <div className="mt-6 flex items-center gap-2"> |
| 177 | + {SLIDES.map((slide, index) => ( |
| 178 | + <button |
| 179 | + key={slide.map((item) => item.title).join("-")} |
| 180 | + type="button" |
| 181 | + aria-label={`Show showcase slide ${index + 1}`} |
| 182 | + aria-current={index === active} |
| 183 | + onClick={() => goTo(index)} |
| 184 | + className={cn( |
| 185 | + "h-1.5 rounded-full transition-all duration-300", |
| 186 | + index === active |
| 187 | + ? "w-6 bg-primary" |
| 188 | + : "w-1.5 bg-primary/20 hover:bg-primary/40", |
| 189 | + )} |
| 190 | + /> |
| 191 | + ))} |
| 192 | + </div> |
| 193 | + |
| 194 | + <button |
| 195 | + type="button" |
| 196 | + aria-label="Next showcase slide" |
| 197 | + onClick={() => goTo(active + 1)} |
| 198 | + className="absolute top-1/2 right-0 z-30 flex size-9 -translate-y-1/2 translate-x-1/2 items-center justify-center rounded-full border border-primary/15 bg-background text-primary shadow-sm transition-all duration-300 hover:scale-105 hover:border-primary/30 hover:shadow-md" |
| 199 | + > |
| 200 | + <ArrowRight className="size-4" strokeWidth={1.75} /> |
| 201 | + </button> |
| 202 | + </div> |
| 203 | + ); |
| 204 | +}; |
0 commit comments