From fa545885a4493bdf0e8d5e9916b295189323c6e7 Mon Sep 17 00:00:00 2001 From: Aarav Sharma Date: Sat, 12 Sep 2026 20:35:24 -0600 Subject: [PATCH 1/4] redesign(website): simplify /install to a single dependency step --- website/src/lib/highlight.ts | 8 +- website/src/pages/install.astro | 465 ++++++++++++++++++++------------ 2 files changed, 307 insertions(+), 166 deletions(-) diff --git a/website/src/lib/highlight.ts b/website/src/lib/highlight.ts index 6df94e6..77622c4 100644 --- a/website/src/lib/highlight.ts +++ b/website/src/lib/highlight.ts @@ -25,9 +25,15 @@ export const synapseTheme: ThemeRegistration = { const highlighter = await createHighlighter({ themes: [synapseTheme], - langs: ['java'], + langs: ['java', 'groovy', 'kotlin', 'properties'], }) export function highlightJava(code: string): string { return highlighter.codeToHtml(code, { lang: 'java', theme: synapseTheme }) } + +export type SnippetLang = 'java' | 'groovy' | 'kotlin' | 'properties'; + +export function highlightCode(code: string, lang: SnippetLang): string { + return highlighter.codeToHtml(code, { lang, theme: synapseTheme }) +} diff --git a/website/src/pages/install.astro b/website/src/pages/install.astro index 26432ad..00f677d 100644 --- a/website/src/pages/install.astro +++ b/website/src/pages/install.astro @@ -2,22 +2,43 @@ import BaseLayout from '~/components/layout/BaseLayout.astro'; import Nav from '~/components/layout/Nav.astro'; import Footer from '~/components/layout/Footer.astro'; +import { highlightCode } from '@/lib/highlight'; +import { Badge } from '@/components/ui/badge'; +import { buttonVariants } from '@/components/ui/button'; +import { ArrowRight, BookOpen, Check } from 'lucide-react'; -const groovy = `dependencies { - implementation 'com.aaravlabs:synapse:0.4.0' +const VERSION = '0.4.0'; + +const snippets = [ + { + id: 'groovy', + label: 'Gradle — Groovy', + file: 'build.dependencies.gradle', + code: `dependencies { + implementation 'com.aaravlabs:synapse:${VERSION}' // ... your other FTC deps -}`; +}`, + }, + { + id: 'kotlin', + label: 'Gradle — Kotlin DSL', + file: 'build.dependencies.gradle.kts', + code: `dependencies { + implementation("com.aaravlabs:synapse:${VERSION}") + // ... your other FTC deps +}`, + }, +].map((s) => ({ ...s, html: highlightCode(s.code, s.id as 'groovy' | 'kotlin') })); -const kotlinDsl = `dependencies { - implementation("com.aaravlabs:synapse:0.4.0") -}`; +const reassurances = [ + 'No token or credentials', + 'No repository changes', + 'R8-safe out of the box', +]; -const maven = ` - - com.aaravlabs - synapse - 0.4.0 -`; +const gprProps = `# ~/.gradle/gradle.properties (never commit) +githubUser= +githubToken=`; const gprGroovy = `repositories { mavenCentral() @@ -32,183 +53,297 @@ const gprGroovy = `repositories { } dependencies { - implementation 'com.aaravlabs:synapse:0.4.0' -}`; - -const gprKotlinDsl = `repositories { - mavenCentral() - google() - maven { - url = uri("https://maven.pkg.github.com/IamCoder18/synapse") - credentials { - username = (findProperty("githubUser") as String?) - ?: System.getenv("GITHUB_USER") - ?: System.getenv("GITHUB_ACTOR") - password = (findProperty("githubToken") as String?) - ?: System.getenv("GITHUB_TOKEN") - } - } -} - -dependencies { - implementation("com.aaravlabs:synapse:0.4.0") -}`; - -const gradleProps = `# ~/.gradle/gradle.properties (never commit) -githubUser= -githubToken=`; -const proguard = `# Already in the JAR. R8 keeps everything you need. --keep class com.aaravlabs.synapse.** { *; } --keep @com.aaravlabs.synapse.annotation.* class *`; - -const verify = `import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import com.aaravlabs.synapse.ftc.GamepadAdaptor; -import com.aaravlabs.synapse.ftc.SafeOpMode; - -@TeleOp(name = "MyFirstOpMode", group = "Synapse") -public class MyFirstOpMode extends SafeOpMode { - @Override protected void onSafeInit() { - // You now have: orchestrator, hardware, safeMap ready. - GamepadAdaptor.attach(orchestrator, gamepad1, "g1"); - } - @Override protected void onSafeLoop() { - telemetry.update(); - } + implementation 'com.aaravlabs:synapse:${VERSION}' }`; ---