Spaces:
Running
Running
File size: 15,556 Bytes
000f970 |
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 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> IDE</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Fira Code', 'Courier New', monospace;
}
body {
height: 100vh;
display: flex;
overflow: hidden;
color: #e0e0e0;
background-color: #121212;
}
/* Custom scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #1e1e1e;
}
::-webkit-scrollbar-thumb {
background: #00bcd4;
border-radius: 0;
}
/* Chat panel */
.chat-panel {
width: 280px;
height: 100vh;
background-color: #1e1e1e;
border-right: 1px solid #00bcd4;
display: flex;
flex-direction: column;
flex-shrink: 0;
}
.chat-header {
padding: 10px 12px;
border-bottom: 1px solid #00bcd4;
font-weight: 600;
display: flex;
justify-content: space-between;
align-items: center;
background-color: #121212;
color: #00bcd4;
font-size: 14px;
}
.chat-messages {
flex: 1;
overflow-y: auto;
padding: 12px;
background-color: #1e1e1e;
}
.message {
margin-bottom: 12px;
padding: 8px 10px;
background-color: #252525;
border-radius: 0;
border-left: 2px solid #00bcd4;
max-width: 90%;
font-size: 13px;
line-height: 1.4;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.message.user {
margin-left: auto;
background-color: #003d4d;
border-left: 3px solid #00bcd4;
color: white;
}
.message.bot {
background-color: #252525;
border-left: 3px solid #4caf50;
}
.message.system {
background-color: #252525;
border-left: 3px solid #ff5722;
font-size: 12px;
color: #b0b0b0;
}
.message-time {
font-size: 10px;
color: #757575;
margin-top: 2px;
text-align: right;
}
.chat-input-container {
padding: 10px 12px;
border-top: 1px solid #00bcd4;
background-color: #121212;
}
.chat-input {
width: 100%;
padding: 8px 10px;
border: 1px solid #00bcd4;
border-radius: 0;
resize: none;
margin-bottom: 8px;
font-size: 13px;
background-color: #252525;
color: #e0e0e0;
min-height: 60px;
}
.chat-input:focus {
outline: none;
border-color: #00e5ff;
}
.chat-buttons {
display: flex;
gap: 6px;
margin-bottom: 8px;
}
.chat-button {
background-color: #00bcd4;
color: #121212;
border: none;
padding: 6px 10px;
border-radius: 0;
cursor: pointer;
font-size: 12px;
font-weight: bold;
transition: all 0.2s;
flex: 1;
text-align: center;
}
.chat-button:hover {
background-color: #00e5ff;
}
.chat-button.secondary {
background-color: #252525;
color: #00bcd4;
border: 1px solid #00bcd4;
}
.chat-button.secondary:hover {
background-color: #003d4d;
}
.chat-button.danger {
background-color: #252525;
color: #ff5252;
border: 1px solid #ff5252;
}
.chat-button.danger:hover {
background-color: #4d0000;
}
/* StackBlitz container */
.stackblitz-container {
flex: 1;
height: 100vh;
position: relative;
background-color: #121212;
}
#stackblitz-embed {
width: 100%;
height: 100%;
border: none;
}
/* Resize handle */
.resize-handle {
width: 4px;
background-color: #00bcd4;
cursor: col-resize;
flex-shrink: 0;
transition: background-color 0.2s;
}
.resize-handle:hover {
background-color: #00e5ff;
}
/* Tabs */
.chat-tabs {
display: flex;
border-bottom: 1px solid #00bcd4;
}
.chat-tab {
padding: 8px 12px;
cursor: pointer;
background-color: #252525;
color: #757575;
border-right: 1px solid #121212;
font-size: 12px;
}
>
.chat-tab.active {
background-color: #121212;
color: #00bcd4;
border-bottom: 2px solid #00bcd4;
}
/* Status bar */
.status-bar {
display: flex;
justify-content: space-between;
padding: 8px 16px;
background-color: #121212;
color: #00bcd4;
font-size: 12px;
border-top: 1px solid #00bcd4;
}
/* Responsive */
@media (max-width: 768px) {
.chat-panel {
width: 280px;
}
.chat-buttons {
flex-direction: column;
}
}
</style>
</head>
<body>
<!-- Left Chat Panel -->
<div class="chat-panel">
<div class="chat-header">
<span><i class="fas fa-code mr-2"></i>CyberBlitz IDE</span>
<div>
<i class="fas fa-cog cursor-pointer hover:text-cyan-300"></i>
<i class="fas fa-expand ml-3 cursor-pointer hover:text-cyan-300"></i>
</div>
</div>
<div class="chat-tabs">
<div class="chat-tab active"><i class="fas fa-comments mr-2"></i>Chat</div>
<div class="chat-tab"><i class="fas fa-users mr-2"></i>Collaborators</div>
<div class="chat-tab"><i class="fas fa-terminal mr-2"></i>Console</div>
</div>
<div class="chat-messages">
<div class="message bot">
<div>Welcome to CyberBlitz IDE! I'm your AI coding assistant.</div>
<div class="message-time">12:34 PM</div>
</div>
<div class="message system">
<div>System connected to StackBlitz project</div>
<div class="message-time">12:34 PM</div>
</div>
<div class="message user">
<div>Can you help me fix this React component?</div>
<div class="message-time">12:35 PM</div>
</div>
<div class="message bot">
<div>Of course! I can see your code on the right. What specific issue are you facing?</div>
<div class="message-time">12:35 PM</div>
</div>
<div class="message bot">
<div>I've detected a potential error in your App.tsx file. Would you like me to suggest a fix?</div>
<div class="message-time">12:36 PM</div>
</div>
</div>
<div class="chat-input-container">
<div class="chat-buttons">
<button class="chat-button" id="suggest-fix"><i class="fas fa-lightbulb mr-2"></i>Suggest Fix</button>
<button class="chat-button secondary" id="explain-code"><i class="fas fa-question mr-2"></i>Explain</button>
<button class="chat-button secondary" id="format-code"><i class="fas fa-align-left mr-2"></i>Format</button>
</div>
<textarea class="chat-input" placeholder="Type your message or code question..." rows="3"></textarea>
<div class="flex justify-between">
<button class="chat-button secondary" id="send-code"><i class="fas fa-code mr-2"></i>Send Code</button>
<button class="chat-button" id="send-message"><i class="fas fa-paper-plane mr-2"></i>Send</button>
</div>
</div>
<div class="status-bar">
<div><i class="fas fa-circle text-green-500 mr-2"></i>Connected</div>
<div>AI Assistant v2.4.1</div>
</div>
</div>
<!-- Resize handle -->
<div class="resize-handle"></div>
<!-- Right StackBlitz Container -->
<div class="stackblitz-container">
<iframe
id="stackblitz-embed"
src="https://stackblitz.com/edit/react-ts?embed=1&file=App.tsx&hideExplorer=0&hideNavigation=0&theme=dark&view=both"
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
></iframe>
</div>
<script>
// Make the chat panel resizable
const resizeHandle = document.querySelector('.resize-handle');
const chatPanel = document.querySelector('.chat-panel');
resizeHandle.addEventListener('mousedown', function(e) {
e.preventDefault();
document.addEventListener('mousemove', resize);
document.addEventListener('mouseup', stopResize);
});
function resize(e) {
const newWidth = e.clientX;
if (newWidth > 250 && newWidth < 500) {
chatPanel.style.width = `${newWidth}px`;
}
}
function stopResize() {
document.removeEventListener('mousemove', resize);
}
// Tab switching
const tabs = document.querySelectorAll('.chat-tab');
tabs.forEach(tab => {
tab.addEventListener('click', () => {
tabs.forEach(t => t.classList.remove('active'));
tab.classList.add('active');
});
});
// Chat functionality
const chatInput = document.querySelector('.chat-input');
const messagesContainer = document.querySelector('.chat-messages');
function addMessage(text, isUser = true) {
const now = new Date();
const timeString = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
const messageDiv = document.createElement('div');
messageDiv.className = isUser ? 'message user' : 'message bot';
messageDiv.innerHTML = `
<div>${text}</div>
<div class="message-time">${timeString}</div>
`;
messagesContainer.appendChild(messageDiv);
messagesContainer.scrollTop = messagesContainer.scrollHeight;
}
// Send message button
document.getElementById('send-message').addEventListener('click', sendMessage);
// Send message on Enter (but allow Shift+Enter for new lines)
chatInput.addEventListener('keydown', function(e) {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
sendMessage();
}
});
function sendMessage() {
const message = chatInput.value.trim();
if (message) {
addMessage(message, true);
chatInput.value = '';
// Simulate bot response
setTimeout(() => {
const responses = [
"I've analyzed your code. The issue appears to be in the component lifecycle.",
"Would you like me to refactor that section for you?",
"I've detected a potential optimization in your code.",
"That's an interesting approach. Have you considered using hooks instead?",
"The error you're seeing is due to a missing dependency in your useEffect hook."
];
const randomResponse = responses[Math.floor(Math.random() * responses.length)];
addMessage(randomResponse, false);
}, 1000 + Math.random() * 2000);
}
}
// Special action buttons
document.getElementById('suggest-fix').addEventListener('click', () => {
addMessage("Please suggest a fix for the current file.", true);
setTimeout(() => {
addMessage("I recommend restructuring the component to use custom hooks. This will improve reusability and make the code easier to test. Would you like me to show you how?", false);
}, 1500);
});
document.getElementById('explain-code').addEventListener('click', () => {
addMessage("Can you explain the current code selection?", true);
setTimeout(() => {
addMessage("This code creates a React component with state management using useState. The useEffect hook is used for side effects when the component mounts or when dependencies change.", false);
}, 1500);
});
document.getElementById('format-code').addEventListener('click', () => {
addMessage("Please format the current file.", true);
setTimeout(() => {
addMessage("I've formatted the code according to standard React practices. The indentation is now consistent and the imports are properly organized.", false);
addMessage("system", "Code formatting applied to App.tsx");
}, 1500);
});
document.getElementById('send-code').addEventListener('click', () => {
addMessage("Here's the code I'm working on: [code snippet]", true);
setTimeout(() => {
addMessage("I see the issue. Line 42 has an incorrect state update. You should use the functional form of setState when the new state depends on the previous state.", false);
}, 1500);
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=subatomicERROR/cyberblitz-ide" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |