make input.js div in a sigle colum in a row and the size of input dive should be bigger and also add small divs where person can see doccumentation and comments in the code
Browse files- index.html +61 -20
index.html
CHANGED
|
@@ -203,10 +203,10 @@
|
|
| 203 |
</div>
|
| 204 |
<!-- Interactive Code Section -->
|
| 205 |
<div class="py-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto">
|
| 206 |
-
<div class="grid grid-cols-1
|
| 207 |
<!-- Enhanced Code Editor with VS Code-like styling -->
|
| 208 |
-
<div class="code-editor p-4 glow
|
| 209 |
-
|
| 210 |
<div class="flex items-center">
|
| 211 |
<div class="flex space-x-2 mr-4">
|
| 212 |
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
|
@@ -221,8 +221,8 @@
|
|
| 221 |
</button>
|
| 222 |
</div>
|
| 223 |
</div>
|
| 224 |
-
<div id="codeEditor" class="w-full h-
|
| 225 |
-
|
| 226 |
<div class="text-primary font-medium">Function Declaration:</div>
|
| 227 |
<div class="text-gray-400 ml-4"><span class="text-purple-400">function</span> <span class="text-yellow-300">calculateTotal</span>(<span class="text-blue-400">items</span>) {</div>
|
| 228 |
</div>
|
|
@@ -246,8 +246,8 @@
|
|
| 246 |
<div class="text-gray-400 ml-4">}</div>
|
| 247 |
</div>
|
| 248 |
</div>
|
| 249 |
-
<div class="grid grid-cols-
|
| 250 |
-
|
| 251 |
<div class="absolute inset-0 bg-blue-500/10 group-hover:bg-blue-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
|
| 252 |
<i data-feather="book-open" class="mr-2 w-4 h-4 text-blue-400"></i>
|
| 253 |
<span class="relative">Explain</span>
|
|
@@ -269,8 +269,57 @@
|
|
| 269 |
</button>
|
| 270 |
</div>
|
| 271 |
</div>
|
| 272 |
-
|
| 273 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
<div class="flex items-center mb-4">
|
| 275 |
<div class="flex space-x-2 mr-4">
|
| 276 |
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
|
@@ -282,18 +331,10 @@
|
|
| 282 |
<div id="bugTerminal" class="w-full h-64 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-y-auto">
|
| 283 |
<div class="text-green-400">$ Waiting for code analysis...</div>
|
| 284 |
</div>
|
| 285 |
-
<div class="mt-4 p-3 bg-gray-800 rounded text-sm text-gray-300">
|
| 286 |
-
<div class="flex items-start">
|
| 287 |
-
<i data-feather="info" class="text-blue-400 mr-2 mt-0.5 flex-shrink-0"></i>
|
| 288 |
-
<div>
|
| 289 |
-
<span class="font-medium">AI Insights:</span> The analyzer will detect potential bugs, security issues, and optimization opportunities.
|
| 290 |
-
</div>
|
| 291 |
-
</div>
|
| 292 |
-
</div>
|
| 293 |
</div>
|
| 294 |
|
| 295 |
<!-- Fixed Code Editor -->
|
| 296 |
-
<div class="code-editor p-4 glow
|
| 297 |
<div class="flex items-center mb-4">
|
| 298 |
<div class="flex space-x-2 mr-4">
|
| 299 |
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
|
@@ -309,9 +350,9 @@
|
|
| 309 |
<i data-feather="check-circle" class="mr-2 text-green-400"></i>
|
| 310 |
<span class="relative">Apply Fix</span>
|
| 311 |
</button>
|
| 312 |
-
</div>
|
| 313 |
</div>
|
| 314 |
-
|
| 315 |
|
| 316 |
<script>
|
| 317 |
function analyzeCode() {
|
|
|
|
| 203 |
</div>
|
| 204 |
<!-- Interactive Code Section -->
|
| 205 |
<div class="py-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto">
|
| 206 |
+
<div class="grid grid-cols-1 gap-8">
|
| 207 |
<!-- Enhanced Code Editor with VS Code-like styling -->
|
| 208 |
+
<div class="code-editor p-4 glow">
|
| 209 |
+
<div class="flex items-center justify-between mb-4">
|
| 210 |
<div class="flex items-center">
|
| 211 |
<div class="flex space-x-2 mr-4">
|
| 212 |
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
|
|
|
| 221 |
</button>
|
| 222 |
</div>
|
| 223 |
</div>
|
| 224 |
+
<div id="codeEditor" class="w-full h-96 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-auto">
|
| 225 |
+
<div>
|
| 226 |
<div class="text-primary font-medium">Function Declaration:</div>
|
| 227 |
<div class="text-gray-400 ml-4"><span class="text-purple-400">function</span> <span class="text-yellow-300">calculateTotal</span>(<span class="text-blue-400">items</span>) {</div>
|
| 228 |
</div>
|
|
|
|
| 246 |
<div class="text-gray-400 ml-4">}</div>
|
| 247 |
</div>
|
| 248 |
</div>
|
| 249 |
+
<div class="grid grid-cols-4 gap-3 mt-4">
|
| 250 |
+
<button onclick="explainCode()" class="group relative bg-gray-700/70 hover:bg-gray-600/80 border border-gray-600 hover:border-blue-500 text-white py-2.5 px-3 rounded-lg text-sm font-medium flex items-center justify-center transition-all duration-200 shadow-md hover:shadow-blue-500/20">
|
| 251 |
<div class="absolute inset-0 bg-blue-500/10 group-hover:bg-blue-500/20 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
|
| 252 |
<i data-feather="book-open" class="mr-2 w-4 h-4 text-blue-400"></i>
|
| 253 |
<span class="relative">Explain</span>
|
|
|
|
| 269 |
</button>
|
| 270 |
</div>
|
| 271 |
</div>
|
| 272 |
+
</div>
|
| 273 |
+
|
| 274 |
+
<!-- Documentation and Comments Section -->
|
| 275 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mt-8">
|
| 276 |
+
<!-- Documentation Panel -->
|
| 277 |
+
<div class="code-editor p-4 glow">
|
| 278 |
+
<div class="flex items-center mb-4">
|
| 279 |
+
<div class="flex space-x-2 mr-4">
|
| 280 |
+
<div class="w-3 h-3 rounded-full bg-blue-500"></div>
|
| 281 |
+
<div class="w-3 h-3 rounded-full bg-purple-500"></div>
|
| 282 |
+
<div class="w-3 h-3 rounded-full bg-pink-500"></div>
|
| 283 |
+
</div>
|
| 284 |
+
<div class="text-sm text-gray-400">Documentation</div>
|
| 285 |
+
</div>
|
| 286 |
+
<div id="documentationPanel" class="w-full h-64 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-y-auto">
|
| 287 |
+
<div class="text-blue-400">/**
|
| 288 |
+
* <span class="text-purple-400">@function</span> calculateTotal
|
| 289 |
+
* <span class="text-purple-400">@description</span> Calculates the total price of items in a shopping cart
|
| 290 |
+
* <span class="text-purple-400">@param</span> {Array} items - Array of item objects with price and quantity
|
| 291 |
+
* <span class="text-purple-400">@returns</span> {Number} Total calculated amount
|
| 292 |
+
* <span class="text-purple-400">@throws</span> {Error} If items is not an array
|
| 293 |
+
*/</div>
|
| 294 |
+
</div>
|
| 295 |
+
</div>
|
| 296 |
+
|
| 297 |
+
<!-- Comments Panel -->
|
| 298 |
+
<div class="code-editor p-4 glow">
|
| 299 |
+
<div class="flex items-center mb-4">
|
| 300 |
+
<div class="flex space-x-2 mr-4">
|
| 301 |
+
<div class="w-3 h-3 rounded-full bg-green-500"></div>
|
| 302 |
+
<div class="w-3 h-3 rounded-full bg-yellow-500"></div>
|
| 303 |
+
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
| 304 |
+
</div>
|
| 305 |
+
<div class="text-sm text-gray-400">Comments</div>
|
| 306 |
+
</div>
|
| 307 |
+
<div id="commentsPanel" class="w-full h-64 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-y-auto">
|
| 308 |
+
<div class="text-green-400">// Function declaration with items parameter</div>
|
| 309 |
+
<div class="text-green-400 mt-2">// Input validation - checks if items is an array</div>
|
| 310 |
+
<div class="text-green-400 mt-2">// Initialize total to 0</div>
|
| 311 |
+
<div class="text-green-400 mt-2">// Loop through each item in the array</div>
|
| 312 |
+
<div class="text-green-400 mt-2">// Convert price to number, default to 0 if invalid</div>
|
| 313 |
+
<div class="text-green-400 mt-2">// Calculate line total (price * quantity)</div>
|
| 314 |
+
<div class="text-green-400 mt-2">// Return the calculated total</div>
|
| 315 |
+
</div>
|
| 316 |
+
</div>
|
| 317 |
+
</div>
|
| 318 |
+
|
| 319 |
+
<!-- Bug Analysis and Fixed Code Section -->
|
| 320 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 mt-8">
|
| 321 |
+
<!-- Bug Explanation Terminal -->
|
| 322 |
+
<div class="code-editor p-4 glow">
|
| 323 |
<div class="flex items-center mb-4">
|
| 324 |
<div class="flex space-x-2 mr-4">
|
| 325 |
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
|
|
|
| 331 |
<div id="bugTerminal" class="w-full h-64 bg-gray-800 text-gray-300 font-mono text-sm p-4 rounded overflow-y-auto">
|
| 332 |
<div class="text-green-400">$ Waiting for code analysis...</div>
|
| 333 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
</div>
|
| 335 |
|
| 336 |
<!-- Fixed Code Editor -->
|
| 337 |
+
<div class="code-editor p-4 glow">
|
| 338 |
<div class="flex items-center mb-4">
|
| 339 |
<div class="flex space-x-2 mr-4">
|
| 340 |
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
|
|
|
| 350 |
<i data-feather="check-circle" class="mr-2 text-green-400"></i>
|
| 351 |
<span class="relative">Apply Fix</span>
|
| 352 |
</button>
|
| 353 |
+
</div>
|
| 354 |
</div>
|
| 355 |
+
</div>
|
| 356 |
|
| 357 |
<script>
|
| 358 |
function analyzeCode() {
|