From 30211a68b8df50e8a57fef578ac864960403d8ca Mon Sep 17 00:00:00 2001 From: Raushan Singh Date: Fri, 20 Feb 2026 13:30:17 +0530 Subject: [PATCH 1/7] Add landing page with hero, features, pricing, and more sections Replace root redirect with a full SaaS landing page composed of 9 section components (Navbar, Hero, Features, How It Works, Integrations, Testimonials, Pricing, CTA, Footer) plus tests. Reuses existing design system (gradient buttons, glassmorphic cards, floating orbs, Geist fonts). Auth-aware CTAs show "Go to Dashboard" for logged-in users. Co-Authored-By: Claude Opus 4.6 --- src/app/globals.css | 4 + src/app/page.tsx | 37 +- src/components/landing/CTASection.tsx | 38 ++ src/components/landing/FeaturesSection.tsx | 88 ++++ src/components/landing/FooterSection.tsx | 78 ++++ src/components/landing/HeroSection.tsx | 78 ++++ src/components/landing/HowItWorksSection.tsx | 73 ++++ .../landing/IntegrationsSection.tsx | 90 ++++ src/components/landing/LandingNavbar.tsx | 108 +++++ src/components/landing/PricingSection.tsx | 127 ++++++ .../landing/TestimonialsSection.tsx | 74 ++++ .../landing/__tests__/landing.test.tsx | 386 ++++++++++++++++++ 12 files changed, 1175 insertions(+), 6 deletions(-) create mode 100644 src/components/landing/CTASection.tsx create mode 100644 src/components/landing/FeaturesSection.tsx create mode 100644 src/components/landing/FooterSection.tsx create mode 100644 src/components/landing/HeroSection.tsx create mode 100644 src/components/landing/HowItWorksSection.tsx create mode 100644 src/components/landing/IntegrationsSection.tsx create mode 100644 src/components/landing/LandingNavbar.tsx create mode 100644 src/components/landing/PricingSection.tsx create mode 100644 src/components/landing/TestimonialsSection.tsx create mode 100644 src/components/landing/__tests__/landing.test.tsx diff --git a/src/app/globals.css b/src/app/globals.css index 25bbefa..5f09bf5 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -132,6 +132,10 @@ } @layer base { + html { + scroll-behavior: smooth; + scroll-padding-top: 5rem; + } * { @apply border-border; } diff --git a/src/app/page.tsx b/src/app/page.tsx index dc72454..b45eaee 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,13 +1,38 @@ -import { redirect } from "next/navigation"; import { getServerSession } from "next-auth"; import { authOptions } from "@/lib/auth"; +import { LandingNavbar } from "@/components/landing/LandingNavbar"; +import { HeroSection } from "@/components/landing/HeroSection"; +import { FeaturesSection } from "@/components/landing/FeaturesSection"; +import { HowItWorksSection } from "@/components/landing/HowItWorksSection"; +import { IntegrationsSection } from "@/components/landing/IntegrationsSection"; +import { TestimonialsSection } from "@/components/landing/TestimonialsSection"; +import { PricingSection } from "@/components/landing/PricingSection"; +import { CTASection } from "@/components/landing/CTASection"; +import { FooterSection } from "@/components/landing/FooterSection"; + +export const metadata = { + title: "FlowForge — AI-Powered Project Management for Dev Teams", + description: + "Ship software faster with AI code generation, GitHub integration, and smart sprint planning. FlowForge is the project management platform built for modern development teams.", +}; export default async function Home() { const session = await getServerSession(authOptions); + const isAuthenticated = !!session; - if (session) { - redirect("/dashboard"); - } else { - redirect("/login"); - } + return ( +
+ +
+ + + + + + + +
+ +
+ ); } diff --git a/src/components/landing/CTASection.tsx b/src/components/landing/CTASection.tsx new file mode 100644 index 0000000..547910f --- /dev/null +++ b/src/components/landing/CTASection.tsx @@ -0,0 +1,38 @@ +import Link from "next/link"; +import { ArrowRight } from "lucide-react"; +import { Button } from "@/components/ui/button"; + +export function CTASection({ isAuthenticated }: { isAuthenticated: boolean }) { + return ( +
+ {/* Background gradient */} +
+
+ +
+

+ Ready to automate your SDLC? +

+

+ Join thousands of developers shipping faster with FlowForge. Get + started for free — no credit card required. +

+ {isAuthenticated ? ( + + ) : ( + + )} +
+
+ ); +} diff --git a/src/components/landing/FeaturesSection.tsx b/src/components/landing/FeaturesSection.tsx new file mode 100644 index 0000000..b01432f --- /dev/null +++ b/src/components/landing/FeaturesSection.tsx @@ -0,0 +1,88 @@ +import { + Sparkles, + GitPullRequest, + LayoutDashboard, + Github, + Users, + Activity, +} from "lucide-react"; +import { Card, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"; + +const features = [ + { + icon: Sparkles, + title: "AI Code Generation", + description: + "Generate code, tests, and documentation with AI assistance directly from your tasks and user stories.", + }, + { + icon: GitPullRequest, + title: "PR Management", + description: + "Automatically link pull requests to tasks, track review status, and streamline your merge workflow.", + }, + { + icon: LayoutDashboard, + title: "Sprint Planning", + description: + "Plan and manage sprints with drag-and-drop boards, velocity tracking, and AI-powered estimations.", + }, + { + icon: Github, + title: "GitHub Integration", + description: + "Deep GitHub integration syncs repos, branches, issues, and PRs in real time with your project board.", + }, + { + icon: Users, + title: "Team Collaboration", + description: + "Invite team members, assign tasks, and collaborate with comments, mentions, and real-time updates.", + }, + { + icon: Activity, + title: "Activity Tracking", + description: + "Track every action across your project with a detailed activity feed and analytics dashboard.", + }, +]; + +export function FeaturesSection() { + return ( +
+
+
+

+ Everything you need to{" "} + ship faster +

+

+ A complete project management platform built for modern development + teams, powered by AI. +

+
+ +
+ {features.map((feature, index) => ( + +
+ +
+ +
+ {feature.title} + + {feature.description} + +
+ + ))} +
+
+
+ ); +} diff --git a/src/components/landing/FooterSection.tsx b/src/components/landing/FooterSection.tsx new file mode 100644 index 0000000..d5c453d --- /dev/null +++ b/src/components/landing/FooterSection.tsx @@ -0,0 +1,78 @@ +import Link from "next/link"; +import { Workflow } from "lucide-react"; + +const footerLinks = { + Product: [ + { label: "Features", href: "#features" }, + { label: "Integrations", href: "#integrations" }, + { label: "Pricing", href: "#pricing" }, + { label: "Changelog", href: "#" }, + ], + Company: [ + { label: "About", href: "#" }, + { label: "Blog", href: "#" }, + { label: "Careers", href: "#" }, + { label: "Contact", href: "#" }, + ], + Legal: [ + { label: "Privacy Policy", href: "#" }, + { label: "Terms of Service", href: "#" }, + { label: "Cookie Policy", href: "#" }, + ], + Developers: [ + { label: "Documentation", href: "#" }, + { label: "API Reference", href: "#" }, + { label: "GitHub", href: "https://github.com" }, + ], +}; + +export function FooterSection() { + return ( +
+
+
+ {/* Brand */} +
+ +
+ +
+ FlowForge + +

+ AI-powered project management for modern development teams. +

+
+ + {/* Link columns */} + {Object.entries(footerLinks).map(([category, links]) => ( +
+

{category}

+
    + {links.map((link) => ( +
  • + + {link.label} + +
  • + ))} +
+
+ ))} +
+ +
+

+ © {new Date().getFullYear()} FlowForge. All rights reserved. +

+

+ Built with Next.js, Tailwind CSS, and AI. +

+
+
+
+ ); +} diff --git a/src/components/landing/HeroSection.tsx b/src/components/landing/HeroSection.tsx new file mode 100644 index 0000000..8a873f1 --- /dev/null +++ b/src/components/landing/HeroSection.tsx @@ -0,0 +1,78 @@ +import Link from "next/link"; +import { ArrowRight, Sparkles } from "lucide-react"; +import { Button } from "@/components/ui/button"; +import { Badge } from "@/components/ui/badge"; + +export function HeroSection({ isAuthenticated }: { isAuthenticated: boolean }) { + return ( +
+ {/* Background gradient */} +
+ + {/* Floating orbs */} +
+
+
+ +
+
+ + + AI-Powered Project Management + +
+ +

+ Ship Software Faster with{" "} + + AI-Powered + {" "} + Project Management +

+ +

+ FlowForge combines AI code generation, GitHub integration, and smart + sprint planning to help your team deliver software faster than ever. +

+ +
+ {isAuthenticated ? ( + + ) : ( + <> + + + + )} +
+
+
+ ); +} diff --git a/src/components/landing/HowItWorksSection.tsx b/src/components/landing/HowItWorksSection.tsx new file mode 100644 index 0000000..e5f5676 --- /dev/null +++ b/src/components/landing/HowItWorksSection.tsx @@ -0,0 +1,73 @@ +import { Github, ListChecks, Rocket } from "lucide-react"; + +const steps = [ + { + number: "1", + icon: Github, + title: "Connect GitHub", + description: + "Sign in with GitHub and connect your repositories. FlowForge syncs your repos, branches, and pull requests automatically.", + }, + { + number: "2", + icon: ListChecks, + title: "Create Tasks", + description: + "Break down your project into tasks and user stories. Use AI to generate subtasks, estimates, and even code scaffolding.", + }, + { + number: "3", + icon: Rocket, + title: "Ship with Confidence", + description: + "Track progress across sprints, review PRs in context, and deploy knowing every task has been completed and tested.", + }, +]; + +export function HowItWorksSection() { + return ( +
+
+
+

+ Get started in{" "} + three simple steps +

+

+ From zero to productive in minutes — no complex setup required. +

+
+ +
+ {steps.map((step, index) => ( +
+ {/* Connector line (desktop only) */} + {index < steps.length - 1 && ( +
+ )} + +
+
+
+ +
+ + {step.number} + +
+ +

{step.title}

+

+ {step.description} +

+
+ ))} +
+
+
+ ); +} diff --git a/src/components/landing/IntegrationsSection.tsx b/src/components/landing/IntegrationsSection.tsx new file mode 100644 index 0000000..64a686f --- /dev/null +++ b/src/components/landing/IntegrationsSection.tsx @@ -0,0 +1,90 @@ +import { Github } from "lucide-react"; +import { Card, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; + +const integrations = [ + { + name: "GitHub", + description: + "Full integration with repositories, pull requests, issues, and Actions. Your entire workflow in one place.", + icon: Github, + status: "live" as const, + }, + { + name: "Jira", + description: + "Import existing Jira projects and sync tasks bi-directionally to ease your migration.", + icon: null, + status: "coming-soon" as const, + }, + { + name: "GitLab", + description: + "Connect GitLab repositories and merge requests for teams using GitLab as their primary platform.", + icon: null, + status: "coming-soon" as const, + }, + { + name: "Slack", + description: + "Get real-time notifications, create tasks from messages, and keep your team in sync.", + icon: null, + status: "coming-soon" as const, + }, +]; + +export function IntegrationsSection() { + return ( +
+
+
+

+ Integrates with your{" "} + favorite tools +

+

+ Connect the tools you already use and love. More integrations coming + soon. +

+
+ +
+ {integrations.map((integration, index) => ( + + +
+
+ {integration.icon ? ( + + ) : ( + + {integration.name[0]} + + )} +
+ {integration.status === "live" ? ( + Live + ) : ( + Coming Soon + )} +
+ {integration.name} + + {integration.description} + +
+
+ ))} +
+
+
+ ); +} diff --git a/src/components/landing/LandingNavbar.tsx b/src/components/landing/LandingNavbar.tsx new file mode 100644 index 0000000..33f91ee --- /dev/null +++ b/src/components/landing/LandingNavbar.tsx @@ -0,0 +1,108 @@ +"use client"; + +import { useState } from "react"; +import Link from "next/link"; +import { Workflow, Menu, X } from "lucide-react"; +import { Button } from "@/components/ui/button"; +import { ThemeToggle } from "@/components/layout/ThemeToggle"; + +const navLinks = [ + { label: "Features", href: "#features" }, + { label: "How It Works", href: "#how-it-works" }, + { label: "Integrations", href: "#integrations" }, + { label: "Pricing", href: "#pricing" }, +]; + +export function LandingNavbar({ isAuthenticated }: { isAuthenticated: boolean }) { + const [mobileOpen, setMobileOpen] = useState(false); + + return ( +
+
+ {/* Logo */} + +
+ +
+ + FlowForge + + + + {/* Desktop Nav */} + + + {/* Desktop Actions */} +
+ + {isAuthenticated ? ( + + ) : ( + <> + + + + )} +
+ + {/* Mobile Menu Button */} +
+ + +
+
+ + {/* Mobile Menu */} + {mobileOpen && ( +
+
+ {navLinks.map((link) => ( + setMobileOpen(false)} + className="block text-sm font-medium text-muted-foreground hover:text-foreground transition-colors py-2" + > + {link.label} + + ))} +
+ {isAuthenticated ? ( + + ) : ( + <> + + + + )} +
+
+
+ )} +
+ ); +} diff --git a/src/components/landing/PricingSection.tsx b/src/components/landing/PricingSection.tsx new file mode 100644 index 0000000..2eacaf5 --- /dev/null +++ b/src/components/landing/PricingSection.tsx @@ -0,0 +1,127 @@ +import Link from "next/link"; +import { Check } from "lucide-react"; +import { Button } from "@/components/ui/button"; +import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@/components/ui/card"; +import { Badge } from "@/components/ui/badge"; + +const tiers = [ + { + name: "Free", + price: "$0", + period: "forever", + description: "Perfect for individual developers and small side projects.", + features: [ + "Up to 3 projects", + "GitHub integration", + "Basic AI suggestions", + "Activity tracking", + "Community support", + ], + cta: "Get Started", + href: "/login", + highlighted: false, + }, + { + name: "Pro", + price: "$12", + period: "per user / month", + description: "For growing teams that need advanced AI and collaboration features.", + features: [ + "Unlimited projects", + "Advanced AI code generation", + "Sprint analytics & velocity", + "Priority PR management", + "Team collaboration tools", + "Priority support", + ], + cta: "Start Free Trial", + href: "/login", + highlighted: true, + }, + { + name: "Enterprise", + price: "Custom", + period: "contact sales", + description: "For organizations that need advanced security, compliance, and support.", + features: [ + "Everything in Pro", + "SSO / SAML authentication", + "Custom integrations", + "Dedicated account manager", + "SLA guarantees", + "On-premise deployment", + ], + cta: "Contact Sales", + href: "mailto:sales@flowforge.dev", + highlighted: false, + }, +]; + +export function PricingSection() { + return ( +
+
+
+

