-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
376 lines (333 loc) · 14.3 KB
/
Copy pathindex.html
File metadata and controls
376 lines (333 loc) · 14.3 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
import React, { useState, useRef } from 'react';
import { Upload, FileText, Download, Plus, Trash2, Edit, Eye, Copy, Check } from 'lucide-react';
const ReadmeIntegrator = () => {
const [mainReadme, setMainReadme] = useState('');
const [subFiles, setSubFiles] = useState([]);
const [integratedContent, setIntegratedContent] = useState('');
const [activeTab, setActiveTab] = useState('upload');
const [copied, setCopied] = useState(false);
const fileInputRef = useRef(null);
// Cargar el contenido inicial del README de Neural Nexus
React.useEffect(() => {
const initialContent = `# 🧠 Neural Nexus - Core System
[](https://github.com/mechmind-dwv/core-system/actions)
[](https://neural-nexus.dev/benchmarks)
[](https://neural-nexus.dev/efficiency)
[](https://www.rust-lang.org)
[](https://www.python.org)
[](LICENSE)
[](https://discord.gg/neural-nexus)
> **Plataforma de IA Distribuida para Edge Computing** que combina **inferencia descentralizada**, **eficiencia energética** y **aprendizaje federado** con procesamiento **neuromorphic**. 🚀
## 🎯 ¿Qué es Neural Nexus?
Neural Nexus revoluciona el edge computing al distribuir la inteligencia artificial directamente en los dispositivos, eliminando la dependencia de la nube y garantizando:
- ⚡ **Ultra-baja latencia** (< 2ms)
- 🔋 **Eficiencia energética** (< 5W por nodo)
- 🛡️ **Privacidad por diseño** (datos nunca salen del edge)
- 🌐 **Escalabilidad masiva** (miles de nodos)
- 🧠 **Aprendizaje continuo** (federated learning)
<!-- INTEGRATION_POINT:architecture -->
<!-- INTEGRATION_POINT:quick-start -->
<!-- INTEGRATION_POINT:project-structure -->
<!-- INTEGRATION_POINT:tech-stack -->
<!-- INTEGRATION_POINT:use-cases -->
<!-- INTEGRATION_POINT:benchmarks -->
<!-- INTEGRATION_POINT:deployment -->
<!-- INTEGRATION_POINT:development -->
<!-- INTEGRATION_POINT:security -->
<!-- INTEGRATION_POINT:roadmap -->
<!-- INTEGRATION_POINT:contributing -->
<!-- INTEGRATION_POINT:support -->
<!-- INTEGRATION_POINT:license -->`;
setMainReadme(initialContent);
setIntegratedContent(initialContent);
}, []);
const handleFileUpload = async (event) => {
const files = Array.from(event.target.files);
for (const file of files) {
const content = await file.text();
const newFile = {
id: Date.now() + Math.random(),
name: file.name,
content: content,
section: extractSectionName(file.name),
integrationPoint: generateIntegrationPoint(file.name)
};
setSubFiles(prev => [...prev, newFile]);
}
};
const extractSectionName = (filename) => {
// Extraer nombre de sección basado en el nombre del archivo
const name = filename.replace(/\.(md|txt)$/i, '');
return name
.replace(/[-_]/g, ' ')
.replace(/\b\w/g, l => l.toUpperCase());
};
const generateIntegrationPoint = (filename) => {
// Generar punto de integración basado en el nombre del archivo
return filename
.replace(/\.(md|txt)$/i, '')
.toLowerCase()
.replace(/[^a-z0-9]/g, '-');
};
const addManualSection = () => {
const newFile = {
id: Date.now(),
name: 'nueva-seccion.md',
content: '## Nueva Sección\n\nContenido de la nueva sección...',
section: 'Nueva Sección',
integrationPoint: 'nueva-seccion'
};
setSubFiles(prev => [...prev, newFile]);
};
const updateSubFile = (id, field, value) => {
setSubFiles(prev => prev.map(file =>
file.id === id ? { ...file, [field]: value } : file
));
};
const deleteSubFile = (id) => {
setSubFiles(prev => prev.filter(file => file.id !== id));
};
const integrateFiles = () => {
let integrated = mainReadme;
subFiles.forEach(file => {
const integrationPoint = `<!-- INTEGRATION_POINT:${file.integrationPoint} -->`;
if (integrated.includes(integrationPoint)) {
// Reemplazar el punto de integración con el contenido
integrated = integrated.replace(
integrationPoint,
`${file.content}\n\n${integrationPoint}`
);
} else {
// Si no existe el punto de integración, agregar al final
integrated += `\n\n${file.content}`;
}
});
setIntegratedContent(integrated);
setActiveTab('preview');
};
const downloadIntegratedFile = () => {
const blob = new Blob([integratedContent], { type: 'text/markdown' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'README-integrated.md';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
};
const copyToClipboard = async () => {
try {
await navigator.clipboard.writeText(integratedContent);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
} catch (err) {
console.error('Error copying to clipboard:', err);
}
};
const generateTemplate = () => {
const template = `# Proyecto
## Descripción
<!-- INTEGRATION_POINT:description -->
## Instalación
<!-- INTEGRATION_POINT:installation -->
## Uso
<!-- INTEGRATION_POINT:usage -->
## API
<!-- INTEGRATION_POINT:api -->
## Contribuir
<!-- INTEGRATION_POINT:contributing -->
## Licencia
<!-- INTEGRATION_POINT:license -->`;
setMainReadme(template);
setIntegratedContent(template);
};
return (
<div className="max-w-6xl mx-auto p-6 bg-gray-50 min-h-screen">
<div className="bg-white rounded-lg shadow-lg p-6 mb-6">
<h1 className="text-3xl font-bold text-gray-800 mb-2 flex items-center gap-2">
<FileText className="text-blue-600" size={32} />
Integrador de Archivos README
</h1>
<p className="text-gray-600">
Herramienta para integrar múltiples archivos README y crear documentación unificada
</p>
</div>
{/* Tabs */}
<div className="bg-white rounded-lg shadow-lg mb-6">
<div className="flex border-b">
{[
{ id: 'upload', label: 'Subir Archivos', icon: Upload },
{ id: 'manage', label: 'Gestionar Secciones', icon: Edit },
{ id: 'preview', label: 'Vista Previa', icon: Eye }
].map(tab => (
<button
key={tab.id}
onClick={() => setActiveTab(tab.id)}
className={`flex items-center gap-2 px-6 py-3 font-medium transition-colors ${
activeTab === tab.id
? 'text-blue-600 border-b-2 border-blue-600'
: 'text-gray-600 hover:text-gray-800'
}`}
>
<tab.icon size={20} />
{tab.label}
</button>
))}
</div>
{/* Tab Content */}
<div className="p-6">
{activeTab === 'upload' && (
<div className="space-y-6">
<div>
<h3 className="text-xl font-semibold mb-4">README Principal</h3>
<div className="flex gap-4 mb-4">
<button
onClick={generateTemplate}
className="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors"
>
Generar Template
</button>
</div>
<textarea
value={mainReadme}
onChange={(e) => setMainReadme(e.target.value)}
className="w-full h-40 p-4 border border-gray-300 rounded-lg font-mono text-sm"
placeholder="Pega aquí tu README principal o usa el template..."
/>
</div>
<div>
<h3 className="text-xl font-semibold mb-4">Subir Archivos Adicionales</h3>
<div
className="border-2 border-dashed border-gray-300 rounded-lg p-8 text-center hover:border-blue-400 transition-colors cursor-pointer"
onClick={() => fileInputRef.current?.click()}
>
<Upload size={48} className="mx-auto text-gray-400 mb-4" />
<p className="text-gray-600 mb-2">
Haz clic para subir archivos README o suéltalos aquí
</p>
<p className="text-sm text-gray-500">
Soporta archivos .md, .txt
</p>
<input
ref={fileInputRef}
type="file"
multiple
accept=".md,.txt"
onChange={handleFileUpload}
className="hidden"
/>
</div>
<button
onClick={addManualSection}
className="mt-4 flex items-center gap-2 px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors"
>
<Plus size={20} />
Añadir Sección Manual
</button>
</div>
</div>
)}
{activeTab === 'manage' && (
<div className="space-y-6">
<div className="flex justify-between items-center">
<h3 className="text-xl font-semibold">Secciones a Integrar</h3>
<button
onClick={integrateFiles}
className="px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors"
>
Integrar Archivos
</button>
</div>
{subFiles.length === 0 ? (
<div className="text-center py-8 text-gray-500">
No hay archivos para integrar. Sube algunos archivos en la pestaña anterior.
</div>
) : (
<div className="space-y-4">
{subFiles.map(file => (
<div key={file.id} className="border border-gray-200 rounded-lg p-4">
<div className="flex justify-between items-start mb-4">
<div className="flex-1 space-y-2">
<input
type="text"
value={file.name}
onChange={(e) => updateSubFile(file.id, 'name', e.target.value)}
className="text-lg font-semibold bg-transparent border-b border-transparent hover:border-gray-300 focus:border-blue-500 outline-none"
/>
<input
type="text"
value={file.integrationPoint}
onChange={(e) => updateSubFile(file.id, 'integrationPoint', e.target.value)}
className="text-sm text-gray-600 bg-gray-50 px-2 py-1 rounded border"
placeholder="punto-de-integracion"
/>
</div>
<button
onClick={() => deleteSubFile(file.id)}
className="text-red-600 hover:text-red-800 p-1"
>
<Trash2 size={20} />
</button>
</div>
<textarea
value={file.content}
onChange={(e) => updateSubFile(file.id, 'content', e.target.value)}
className="w-full h-32 p-3 border border-gray-300 rounded-lg font-mono text-sm"
/>
</div>
))}
</div>
)}
</div>
)}
{activeTab === 'preview' && (
<div className="space-y-4">
<div className="flex justify-between items-center">
<h3 className="text-xl font-semibold">README Integrado</h3>
<div className="flex gap-2">
<button
onClick={copyToClipboard}
className="flex items-center gap-2 px-4 py-2 bg-gray-600 text-white rounded-lg hover:bg-gray-700 transition-colors"
>
{copied ? <Check size={20} /> : <Copy size={20} />}
{copied ? 'Copiado!' : 'Copiar'}
</button>
<button
onClick={downloadIntegratedFile}
className="flex items-center gap-2 px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors"
>
<Download size={20} />
Descargar
</button>
</div>
</div>
<div className="border border-gray-300 rounded-lg">
<div className="bg-gray-100 px-4 py-2 border-b border-gray-300 text-sm text-gray-600">
README-integrated.md
</div>
<div className="p-4 max-h-96 overflow-y-auto">
<pre className="whitespace-pre-wrap font-mono text-sm text-gray-800">
{integratedContent}
</pre>
</div>
</div>
</div>
)}
</div>
</div>
{/* Instrucciones */}
<div className="bg-blue-50 border border-blue-200 rounded-lg p-6">
<h4 className="font-semibold text-blue-800 mb-2">💡 Cómo usar la herramienta:</h4>
<ol className="list-decimal list-inside space-y-1 text-blue-700 text-sm">
<li>En tu README principal, usa comentarios como <code className="bg-blue-100 px-1 rounded"><!-- INTEGRATION_POINT:nombre-seccion --></code></li>
<li>Sube los archivos que quieres integrar o créalos manualmente</li>
<li>Ajusta los puntos de integración para que coincidan con los comentarios</li>
<li>Haz clic en "Integrar Archivos" para generar el README final</li>
<li>Descarga o copia el resultado integrado</li>
</ol>
</div>
</div>
);
};
export default ReadmeIntegrator;