'use client'; import { ComponentProps, ReactElement, useState } from 'react'; import { ButtonLink, SectionHeading, VideoModal } from '@nx/nx-dev/ui-common'; import { PlayIcon, CommandLineIcon, CpuChipIcon, } from '@heroicons/react/24/outline'; import { sendCustomEvent } from '@nx/nx-dev/feature-analytics'; import { cx } from '@nx/nx-dev/ui-primitives'; import { MovingBorder } from '@nx/nx-dev/ui-animations'; import { motion, AnimatePresence } from 'framer-motion'; import Image from 'next/image'; function PlayButton({ className, ...props }: ComponentProps<'div'>): ReactElement { const parent = { initial: { width: 82, transition: { when: 'afterChildren', }, }, hover: { width: 296, transition: { duration: 0.125, type: 'tween', ease: 'easeOut', }, }, }; const child = { initial: { opacity: 0, x: -6, }, hover: { x: 0, opacity: 1, transition: { duration: 0.015, type: 'tween', ease: 'easeOut', }, }, }; return (
); } interface AIFeature { id: string; title: string; description: string; icon: React.ComponentType>; videoUrl: string; thumbnailUrl: string; eventId: string; blogUrl?: string; } const aiFeatures: AIFeature[] = [ { id: 'vscode-copilot', title: 'Integrate with your LLM via MCP', description: 'Connect your AI assistants directly to your Nx workspace for deep project understanding.', icon: CpuChipIcon, videoUrl: 'https://youtu.be/RNilYmJJzdk', thumbnailUrl: '/images/ai/nx-copilot-mcp-yt-thumb.avif', eventId: 'nx-ai-vscode-video-click', blogUrl: '/blog/nx-mcp-vscode-copilot', }, { id: 'ci-fixes', title: 'CI integration and AI-powered fixes', description: 'Your LLM automatically diagnoses CI failures and suggests targeted fixes.', icon: ({ className, ...props }: React.ComponentProps<'svg'>) => ( ), videoUrl: 'https://youtu.be/fPqPh4h8RJg', thumbnailUrl: '/images/ai/ai-ci-fix-thumb.avif', eventId: 'nx-ai-ci-video-click', blogUrl: '/blog/nx-editor-ci-llm-integration', }, { id: 'terminal-integration', title: 'Active terminal task and log awareness', description: 'Give your LLM real-time visibility into running tasks and build outputs.', icon: CommandLineIcon, videoUrl: 'https://youtu.be/Cbc9_W5J6DA', thumbnailUrl: '/images/ai/terminal-llm-comm-thumb.avif', eventId: 'nx-ai-terminal-video-click', // blogUrl: '/blog/nx-editor-ci-llm-integration', }, { id: 'code-generation', title: 'Predictable code generation that works', description: 'Generate workspace-aware code that follows your patterns and architecture.', icon: ({ className, ...props }: React.ComponentProps<'svg'>) => ( ), videoUrl: 'https://youtu.be/PXNjedYhZDs', thumbnailUrl: '/images/ai/video-code-gen-and-ai-thumb.avif', eventId: 'nx-ai-codegen-video-click', blogUrl: '/blog/nx-generators-ai-integration', }, ]; export interface HeroProps { className?: string; } export function Hero(): JSX.Element { const [isOpen, setIsOpen] = useState(false); const [selectedFeature, setSelectedFeature] = useState( aiFeatures[0] ); const headingVariants = { hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0, transition: { duration: 0.6, ease: 'easeOut', }, }, }; return (
{/* Header Section */}
AI that{' '} actually works {' '}
for large codebases
{/* Interactive Video + Features Section */}
{/* Video Section */}
{`${selectedFeature.title}
{ setIsOpen(true); sendCustomEvent( selectedFeature.eventId, 'ai-landing-hero-video', 'ai-landing' ); }} />
{selectedFeature.blogUrl && ( sendCustomEvent( `${selectedFeature.eventId}-learn-more`, 'ai-landing-hero-learn-more', 'ai-landing' ) } > Learn more about {selectedFeature.title.toLowerCase()} )}
{/* Features Section */}
{aiFeatures.map((feature, index) => { const Icon = feature.icon; const isSelected = selectedFeature.id === feature.id; return ( ); })}
sendCustomEvent( 'ai-landing-enhance-click', 'ai-landing-hero', 'ai-landing' ) } > Enhance your AI assistant
setIsOpen(false)} videoUrl={selectedFeature.videoUrl} />
); }