+ Simple, transparent{" "} + pricing +

+

+ Start free and scale as your team grows. No hidden fees. +

+
+ +
+ {tiers.map((tier, index) => ( + + {tier.highlighted && ( +
+ Most Popular +
+ )} + + {tier.name} +
+ {tier.price} + + {tier.period} + +
+ + {tier.description} + +
+ +
    + {tier.features.map((feature) => ( +
  • + + {feature} +
  • + ))} +
+
+ + + +
+ ))} +
+
+
+ ); +} diff --git a/src/components/landing/TestimonialsSection.tsx b/src/components/landing/TestimonialsSection.tsx new file mode 100644 index 0000000..75081dc --- /dev/null +++ b/src/components/landing/TestimonialsSection.tsx @@ -0,0 +1,74 @@ +import { Card, CardContent } from "@/components/ui/card"; +import { Star } from "lucide-react"; + +const testimonials = [ + { + quote: + "FlowForge cut our sprint planning time in half. The AI suggestions are surprisingly accurate and the GitHub integration is seamless.", + author: "Sarah Chen", + role: "Engineering Lead", + company: "TechStart", + }, + { + quote: + "We switched from Jira and never looked back. The AI code generation feature alone saves us hours every week.", + author: "Marcus Johnson", + role: "CTO", + company: "DevScale", + }, + { + quote: + "Finally, a project management tool that understands how developers actually work. The PR tracking is a game-changer.", + author: "Priya Patel", + role: "Senior Developer", + company: "CloudNine", + }, +]; + +export function TestimonialsSection() { + return ( +
+
+
+

+ Loved by{" "} + development teams +

+

+ See what teams are saying about FlowForge. +

+
+ +
+ {testimonials.map((testimonial, index) => ( + + +
+ {Array.from({ length: 5 }).map((_, i) => ( + + ))} +
+
+ “{testimonial.quote}” +
+
+

{testimonial.author}

+

+ {testimonial.role}, {testimonial.company} +

+
+
+
+ ))} +
+
+
+ ); +} diff --git a/src/components/landing/__tests__/landing.test.tsx b/src/components/landing/__tests__/landing.test.tsx new file mode 100644 index 0000000..e190aa4 --- /dev/null +++ b/src/components/landing/__tests__/landing.test.tsx @@ -0,0 +1,386 @@ +/** + * @jest-environment node + * + * Landing page tests. + * Tests component structure, data integrity, section consistency, and page composition. + * (Render tests require @testing-library/react + jsdom which aren't currently installed.) + */ + +import * as fs from 'fs'; +import * as path from 'path'; + +function readComponent(fileName: string): string { + return fs.readFileSync(path.resolve(__dirname, '..', fileName), 'utf8'); +} + +function readAppFile(fileName: string): string { + return fs.readFileSync(path.resolve(__dirname, '../../../app', fileName), 'utf8'); +} + +// Test all component files exist +describe('Landing component files', () => { + const expectedFiles = [ + 'LandingNavbar.tsx', + 'HeroSection.tsx', + 'FeaturesSection.tsx', + 'HowItWorksSection.tsx', + 'IntegrationsSection.tsx', + 'TestimonialsSection.tsx', + 'PricingSection.tsx', + 'CTASection.tsx', + 'FooterSection.tsx', + ]; + + it.each(expectedFiles)('%s exists', (file) => { + const filePath = path.resolve(__dirname, '..', file); + expect(fs.existsSync(filePath)).toBe(true); + }); +}); + +// Test FeaturesSection data integrity +describe('FeaturesSection data', () => { + it('has exactly 6 features', () => { + const source = readComponent('FeaturesSection.tsx'); + const featureMatches = source.match(/title:\s*"/g); + expect(featureMatches).toHaveLength(6); + }); + + it('includes expected feature titles', () => { + const source = readComponent('FeaturesSection.tsx'); + const expectedTitles = [ + 'AI Code Generation', + 'PR Management', + 'Sprint Planning', + 'GitHub Integration', + 'Team Collaboration', + 'Activity Tracking', + ]; + for (const title of expectedTitles) { + expect(source).toContain(title); + } + }); +}); + +// Test PricingSection data integrity +describe('PricingSection data', () => { + it('has 3 pricing tiers', () => { + const source = readComponent('PricingSection.tsx'); + const tierNames = ['Free', 'Pro', 'Enterprise']; + for (const name of tierNames) { + expect(source).toContain(`name: "${name}"`); + } + }); + + it('Pro tier is highlighted', () => { + const source = readComponent('PricingSection.tsx'); + const proSection = source.substring( + source.indexOf('name: "Pro"'), + source.indexOf('name: "Enterprise"') + ); + expect(proSection).toContain('highlighted: true'); + }); +}); + +// Test HowItWorksSection data integrity +describe('HowItWorksSection data', () => { + it('has 3 steps', () => { + const source = readComponent('HowItWorksSection.tsx'); + const stepTitles = ['Connect GitHub', 'Create Tasks', 'Ship with Confidence']; + for (const title of stepTitles) { + expect(source).toContain(title); + } + }); +}); + +// Test IntegrationsSection data integrity +describe('IntegrationsSection data', () => { + it('has GitHub as live integration', () => { + const source = readComponent('IntegrationsSection.tsx'); + const githubSection = source.substring( + source.indexOf('name: "GitHub"'), + source.indexOf('name: "Jira"') + ); + expect(githubSection).toContain('"live"'); + }); + + it('has Jira, GitLab, and Slack as coming-soon', () => { + const source = readComponent('IntegrationsSection.tsx'); + for (const name of ['Jira', 'GitLab', 'Slack']) { + expect(source).toContain(`name: "${name}"`); + } + const afterGithub = source.substring(source.indexOf('name: "Jira"')); + const comingSoonMatches = afterGithub.match(/"coming-soon"/g); + expect(comingSoonMatches).toHaveLength(3); + }); +}); + +// Test LandingNavbar has correct anchor links +describe('LandingNavbar navigation', () => { + it('has anchor links to all major sections', () => { + const source = readComponent('LandingNavbar.tsx'); + const expectedAnchors = ['#features', '#how-it-works', '#integrations', '#pricing']; + for (const anchor of expectedAnchors) { + expect(source).toContain(anchor); + } + }); +}); + +// Test auth-aware behavior (source-level checks) +describe('Auth-aware components', () => { + it('HeroSection accepts isAuthenticated prop', () => { + const source = readComponent('HeroSection.tsx'); + expect(source).toContain('isAuthenticated'); + expect(source).toContain('Go to Dashboard'); + expect(source).toContain('Get Started Free'); + }); + + it('CTASection accepts isAuthenticated prop', () => { + const source = readComponent('CTASection.tsx'); + expect(source).toContain('isAuthenticated'); + expect(source).toContain('Go to Dashboard'); + expect(source).toContain('Get Started Free'); + }); + + it('LandingNavbar accepts isAuthenticated prop', () => { + const source = readComponent('LandingNavbar.tsx'); + expect(source).toContain('isAuthenticated'); + expect(source).toContain('Go to Dashboard'); + expect(source).toContain('Sign In'); + expect(source).toContain('Get Started'); + }); +}); + +// Test page.tsx composition +describe('Landing page composition (page.tsx)', () => { + it('imports all landing components', () => { + const source = readAppFile('page.tsx'); + const expectedImports = [ + 'LandingNavbar', + 'HeroSection', + 'FeaturesSection', + 'HowItWorksSection', + 'IntegrationsSection', + 'TestimonialsSection', + 'PricingSection', + 'CTASection', + 'FooterSection', + ]; + for (const imp of expectedImports) { + expect(source).toContain(imp); + } + }); + + it('uses getServerSession for auth', () => { + const source = readAppFile('page.tsx'); + expect(source).toContain('getServerSession'); + expect(source).toContain('authOptions'); + expect(source).toContain('isAuthenticated'); + }); + + it('has SEO metadata', () => { + const source = readAppFile('page.tsx'); + expect(source).toContain('export const metadata'); + expect(source).toContain('title:'); + expect(source).toContain('description:'); + }); + + it('does not redirect anymore', () => { + const source = readAppFile('page.tsx'); + expect(source).not.toContain('redirect("/login")'); + expect(source).not.toContain('redirect("/dashboard")'); + }); +}); + +// Test globals.css has smooth scrolling +describe('globals.css smooth scrolling', () => { + it('includes scroll-behavior: smooth', () => { + const source = readAppFile('globals.css'); + expect(source).toContain('scroll-behavior: smooth'); + }); + + it('includes scroll-padding-top for sticky nav offset', () => { + const source = readAppFile('globals.css'); + expect(source).toContain('scroll-padding-top'); + }); +}); + +// Test section IDs match navbar anchors +describe('Section ID consistency', () => { + it('all navbar anchors have matching section IDs', () => { + const navbarSource = readComponent('LandingNavbar.tsx'); + + const anchorRegex = /href:\s*"(#[^"]+)"/g; + const anchors: string[] = []; + let match; + while ((match = anchorRegex.exec(navbarSource)) !== null) { + anchors.push(match[1].substring(1)); // Remove the '#' + } + + expect(anchors.length).toBeGreaterThan(0); + + const sectionFiles: Record = { + features: 'FeaturesSection.tsx', + 'how-it-works': 'HowItWorksSection.tsx', + integrations: 'IntegrationsSection.tsx', + pricing: 'PricingSection.tsx', + }; + + for (const anchor of anchors) { + const fileName = sectionFiles[anchor]; + expect(fileName).toBeDefined(); + const sectionSource = readComponent(fileName); + expect(sectionSource).toContain(`id="${anchor}"`); + } + }); +}); + +// Test TestimonialsSection data +describe('TestimonialsSection data', () => { + it('has 3 testimonials', () => { + const source = readComponent('TestimonialsSection.tsx'); + const quoteMatches = source.match(/quote:/g); + expect(quoteMatches).toHaveLength(3); + }); +}); + +// Test FooterSection structure +describe('FooterSection structure', () => { + it('has the expected footer link categories', () => { + const source = readComponent('FooterSection.tsx'); + for (const category of ['Product', 'Company', 'Legal', 'Developers']) { + expect(source).toContain(category); + } + }); + + it('includes copyright notice', () => { + const source = readComponent('FooterSection.tsx'); + expect(source).toContain('FlowForge'); + expect(source).toContain('All rights reserved'); + }); +}); + +// Test design system consistency +describe('Design system usage', () => { + it('LandingNavbar uses sticky header blur pattern', () => { + const source = readComponent('LandingNavbar.tsx'); + expect(source).toContain('sticky top-0 z-50'); + expect(source).toContain('backdrop-blur'); + expect(source).toContain('border-border/40'); + }); + + it('HeroSection uses floating orb pattern', () => { + const source = readComponent('HeroSection.tsx'); + expect(source).toContain('blur-3xl'); + expect(source).toContain('animate-float'); + expect(source).toContain('rounded-full'); + }); + + it('HeroSection uses gradient text', () => { + const source = readComponent('HeroSection.tsx'); + expect(source).toContain('bg-gradient-to-r'); + expect(source).toContain('bg-clip-text'); + expect(source).toContain('text-transparent'); + }); + + it('FeaturesSection uses gradient icon containers', () => { + const source = readComponent('FeaturesSection.tsx'); + expect(source).toContain('from-[hsl(var(--gradient-start))]'); + expect(source).toContain('to-[hsl(var(--gradient-end))]'); + }); + + it('components use gradient-text utility class', () => { + for (const file of ['FeaturesSection.tsx', 'HowItWorksSection.tsx', 'IntegrationsSection.tsx', 'PricingSection.tsx']) { + const source = readComponent(file); + expect(source).toContain('gradient-text'); + } + }); + + it('uses Button variant="gradient" for primary CTAs', () => { + const source = readComponent('HeroSection.tsx'); + expect(source).toContain('variant="gradient"'); + }); + + it('uses Badge variant="ai" in HeroSection', () => { + const source = readComponent('HeroSection.tsx'); + expect(source).toContain('variant="ai"'); + }); + + it('LandingNavbar is a client component', () => { + const source = readComponent('LandingNavbar.tsx'); + expect(source).toContain('"use client"'); + }); + + it('server components do not have "use client" directive', () => { + const serverComponents = [ + 'HeroSection.tsx', + 'FeaturesSection.tsx', + 'HowItWorksSection.tsx', + 'IntegrationsSection.tsx', + 'TestimonialsSection.tsx', + 'PricingSection.tsx', + 'CTASection.tsx', + 'FooterSection.tsx', + ]; + for (const file of serverComponents) { + const source = readComponent(file); + expect(source).not.toContain('"use client"'); + } + }); +}); + +// Test responsive design patterns +describe('Responsive design', () => { + it('page uses max-w-7xl container pattern', () => { + const components = [ + 'LandingNavbar.tsx', + 'HeroSection.tsx', + 'FeaturesSection.tsx', + 'HowItWorksSection.tsx', + 'IntegrationsSection.tsx', + 'PricingSection.tsx', + 'CTASection.tsx', + 'FooterSection.tsx', + ]; + for (const file of components) { + const source = readComponent(file); + expect(source).toContain('max-w-7xl'); + } + }); + + it('LandingNavbar has mobile hamburger menu', () => { + const source = readComponent('LandingNavbar.tsx'); + expect(source).toContain('mobileOpen'); + expect(source).toContain('md:hidden'); + expect(source).toContain('hidden md:flex'); + }); + + it('FeaturesSection uses responsive grid', () => { + const source = readComponent('FeaturesSection.tsx'); + expect(source).toContain('grid-cols-1'); + expect(source).toContain('md:grid-cols-2'); + expect(source).toContain('lg:grid-cols-3'); + }); + + it('PricingSection uses responsive grid', () => { + const source = readComponent('PricingSection.tsx'); + expect(source).toContain('grid-cols-1'); + expect(source).toContain('md:grid-cols-3'); + }); +}); + +// Test links point to correct routes +describe('CTA link destinations', () => { + it('authenticated CTAs link to /dashboard', () => { + for (const file of ['HeroSection.tsx', 'CTASection.tsx', 'LandingNavbar.tsx']) { + const source = readComponent(file); + expect(source).toContain('href="/dashboard"'); + } + }); + + it('unauthenticated CTAs link to /login', () => { + for (const file of ['HeroSection.tsx', 'CTASection.tsx', 'LandingNavbar.tsx']) { + const source = readComponent(file); + expect(source).toContain('href="/login"'); + } + }); +}); From 95a53c2145295cc80c47a9450f1c0b92e07b7e9b Mon Sep 17 00:00:00 2001 From: Raushan Singh Date: Sun, 22 Feb 2026 12:56:23 +0530 Subject: [PATCH 2/7] Add sprint selector to dashboard and disable AI features when AI is off - Add sprint select dropdown on KanbanBoard to filter tasks by sprint, with active sprint selected by default - Query aiEnabled from ProjectAISettings on all project pages - Disable AI buttons (Estimate, Generate Prompt, Execute Task, AI Plan, AI Retrospective, Risk Assessment) when AI is disabled, showing descriptive tooltips on hover explaining what each feature does Co-Authored-By: Claude Opus 4.6 --- src/app/project/[projectId]/page.tsx | 19 +++++ .../[projectId]/sprint/[sprintId]/page.tsx | 8 ++ src/app/project/[projectId]/sprint/page.tsx | 9 ++- .../[projectId]/task/[taskId]/page.tsx | 9 ++- src/components/sprint/ai-plan-dialog.tsx | 25 ++++++ src/components/sprint/ai-retro-view.tsx | 25 ++++++ src/components/sprint/risk-dashboard.tsx | 26 +++++- src/components/sprints/SprintBoard.tsx | 5 ++ src/components/sprints/SprintCard.tsx | 6 +- src/components/sprints/SprintList.tsx | 4 +- src/components/sprints/SprintListPage.tsx | 4 +- src/components/task/ai-estimate-badge.tsx | 32 ++++++++ src/components/tasks/KanbanBoard.tsx | 69 +++++++++++++++- src/components/tasks/KanbanColumn.tsx | 5 +- src/components/tasks/TaskCard.tsx | 4 +- src/components/tasks/TaskDetail.tsx | 80 +++++++++++++++---- 16 files changed, 300 insertions(+), 30 deletions(-) diff --git a/src/app/project/[projectId]/page.tsx b/src/app/project/[projectId]/page.tsx index 43f1d79..734653b 100644 --- a/src/app/project/[projectId]/page.tsx +++ b/src/app/project/[projectId]/page.tsx @@ -78,6 +78,22 @@ export default async function ProjectPage({ params }: ProjectPageProps) { notFound(); } + // Fetch sprints for the project + const sprints = await prisma.sprint.findMany({ + where: { projectId: project.id }, + select: { id: true, name: true, status: true }, + orderBy: { startDate: "desc" }, + }); + + const activeSprint = sprints.find((s) => s.status === "ACTIVE"); + + // Check if AI is enabled for this project + const aiSettings = await prisma.projectAISettings.findUnique({ + where: { projectId: project.id }, + select: { aiEnabled: true }, + }); + const aiEnabled = aiSettings?.aiEnabled ?? false; + const projects = await prisma.project.findMany({ where: { OR: [ @@ -158,8 +174,11 @@ export default async function ProjectPage({ params }: ProjectPageProps) { ...task, projectId: project.id, }))} + sprints={sprints} + defaultSprintId={activeSprint?.id ?? null} wipLimits={(project.wipLimits as Record) || {}} boardColumns={(project.boardColumns as unknown as BoardColumn[]) || null} + aiEnabled={aiEnabled} members={[ // Include project owner (if personal project) ...(project.user ? [{ id: project.user.id, name: project.user.name, image: project.user.image }] : []), diff --git a/src/app/project/[projectId]/sprint/[sprintId]/page.tsx b/src/app/project/[projectId]/sprint/[sprintId]/page.tsx index 2cf3229..a722e87 100644 --- a/src/app/project/[projectId]/sprint/[sprintId]/page.tsx +++ b/src/app/project/[projectId]/sprint/[sprintId]/page.tsx @@ -115,6 +115,13 @@ export default async function SprintDetailPage({ params }: SprintDetailPageProps }, }; + // Check if AI is enabled for this project + const aiSettings = await prisma.projectAISettings.findUnique({ + where: { projectId: project.id }, + select: { aiEnabled: true }, + }); + const aiEnabled = aiSettings?.aiEnabled ?? false; + const projects = await prisma.project.findMany({ where: { OR: [ @@ -161,6 +168,7 @@ export default async function SprintDetailPage({ params }: SprintDetailPageProps projectKey={project.projectKey} sprintTasks={sprintTasks} backlogTasks={backlogTasks} + aiEnabled={aiEnabled} /> diff --git a/src/app/project/[projectId]/sprint/page.tsx b/src/app/project/[projectId]/sprint/page.tsx index 6deee95..f11fee0 100644 --- a/src/app/project/[projectId]/sprint/page.tsx +++ b/src/app/project/[projectId]/sprint/page.tsx @@ -82,6 +82,13 @@ export default async function SprintPage({ params }: SprintPageProps) { }; }); + // Check if AI is enabled for this project + const aiSettings = await prisma.projectAISettings.findUnique({ + where: { projectId: project.id }, + select: { aiEnabled: true }, + }); + const aiEnabled = aiSettings?.aiEnabled ?? false; + const projects = await prisma.project.findMany({ where: { OR: [ @@ -117,7 +124,7 @@ export default async function SprintPage({ params }: SprintPageProps) {
- +
diff --git a/src/app/project/[projectId]/task/[taskId]/page.tsx b/src/app/project/[projectId]/task/[taskId]/page.tsx index 46c800d..ee6176c 100644 --- a/src/app/project/[projectId]/task/[taskId]/page.tsx +++ b/src/app/project/[projectId]/task/[taskId]/page.tsx @@ -108,6 +108,13 @@ export default async function TaskPage({ params }: TaskPageProps) { }, }; + // Check if AI is enabled for this project + const aiSettings = await prisma.projectAISettings.findUnique({ + where: { projectId: task.projectId }, + select: { aiEnabled: true }, + }); + const aiEnabled = aiSettings?.aiEnabled ?? false; + const projects = await prisma.project.findMany({ where: { OR: [ @@ -125,7 +132,7 @@ export default async function TaskPage({ params }: TaskPageProps) {
- +
diff --git a/src/components/sprint/ai-plan-dialog.tsx b/src/components/sprint/ai-plan-dialog.tsx index af41302..e6e1732 100644 --- a/src/components/sprint/ai-plan-dialog.tsx +++ b/src/components/sprint/ai-plan-dialog.tsx @@ -17,6 +17,11 @@ import { Progress } from "@/components/ui/progress"; import { Card, CardContent } from "@/components/ui/card"; import { Checkbox } from "@/components/ui/checkbox"; import { ScrollArea } from "@/components/ui/scroll-area"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "@/components/ui/tooltip"; import { Sparkles, Loader2, @@ -72,6 +77,7 @@ interface AIPlanDialogProps { sprintName: string; sprintStatus: string; teamMembers?: TeamMember[]; + aiEnabled?: boolean; onPlanApplied?: () => void; } @@ -80,6 +86,7 @@ export function AIPlanDialog({ sprintName, sprintStatus, teamMembers = [], + aiEnabled = true, onPlanApplied, }: AIPlanDialogProps) { const router = useRouter(); @@ -204,6 +211,24 @@ export function AIPlanDialog({ .reduce((sum, t) => sum + (t.storyPoints || 0), 0) : 0; + if (!aiEnabled) { + return ( + + + + + + + +

AI Plan uses AI to analyze your backlog and suggest optimal task selection based on team capacity and velocity. Enable AI in project settings to use this feature.

+
+
+ ); + } + return ( diff --git a/src/components/sprint/ai-retro-view.tsx b/src/components/sprint/ai-retro-view.tsx index c03ad53..3c67c40 100644 --- a/src/components/sprint/ai-retro-view.tsx +++ b/src/components/sprint/ai-retro-view.tsx @@ -15,6 +15,11 @@ import { Progress } from "@/components/ui/progress"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "@/components/ui/tooltip"; import { Sparkles, Loader2, @@ -98,11 +103,13 @@ interface SprintRetrospective { interface AIRetroViewProps { sprintId: string; sprintName: string; + aiEnabled?: boolean; } export function AIRetroView({ sprintId, sprintName, + aiEnabled = true, }: AIRetroViewProps) { const [open, setOpen] = useState(false); const [isLoading, setIsLoading] = useState(false); @@ -189,6 +196,24 @@ export function AIRetroView({ } }; + if (!aiEnabled) { + return ( + + + + + + + +

AI Retrospective generates insights from sprint data including achievements, challenges, and action items. Enable AI in project settings to use this feature.

+
+
+ ); + } + return ( diff --git a/src/components/sprint/risk-dashboard.tsx b/src/components/sprint/risk-dashboard.tsx index 422cc78..f64c25d 100644 --- a/src/components/sprint/risk-dashboard.tsx +++ b/src/components/sprint/risk-dashboard.tsx @@ -15,6 +15,11 @@ import { Progress } from "@/components/ui/progress"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "@/components/ui/tooltip"; import { AlertTriangle, Loader2, @@ -102,9 +107,10 @@ interface SprintRiskAssessment { interface RiskDashboardProps { sprintId: string; sprintName: string; + aiEnabled?: boolean; } -export function RiskDashboard({ sprintId, sprintName }: RiskDashboardProps) { +export function RiskDashboard({ sprintId, sprintName, aiEnabled = true }: RiskDashboardProps) { const [open, setOpen] = useState(false); const [isLoading, setIsLoading] = useState(false); const [assessment, setAssessment] = useState(null); @@ -187,6 +193,24 @@ export function RiskDashboard({ sprintId, sprintName }: RiskDashboardProps) { return "text-red-500"; }; + if (!aiEnabled) { + return ( + + + + + + + +

Risk Assessment uses AI to analyze sprint risks, dependencies, and success probability. Enable AI in project settings to use this feature.

+
+
+ ); + } + return ( diff --git a/src/components/sprints/SprintBoard.tsx b/src/components/sprints/SprintBoard.tsx index 6225c74..1862221 100644 --- a/src/components/sprints/SprintBoard.tsx +++ b/src/components/sprints/SprintBoard.tsx @@ -81,6 +81,7 @@ interface SprintBoardProps { projectKey?: string; sprintTasks: Task[]; backlogTasks: Task[]; + aiEnabled?: boolean; } function DroppableColumn({ @@ -122,6 +123,7 @@ export function SprintBoard({ sprint, sprintTasks: initialSprintTasks, backlogTasks: initialBacklogTasks, + aiEnabled, }: SprintBoardProps) { const router = useRouter(); const [sprintTasks, setSprintTasks] = useState(initialSprintTasks); @@ -258,6 +260,7 @@ export function SprintBoard({ sprintId={sprint.id} sprintName={sprint.name} sprintStatus={sprint.status} + aiEnabled={aiEnabled} /> @@ -287,6 +290,7 @@ export function SprintBoard({ @@ -317,6 +321,7 @@ export function SprintBoard({ diff --git a/src/components/sprints/SprintCard.tsx b/src/components/sprints/SprintCard.tsx index 200b13e..4ab7e55 100644 --- a/src/components/sprints/SprintCard.tsx +++ b/src/components/sprints/SprintCard.tsx @@ -49,6 +49,7 @@ interface SprintCardProps { stats: SprintStats; }; projectKey?: string; + aiEnabled?: boolean; onStart?: () => void; onComplete?: () => void; onDelete?: () => void; @@ -60,7 +61,7 @@ const statusConfig: Record @@ -115,6 +117,7 @@ export function SprintCard({ sprint, projectKey, onStart, onComplete, onDelete } @@ -131,6 +134,7 @@ export function SprintCard({ sprint, projectKey, onStart, onComplete, onDelete } diff --git a/src/components/sprints/SprintList.tsx b/src/components/sprints/SprintList.tsx index 6ac86da..8f77428 100644 --- a/src/components/sprints/SprintList.tsx +++ b/src/components/sprints/SprintList.tsx @@ -40,10 +40,11 @@ interface Sprint { interface SprintListProps { sprints: Sprint[]; projectKey?: string; + aiEnabled?: boolean; onCreateSprint?: () => void; } -export function SprintList({ sprints, projectKey, onCreateSprint }: SprintListProps) { +export function SprintList({ sprints, projectKey, aiEnabled, onCreateSprint }: SprintListProps) { const router = useRouter(); const [loading, setLoading] = useState(null); const [deleteConfirm, setDeleteConfirm] = useState(null); @@ -131,6 +132,7 @@ export function SprintList({ sprints, projectKey, onCreateSprint }: SprintListPr handleStart(sprint.id)} onComplete={() => handleComplete(sprint.id)} onDelete={() => setDeleteConfirm(sprint)} diff --git a/src/components/sprints/SprintListPage.tsx b/src/components/sprints/SprintListPage.tsx index 1e5e664..6a88cca 100644 --- a/src/components/sprints/SprintListPage.tsx +++ b/src/components/sprints/SprintListPage.tsx @@ -29,9 +29,10 @@ interface SprintListPageProps { sprints: Sprint[]; projectId: string; projectKey?: string; + aiEnabled?: boolean; } -export function SprintListPage({ sprints, projectId, projectKey }: SprintListPageProps) { +export function SprintListPage({ sprints, projectId, projectKey, aiEnabled }: SprintListPageProps) { const [showForm, setShowForm] = useState(false); // Prepare data for velocity chart @@ -59,6 +60,7 @@ export function SprintListPage({ sprints, projectId, projectKey }: SprintListPag setShowForm(true)} /> diff --git a/src/components/task/ai-estimate-badge.tsx b/src/components/task/ai-estimate-badge.tsx index fc608cf..207259a 100644 --- a/src/components/task/ai-estimate-badge.tsx +++ b/src/components/task/ai-estimate-badge.tsx @@ -11,6 +11,11 @@ import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Progress } from "@/components/ui/progress"; import { Separator } from "@/components/ui/separator"; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from "@/components/ui/tooltip"; import { Sparkles, Loader2, @@ -57,6 +62,7 @@ interface AIEstimateBadgeProps { taskId: string; currentStoryPoints: number | null; compact?: boolean; + aiEnabled?: boolean; onEstimateApplied?: (points: number) => void; } @@ -64,6 +70,7 @@ export function AIEstimateBadge({ taskId, currentStoryPoints, compact = false, + aiEnabled = true, onEstimateApplied, }: AIEstimateBadgeProps) { const router = useRouter(); @@ -152,6 +159,31 @@ export function AIEstimateBadge({ } }; + if (!aiEnabled) { + const disabledButton = ( + + ); + + return ( + + + {disabledButton} + + +

AI Estimate uses AI to analyze task complexity and suggest story points. Enable AI in project settings to use this feature.

+
+
+ ); + } + if (compact) { return ( diff --git a/src/components/tasks/KanbanBoard.tsx b/src/components/tasks/KanbanBoard.tsx index f60d7f5..c0fef25 100644 --- a/src/components/tasks/KanbanBoard.tsx +++ b/src/components/tasks/KanbanBoard.tsx @@ -39,7 +39,14 @@ import { AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog"; -import { Users, User, LayoutGrid, X, ChevronDown, Zap, Layers, ArrowUpDown, AlertTriangle, GitPullRequest, Clock, Flame } from "lucide-react"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { Users, User, LayoutGrid, X, ChevronDown, Zap, Layers, ArrowUpDown, AlertTriangle, GitPullRequest, Clock, Flame, Target } from "lucide-react"; import { cn } from "@/lib/utils"; import { useSession } from "next-auth/react"; import { isPast, isToday } from "date-fns"; @@ -72,6 +79,7 @@ interface Task { taskType?: TaskType; storyPoints?: number | null; dueDate?: Date | string | null; + sprintId?: string | null; prNumber: number | null; prUrl: string | null; projectId: string; @@ -102,13 +110,22 @@ interface Member { image: string | null; } +interface Sprint { + id: string; + name: string; + status: "PLANNING" | "ACTIVE" | "COMPLETED"; +} + interface KanbanBoardProps { tasks: Task[]; projectId: string; projectKey: string; + sprints?: Sprint[]; + defaultSprintId?: string | null; wipLimits?: WipLimits; members?: Member[]; boardColumns?: BoardColumn[] | null; + aiEnabled?: boolean; } interface WipWarningState { @@ -120,10 +137,11 @@ interface WipWarningState { limit: number; } -export function KanbanBoard({ tasks: initialTasks, projectId, projectKey, wipLimits = {}, members = [], boardColumns }: KanbanBoardProps) { +export function KanbanBoard({ tasks: initialTasks, projectId, projectKey, sprints = [], defaultSprintId, wipLimits = {}, members = [], boardColumns, aiEnabled }: KanbanBoardProps) { const { data: session } = useSession(); const [tasks, setTasks] = useState(initialTasks); const [activeTask, setActiveTask] = useState(null); + const [selectedSprint, setSelectedSprint] = useState(defaultSprintId ?? "all"); const [selectedAssignee, setSelectedAssignee] = useState(null); const [groupBy, setGroupBy] = useState("none"); const [wipWarning, setWipWarning] = useState(null); @@ -172,10 +190,17 @@ export function KanbanBoard({ tasks: initialTasks, projectId, projectKey, wipLim }); }, [members]); - // Get filtered tasks based on selected assignee and quick filters + // Get filtered tasks based on selected sprint, assignee, and quick filters const filteredTasks = useMemo(() => { let result = tasks; + // Sprint filter + if (selectedSprint === "backlog") { + result = result.filter((t) => !t.sprintId); + } else if (selectedSprint !== "all") { + result = result.filter((t) => t.sprintId === selectedSprint); + } + // Assignee filter if (selectedAssignee) { if (selectedAssignee === "unassigned") { @@ -207,7 +232,7 @@ export function KanbanBoard({ tasks: initialTasks, projectId, projectKey, wipLim } return result; - }, [tasks, selectedAssignee, quickFilters, session?.user?.id]); + }, [tasks, selectedSprint, selectedAssignee, quickFilters, session?.user?.id]); // Group tasks based on groupBy mode const groupedTasks = useMemo(() => { @@ -546,6 +571,40 @@ export function KanbanBoard({ tasks: initialTasks, projectId, projectKey, wipLim )} + {/* Sprint Filter */} + {sprints.length > 0 && ( + + )} + {/* Separator */}
@@ -717,6 +776,7 @@ export function KanbanBoard({ tasks: initialTasks, projectId, projectKey, wipLim tasks={getTasksByStatus(column.id, group.tasks)} projectKey={projectKey} wipLimit={wipLimits[column.id]} + aiEnabled={aiEnabled} compact /> ))} @@ -744,6 +804,7 @@ export function KanbanBoard({ tasks: initialTasks, projectId, projectKey, wipLim tasks={getTasksByStatus(column.id)} projectKey={projectKey} wipLimit={wipLimits[column.id]} + aiEnabled={aiEnabled} /> ))}
diff --git a/src/components/tasks/KanbanColumn.tsx b/src/components/tasks/KanbanColumn.tsx index bb5fd73..0c9ed72 100644 --- a/src/components/tasks/KanbanColumn.tsx +++ b/src/components/tasks/KanbanColumn.tsx @@ -28,6 +28,7 @@ interface KanbanColumnProps { projectKey: string; wipLimit?: number; compact?: boolean; + aiEnabled?: boolean; } const columnStyles: Record t.id)} strategy={verticalListSortingStrategy}>
{tasks.map((task) => ( - + ))} {tasks.length === 0 && (
= { @@ -61,7 +62,7 @@ const priorityColors: Record = { URGENT: "bg-red-500", }; -export function TaskCard({ task, projectKey }: TaskCardProps) { +export function TaskCard({ task, projectKey, aiEnabled }: TaskCardProps) { const router = useRouter(); const { attributes, @@ -247,6 +248,7 @@ export function TaskCard({ task, projectKey }: TaskCardProps) { taskId={task.id} currentStoryPoints={task.storyPoints ?? null} compact={true} + aiEnabled={aiEnabled} onEstimateApplied={() => router.refresh()} /> )} diff --git a/src/components/tasks/TaskDetail.tsx b/src/components/tasks/TaskDetail.tsx index 6ee16f8..ad4bcce 100644 --- a/src/components/tasks/TaskDetail.tsx +++ b/src/components/tasks/TaskDetail.tsx @@ -125,6 +125,7 @@ type TaskWithRelations = Task & { interface TaskDetailProps { task: TaskWithRelations; currentUserId: string; + aiEnabled?: boolean; } const priorityColors: Record = { @@ -145,7 +146,7 @@ const priorityGradients: Record = { const ACTIVE_STATUSES = ["GENERATING", "AWAITING_CODE_REVIEW", "PR_OPEN", "IN_REVIEW", "CHANGES_REQUESTED"]; const POLL_INTERVAL = 5000; -export function TaskDetail({ task, currentUserId }: TaskDetailProps) { +export function TaskDetail({ task, currentUserId, aiEnabled = true }: TaskDetailProps) { const router = useRouter(); const [isGenerating, setIsGenerating] = useState(false); const [isExecuting, setIsExecuting] = useState(false); @@ -685,23 +686,45 @@ export function TaskDetail({ task, currentUserId }: TaskDetailProps) { - + {aiEnabled ? ( + + ) : ( + + + + + + + +

Generate Prompt uses AI to create an implementation prompt for this task. Enable AI in project settings to use this feature.

+
+
+ )} - {canExecute && ( + {aiEnabled && canExecute && ( + + + +

Execute Task uses AI to automatically generate code and create a pull request. Enable AI in project settings to use this feature.

+
+ + )} +
From 4dc49dcbadfa28e987e683278d75a49800cddbe5 Mon Sep 17 00:00:00 2001 From: Raushan Singh Date: Sun, 22 Feb 2026 13:41:33 +0530 Subject: [PATCH 3/7] Add project search, AI badge, sprint task auto-move, editable code review, CI/CD status comments, and default prompt quality requirements - Sidebar: add search input to filter projects by name/key, show project key labels - Dashboard: add search bar in header beside New Project button, show AI badge on AI-enabled projects - Sprint start: auto-move BACKLOG tasks to TODO status in a transaction - Code review: make generated code editable inline with edit/reset/done controls, persist edits on approve - CI/CD: fetch GitHub Actions workflow runs after PR merge and post build status as task activity comment - Prompts: add default requirements for tests, failing test fixes, SonarQube linting, and 80% coverage Co-Authored-By: Claude Opus 4.6 --- src/app/api/sprints/[sprintId]/start/route.ts | 17 ++- .../api/tasks/[taskId]/code-review/route.ts | 12 +- src/app/api/webhooks/github/route.ts | 104 ++++++++++++- src/app/dashboard/layout.tsx | 2 +- src/app/dashboard/page.tsx | 103 ++++++------- src/components/layout/Sidebar.tsx | 45 +++++- src/components/projects/ProjectCard.tsx | 21 ++- src/components/projects/ProjectSearch.tsx | 94 ++++++++++++ src/components/tasks/CodeReviewPanel.tsx | 21 ++- src/components/tasks/CommentsSection.tsx | 2 + src/components/tasks/GeneratedFileCard.tsx | 140 +++++++++++++----- src/components/tasks/GeneratedFilesList.tsx | 9 +- src/services/agent.ts | 4 + src/services/github.ts | 66 ++++++++- src/services/prompt-generator.ts | 7 +- 15 files changed, 537 insertions(+), 110 deletions(-) create mode 100644 src/components/projects/ProjectSearch.tsx diff --git a/src/app/api/sprints/[sprintId]/start/route.ts b/src/app/api/sprints/[sprintId]/start/route.ts index d3ba4a8..d325ee9 100644 --- a/src/app/api/sprints/[sprintId]/start/route.ts +++ b/src/app/api/sprints/[sprintId]/start/route.ts @@ -59,10 +59,19 @@ export async function POST(request: NextRequest, { params }: RouteParams) { ); } - const sprint = await prisma.sprint.update({ - where: { id: sprintId }, - data: { status: "ACTIVE" }, - }); + const [sprint] = await prisma.$transaction([ + prisma.sprint.update({ + where: { id: sprintId }, + data: { status: "ACTIVE" }, + }), + prisma.task.updateMany({ + where: { + sprintId: sprintId, + status: "BACKLOG", + }, + data: { status: "TODO" }, + }), + ]); return NextResponse.json({ sprint }); } catch (error) { diff --git a/src/app/api/tasks/[taskId]/code-review/route.ts b/src/app/api/tasks/[taskId]/code-review/route.ts index 4bb6ab8..1aff552 100644 --- a/src/app/api/tasks/[taskId]/code-review/route.ts +++ b/src/app/api/tasks/[taskId]/code-review/route.ts @@ -10,11 +10,18 @@ interface RouteParams { params: Promise<{ taskId: string }>; } +interface GeneratedFile { + path: string; + content: string; + action: "create" | "update" | "delete"; +} + interface CodeReviewRequest { action: "approve" | "request_changes" | "reject"; generatedCodeId: string; feedback?: string; deleteBranch?: boolean; + updatedFiles?: GeneratedFile[]; } /** @@ -31,7 +38,7 @@ export async function POST(request: NextRequest, { params }: RouteParams) { try { const body: CodeReviewRequest = await request.json(); - const { action, generatedCodeId, feedback, deleteBranch } = body; + const { action, generatedCodeId, feedback, deleteBranch, updatedFiles } = body; if (!action || !generatedCodeId) { return NextResponse.json( @@ -101,12 +108,13 @@ export async function POST(request: NextRequest, { params }: RouteParams) { switch (action) { case "approve": { - // Update generated code status to APPROVED + // Update generated code status to APPROVED, with edited files if provided await prisma.generatedCode.update({ where: { id: generatedCodeId }, data: { status: "APPROVED", reviewedAt: new Date(), + ...(updatedFiles ? { files: updatedFiles } : {}), }, }); diff --git a/src/app/api/webhooks/github/route.ts b/src/app/api/webhooks/github/route.ts index 960045a..c89d5a2 100644 --- a/src/app/api/webhooks/github/route.ts +++ b/src/app/api/webhooks/github/route.ts @@ -8,7 +8,7 @@ import { notifyPRMerged, notifyReviewRequested, } from "@/services/notifications"; -import { getPRSummary, type PRSummary } from "@/services/github"; +import { getPRSummary, getWorkflowRunsAfterMerge, type PRSummary, type WorkflowRunStatus } from "@/services/github"; import { parseGitHubRepo } from "@/lib/utils"; // Verify GitHub webhook signature @@ -328,6 +328,18 @@ async function handlePullRequest(body: Record): Promise { } } + // Fetch CI/CD build status in background and post as comment + if (repoInfo && accessToken) { + fetchAndPostCIStatus( + accessToken, + repoInfo.owner, + repoInfo.repo, + pullRequest.merge_commit_sha as string | undefined, + task.id, + prNumber + ).catch((err) => console.error("Failed to fetch CI/CD status:", err)); + } + // Send notification for PR merged if (task.project.userId) { await notifyPRMerged(task.project.userId, { @@ -485,3 +497,93 @@ async function handleIssueComment(body: Record): Promise console.log(`Queued PR comment handling for task ${task.id}: comment #${commentId} by @${commentAuthor}`); } + +/** + * Fetch GitHub Actions workflow runs after a merge and post build status as a task comment. + * Runs in the background with retries since workflows take a moment to trigger. + */ +async function fetchAndPostCIStatus( + accessToken: string, + owner: string, + repo: string, + mergeCommitSha: string | undefined, + taskId: string, + prNumber: number +): Promise { + if (!mergeCommitSha) { + console.log(`No merge commit SHA for PR #${prNumber}, skipping CI/CD status`); + return; + } + + // Wait for workflows to be triggered and get initial status + const runs = await getWorkflowRunsAfterMerge(accessToken, owner, repo, mergeCommitSha); + + if (runs.length === 0) { + console.log(`No workflow runs found for merge commit ${mergeCommitSha}`); + return; + } + + const buildComment = formatCIStatusComment(runs, prNumber, mergeCommitSha); + + await prisma.comment.create({ + data: { + taskId, + content: buildComment, + type: "ACTIVITY", + isSystem: true, + metadata: { + type: "ci_status", + prNumber, + mergeCommitSha, + workflows: runs.map((r) => ({ + name: r.name, + status: r.status, + conclusion: r.conclusion, + url: r.html_url, + })), + } as Prisma.InputJsonValue, + }, + }); + + console.log(`CI/CD status comment posted for task ${taskId} (${runs.length} workflows)`); +} + +function formatCIStatusComment(runs: WorkflowRunStatus[], prNumber: number, commitSha: string): string { + const activities: { icon: string; label: string; detail?: string }[] = []; + + activities.push({ + icon: "build", + label: "CI/CD Pipeline", + detail: `PR #${prNumber} · ${commitSha.substring(0, 7)}`, + }); + + for (const run of runs) { + const statusEmoji = getWorkflowStatusIcon(run.status, run.conclusion); + activities.push({ + icon: "build", + label: `${statusEmoji} ${run.name}`, + detail: run.conclusion || run.status, + }); + } + + return JSON.stringify({ + type: "activity_summary", + title: "CI/CD Build Status", + activities, + }); +} + +function getWorkflowStatusIcon(status: string, conclusion: string | null): string { + if (status === "completed") { + switch (conclusion) { + case "success": return "\u2705"; + case "failure": return "\u274C"; + case "cancelled": return "\u23F9\uFE0F"; + case "skipped": return "\u23ED\uFE0F"; + default: return "\u2753"; + } + } + if (status === "in_progress") return "\u23F3"; + if (status === "queued" || status === "waiting") return "\u23F8\uFE0F"; + return "\u2B55"; +} diff --git a/src/app/dashboard/layout.tsx b/src/app/dashboard/layout.tsx index 36a76d2..c821fc3 100644 --- a/src/app/dashboard/layout.tsx +++ b/src/app/dashboard/layout.tsx @@ -19,7 +19,7 @@ export default async function DashboardLayout({ const projects = await prisma.project.findMany({ where: { userId: session.user.id }, orderBy: { updatedAt: "desc" }, - select: { id: true, name: true }, + select: { id: true, name: true, projectKey: true }, }); return ( diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx index e5578aa..372b06a 100644 --- a/src/app/dashboard/page.tsx +++ b/src/app/dashboard/page.tsx @@ -5,7 +5,7 @@ import { redirect } from "next/navigation"; import Link from "next/link"; import { Plus, FolderKanban } from "lucide-react"; import { Button } from "@/components/ui/button"; -import { ProjectCard } from "@/components/projects/ProjectCard"; +import { ProjectListWithSearch } from "@/components/projects/ProjectSearch"; export default async function DashboardPage() { const session = await getServerSession(authOptions); @@ -28,68 +28,63 @@ export default async function DashboardPage() { }, select: { id: true }, }, + aiSettings: { + select: { aiEnabled: true }, + }, }, orderBy: { updatedAt: "desc" }, }); return (
-
-
-

Projects

-

- Manage your FlowForge projects and tasks -

-
- -
- {projects.length === 0 ? ( -
-
- + <> +
+
+

Projects

+

+ Manage your FlowForge projects and tasks +

+
+
-

- No projects yet -

-

- Create your first project to start automating your development workflow with AI. -

- -
- ) : ( -
- {projects.map((project: typeof projects[number], index: number) => ( -
- +
+
+
- ))} -
+

+ No projects yet +

+

+ Create your first project to start automating your development workflow with AI. +

+ +
+ + ) : ( + ({ + id: project.id, + name: project.name, + description: project.description, + githubRepo: project.githubRepo, + projectKey: project.projectKey, + taskCount: project._count.tasks, + activePRCount: project.tasks.length, + updatedAt: project.updatedAt, + aiEnabled: project.aiSettings?.aiEnabled ?? false, + }))} + /> )}
); diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx index 475068f..9dc3505 100644 --- a/src/components/layout/Sidebar.tsx +++ b/src/components/layout/Sidebar.tsx @@ -1,14 +1,18 @@ "use client"; +import { useState } from "react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; import { ScrollArea } from "@/components/ui/scroll-area"; import { Separator } from "@/components/ui/separator"; import { Plus, LayoutDashboard, Settings, + Search, + X, } from "lucide-react"; import { cn } from "@/lib/utils"; @@ -40,6 +44,17 @@ function getProjectColor(id: string): string { export function Sidebar({ projects = [] }: SidebarProps) { const pathname = usePathname(); + const [searchQuery, setSearchQuery] = useState(""); + + const filteredProjects = searchQuery + ? projects.filter((project) => { + const query = searchQuery.toLowerCase(); + return ( + project.name.toLowerCase().includes(query) || + (project.projectKey && project.projectKey.toLowerCase().includes(query)) + ); + }) + : projects; const mainNav = [ { @@ -87,11 +102,32 @@ export function Sidebar({ projects = [] }: SidebarProps) {

Projects

+ {projects.length > 0 && ( +
+ + setSearchQuery(e.target.value)} + className="h-8 pl-8 pr-8 text-sm" + /> + {searchQuery && ( + + )} +
+ )}
{projects.length === 0 ? (

No projects yet

+ ) : filteredProjects.length === 0 ? ( +

No projects found

) : ( - projects.map((project) => { + filteredProjects.map((project) => { const projectSlug = project.projectKey || project.id; const isActive = pathname.startsWith(`/project/${project.id}`) || pathname.startsWith(`/project/${project.projectKey}`); const colorClass = getProjectColor(project.id); @@ -106,8 +142,13 @@ export function Sidebar({ projects = [] }: SidebarProps) { asChild > -
+
{project.name} + {project.projectKey && ( + + {project.projectKey} + + )} ); diff --git a/src/components/projects/ProjectCard.tsx b/src/components/projects/ProjectCard.tsx index c84c339..77615cb 100644 --- a/src/components/projects/ProjectCard.tsx +++ b/src/components/projects/ProjectCard.tsx @@ -1,7 +1,7 @@ import Link from "next/link"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; -import { Github, ListTodo } from "lucide-react"; +import { Github, ListTodo, Sparkles } from "lucide-react"; import { formatDate } from "@/lib/utils"; interface ProjectCardProps { @@ -14,6 +14,7 @@ interface ProjectCardProps { taskCount: number; activePRCount: number; updatedAt: Date; + aiEnabled?: boolean; }; } @@ -24,11 +25,19 @@ export function ProjectCard({ project }: ProjectCardProps) {
{project.name} - {project.activePRCount > 0 && ( - - {project.activePRCount} PR{project.activePRCount !== 1 ? "s" : ""} open - - )} +
+ {project.aiEnabled && ( + + + AI + + )} + {project.activePRCount > 0 && ( + + {project.activePRCount} PR{project.activePRCount !== 1 ? "s" : ""} open + + )} +
{project.description && (

diff --git a/src/components/projects/ProjectSearch.tsx b/src/components/projects/ProjectSearch.tsx new file mode 100644 index 0000000..b8b4148 --- /dev/null +++ b/src/components/projects/ProjectSearch.tsx @@ -0,0 +1,94 @@ +"use client"; + +import { useState } from "react"; +import Link from "next/link"; +import { Plus, Search, X } from "lucide-react"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { ProjectCard } from "./ProjectCard"; + +interface Project { + id: string; + name: string; + description: string | null; + githubRepo: string; + projectKey?: string; + taskCount: number; + activePRCount: number; + updatedAt: Date; + aiEnabled?: boolean; +} + +interface ProjectListWithSearchProps { + projects: Project[]; +} + +export function ProjectListWithSearch({ projects }: ProjectListWithSearchProps) { + const [searchQuery, setSearchQuery] = useState(""); + + const filteredProjects = searchQuery + ? projects.filter((project) => { + const query = searchQuery.toLowerCase(); + return ( + project.name.toLowerCase().includes(query) || + (project.projectKey && project.projectKey.toLowerCase().includes(query)) + ); + }) + : projects; + + return ( + <> +

+
+

Projects

+

+ Manage your FlowForge projects and tasks +

+
+
+
+ + setSearchQuery(e.target.value)} + className="w-64 pl-9 pr-9" + /> + {searchQuery && ( + + )} +
+ +
+
+ +
+ {filteredProjects.length === 0 ? ( +

+ No projects found for “{searchQuery}” +

+ ) : ( + filteredProjects.map((project, index) => ( +
+ +
+ )) + )} +
+ + ); +} diff --git a/src/components/tasks/CodeReviewPanel.tsx b/src/components/tasks/CodeReviewPanel.tsx index 8433880..a231fa2 100644 --- a/src/components/tasks/CodeReviewPanel.tsx +++ b/src/components/tasks/CodeReviewPanel.tsx @@ -52,6 +52,7 @@ export function CodeReviewPanel({ taskId }: CodeReviewPanelProps) { const [isRejecting, setIsRejecting] = useState(false); const [showFeedbackDialog, setShowFeedbackDialog] = useState(false); const [showRejectDialog, setShowRejectDialog] = useState(false); + const [editedFiles, setEditedFiles] = useState>({}); useEffect(() => { async function fetchGeneratedCode() { @@ -77,17 +78,32 @@ export function CodeReviewPanel({ taskId }: CodeReviewPanelProps) { fetchGeneratedCode(); }, [taskId]); + function handleFileContentChange(path: string, newContent: string) { + setEditedFiles((prev) => ({ ...prev, [path]: newContent })); + } + async function handleApprove() { if (!generatedCode) return; setIsApproving(true); try { + // Build updated files array if any edits were made + const hasEdits = Object.keys(editedFiles).length > 0; + const updatedFiles = hasEdits + ? generatedCode.files.map((file) => + editedFiles[file.path] !== undefined + ? { ...file, content: editedFiles[file.path] } + : file + ) + : undefined; + const response = await fetch(`/api/tasks/${taskId}/code-review`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ action: "approve", generatedCodeId: generatedCode.id, + updatedFiles, }), }); @@ -231,7 +247,10 @@ export function CodeReviewPanel({ taskId }: CodeReviewPanelProps) {

Generated Files

- +
diff --git a/src/components/tasks/CommentsSection.tsx b/src/components/tasks/CommentsSection.tsx index 06f12a1..6e3eeb6 100644 --- a/src/components/tasks/CommentsSection.tsx +++ b/src/components/tasks/CommentsSection.tsx @@ -36,6 +36,7 @@ import { GitPullRequest, Code, Users, + Workflow, Check, X, CheckCircle2, @@ -84,6 +85,7 @@ const ACTIVITY_ICONS: Record = { commit: GitCommit, pr: GitPullRequest, review: Users, + build: Workflow, }; // Parse activity summary from JSON content diff --git a/src/components/tasks/GeneratedFileCard.tsx b/src/components/tasks/GeneratedFileCard.tsx index 68a798e..1bbcd35 100644 --- a/src/components/tasks/GeneratedFileCard.tsx +++ b/src/components/tasks/GeneratedFileCard.tsx @@ -17,14 +17,12 @@ import { FileX, Copy, Check, + Pencil, + Undo2, } from "lucide-react"; import { cn } from "@/lib/utils"; import type { GeneratedFile } from "@/types"; -interface GeneratedFileCardProps { - file: GeneratedFile; -} - const actionConfig = { create: { label: "Create", @@ -83,9 +81,16 @@ function getLanguageFromExtension(ext: string): string { return map[ext.toLowerCase()] || ext || "text"; } -export function GeneratedFileCard({ file }: GeneratedFileCardProps) { +interface GeneratedFileCardProps { + file: GeneratedFile; + onContentChange?: (path: string, newContent: string) => void; +} + +export function GeneratedFileCard({ file, onContentChange }: GeneratedFileCardProps) { const [isOpen, setIsOpen] = useState(false); const [copied, setCopied] = useState(false); + const [isEditing, setIsEditing] = useState(false); + const [editedContent, setEditedContent] = useState(file.content); const config = actionConfig[file.action]; const ActionIcon = config.icon; @@ -93,12 +98,27 @@ export function GeneratedFileCard({ file }: GeneratedFileCardProps) { const language = getLanguageFromExtension(ext); const lineCount = file.content.split("\n").length; + const currentContent = isEditing ? editedContent : file.content; + async function handleCopy() { - await navigator.clipboard.writeText(file.content); + await navigator.clipboard.writeText(currentContent); setCopied(true); setTimeout(() => setCopied(false), 2000); } + function handleToggleEdit() { + if (isEditing) { + // Save edits + onContentChange?.(file.path, editedContent); + } + setIsEditing(!isEditing); + } + + function handleResetContent() { + setEditedContent(file.content); + onContentChange?.(file.path, file.content); + } + return ( @@ -135,40 +155,92 @@ export function GeneratedFileCard({ file }: GeneratedFileCardProps) { {/* Header */}
{language} - + )} + )} - -
- - {/* Code content */} -
-
-                
-                  {file.action === "delete" ? (
-                    
-                      This file will be deleted
-                    
+                
+ +
+ + {/* Code content */} + {file.action === "delete" ? ( +
+ + This file will be deleted + +
+ ) : isEditing ? ( +