File size: 6,655 Bytes
8f9c4ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
// ─────────────────────────────────────────────────────────────
// Landing Page β€” Hero + Features showcase
// ─────────────────────────────────────────────────────────────

'use client';

import Link from 'next/link';
import { Code2, Users, Zap, Shield, Video, Bot, Terminal, Globe } from 'lucide-react';

const features = [
  { icon: Users, title: 'Real-Time Collaboration', desc: 'Multiple users editing simultaneously with CRDT-based sync' },
  { icon: Zap, title: 'Low Latency', desc: 'WebSocket-powered updates with optimistic UI rendering' },
  { icon: Terminal, title: 'Code Execution', desc: 'Run code in isolated Docker containers with streaming output' },
  { icon: Bot, title: 'AI Assistant', desc: 'Integrated AI for debugging, optimization, and code explanation' },
  { icon: Video, title: 'Video Calls', desc: 'WebRTC peer-to-peer video/audio with screen sharing' },
  { icon: Shield, title: 'Secure Sandbox', desc: 'Isolated execution with resource limits and network isolation' },
  { icon: Code2, title: 'Monaco Editor', desc: 'VS Code-grade editing with IntelliSense and multi-language support' },
  { icon: Globe, title: 'Scalable', desc: 'Redis pub/sub for horizontal scaling across multiple instances' },
];

export default function HomePage() {
  return (
    <div className="min-h-screen bg-gradient-to-b from-editor-bg via-editor-surface to-editor-bg">
      {/* Nav */}
      <nav className="flex items-center justify-between px-6 py-4 max-w-7xl mx-auto">
        <div className="flex items-center gap-2">
          <Code2 className="h-6 w-6 text-editor-accent" />
          <span className="text-lg font-bold">CodeSync</span>
        </div>
        <div className="flex items-center gap-4">
          <Link href="/login" className="text-sm text-editor-text-muted hover:text-editor-text transition-colors">
            Sign In
          </Link>
          <Link href="/register" className="btn-primary text-sm">
            Get Started
          </Link>
        </div>
      </nav>

      {/* Hero */}
      <section className="flex flex-col items-center justify-center px-6 py-24 text-center max-w-4xl mx-auto">
        <div className="mb-4 inline-flex items-center gap-2 rounded-full border border-editor-border px-4 py-1.5 text-xs text-editor-text-muted">
          <span className="h-2 w-2 rounded-full bg-editor-success animate-pulse" />
          Real-time collaborative coding platform
        </div>
        
        <h1 className="text-5xl font-bold leading-tight tracking-tight md:text-6xl">
          Code Together,{' '}
          <span className="bg-gradient-to-r from-editor-accent to-editor-success bg-clip-text text-transparent">
            Build Faster
          </span>
        </h1>
        
        <p className="mt-6 max-w-2xl text-lg text-editor-text-muted leading-relaxed">
          A production-grade collaborative IDE with real-time editing, AI-powered debugging,
          video collaboration, and secure sandboxed code execution. Like VS Code, but multiplayer.
        </p>

        <div className="mt-10 flex items-center gap-4">
          <Link href="/register" className="btn-primary px-6 py-3 text-base">
            Start Coding Free β†’
          </Link>
          <Link href="/login" className="btn-secondary px-6 py-3 text-base">
            View Demo
          </Link>
        </div>

        {/* Code preview mockup */}
        <div className="mt-16 w-full max-w-3xl rounded-xl border border-editor-border bg-editor-surface shadow-2xl overflow-hidden">
          <div className="flex items-center gap-2 border-b border-editor-border px-4 py-2">
            <span className="h-3 w-3 rounded-full bg-red-500" />
            <span className="h-3 w-3 rounded-full bg-yellow-500" />
            <span className="h-3 w-3 rounded-full bg-green-500" />
            <span className="ml-4 text-xs text-editor-text-muted">main.ts β€” CodeSync</span>
          </div>
          <div className="p-4 font-mono text-sm text-left">
            <pre className="text-editor-text-muted">
{`  1 β”‚ `}<span className="text-purple-400">import</span>{` { collaborate } `}<span className="text-purple-400">from</span>{` `}<span className="text-green-400">'codesync'</span>{`;
  2 β”‚
  3 β”‚ `}<span className="text-purple-400">const</span>{` room = `}<span className="text-purple-400">await</span>{` collaborate.`}<span className="text-yellow-300">createRoom</span>{`({
  4 β”‚   name: `}<span className="text-green-400">'Project Alpha'</span>{`,
  5 β”‚   language: `}<span className="text-green-400">'typescript'</span>{`,
  6 β”‚   members: [`}<span className="text-green-400">'alice'</span>{`, `}<span className="text-green-400">'bob'</span>{`],
  7 β”‚ });
  8 β”‚
  9 β”‚ room.`}<span className="text-yellow-300">on</span>{`(`}<span className="text-green-400">'update'</span>{`, (delta) => {
 10 β”‚   `}<span className="text-editor-text-muted">// CRDT ensures conflict-free merging</span>{`
 11 β”‚   editor.`}<span className="text-yellow-300">applyDelta</span>{`(delta);
 12 β”‚ });`}
            </pre>
          </div>
        </div>
      </section>

      {/* Features Grid */}
      <section className="max-w-6xl mx-auto px-6 py-24">
        <h2 className="text-center text-3xl font-bold mb-4">Everything You Need</h2>
        <p className="text-center text-editor-text-muted mb-12 max-w-2xl mx-auto">
          Built with production-grade architecture, real-time synchronization, and modern developer tooling.
        </p>
        
        <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
          {features.map((feature) => (
            <div
              key={feature.title}
              className="rounded-lg border border-editor-border bg-editor-surface p-5 hover:border-editor-accent/50 transition-colors group"
            >
              <feature.icon className="h-8 w-8 text-editor-accent mb-3 group-hover:scale-110 transition-transform" />
              <h3 className="font-semibold text-sm mb-1">{feature.title}</h3>
              <p className="text-xs text-editor-text-muted leading-relaxed">{feature.desc}</p>
            </div>
          ))}
        </div>
      </section>

      {/* Footer */}
      <footer className="border-t border-editor-border py-8 text-center text-xs text-editor-text-muted">
        <p>Β© 2024 CodeSync. Built with Next.js, Socket.io, Yjs, and WebRTC.</p>
      </footer>
    </div>
  );
}