make the terminal for input js bigger and color full like vs code codding leeters as code explainer and near the terminal add the button explain , comment in the lines ,find bugs and doccumentation maker and donload option in every function
Browse files- index.html +39 -22
index.html
CHANGED
|
@@ -204,36 +204,53 @@
|
|
| 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 lg:grid-cols-3 gap-8">
|
| 207 |
-
<!--
|
| 208 |
<div class="code-editor p-4 glow lg:col-span-1">
|
| 209 |
-
<div class="flex items-center mb-4">
|
| 210 |
-
<div class="flex
|
| 211 |
-
<div class="
|
| 212 |
-
|
| 213 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
</div>
|
| 215 |
-
<div class="text-sm text-gray-400">input.js</div>
|
| 216 |
</div>
|
| 217 |
-
<
|
| 218 |
-
function calculateTotal(items) {
|
| 219 |
-
if (!Array.isArray(items)) {
|
| 220 |
-
throw new Error('Items must be an array');
|
| 221 |
}
|
| 222 |
|
| 223 |
-
let total = 0
|
| 224 |
-
items
|
| 225 |
-
const price = Number(item
|
| 226 |
-
total += price * (item
|
| 227 |
});
|
| 228 |
|
| 229 |
-
return total;
|
| 230 |
-
}</
|
| 231 |
-
<
|
| 232 |
-
|
| 233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
</div>
|
| 235 |
-
|
| 236 |
-
<!-- Bug Explanation Terminal -->
|
| 237 |
<div class="code-editor p-4 glow lg:col-span-1">
|
| 238 |
<div class="flex items-center mb-4">
|
| 239 |
<div class="flex space-x-2 mr-4">
|
|
|
|
| 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 lg:grid-cols-3 gap-8">
|
| 207 |
+
<!-- Enhanced Code Editor with VS Code-like styling -->
|
| 208 |
<div class="code-editor p-4 glow lg:col-span-1">
|
| 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>
|
| 213 |
+
<div class="w-3 h-3 rounded-full bg-yellow-500"></div>
|
| 214 |
+
<div class="w-3 h-3 rounded-full bg-green-500"></div>
|
| 215 |
+
</div>
|
| 216 |
+
<div class="text-sm text-gray-400">input.js</div>
|
| 217 |
+
</div>
|
| 218 |
+
<div class="flex space-x-2">
|
| 219 |
+
<button onclick="downloadCode()" class="text-gray-400 hover:text-white p-1">
|
| 220 |
+
<i data-feather="download" class="w-4 h-4"></i>
|
| 221 |
+
</button>
|
| 222 |
</div>
|
|
|
|
| 223 |
</div>
|
| 224 |
+
<div id="codeEditor" class="w-full h-80 bg-gray-900 text-gray-100 font-mono text-sm p-4 rounded overflow-auto focus:outline-none focus:ring-2 focus:ring-primary" contenteditable="true" spellcheck="false">
|
| 225 |
+
<span class="text-purple-400">function</span> <span class="text-yellow-300">calculateTotal</span>(<span class="text-blue-400">items</span>) {
|
| 226 |
+
<span class="text-green-400">if</span> (!Array.isArray(<span class="text-blue-400">items</span>)) {
|
| 227 |
+
<span class="text-green-400">throw</span> <span class="text-purple-400">new</span> <span class="text-blue-400">Error</span>(<span class="text-orange-300">'Items must be an array'</span>);
|
| 228 |
}
|
| 229 |
|
| 230 |
+
<span class="text-purple-400">let</span> total = <span class="text-blue-400">0</span>;
|
| 231 |
+
<span class="text-blue-400">items</span>.forEach(<span class="text-blue-400">item</span> => {
|
| 232 |
+
<span class="text-purple-400">const</span> price = <span class="text-blue-400">Number</span>(<span class="text-blue-400">item</span>.price) || <span class="text-blue-400">0</span>;
|
| 233 |
+
total += price * (<span class="text-blue-400">item</span>.quantity || <span class="text-blue-400">1</span>);
|
| 234 |
});
|
| 235 |
|
| 236 |
+
<span class="text-green-400">return</span> total;
|
| 237 |
+
}</div>
|
| 238 |
+
<div class="grid grid-cols-2 gap-2 mt-4">
|
| 239 |
+
<button onclick="explainCode()" class="bg-blue-600 hover:bg-blue-700 text-white py-2 px-3 rounded-md text-sm font-medium flex items-center justify-center">
|
| 240 |
+
<i data-feather="book-open" class="mr-1 w-4 h-4"></i> Explain
|
| 241 |
+
</button>
|
| 242 |
+
<button onclick="commentCode()" class="bg-purple-600 hover:bg-purple-700 text-white py-2 px-3 rounded-md text-sm font-medium flex items-center justify-center">
|
| 243 |
+
<i data-feather="message-square" class="mr-1 w-4 h-4"></i> Comment
|
| 244 |
+
</button>
|
| 245 |
+
<button onclick="analyzeCode()" class="bg-red-600 hover:bg-red-700 text-white py-2 px-3 rounded-md text-sm font-medium flex items-center justify-center">
|
| 246 |
+
<i data-feather="bug" class="mr-1 w-4 h-4"></i> Find Bugs
|
| 247 |
+
</button>
|
| 248 |
+
<button onclick="documentCode()" class="bg-green-600 hover:bg-green-700 text-white py-2 px-3 rounded-md text-sm font-medium flex items-center justify-center">
|
| 249 |
+
<i data-feather="file-text" class="mr-1 w-4 h-4"></i> Document
|
| 250 |
+
</button>
|
| 251 |
+
</div>
|
| 252 |
</div>
|
| 253 |
+
<!-- Bug Explanation Terminal -->
|
|
|
|
| 254 |
<div class="code-editor p-4 glow lg:col-span-1">
|
| 255 |
<div class="flex items-center mb-4">
|
| 256 |
<div class="flex space-x-2 mr-4">
|