| 4bb999b | | | 1 | "use client"; |
| 4bb999b | | | 2 | |
| 4bb999b | | | 3 | import { useEffect, useRef, useState } from "react"; |
| 4bb999b | | | 4 | import { GroveLogo } from "@/app/components/grove-logo"; |
| 44863ab | | | 5 | import { useTheme } from "@/lib/theme"; |
| 4bb999b | | | 6 | |
| 4bb999b | | | 7 | const TERMINAL_LINES = [ |
| 4bb999b | | | 8 | { prompt: true, text: "grove init --owner letterpress-labs", delay: 40 }, |
| 4bb999b | | | 9 | { prompt: false, text: "┌ grove init grove-cli", delay: 0 }, |
| 4bb999b | | | 10 | { prompt: false, text: "◇ Created letterpress-labs/grove-cli", delay: 800 }, |
| 4bb999b | | | 11 | { prompt: false, text: "◇ Sapling repository initialized", delay: 400 }, |
| 4bb999b | | | 12 | { prompt: false, text: "◇ Remote configured", delay: 300 }, |
| 4bb999b | | | 13 | { prompt: false, text: "└ Initialized letterpress-labs/grove-cli", delay: 200 }, |
| 4bb999b | | | 14 | { prompt: false, text: "", delay: 400 }, |
| 4bb999b | | | 15 | { prompt: true, text: 'sl commit -m "add CLI help system and read-only ISL mode"', delay: 35 }, |
| 4bb999b | | | 16 | { prompt: false, text: "", delay: 600 }, |
| 4bb999b | | | 17 | { prompt: true, text: "sl push --to main", delay: 40 }, |
| 4bb999b | | | 18 | { prompt: false, text: "pushing rev c21911da to bookmark main", delay: 400 }, |
| 4bb999b | | | 19 | { prompt: false, text: "edenapi: uploaded 9 files", delay: 300 }, |
| 4bb999b | | | 20 | { prompt: false, text: "edenapi: uploaded 1 commit", delay: 200 }, |
| 4bb999b | | | 21 | { prompt: false, text: 'updated remote bookmark main to c21911da', delay: 300 }, |
| 4bb999b | | | 22 | ]; |
| 4bb999b | | | 23 | |
| 4bb999b | | | 24 | function TerminalDemo() { |
| 4bb999b | | | 25 | const [lines, setLines] = useState<{ text: string; isPrompt: boolean }[]>([]); |
| 4bb999b | | | 26 | const [currentTyping, setCurrentTyping] = useState(""); |
| 4bb999b | | | 27 | const [isTyping, setIsTyping] = useState(false); |
| 4bb999b | | | 28 | const [showCursor, setShowCursor] = useState(true); |
| 4bb999b | | | 29 | const termRef = useRef<HTMLDivElement>(null); |
| 4bb999b | | | 30 | |
| 4bb999b | | | 31 | useEffect(() => { |
| 4bb999b | | | 32 | const blink = setInterval(() => setShowCursor((c) => !c), 530); |
| 4bb999b | | | 33 | return () => clearInterval(blink); |
| 4bb999b | | | 34 | }, []); |
| 4bb999b | | | 35 | |
| 4bb999b | | | 36 | useEffect(() => { |
| 4bb999b | | | 37 | let cancelled = false; |
| 4bb999b | | | 38 | |
| 4bb999b | | | 39 | async function run() { |
| 4bb999b | | | 40 | await sleep(800); |
| 4bb999b | | | 41 | for (const line of TERMINAL_LINES) { |
| 4bb999b | | | 42 | if (cancelled) return; |
| 4bb999b | | | 43 | if (line.prompt) { |
| 4bb999b | | | 44 | setIsTyping(true); |
| 4bb999b | | | 45 | for (let i = 0; i <= line.text.length; i++) { |
| 4bb999b | | | 46 | if (cancelled) return; |
| 4bb999b | | | 47 | setCurrentTyping(line.text.slice(0, i)); |
| 4bb999b | | | 48 | await sleep(line.delay + Math.random() * 20); |
| 4bb999b | | | 49 | } |
| 4bb999b | | | 50 | setIsTyping(false); |
| 4bb999b | | | 51 | setLines((prev) => [...prev, { text: line.text, isPrompt: true }]); |
| 4bb999b | | | 52 | setCurrentTyping(""); |
| 4bb999b | | | 53 | await sleep(200); |
| 4bb999b | | | 54 | } else { |
| 4bb999b | | | 55 | await sleep(line.delay); |
| 4bb999b | | | 56 | if (line.text) { |
| 4bb999b | | | 57 | setLines((prev) => [...prev, { text: line.text, isPrompt: false }]); |
| 4bb999b | | | 58 | } else { |
| 4bb999b | | | 59 | setLines((prev) => [...prev, { text: "", isPrompt: false }]); |
| 4bb999b | | | 60 | } |
| 4bb999b | | | 61 | } |
| 4bb999b | | | 62 | } |
| 4bb999b | | | 63 | } |
| 4bb999b | | | 64 | run(); |
| 4bb999b | | | 65 | return () => { cancelled = true; }; |
| 4bb999b | | | 66 | }, []); |
| 4bb999b | | | 67 | |
| 4bb999b | | | 68 | useEffect(() => { |
| 4bb999b | | | 69 | if (termRef.current) { |
| 4bb999b | | | 70 | termRef.current.scrollTop = termRef.current.scrollHeight; |
| 4bb999b | | | 71 | } |
| 4bb999b | | | 72 | }, [lines, currentTyping]); |
| 4bb999b | | | 73 | |
| 4bb999b | | | 74 | const cursor = showCursor ? "█" : " "; |
| 4bb999b | | | 75 | |
| 4bb999b | | | 76 | return ( |
| 4bb999b | | | 77 | <div |
| 4bb999b | | | 78 | ref={termRef} |
| 4bb999b | | | 79 | style={{ |
| 4bb999b | | | 80 | backgroundColor: "#1a1918", |
| 4bb999b | | | 81 | border: "1px solid #302e2b", |
| 4bb999b | | | 82 | padding: "20px", |
| 4bb999b | | | 83 | fontFamily: "'JetBrains Mono', Menlo, monospace", |
| 4bb999b | | | 84 | fontSize: "13px", |
| 4bb999b | | | 85 | lineHeight: 1.7, |
| 4bb999b | | | 86 | color: "#c4bfb8", |
| 4bb999b | | | 87 | overflow: "hidden", |
| 4bb999b | | | 88 | maxHeight: "380px", |
| 4bb999b | | | 89 | }} |
| 4bb999b | | | 90 | > |
| 4bb999b | | | 91 | {lines.map((line, i) => ( |
| 4bb999b | | | 92 | <div key={i} style={{ minHeight: "1.7em" }}> |
| 4bb999b | | | 93 | {line.isPrompt && <span style={{ color: "#7aab9c" }}>❯ </span>} |
| 4bb999b | | | 94 | {line.isPrompt ? ( |
| 4bb999b | | | 95 | <span style={{ color: "#e8e4df" }}>{line.text}</span> |
| 4bb999b | | | 96 | ) : ( |
| 4bb999b | | | 97 | <span style={{ color: "#9a948c" }}>{line.text}</span> |
| 4bb999b | | | 98 | )} |
| 4bb999b | | | 99 | </div> |
| 4bb999b | | | 100 | ))} |
| 4bb999b | | | 101 | {(isTyping || lines.length === 0) && ( |
| 4bb999b | | | 102 | <div> |
| 4bb999b | | | 103 | <span style={{ color: "#7aab9c" }}>❯ </span> |
| 4bb999b | | | 104 | <span style={{ color: "#e8e4df" }}>{currentTyping}</span> |
| 4bb999b | | | 105 | <span style={{ color: "#7aab9c" }}>{cursor}</span> |
| 4bb999b | | | 106 | </div> |
| 4bb999b | | | 107 | )} |
| 4bb999b | | | 108 | </div> |
| 4bb999b | | | 109 | ); |
| 4bb999b | | | 110 | } |
| 4bb999b | | | 111 | |
| 4bb999b | | | 112 | function sleep(ms: number) { |
| 4bb999b | | | 113 | return new Promise((r) => setTimeout(r, ms)); |
| 4bb999b | | | 114 | } |
| 4bb999b | | | 115 | |
| 4bb999b | | | 116 | export function LandingPage() { |
| 4bb999b | | | 117 | const [islDomain, setIslDomain] = useState(""); |
| 44863ab | | | 118 | const { theme } = useTheme(); |
| 44863ab | | | 119 | const islRef = useRef<HTMLIFrameElement>(null); |
| 4bb999b | | | 120 | |
| 4bb999b | | | 121 | useEffect(() => { |
| 4bb999b | | | 122 | const host = window.location.hostname; |
| 4bb999b | | | 123 | if (host !== "localhost" && !host.match(/^\d/)) { |
| 7e5aa77 | | | 124 | setIslDomain("https://isl.grove.host"); |
| 4bb999b | | | 125 | } |
| 4bb999b | | | 126 | }, []); |
| 4bb999b | | | 127 | |
| 44863ab | | | 128 | // Send theme changes to ISL iframe via postMessage |
| 44863ab | | | 129 | useEffect(() => { |
| 44863ab | | | 130 | if (islRef.current?.contentWindow) { |
| 44863ab | | | 131 | islRef.current.contentWindow.postMessage({ type: "theme", value: theme }, "*"); |
| 44863ab | | | 132 | } |
| 44863ab | | | 133 | }, [theme]); |
| 44863ab | | | 134 | |
| 4bb999b | | | 135 | return ( |
| 44863ab | | | 136 | <div style={{ display: "flex", flexDirection: "column", minHeight: "calc(100vh - 3.5rem)" }}> |
| 44863ab | | | 137 | {/* Hero + Terminal + Features */} |
| 44863ab | | | 138 | <div style={{ maxWidth: "800px", margin: "0 auto", padding: "60px 24px 0", width: "100%" }}> |
| 44863ab | | | 139 | |
| 4bb999b | | | 140 | {/* Hero */} |
| 4bb999b | | | 141 | <div style={{ textAlign: "center", marginBottom: "64px" }}> |
| 4bb999b | | | 142 | <div style={{ display: "inline-block", marginBottom: "24px" }}> |
| 4bb999b | | | 143 | <GroveLogo size={64} /> |
| 4bb999b | | | 144 | </div> |
| 4bb999b | | | 145 | <h1 |
| 4bb999b | | | 146 | style={{ |
| 4bb999b | | | 147 | fontSize: "2rem", |
| 4bb999b | | | 148 | fontWeight: 400, |
| 4bb999b | | | 149 | color: "var(--text-primary)", |
| 4bb999b | | | 150 | marginBottom: "12px", |
| 4bb999b | | | 151 | }} |
| 4bb999b | | | 152 | > |
| 4bb999b | | | 153 | Source control, self-hosted |
| 4bb999b | | | 154 | </h1> |
| 4bb999b | | | 155 | <p |
| 4bb999b | | | 156 | style={{ |
| 4bb999b | | | 157 | fontSize: "1rem", |
| 4bb999b | | | 158 | color: "var(--text-muted)", |
| 4bb999b | | | 159 | maxWidth: "480px", |
| 4bb999b | | | 160 | margin: "0 auto 32px", |
| 4bb999b | | | 161 | lineHeight: 1.6, |
| 4bb999b | | | 162 | }} |
| 4bb999b | | | 163 | > |
| 4bb999b | | | 164 | Grove is a complete code hosting platform built on Sapling SCM and Mononoke. |
| 4bb999b | | | 165 | Stacked diffs, interactive smartlog, CI pipelines — on your own infrastructure. |
| 4bb999b | | | 166 | </p> |
| 4bb999b | | | 167 | <a |
| 4bb999b | | | 168 | href="/login" |
| 4bb999b | | | 169 | style={{ |
| 4bb999b | | | 170 | display: "inline-block", |
| 4bb999b | | | 171 | padding: "10px 24px", |
| 4bb999b | | | 172 | backgroundColor: "var(--accent)", |
| 4bb999b | | | 173 | color: "var(--accent-text)", |
| 4bb999b | | | 174 | fontSize: "0.875rem", |
| 4bb999b | | | 175 | textDecoration: "none", |
| 4bb999b | | | 176 | }} |
| 4bb999b | | | 177 | > |
| 4bb999b | | | 178 | Get started |
| 4bb999b | | | 179 | </a> |
| 4bb999b | | | 180 | </div> |
| 4bb999b | | | 181 | |
| 4bb999b | | | 182 | {/* Terminal */} |
| 4bb999b | | | 183 | <section style={{ marginBottom: "64px" }}> |
| 4bb999b | | | 184 | <div style={{ marginBottom: "16px" }}> |
| 4bb999b | | | 185 | <h2 |
| 4bb999b | | | 186 | style={{ |
| 4bb999b | | | 187 | fontSize: "0.75rem", |
| 4bb999b | | | 188 | fontWeight: 600, |
| 4bb999b | | | 189 | textTransform: "uppercase", |
| 4bb999b | | | 190 | letterSpacing: "0.1em", |
| 4bb999b | | | 191 | color: "var(--text-faint)", |
| 4bb999b | | | 192 | marginBottom: "4px", |
| 4bb999b | | | 193 | }} |
| 4bb999b | | | 194 | > |
| 4bb999b | | | 195 | Init, commit, push |
| 4bb999b | | | 196 | </h2> |
| 4bb999b | | | 197 | <p style={{ fontSize: "0.875rem", color: "var(--text-muted)" }}> |
| 4bb999b | | | 198 | From zero to hosted repository in seconds. Sapling's clean CLI, backed by Mononoke. |
| 4bb999b | | | 199 | </p> |
| 4bb999b | | | 200 | </div> |
| 4bb999b | | | 201 | <TerminalDemo /> |
| 4bb999b | | | 202 | </section> |
| 4bb999b | | | 203 | |
| 4bb999b | | | 204 | {/* Features */} |
| 44863ab | | | 205 | <section style={{ marginBottom: "48px" }}> |
| 4bb999b | | | 206 | <div |
| 4bb999b | | | 207 | style={{ |
| 4bb999b | | | 208 | display: "grid", |
| 4bb999b | | | 209 | gridTemplateColumns: "1fr 1fr", |
| 4bb999b | | | 210 | gap: "1px", |
| 4bb999b | | | 211 | backgroundColor: "var(--border-subtle)", |
| 4bb999b | | | 212 | border: "1px solid var(--border-subtle)", |
| 4bb999b | | | 213 | }} |
| 4bb999b | | | 214 | > |
| 4bb999b | | | 215 | {[ |
| 4bb999b | | | 216 | { |
| 4bb999b | | | 217 | title: "Sapling SCM", |
| 4bb999b | | | 218 | desc: "Stacked diffs, amend-based workflow, interactive rebase — built for how engineers actually work.", |
| 4bb999b | | | 219 | }, |
| 4bb999b | | | 220 | { |
| 4bb999b | | | 221 | title: "Mononoke", |
| 4bb999b | | | 222 | desc: "Meta's scalable source control server. Handles monorepos with millions of files.", |
| 4bb999b | | | 223 | }, |
| 4bb999b | | | 224 | { |
| 4bb999b | | | 225 | title: "Canopy CI", |
| 4bb999b | | | 226 | desc: "Pipelines defined in YAML, triggered on push. Build, test, and deploy from your own runners.", |
| 4bb999b | | | 227 | }, |
| 4bb999b | | | 228 | { |
| 4bb999b | | | 229 | title: "Self-hosted", |
| 4bb999b | | | 230 | desc: "Your code, your servers. Deploy on any Linux machine with a single command.", |
| 4bb999b | | | 231 | }, |
| 4bb999b | | | 232 | ].map((f) => ( |
| 4bb999b | | | 233 | <div |
| 4bb999b | | | 234 | key={f.title} |
| 4bb999b | | | 235 | style={{ |
| 4bb999b | | | 236 | backgroundColor: "var(--bg-card)", |
| 4bb999b | | | 237 | padding: "24px", |
| 4bb999b | | | 238 | }} |
| 4bb999b | | | 239 | > |
| 4bb999b | | | 240 | <h3 |
| 4bb999b | | | 241 | style={{ |
| 4bb999b | | | 242 | fontSize: "0.875rem", |
| 4bb999b | | | 243 | color: "var(--text-primary)", |
| 4bb999b | | | 244 | marginBottom: "6px", |
| 4bb999b | | | 245 | }} |
| 4bb999b | | | 246 | > |
| 4bb999b | | | 247 | {f.title} |
| 4bb999b | | | 248 | </h3> |
| 4bb999b | | | 249 | <p style={{ fontSize: "0.8rem", color: "var(--text-muted)", lineHeight: 1.6 }}> |
| 4bb999b | | | 250 | {f.desc} |
| 4bb999b | | | 251 | </p> |
| 4bb999b | | | 252 | </div> |
| 4bb999b | | | 253 | ))} |
| 4bb999b | | | 254 | </div> |
| 4bb999b | | | 255 | </section> |
| 44863ab | | | 256 | |
| 44863ab | | | 257 | </div>{/* end centered wrapper */} |
| 44863ab | | | 258 | |
| 44863ab | | | 259 | {/* ISL — fills remaining viewport */} |
| 44863ab | | | 260 | {islDomain && ( |
| 44863ab | | | 261 | <section style={{ flex: 1, display: "flex", flexDirection: "column", minHeight: "500px" }}> |
| 44863ab | | | 262 | <div style={{ padding: "0 24px 16px", maxWidth: "800px", margin: "0 auto", width: "100%" }}> |
| 44863ab | | | 263 | <h2 |
| 44863ab | | | 264 | style={{ |
| 44863ab | | | 265 | fontSize: "0.75rem", |
| 44863ab | | | 266 | fontWeight: 600, |
| 44863ab | | | 267 | textTransform: "uppercase", |
| 44863ab | | | 268 | letterSpacing: "0.1em", |
| 44863ab | | | 269 | color: "var(--text-faint)", |
| 44863ab | | | 270 | marginBottom: "4px", |
| 44863ab | | | 271 | }} |
| 44863ab | | | 272 | > |
| 44863ab | | | 273 | Interactive Smartlog |
| 44863ab | | | 274 | </h2> |
| 44863ab | | | 275 | <p style={{ fontSize: "0.875rem", color: "var(--text-muted)" }}> |
| 44863ab | | | 276 | Visualize your commit graph, browse diffs, and manage stacked changes — all in the browser. |
| 44863ab | | | 277 | This is a live, read-only view of Grove's own repository. |
| 44863ab | | | 278 | </p> |
| 44863ab | | | 279 | </div> |
| 44863ab | | | 280 | <div |
| 44863ab | | | 281 | style={{ |
| 44863ab | | | 282 | flex: 1, |
| 44863ab | | | 283 | borderTop: "1px solid var(--border-subtle)", |
| 44863ab | | | 284 | }} |
| 44863ab | | | 285 | > |
| 44863ab | | | 286 | <iframe |
| 44863ab | | | 287 | ref={islRef} |
| 44863ab | | | 288 | src={`${islDomain}?theme=${theme}`} |
| 44863ab | | | 289 | style={{ |
| 44863ab | | | 290 | width: "100%", |
| 44863ab | | | 291 | height: "100%", |
| 44863ab | | | 292 | border: "none", |
| 44863ab | | | 293 | display: "block", |
| 44863ab | | | 294 | }} |
| 44863ab | | | 295 | title="Interactive Smartlog" |
| 44863ab | | | 296 | onLoad={() => { |
| 44863ab | | | 297 | // Send theme on initial load |
| 44863ab | | | 298 | islRef.current?.contentWindow?.postMessage({ type: "theme", value: theme }, "*"); |
| 44863ab | | | 299 | }} |
| 44863ab | | | 300 | /> |
| 44863ab | | | 301 | </div> |
| 44863ab | | | 302 | </section> |
| 44863ab | | | 303 | )} |
| 4bb999b | | | 304 | </div> |
| 4bb999b | | | 305 | ); |
| 4bb999b | | | 306 | } |