| 1 | "use client"; |
| 2 | |
| 3 | import Image from "next/image"; |
| 4 | import { useCallback, useEffect, useRef, useState } from "react"; |
| 5 | |
| 6 | type Shot = { |
| 7 | src: string; |
| 8 | alt: string; |
| 9 | caption: string; |
| 10 | device: "phone" | "tablet"; |
| 11 | width: number; |
| 12 | height: number; |
| 13 | }; |
| 14 | |
| 15 | const slides: Shot[] = [ |
| 16 | { |
| 17 | src: "/screenshots/iphone-chat.png", |
| 18 | alt: "Siti AI chat running on iPhone", |
| 19 | caption: "Ask anything, on device", |
| 20 | device: "phone", |
| 21 | width: 1242, |
| 22 | height: 2688, |
| 23 | }, |
| 24 | { |
| 25 | src: "/screenshots/iphone-settings.png", |
| 26 | alt: "Siti AI on-device model settings on iPhone", |
| 27 | caption: "Pick your model", |
| 28 | device: "phone", |
| 29 | width: 1242, |
| 30 | height: 2688, |
| 31 | }, |
| 32 | { |
| 33 | src: "/screenshots/ipad-chat.png", |
| 34 | alt: "Siti AI chat running on iPad", |
| 35 | caption: "Roomy on iPad", |
| 36 | device: "tablet", |
| 37 | width: 2064, |
| 38 | height: 2752, |
| 39 | }, |
| 40 | { |
| 41 | src: "/screenshots/ipad-settings.png", |
| 42 | alt: "Siti AI on-device model settings on iPad", |
| 43 | caption: "Everything stays local", |
| 44 | device: "tablet", |
| 45 | width: 2064, |
| 46 | height: 2752, |
| 47 | }, |
| 48 | ]; |
| 49 | |
| 50 | const AUTOPLAY_MS = 5000; |
| 51 | const SWIPE_THRESHOLD = 40; |
| 52 | |
| 53 | function Arrow({ dir }: { dir: "left" | "right" }) { |
| 54 | return ( |
| 55 | <svg |
| 56 | viewBox="0 0 24 24" |
| 57 | fill="none" |
| 58 | stroke="currentColor" |
| 59 | strokeWidth="2" |
| 60 | strokeLinecap="round" |
| 61 | strokeLinejoin="round" |
| 62 | className="h-5 w-5" |
| 63 | aria-hidden="true" |
| 64 | > |
| 65 | <path d={dir === "left" ? "M15 18l-6-6 6-6" : "M9 18l6-6-6-6"} /> |
| 66 | </svg> |
| 67 | ); |
| 68 | } |
| 69 | |
| 70 | export function AppScreenshots() { |
| 71 | const [index, setIndex] = useState(0); |
| 72 | const [paused, setPaused] = useState(false); |
| 73 | const touchStartX = useRef<number | null>(null); |
| 74 | |
| 75 | const count = slides.length; |
| 76 | const goTo = useCallback( |
| 77 | (next: number) => setIndex((next + count) % count), |
| 78 | [count] |
| 79 | ); |
| 80 | const prev = useCallback(() => goTo(index - 1), [goTo, index]); |
| 81 | const next = useCallback(() => goTo(index + 1), [goTo, index]); |
| 82 | |
| 83 | // Auto-advance, paused on hover/focus and when the user prefers reduced motion. |
| 84 | useEffect(() => { |
| 85 | if (paused) return; |
| 86 | if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return; |
| 87 | const id = window.setInterval( |
| 88 | () => setIndex((i) => (i + 1) % count), |
| 89 | AUTOPLAY_MS |
| 90 | ); |
| 91 | return () => window.clearInterval(id); |
| 92 | }, [paused, count]); |
| 93 | |
| 94 | function onTouchStart(e: React.TouchEvent) { |
| 95 | touchStartX.current = e.touches[0].clientX; |
| 96 | } |
| 97 | function onTouchEnd(e: React.TouchEvent) { |
| 98 | if (touchStartX.current === null) return; |
| 99 | const delta = e.changedTouches[0].clientX - touchStartX.current; |
| 100 | if (delta > SWIPE_THRESHOLD) prev(); |
| 101 | else if (delta < -SWIPE_THRESHOLD) next(); |
| 102 | touchStartX.current = null; |
| 103 | } |
| 104 | |
| 105 | return ( |
| 106 | <section className="mx-auto max-w-5xl px-6 py-20"> |
| 107 | <div className="text-center"> |
| 108 | <p className="text-xs font-semibold uppercase tracking-[0.15em] text-brand"> |
| 109 | A look inside |
| 110 | </p> |
| 111 | <h2 className="mt-3 text-3xl font-semibold tracking-tight sm:text-4xl"> |
| 112 | Private by design, on every device. |
| 113 | </h2> |
| 114 | <p className="mx-auto mt-4 max-w-xl text-muted"> |
| 115 | The same assistant on iPhone and iPad. Your model runs locally and your |
| 116 | chats never leave the device. |
| 117 | </p> |
| 118 | </div> |
| 119 | |
| 120 | <div |
| 121 | className="mt-12" |
| 122 | role="group" |
| 123 | aria-roledescription="carousel" |
| 124 | aria-label="App screenshots" |
| 125 | onMouseEnter={() => setPaused(true)} |
| 126 | onMouseLeave={() => setPaused(false)} |
| 127 | onFocus={() => setPaused(true)} |
| 128 | onBlur={() => setPaused(false)} |
| 129 | onKeyDown={(e) => { |
| 130 | if (e.key === "ArrowLeft") prev(); |
| 131 | if (e.key === "ArrowRight") next(); |
| 132 | }} |
| 133 | > |
| 134 | <div className="flex items-center justify-center gap-3 sm:gap-5"> |
| 135 | <button |
| 136 | type="button" |
| 137 | onClick={prev} |
| 138 | aria-label="Previous screenshot" |
| 139 | className="hidden shrink-0 rounded-full border border-border bg-surface p-3 text-muted shadow-sm transition-colors hover:text-ink sm:block" |
| 140 | > |
| 141 | <Arrow dir="left" /> |
| 142 | </button> |
| 143 | |
| 144 | {/* Stage: a fixed-height frame so slides of different aspect ratios |
| 145 | swap without the layout jumping. */} |
| 146 | <div |
| 147 | className="relative h-[460px] w-full max-w-md overflow-hidden sm:h-[600px]" |
| 148 | onTouchStart={onTouchStart} |
| 149 | onTouchEnd={onTouchEnd} |
| 150 | > |
| 151 | <div |
| 152 | className="flex h-full transition-transform duration-500 ease-out" |
| 153 | style={{ transform: `translateX(-${index * 100}%)` }} |
| 154 | > |
| 155 | {slides.map((shot, i) => ( |
| 156 | <figure |
| 157 | key={shot.src} |
| 158 | className="flex h-full w-full shrink-0 flex-col items-center justify-center" |
| 159 | aria-roledescription="slide" |
| 160 | aria-label={`${i + 1} of ${count}`} |
| 161 | aria-hidden={i !== index} |
| 162 | > |
| 163 | <div |
| 164 | className="flex min-h-0 flex-1 items-center justify-center" |
| 165 | style={{ maxWidth: shot.device === "phone" ? 260 : 420 }} |
| 166 | > |
| 167 | <Image |
| 168 | src={shot.src} |
| 169 | alt={shot.alt} |
| 170 | width={shot.width} |
| 171 | height={shot.height} |
| 172 | priority={i === 0} |
| 173 | sizes="(max-width: 640px) 90vw, 420px" |
| 174 | className="h-full w-auto rounded-card border border-border bg-surface object-contain shadow-sm" |
| 175 | /> |
| 176 | </div> |
| 177 | <figcaption className="mt-4 text-center text-sm text-muted"> |
| 178 | {shot.caption} |
| 179 | </figcaption> |
| 180 | </figure> |
| 181 | ))} |
| 182 | </div> |
| 183 | </div> |
| 184 | |
| 185 | <button |
| 186 | type="button" |
| 187 | onClick={next} |
| 188 | aria-label="Next screenshot" |
| 189 | className="hidden shrink-0 rounded-full border border-border bg-surface p-3 text-muted shadow-sm transition-colors hover:text-ink sm:block" |
| 190 | > |
| 191 | <Arrow dir="right" /> |
| 192 | </button> |
| 193 | </div> |
| 194 | |
| 195 | {/* Dots */} |
| 196 | <div className="mt-6 flex items-center justify-center gap-2.5"> |
| 197 | {slides.map((shot, i) => ( |
| 198 | <button |
| 199 | key={shot.src} |
| 200 | type="button" |
| 201 | onClick={() => goTo(i)} |
| 202 | aria-label={`Go to ${shot.caption}`} |
| 203 | aria-current={i === index} |
| 204 | className={`h-2 rounded-full transition-all ${ |
| 205 | i === index ? "w-6 bg-brand" : "w-2 bg-border hover:bg-muted" |
| 206 | }`} |
| 207 | /> |
| 208 | ))} |
| 209 | </div> |
| 210 | </div> |
| 211 | </section> |
| 212 | ); |
| 213 | } |