Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

feat(web): replace GSAP scroll carousel with shadcn/Embla + autoplay

Gener131570af682e
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5c684a6dc..c0721fa70 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -149,6 +149,12 @@ importers:
clsx:
specifier: ^2.1.1
version: 2.1.1
+ embla-carousel-autoplay:
+ specifier: ^8.6.0
+ version: 8.6.0([email protected])
+ embla-carousel-react:
+ specifier: ^8.6.0
+ version: 8.6.0([email protected])
gsap:
specifier: ^3.15.0
version: 3.15.0
@@ -3482,6 +3488,24 @@ packages:
resolution: {integrity: sha512-mgjZAz7Jyx1SRCwEpy9wefDS7GvNPazLthHg8eQMJ76wBdGQQDW33TCrUTvQ4wzpmOrv2zrFoD3oNufMdyMpog==}
+ resolution: {integrity: sha512-OBu5G3nwaSXkZCo1A6LTaFMZ8EpkYbwIaH+bPqdBnDGQ2fh4+NbzjXjs2SktoPNKCtflfVMc75njaDHOYXcrsA==}
+ peerDependencies:
+ embla-carousel: 8.6.0
+
+ resolution: {integrity: sha512-0/PjqU7geVmo6F734pmPqpyHqiM99olvyecY7zdweCw+6tKEXnrE90pBiBbMMU8s5tICemzpQ3hi5EpxzGW+JA==}
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.1 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc
+
+ resolution: {integrity: sha512-fMVUDUEx0/uIEDM0Mz3dHznDhfX+znCCDCeIophYb1QGVM7YThSWX+wz11zlYwWFOr74b4QLGg0hrGPJeG2s4A==}
+ peerDependencies:
+ embla-carousel: 8.6.0
+
+ resolution: {integrity: sha512-SjWyZBHJPbqxHOzckOfo8lHisEaJWmwd23XppYFYVh10bU66/Pn5tkVkbkCMZVdbUE5eTCI2nD8OyIP4Z+uwkA==}
+
resolution: {integrity: sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==}
@@ -9556,6 +9580,22 @@ snapshots:
+ dependencies:
+ embla-carousel: 8.6.0
+
+ dependencies:
+ embla-carousel: 8.6.0
+ embla-carousel-reactive-utils: 8.6.0([email protected])
+ react: 19.2.5
+
+ dependencies:
+ embla-carousel: 8.6.0
+
+
@@ -9759,8 +9799,8 @@ snapshots:
'@next/eslint-plugin-next': 16.2.3
eslint: 9.39.4([email protected])
eslint-import-resolver-node: 0.3.10
+ eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))
eslint-plugin-jsx-a11y: 6.10.2([email protected]([email protected]))
eslint-plugin-react: 7.37.5([email protected]([email protected]))
eslint-plugin-react-hooks: 7.0.1([email protected]([email protected]))
@@ -9782,7 +9822,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
'@nolyfill/is-core-module': 1.0.39
debug: 4.4.3
@@ -9793,22 +9833,22 @@ snapshots:
tinyglobby: 0.2.16
unrs-resolver: 1.11.1
optionalDependencies:
transitivePeerDependencies:
- supports-color
dependencies:
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 8.58.2([email protected]([email protected]))([email protected])
eslint: 9.39.4([email protected])
eslint-import-resolver-node: 0.3.10
+ eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))
transitivePeerDependencies:
- supports-color
dependencies:
'@rtsao/scc': 1.1.0
array-includes: 3.1.9
@@ -9819,7 +9859,7 @@ snapshots:
doctrine: 2.1.0
eslint: 9.39.4([email protected])
eslint-import-resolver-node: 0.3.10
hasown: 2.0.2
is-core-module: 2.16.1
is-glob: 4.0.3
diff --git a/src/web/package.json b/src/web/package.json
index ed379f561..b1d1e9be7 100644
--- a/src/web/package.json
+++ b/src/web/package.json
@@ -34,6 +34,8 @@
"better-auth": "^1.6.2",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
+ "embla-carousel-autoplay": "^8.6.0",
+ "embla-carousel-react": "^8.6.0",
"gsap": "^3.15.0",
"input-otp": "^1.4.2",
"lucide-react": "^1.8.0",
diff --git a/src/web/src/app/globals.css b/src/web/src/app/globals.css
index ac05a8511..21a2dc813 100644
--- a/src/web/src/app/globals.css
+++ b/src/web/src/app/globals.css
@@ -538,7 +538,7 @@
/* ── Responsive ── */
@media (max-width: 640px) {
.typewriter-scene {
- transform: scale(0.55) !important;
+ transform: scale(0.85) !important;
}
.tw-paper {
padding: 16px 18px 24px;
diff --git a/src/web/src/components/home/feature-showcase.tsx b/src/web/src/components/home/feature-showcase.tsx
index 9d75952a1..93b8971ca 100644
--- a/src/web/src/components/home/feature-showcase.tsx
+++ b/src/web/src/components/home/feature-showcase.tsx
@@ -4,6 +4,14 @@ import { useRef } from "react";
import gsap from "gsap";
import { useGSAP } from "@gsap/react";
import { ScrollTrigger } from "gsap/ScrollTrigger";
+import Autoplay from "embla-carousel-autoplay";
+import {
+ Carousel,
+ CarouselContent,
+ CarouselItem,
+ CarouselPrevious,
+ CarouselNext,
+} from "@/components/ui/carousel";
gsap.registerPlugin(ScrollTrigger);
@@ -84,158 +92,68 @@ const features: Feature[] = [
];
export function FeatureShowcase() {
- const containerRef = useRef<HTMLDivElement>(null);
- const progressRef = useRef<HTMLDivElement>(null);
+ const mobileRef = useRef<HTMLDivElement>(null);
useGSAP(
() => {
- if (!containerRef.current) return;
-
- const isMobile = window.innerWidth < 1024;
- const panels = gsap.utils.toArray<HTMLElement>(".feature-panel");
-
- if (isMobile) {
- panels.forEach((panel) => {
- gsap.from(panel, {
- y: 40,
- opacity: 0,
- duration: 0.6,
- ease: "power2.out",
- scrollTrigger: {
- trigger: panel,
- start: "top 80%",
- toggleActions: "play none none none",
- },
- });
+ const panels = gsap.utils.toArray<HTMLElement>(".feature-panel-mobile");
+ panels.forEach((panel) => {
+ gsap.from(panel, {
+ y: 40,
+ opacity: 0,
+ duration: 0.6,
+ ease: "power2.out",
+ scrollTrigger: {
+ trigger: panel,
+ start: "top 80%",
+ toggleActions: "play none none none",
+ },
});
- return;
- }
-
- // Desktop: horizontal slide carousel (like shadcn/Embla)
- const panelCount = panels.length;
- const scrollPerPanel = window.innerHeight * 0.6;
- const totalScroll = scrollPerPanel * panelCount;
-
- // Position all panels off-screen to the right, except the first
- panels.forEach((panel, i) => {
- gsap.set(panel, { xPercent: i * 100 });
- });
-
- const progressBar = progressRef.current?.parentElement;
- let currentIndex = 0;
-
- ScrollTrigger.create({
- trigger: containerRef.current,
- start: "top top",
- end: () => `+=${totalScroll}`,
- pin: true,
- pinSpacing: true,
- anticipatePin: 1,
- snap: {
- snapTo: 1 / (panelCount - 1),
- duration: { min: 0.15, max: 0.4 },
- delay: 0.05,
- ease: "power2.inOut",
- },
- onEnter: () => {
- if (progressBar)
- gsap.to(progressBar, { opacity: 1, duration: 0.3 });
- },
- onLeave: () => {
- if (progressBar)
- gsap.to(progressBar, { opacity: 0, duration: 0.3 });
- },
- onEnterBack: () => {
- if (progressBar)
- gsap.to(progressBar, { opacity: 1, duration: 0.3 });
- },
- onLeaveBack: () => {
- if (progressBar)
- gsap.to(progressBar, { opacity: 0, duration: 0.3 });
- },
- onUpdate: (self) => {
- if (progressRef.current) {
- progressRef.current.style.transform = `scaleX(${self.progress})`;
- }
-
- // Determine which panel to show
- const targetIndex = Math.round(
- self.progress * (panelCount - 1)
- );
-
- if (targetIndex !== currentIndex) {
- const leaving = panels[currentIndex];
- const entering = panels[targetIndex];
- const direction = targetIndex > currentIndex ? 1 : -1;
-
- // Slide leaving panel out
- gsap.to(leaving, {
- xPercent: -direction * 100,
- duration: 0.4,
- ease: "power2.inOut",
- overwrite: true,
- });
-
- // Slide entering panel in from the opposite side
- gsap.fromTo(
- entering,
- { xPercent: direction * 100 },
- {
- xPercent: 0,
- duration: 0.4,
- ease: "power2.inOut",
- overwrite: true,
- }
- );
-
- currentIndex = targetIndex;
- }
- },
});
},
- { scope: containerRef }
+ { scope: mobileRef }
);
return (
<section
- ref={containerRef}
- className="relative min-h-screen overflow-hidden"
+ className="relative overflow-hidden py-24"
style={{ backgroundColor: "var(--landing-bg)" }}
>
- {/* Progress bar */}
- <div
- className="fixed bottom-0 left-0 right-0 z-50 h-px opacity-0"
- style={{ backgroundColor: "var(--landing-border)" }}
- >
- <div
- ref={progressRef}
- className="h-full origin-left"
- style={{
- backgroundColor: "var(--landing-text-muted)",
- transform: "scaleX(0)",
- }}
- />
- </div>
-
- {/* Panels */}
- <div className="relative h-screen overflow-hidden lg:block">
- {/* Mobile: normal flow */}
- <div className="flex flex-col gap-16 px-6 py-16 lg:hidden">
- {features.map((feature) => (
- <FeaturePanel key={feature.number} feature={feature} />
- ))}
- </div>
-
- {/* Desktop: absolutely positioned panels that slide horizontally */}
+ {/* Mobile: vertical stacked panels with scroll fade-in */}
+ <div ref={mobileRef} className="flex flex-col gap-16 px-6 lg:hidden">
{features.map((feature) => (
- <div
- key={feature.number}
- className="feature-panel hidden lg:flex absolute inset-0 items-center justify-center will-change-transform"
- >
+ <div key={feature.number} className="feature-panel-mobile">
<FeaturePanel feature={feature} />
</div>
))}
</div>
+
+ {/* Desktop: Embla carousel */}
+ <div className="hidden lg:block">
+ <Carousel
+ opts={{ align: "center", loop: true }}
+ plugins={[Autoplay({ delay: 4000, stopOnInteraction: false })]}
+ className="mx-auto w-full max-w-6xl px-12"
+ >
+ <CarouselContent className="-ml-8">
+ {features.map((feature) => (
+ <CarouselItem key={feature.number} className="pl-8">
+ <div className="flex min-h-[420px] items-center">
+ <FeaturePanel feature={feature} />
+ </div>
+ </CarouselItem>
+ ))}
+ </CarouselContent>
+ <CarouselPrevious
+ className="border-none bg-transparent hover:bg-transparent"
+ style={{ color: "var(--landing-text-muted)" }}
+ />
+ <CarouselNext
+ className="border-none bg-transparent hover:bg-transparent"
+ style={{ color: "var(--landing-text-muted)" }}
+ />
+ </Carousel>
+ </div>
</section>
);
}
diff --git a/src/web/src/components/home/hero-section.tsx b/src/web/src/components/home/hero-section.tsx
index 1472f70cb..120034773 100644
--- a/src/web/src/components/home/hero-section.tsx
+++ b/src/web/src/components/home/hero-section.tsx
@@ -60,7 +60,7 @@ export function HeroSection({ isLoggedIn }: { isLoggedIn: boolean }) {
ScrollTrigger.create({
trigger: sectionRef.current,
start: "top top",
- end: "+=50%",
+ end: () => `+=${window.innerWidth < 640 ? 10 : 25}%`,
pin: true,
pinSpacing: true,
snap: {
@@ -211,7 +211,7 @@ export function HeroSection({ isLoggedIn }: { isLoggedIn: boolean }) {
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
- VIEW SOURCE ON GITHUB
+ OPEN SOURCE
</a>
{isLoggedIn && (
<a
diff --git a/src/web/src/components/ui/button.tsx b/src/web/src/components/ui/button.tsx
index 214c83ec9..09df75367 100644
--- a/src/web/src/components/ui/button.tsx
+++ b/src/web/src/components/ui/button.tsx
@@ -4,13 +4,13 @@ import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
const buttonVariants = cva(
- "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap cursor-pointer transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
outline:
- "border-border bg-card hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
+ "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
secondary:
"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
ghost:
diff --git a/src/web/src/components/ui/carousel.tsx b/src/web/src/components/ui/carousel.tsx
new file mode 100644
index 000000000..9deee76e2
--- /dev/null
+++ b/src/web/src/components/ui/carousel.tsx
@@ -0,0 +1,242 @@
+"use client"
+
+import * as React from "react"
+import useEmblaCarousel, {
+ type UseEmblaCarouselType,
+} from "embla-carousel-react"
+
+import { cn } from "@/lib/utils"
+import { Button } from "@/components/ui/button"
+import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"
+
+type CarouselApi = UseEmblaCarouselType[1]
+type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
+type CarouselOptions = UseCarouselParameters[0]
+type CarouselPlugin = UseCarouselParameters[1]
+
+type CarouselProps = {
+ opts?: CarouselOptions
+ plugins?: CarouselPlugin
+ orientation?: "horizontal" | "vertical"
+ setApi?: (api: CarouselApi) => void
+}
+
+type CarouselContextProps = {
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0]
+ api: ReturnType<typeof useEmblaCarousel>[1]
+ scrollPrev: () => void
+ scrollNext: () => void
+ canScrollPrev: boolean
+ canScrollNext: boolean
+} & CarouselProps
+
+const CarouselContext = React.createContext<CarouselContextProps | null>(null)
+
+function useCarousel() {
+ const context = React.useContext(CarouselContext)
+
+ if (!context) {
+ throw new Error("useCarousel must be used within a <Carousel />")
+ }
+
+ return context
+}
+
+function Carousel({
+ orientation = "horizontal",
+ opts,
+ setApi,
+ plugins,
+ className,
+ children,
+ ...props
+}: React.ComponentProps<"div"> & CarouselProps) {
+ const [carouselRef, api] = useEmblaCarousel(
+ {
+ ...opts,
+ axis: orientation === "horizontal" ? "x" : "y",
+ },
+ plugins
+ )
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false)
+ const [canScrollNext, setCanScrollNext] = React.useState(false)
+
+ const onSelect = React.useCallback((api: CarouselApi) => {
+ if (!api) return
+ setCanScrollPrev(api.canScrollPrev())
+ setCanScrollNext(api.canScrollNext())
+ }, [])
+
+ const scrollPrev = React.useCallback(() => {
+ api?.scrollPrev()
+ }, [api])
+
+ const scrollNext = React.useCallback(() => {
+ api?.scrollNext()
+ }, [api])
+
+ const handleKeyDown = React.useCallback(
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
+ if (event.key === "ArrowLeft") {
+ event.preventDefault()
+ scrollPrev()
+ } else if (event.key === "ArrowRight") {
+ event.preventDefault()
+ scrollNext()
+ }
+ },
+ [scrollPrev, scrollNext]
+ )
+
+ React.useEffect(() => {
+ if (!api || !setApi) return
+ setApi(api)
+ }, [api, setApi])
+
+ React.useEffect(() => {
+ if (!api) return
+ onSelect(api)
+ api.on("reInit", onSelect)
+ api.on("select", onSelect)
+
+ return () => {
+ api?.off("select", onSelect)
+ }
+ }, [api, onSelect])
+
+ return (
+ <CarouselContext.Provider
+ value={{
+ carouselRef,
+ api: api,
+ opts,
+ orientation:
+ orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
+ scrollPrev,
+ scrollNext,
+ canScrollPrev,
+ canScrollNext,
+ }}
+ >
+ <div
+ onKeyDownCapture={handleKeyDown}
+ className={cn("relative", className)}
+ role="region"
+ aria-roledescription="carousel"
+ data-slot="carousel"
+ {...props}
+ >
+ {children}
+ </div>
+ </CarouselContext.Provider>
+ )
+}
+
+function CarouselContent({ className, ...props }: React.ComponentProps<"div">) {
+ const { carouselRef, orientation } = useCarousel()
+
+ return (
+ <div
+ ref={carouselRef}
+ className="overflow-hidden"
+ data-slot="carousel-content"
+ >
+ <div
+ className={cn(
+ "flex",
+ orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
+ className
+ )}
+ {...props}
+ />
+ </div>
+ )
+}
+
+function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
+ const { orientation } = useCarousel()
+
+ return (
+ <div
+ role="group"
+ aria-roledescription="slide"
+ data-slot="carousel-item"
+ className={cn(
+ "min-w-0 shrink-0 grow-0 basis-full",
+ orientation === "horizontal" ? "pl-4" : "pt-4",
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+function CarouselPrevious({
+ className,
+ variant = "outline",
+ size = "icon-sm",
+ ...props
+}: React.ComponentProps<typeof Button>) {
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel()
+
+ return (
+ <Button
+ data-slot="carousel-previous"
+ variant={variant}
+ size={size}
+ className={cn(
+ "absolute touch-manipulation rounded-full",
+ orientation === "horizontal"
+ ? "top-1/2 -left-12 -translate-y-1/2"
+ : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
+ className
+ )}
+ disabled={!canScrollPrev}
+ onClick={scrollPrev}
+ {...props}
+ >
+ <ChevronLeftIcon />
+ <span className="sr-only">Previous slide</span>
+ </Button>
+ )
+}
+
+function CarouselNext({
+ className,
+ variant = "outline",
+ size = "icon-sm",
+ ...props
+}: React.ComponentProps<typeof Button>) {
+ const { orientation, scrollNext, canScrollNext } = useCarousel()
+
+ return (
+ <Button
+ data-slot="carousel-next"
+ variant={variant}
+ size={size}
+ className={cn(
+ "absolute touch-manipulation rounded-full",
+ orientation === "horizontal"
+ ? "top-1/2 -right-12 -translate-y-1/2"
+ : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
+ className
+ )}
+ disabled={!canScrollNext}
+ onClick={scrollNext}
+ {...props}
+ >
+ <ChevronRightIcon />
+ <span className="sr-only">Next slide</span>
+ </Button>
+ )
+}
+
+export {
+ type CarouselApi,
+ Carousel,
+ CarouselContent,
+ CarouselItem,
+ CarouselPrevious,
+ CarouselNext,
+ useCarousel,
+}