now add donload button to all the function and move bug analysis and fixed js at the top and doccumetion and comment in the bootom
Browse files- index.html +169 -35
index.html
CHANGED
|
@@ -6,8 +6,77 @@
|
|
| 6 |
<title>CodeGenius AI - Smart Coding Companion</title>
|
| 7 |
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
theme: {
|
| 12 |
extend: {
|
| 13 |
colors: {
|
|
@@ -201,10 +270,61 @@
|
|
| 201 |
</div>
|
| 202 |
</div>
|
| 203 |
</div>
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
<div class="code-editor p-4 glow">
|
| 209 |
<div class="flex items-center justify-between mb-4">
|
| 210 |
<div class="flex items-center">
|
|
@@ -280,10 +400,7 @@
|
|
| 280 |
</div>
|
| 281 |
</div>
|
| 282 |
</div>
|
| 283 |
-
|
| 284 |
-
<!-- Documentation and Comments Section -->
|
| 285 |
-
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mt-8">
|
| 286 |
-
<!-- Documentation Panel -->
|
| 287 |
<div class="code-editor p-4 glow">
|
| 288 |
<div class="flex items-center mb-4">
|
| 289 |
<div class="flex space-x-2 mr-4">
|
|
@@ -325,41 +442,58 @@
|
|
| 325 |
</div>
|
| 326 |
</div>
|
| 327 |
</div>
|
| 328 |
-
|
| 329 |
-
<!-- Bug Analysis and Fixed Code Section -->
|
| 330 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mt-8">
|
| 331 |
-
<!--
|
| 332 |
<div class="code-editor p-4 glow">
|
| 333 |
-
<div class="flex items-center mb-4">
|
| 334 |
-
<div class="flex
|
| 335 |
-
<div class="
|
| 336 |
-
|
| 337 |
-
|
|
|
|
|
|
|
|
|
|
| 338 |
</div>
|
| 339 |
-
<
|
|
|
|
|
|
|
| 340 |
</div>
|
| 341 |
-
<div id="
|
| 342 |
-
<div class="text-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 343 |
</div>
|
| 344 |
</div>
|
| 345 |
|
| 346 |
-
<!--
|
| 347 |
<div class="code-editor p-4 glow">
|
| 348 |
-
<div class="flex items-center mb-4">
|
| 349 |
-
<div class="flex
|
| 350 |
-
<div class="
|
| 351 |
-
|
| 352 |
-
|
|
|
|
|
|
|
|
|
|
| 353 |
</div>
|
| 354 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 355 |
</div>
|
| 356 |
-
<pre id="fixedCode" class="text-gray-300 text-sm font-mono h-64 overflow-auto bg-gray-800 p-4 rounded">
|
| 357 |
-
<span class="text-gray-500">// Fixed code will appear here after analysis</span></pre>
|
| 358 |
-
<button onclick="applyFix()" class="group relative mt-4 w-full bg-gray-800/50 hover:bg-gray-700/70 border border-gray-700 hover:border-green-500 text-white py-3 px-4 rounded-lg font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-green-500/20">
|
| 359 |
-
<div class="absolute inset-0 bg-green-500/10 group-hover:bg-green-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
|
| 360 |
-
<i data-feather="check-circle" class="mr-2 text-green-400"></i>
|
| 361 |
-
<span class="relative">Apply Fix</span>
|
| 362 |
-
</button>
|
| 363 |
</div>
|
| 364 |
</div>
|
| 365 |
</div>
|
|
|
|
| 6 |
<title>CodeGenius AI - Smart Coding Companion</title>
|
| 7 |
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
| 8 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script>
|
| 10 |
+
function downloadBugAnalysis() {
|
| 11 |
+
const content = document.getElementById('bugTerminal').textContent;
|
| 12 |
+
const blob = new Blob([content], { type: 'text/plain' });
|
| 13 |
+
const url = URL.createObjectURL(blob);
|
| 14 |
+
|
| 15 |
+
const a = document.createElement('a');
|
| 16 |
+
a.href = url;
|
| 17 |
+
a.download = 'bug-analysis.txt';
|
| 18 |
+
document.body.appendChild(a);
|
| 19 |
+
a.click();
|
| 20 |
+
document.body.removeChild(a);
|
| 21 |
+
URL.revokeObjectURL(url);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
function copyFixedCode() {
|
| 25 |
+
const code = document.getElementById('fixedCode').textContent;
|
| 26 |
+
navigator.clipboard.writeText(code);
|
| 27 |
+
|
| 28 |
+
const notification = document.createElement('div');
|
| 29 |
+
notification.className = 'fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-md shadow-lg';
|
| 30 |
+
notification.textContent = 'Fixed code copied to clipboard!';
|
| 31 |
+
document.body.appendChild(notification);
|
| 32 |
+
|
| 33 |
+
setTimeout(() => {
|
| 34 |
+
notification.remove();
|
| 35 |
+
}, 2000);
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
function downloadFixedCode() {
|
| 39 |
+
const code = document.getElementById('fixedCode').textContent;
|
| 40 |
+
const blob = new Blob([code], { type: 'text/javascript' });
|
| 41 |
+
const url = URL.createObjectURL(blob);
|
| 42 |
+
|
| 43 |
+
const a = document.createElement('a');
|
| 44 |
+
a.href = url;
|
| 45 |
+
a.download = 'fixed-code.js';
|
| 46 |
+
document.body.appendChild(a);
|
| 47 |
+
a.click();
|
| 48 |
+
document.body.removeChild(a);
|
| 49 |
+
URL.revokeObjectURL(url);
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
function downloadDocumentation() {
|
| 53 |
+
const content = document.getElementById('documentationPanel').textContent;
|
| 54 |
+
const blob = new Blob([content], { type: 'text/plain' });
|
| 55 |
+
const url = URL.createObjectURL(blob);
|
| 56 |
+
|
| 57 |
+
const a = document.createElement('a');
|
| 58 |
+
a.href = url;
|
| 59 |
+
a.download = 'documentation.txt';
|
| 60 |
+
document.body.appendChild(a);
|
| 61 |
+
a.click();
|
| 62 |
+
document.body.removeChild(a);
|
| 63 |
+
URL.revokeObjectURL(url);
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
function downloadComments() {
|
| 67 |
+
const content = document.getElementById('commentsPanel').textContent;
|
| 68 |
+
const blob = new Blob([content], { type: 'text/plain' });
|
| 69 |
+
const url = URL.createObjectURL(blob);
|
| 70 |
+
|
| 71 |
+
const a = document.createElement('a');
|
| 72 |
+
a.href = url;
|
| 73 |
+
a.download = 'code-comments.txt';
|
| 74 |
+
document.body.appendChild(a);
|
| 75 |
+
a.click();
|
| 76 |
+
document.body.removeChild(a);
|
| 77 |
+
URL.revokeObjectURL(url);
|
| 78 |
+
}
|
| 79 |
+
tailwind.config = {
|
| 80 |
theme: {
|
| 81 |
extend: {
|
| 82 |
colors: {
|
|
|
|
| 270 |
</div>
|
| 271 |
</div>
|
| 272 |
</div>
|
| 273 |
+
<!-- Interactive Code Section -->
|
| 274 |
+
<div class="py-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto">
|
| 275 |
+
<div class="grid grid-cols-1 gap-8">
|
| 276 |
+
<!-- Bug Analysis and Fixed Code Section -->
|
| 277 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
|
| 278 |
+
<!-- Bug Explanation Terminal -->
|
| 279 |
+
<div class="code-editor p-4 glow">
|
| 280 |
+
<div class="flex items-center justify-between mb-4">
|
| 281 |
+
<div class="flex items-center">
|
| 282 |
+
<div class="flex space-x-2 mr-4">
|
| 283 |
+
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
| 284 |
+
<div class="w-3 h-3 rounded-full bg-yellow-500"></div>
|
| 285 |
+
<div class="w-3 h-3 rounded-full bg-green-500"></div>
|
| 286 |
+
</div>
|
| 287 |
+
<div class="text-sm text-gray-400">Bug Analysis</div>
|
| 288 |
+
</div>
|
| 289 |
+
<button onclick="downloadBugAnalysis()" class="text-gray-400 hover:text-white p-1 rounded hover:bg-gray-700/50 transition-all duration-200" title="Download Analysis">
|
| 290 |
+
<i data-feather="download" class="w-4 h-4"></i>
|
| 291 |
+
</button>
|
| 292 |
+
</div>
|
| 293 |
+
<div id="bugTerminal" class="w-full h-64 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-y-auto">
|
| 294 |
+
<div class="text-green-400">$ Waiting for code analysis...</div>
|
| 295 |
+
</div>
|
| 296 |
+
</div>
|
| 297 |
+
|
| 298 |
+
<!-- Fixed Code Editor -->
|
| 299 |
+
<div class="code-editor p-4 glow">
|
| 300 |
+
<div class="flex items-center justify-between mb-4">
|
| 301 |
+
<div class="flex items-center">
|
| 302 |
+
<div class="flex space-x-2 mr-4">
|
| 303 |
+
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
| 304 |
+
<div class="w-3 h-3 rounded-full bg-yellow-500"></div>
|
| 305 |
+
<div class="w-3 h-3 rounded-full bg-green-500"></div>
|
| 306 |
+
</div>
|
| 307 |
+
<div class="text-sm text-gray-400">fixed.js</div>
|
| 308 |
+
</div>
|
| 309 |
+
<div class="flex space-x-2">
|
| 310 |
+
<button onclick="copyFixedCode()" class="text-gray-400 hover:text-white p-1 rounded hover:bg-gray-700/50 transition-all duration-200" title="Copy Code">
|
| 311 |
+
<i data-feather="copy" class="w-4 h-4"></i>
|
| 312 |
+
</button>
|
| 313 |
+
<button onclick="downloadFixedCode()" class="text-gray-400 hover:text-white p-1 rounded hover:bg-gray-700/50 transition-all duration-200" title="Download Code">
|
| 314 |
+
<i data-feather="download" class="w-4 h-4"></i>
|
| 315 |
+
</button>
|
| 316 |
+
</div>
|
| 317 |
+
</div>
|
| 318 |
+
<pre id="fixedCode" class="text-gray-300 text-sm font-mono h-64 overflow-auto bg-gray-800 p-4 rounded">
|
| 319 |
+
<span class="text-gray-500">// Fixed code will appear here after analysis</span></pre>
|
| 320 |
+
<button onclick="applyFix()" class="group relative mt-4 w-full bg-gray-800/50 hover:bg-gray-700/70 border border-gray-700 hover:border-green-500 text-white py-3 px-4 rounded-lg font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-green-500/20">
|
| 321 |
+
<div class="absolute inset-0 bg-green-500/10 group-hover:bg-green-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
|
| 322 |
+
<i data-feather="check-circle" class="mr-2 text-green-400"></i>
|
| 323 |
+
<span class="relative">Apply Fix</span>
|
| 324 |
+
</button>
|
| 325 |
+
</div>
|
| 326 |
+
</div>
|
| 327 |
+
<!-- Enhanced Code Editor with VS Code-like styling -->
|
| 328 |
<div class="code-editor p-4 glow">
|
| 329 |
<div class="flex items-center justify-between mb-4">
|
| 330 |
<div class="flex items-center">
|
|
|
|
| 400 |
</div>
|
| 401 |
</div>
|
| 402 |
</div>
|
| 403 |
+
<!-- Documentation Panel -->
|
|
|
|
|
|
|
|
|
|
| 404 |
<div class="code-editor p-4 glow">
|
| 405 |
<div class="flex items-center mb-4">
|
| 406 |
<div class="flex space-x-2 mr-4">
|
|
|
|
| 442 |
</div>
|
| 443 |
</div>
|
| 444 |
</div>
|
| 445 |
+
<!-- Documentation and Comments Section -->
|
|
|
|
| 446 |
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mt-8">
|
| 447 |
+
<!-- Documentation Panel -->
|
| 448 |
<div class="code-editor p-4 glow">
|
| 449 |
+
<div class="flex items-center justify-between mb-4">
|
| 450 |
+
<div class="flex items-center">
|
| 451 |
+
<div class="flex space-x-2 mr-4">
|
| 452 |
+
<div class="w-3 h-3 rounded-full bg-blue-500"></div>
|
| 453 |
+
<div class="w-3 h-3 rounded-full bg-purple-500"></div>
|
| 454 |
+
<div class="w-3 h-3 rounded-full bg-pink-500"></div>
|
| 455 |
+
</div>
|
| 456 |
+
<div class="text-sm text-gray-400">Documentation</div>
|
| 457 |
</div>
|
| 458 |
+
<button onclick="downloadDocumentation()" class="text-gray-400 hover:text-white p-1 rounded hover:bg-gray-700/50 transition-all duration-200" title="Download Documentation">
|
| 459 |
+
<i data-feather="download" class="w-4 h-4"></i>
|
| 460 |
+
</button>
|
| 461 |
</div>
|
| 462 |
+
<div id="documentationPanel" class="w-full h-64 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-y-auto">
|
| 463 |
+
<div class="text-blue-400">/**
|
| 464 |
+
* <span class="text-purple-400">@function</span> calculateTotal
|
| 465 |
+
* <span class="text-purple-400">@description</span> Calculates the total price of items in a shopping cart
|
| 466 |
+
* <span class="text-purple-400">@param</span> {Array} items - Array of item objects with price and quantity
|
| 467 |
+
* <span class="text-purple-400">@returns</span> {Number} Total calculated amount
|
| 468 |
+
* <span class="text-purple-400">@throws</span> {Error} If items is not an array
|
| 469 |
+
*/</div>
|
| 470 |
</div>
|
| 471 |
</div>
|
| 472 |
|
| 473 |
+
<!-- Comments Panel -->
|
| 474 |
<div class="code-editor p-4 glow">
|
| 475 |
+
<div class="flex items-center justify-between mb-4">
|
| 476 |
+
<div class="flex items-center">
|
| 477 |
+
<div class="flex space-x-2 mr-4">
|
| 478 |
+
<div class="w-3 h-3 rounded-full bg-green-500"></div>
|
| 479 |
+
<div class="w-3 h-3 rounded-full bg-yellow-500"></div>
|
| 480 |
+
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
| 481 |
+
</div>
|
| 482 |
+
<div class="text-sm text-gray-400">Comments</div>
|
| 483 |
</div>
|
| 484 |
+
<button onclick="downloadComments()" class="text-gray-400 hover:text-white p-1 rounded hover:bg-gray-700/50 transition-all duration-200" title="Download Comments">
|
| 485 |
+
<i data-feather="download" class="w-4 h-4"></i>
|
| 486 |
+
</button>
|
| 487 |
+
</div>
|
| 488 |
+
<div id="commentsPanel" class="w-full h-64 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-y-auto">
|
| 489 |
+
<div class="text-green-400">// Function declaration with items parameter</div>
|
| 490 |
+
<div class="text-green-400 mt-2">// Input validation - checks if items is an array</div>
|
| 491 |
+
<div class="text-green-400 mt-2">// Initialize total to 0</div>
|
| 492 |
+
<div class="text-green-400 mt-2">// Loop through each item in the array</div>
|
| 493 |
+
<div class="text-green-400 mt-2">// Convert price to number, default to 0 if invalid</div>
|
| 494 |
+
<div class="text-green-400 mt-2">// Calculate line total (price * quantity)</div>
|
| 495 |
+
<div class="text-green-400 mt-2">// Return the calculated total</div>
|
| 496 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 497 |
</div>
|
| 498 |
</div>
|
| 499 |
</div>
|