Mehdi commited on
Commit
d65c6db
·
verified ·
1 Parent(s): 5266d92

Upload components/Documentation.jsx with huggingface_hub

Browse files
Files changed (1) hide show
  1. components/Documentation.jsx +322 -0
components/Documentation.jsx ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import Link from 'next/link'
2
+ import { FiBook, FiCode, FiCpu, FiServer, FiDatabase, FiCloud } from 'react-icons/fi'
3
+ import { useState } from 'react'
4
+ import ReactMarkdown from 'react-markdown'
5
+ import remarkGfm from 'remark-gfm'
6
+
7
+ export default function Documentation() {
8
+ const [activeSection, setActiveSection] = useState('getting-started')
9
+ const [searchTerm, setSearchTerm] = useState('')
10
+
11
+ const docs = [
12
+ {
13
+ id: 'getting-started',
14
+ title: 'Getting Started',
15
+ icon: <FiBook />,
16
+ content: `
17
+ # Getting Started with FullStack Programming Hub
18
+
19
+ ## Installation
20
+
21
+ To get started with our platform, follow these simple steps:
22
+
23
+ 1. **Clone the repository**:
24
+ \`\`\`bash
25
+ git clone https://github.com/your-repo/fullstack-hub.git
26
+ cd fullstack-hub
27
+ \`\`\`
28
+
29
+ 2. **Install dependencies**:
30
+ \`\`\`bash
31
+ yarn install
32
+ \`\`\`
33
+
34
+ 3. **Run the development server**:
35
+ \`\`\`bash
36
+ yarn dev
37
+ \`\`\`
38
+
39
+ ## System Requirements
40
+
41
+ - Node.js 18+
42
+ - yarn or npm
43
+ - 4GB RAM minimum (8GB recommended for AI models)
44
+ - 10GB free disk space
45
+
46
+ ## First Steps
47
+
48
+ 1. Launch the code editor
49
+ 2. Select your preferred programming language
50
+ 3. Start coding with AI assistance
51
+ 4. Run and test your code
52
+ `,
53
+ link: '/docs/getting-started'
54
+ },
55
+ {
56
+ id: 'code-editor',
57
+ title: 'Code Editor Guide',
58
+ icon: <FiCode />,
59
+ content: `
60
+ # Code Editor Features
61
+
62
+ ## Supported Languages
63
+
64
+ - JavaScript/TypeScript
65
+ - Python
66
+ - Java
67
+ - C#
68
+ - Go
69
+ - Rust
70
+ - And more...
71
+
72
+ ## Keyboard Shortcuts
73
+
74
+ | Shortcut | Action |
75
+ |----------|--------|
76
+ | Ctrl+S | Save snippet |
77
+ | Ctrl+Enter | Run code |
78
+ | Ctrl+Space | Trigger completion |
79
+ | Ctrl+/ | Toggle comment |
80
+
81
+ ## Advanced Features
82
+
83
+ - **Monaco Editor Integration**: Full-featured code editor with syntax highlighting
84
+ - **Snippet Management**: Save and load code snippets
85
+ - **Themes**: Multiple color themes available
86
+ - **Font Customization**: Adjust font size and family
87
+ `,
88
+ link: '/docs/editor'
89
+ },
90
+ {
91
+ id: 'model-integration',
92
+ title: 'Model Integration',
93
+ icon: <FiCpu />,
94
+ content: `
95
+ # AI Model Integration
96
+
97
+ ## Available Models
98
+
99
+ 1. **CodeGen 2B**: Python/JavaScript code generation
100
+ 2. **StableCode**: Multi-language code completion
101
+ 3. **DeepSeek Coder**: Advanced code understanding
102
+
103
+ ## Integration Steps
104
+
105
+ 1. **Download the model** from the Models page
106
+ 2. **Initialize in your code**:
107
+ \`\`\`javascript
108
+ const model = require('@fullstack-hub/codegen')
109
+ const instance = new model({ temperature: 0.7 })
110
+ \`\`\`
111
+
112
+ 3. **Use the model**:
113
+ \`\`\`javascript
114
+ const result = await instance.generate('Write a React component')
115
+ \`\`\`
116
+
117
+ ## Best Practices
118
+
119
+ - Use lower temperatures (0.2-0.5) for more deterministic outputs
120
+ - Higher temperatures (0.7-1.0) for more creative outputs
121
+ - Limit max tokens to control response length
122
+ `,
123
+ link: '/docs/models'
124
+ },
125
+ {
126
+ id: 'offline-development',
127
+ title: 'Offline Development',
128
+ icon: <FiDatabase />,
129
+ content: `
130
+ # Offline Development Guide
131
+
132
+ ## Setting Up Offline Mode
133
+
134
+ 1. Download required models
135
+ 2. Configure local storage paths
136
+ 3. Enable offline mode in settings
137
+
138
+ ## Benefits
139
+
140
+ - Work without internet connection
141
+ - Faster response times
142
+ - Data privacy and security
143
+ - Reduced API costs
144
+
145
+ ## Limitations
146
+
147
+ - Model updates require manual download
148
+ - Limited to downloaded models
149
+ - No cloud sync in offline mode
150
+ `,
151
+ link: '/docs/offline'
152
+ },
153
+ {
154
+ id: 'backend-integration',
155
+ title: 'Backend Integration',
156
+ icon: <FiServer />,
157
+ content: `
158
+ # Backend Integration
159
+
160
+ ## API Endpoints
161
+
162
+ | Endpoint | Method | Description |
163
+ |----------|--------|-------------|
164
+ | /api/execute | POST | Execute code |
165
+ | /api/models | GET | List available models |
166
+ | /api/models/download | POST | Download model |
167
+
168
+ ## Example Integration
169
+
170
+ \`\`\`javascript
171
+ const axios = require('axios')
172
+
173
+ // Execute code
174
+ const response = await axios.post('/api/execute', {
175
+ code: 'console.log("Hello")',
176
+ language: 'javascript'
177
+ })
178
+
179
+ // Download model
180
+ const model = await axios.post('/api/models/download', {
181
+ modelId: 1
182
+ })
183
+ \`\`\`
184
+
185
+ ## Authentication
186
+
187
+ API keys are required for production use. Get your key from the account settings.
188
+ `,
189
+ link: '/docs/backend'
190
+ },
191
+ {
192
+ id: 'deployment',
193
+ title: 'Deployment Guide',
194
+ icon: <FiCloud />,
195
+ content: `
196
+ # Deployment Options
197
+
198
+ ## Docker Deployment
199
+
200
+ 1. Build the image:
201
+ \`\`\`bash
202
+ docker build -t fullstack-hub .
203
+ \`\`\`
204
+
205
+ 2. Run the container:
206
+ \`\`\`bash
207
+ docker run -p 3000:3000 fullstack-hub
208
+ \`\`\`
209
+
210
+ ## Cloud Platforms
211
+
212
+ ### Vercel
213
+ 1. Connect your GitHub repository
214
+ 2. Configure environment variables
215
+ 3. Deploy with one click
216
+
217
+ ### AWS
218
+ 1. Create an EC2 instance
219
+ 2. Install Docker
220
+ 3. Run the container
221
+
222
+ ## Environment Variables
223
+
224
+ | Variable | Description | Required |
225
+ |----------|-------------|----------|
226
+ | NODE_ENV | production/development | Yes |
227
+ | PORT | Server port | No (default: 3000) |
228
+ | API_KEY | For external services | Optional |
229
+ `,
230
+ link: '/docs/deployment'
231
+ }
232
+ ]
233
+
234
+ const filteredDocs = docs.filter(doc =>
235
+ doc.title.toLowerCase().includes(searchTerm.toLowerCase()) ||
236
+ doc.content.toLowerCase().includes(searchTerm.toLowerCase())
237
+ )
238
+
239
+ return (
240
+ <div className="grid grid-cols-1 lg:grid-cols-4 gap-6">
241
+ <div className="lg:col-span-1">
242
+ <div className="bg-white rounded-lg shadow-md p-4 sticky top-24">
243
+ <div className="relative mb-4">
244
+ <FiSearch className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400" />
245
+ <input
246
+ type="text"
247
+ placeholder="Search docs..."
248
+ value={searchTerm}
249
+ onChange={(e) => setSearchTerm(e.target.value)}
250
+ className="w-full pl-10 pr-4 py-2 border border-gray-200 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent"
251
+ />
252
+ </div>
253
+
254
+ <h3 className="font-bold text-gray-800 mb-3">Documentation</h3>
255
+ <ul className="space-y-2">
256
+ {filteredDocs.map((doc) => (
257
+ <li key={doc.id}>
258
+ <button
259
+ onClick={() => setActiveSection(doc.id)}
260
+ className={`w-full text-left p-2 rounded-lg flex items-center space-x-2 transition-colors ${activeSection === doc.id ? 'bg-primary text-white' : 'text-gray-600 hover:bg-gray-100'}`}
261
+ >
262
+ <span>{doc.icon}</span>
263
+ <span>{doc.title}</span>
264
+ </button>
265
+ </li>
266
+ ))}
267
+ </ul>
268
+
269
+ <div className="mt-6 pt-4 border-t border-gray-200">
270
+ <h4 className="font-medium text-gray-800 mb-2">Additional Resources</h4>
271
+ <ul className="space-y-2">
272
+ <li>
273
+ <Link href="/api-docs" className="text-primary hover:text-blue-600 flex items-center space-x-2">
274
+ <FiCode />
275
+ <span>API Documentation</span>
276
+ </Link>
277
+ </li>
278
+ <li>
279
+ <Link href="/examples" className="text-primary hover:text-blue-600 flex items-center space-x-2">
280
+ <FiBook />
281
+ <span>Code Examples</span>
282
+ </Link>
283
+ </li>
284
+ <li>
285
+ <Link href="/community" className="text-primary hover:text-blue-600 flex items-center space-x-2">
286
+ <FiCpu />
287
+ <span>Community Forum</span>
288
+ </Link>
289
+ </li>
290
+ </ul>
291
+ </div>
292
+ </div>
293
+ </div>
294
+
295
+ <div className="lg:col-span-3">
296
+ {filteredDocs.map((doc) => (
297
+ <div key={doc.id} className={`bg-white rounded-lg shadow-md p-6 mb-6 ${activeSection === doc.id ? 'block' : 'hidden'}`}>
298
+ <div className="flex justify-between items-center mb-4">
299
+ <h2 className="text-2xl font-bold text-gray-800 flex items-center space-x-2">
300
+ <span>{doc.icon}</span>
301
+ <span>{doc.title}</span>
302
+ </h2>
303
+ <Link
304
+ href={doc.link}
305
+ className="text-primary hover:text-blue-600 flex items-center space-x-1"
306
+ >
307
+ <span>View Full Guide</span>
308
+ <span>→</span>
309
+ </Link>
310
+ </div>
311
+
312
+ <div className="prose max-w-none">
313
+ <ReactMarkdown remarkPlugins={[remarkGfm]}>
314
+ {doc.content}
315
+ </ReactMarkdown>
316
+ </div>
317
+ </div>
318
+ ))}
319
+ </div>
320
+ </div>
321
+ )
322
+ }