codecraft-ai-studio / index.html
Alim111's picture
Əvəl düzəldimiz bişey varıydı onu gelişdireçem prosdu funksyoda əlavə edək indi vereçem kod replit kimidi AI dı prosdu öz səfin tapamır bəzi səflər və.s və zəifdi sıfırdan edəçək bənzər prosdu ki birşey var ki AI belə işləsin normalda sən kimi kod yaza bilirde prosdu kodun sef olup olmadığın gərəy biz deyey elə eləki AI özü başa düşsün sefin kod düz olana qeder yazın yazıp qutaranda görüne baxsın kod düz işdiyir ya yox bəzən kod düz olsada görünüm səf ola bilir bilirsən bunuda başa düşsün kod budu ilk html <!-- ASISTANT TAB - YENİ GÖRÜNÜŞ -->
1a2ccc6 verified
<!DOCTYPE html>
<html lang="az">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CodeCraft AI Studio</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: {
50: '#f0f9ff',
100: '#e0f2fe',
200: '#bae6fd',
300: '#7dd3fc',
400: '#38bdf8',
500: '#0ea5e9',
600: '#0284c7',
700: '#0369a1',
800: '#075985',
900: '#0c4a6e',
},
secondary: {
50: '#fefce8',
100: '#fef9c3',
200: '#fef08a',
300: '#fde047',
400: '#facc15',
500: '#eab308',
600: '#ca8a04',
700: '#a16207',
800: '#854d0e',
900: '#713f12',
}
}
}
}
}
</script>
<style>
.gradient-bg {
background: linear-gradient(135deg, #0ea5e9 0%, #eab308 100%);
}
.glass-effect {
backdrop-filter: blur(16px);
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.code-block-gradient {
background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
border: 1px solid #e2e8f0;
}
.ai-response-animation {
animation: slideInUp 0.5s ease-out;
}
@keyframes slideInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.typing-indicator {
display: inline-block;
width: 12px;
height: 12px;
border-radius: 50%;
background: #0ea5e9;
animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator:nth-child(2) {
animation-delay: 0.2s;
}
.typing-indicator:nth-child(3) {
animation-delay: 0.4s;
}
@keyframes typing {
0%, 60%, 100% {
transform: scale(0.8);
opacity: 0.5;
}
30% {
transform: scale(1);
opacity: 1;
}
}
</style>
</head>
<body class="bg-gray-50 min-h-screen font-sans">
<!-- Header -->
<header class="gradient-bg text-white shadow-lg">
<div class="container mx-auto px-4 py-6">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-12 h-12 bg-white/20 rounded-xl flex items-center justify-center">
<i data-feather="code" class="w-6 h-6"></i>
</div>
<div>
<h1 class="text-2xl font-bold">CodeCraft AI Studio</h1>
<p class="text-primary-100 text-sm">Azərbaycan dilində kod köməkçisi</p>
</div>
</div>
<div class="flex items-center space-x-4">
<button class="glass-effect px-4 py-2 rounded-lg flex items-center space-x-2 hover:bg-white/20 transition-colors">
<i data-feather="sun" class="w-4 h-4"></i>
<span>Açıq</span>
</button>
<button class="glass-effect px-4 py-2 rounded-lg flex items-center space-x-2 hover:bg-white/20 transition-colors">
<i data-feather="settings" class="w-4 h-4"></i>
<span>Ayarlar</span>
</button>
</div>
</div>
</div>
</header>
<!-- Main Content -->
<main class="container mx-auto px-4 py-8">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- AI Assistant Section -->
<div class="lg:col-span-2">
<div class="bg-white rounded-2xl shadow-xl overflow-hidden">
<div class="p-6 border-b border-gray-100">
<div class="flex items-center space-x-3">
<div class="w-16 h-16 bg-gradient-to-br from-primary-400 to-secondary-400 rounded-2xl flex items-center justify-center">
<i data-feather="bot" class="w-8 h-8 text-white"></i>
</div>
<div>
<h2 class="text-xl font-semibold text-gray-800">AI Köməkçi</h2>
<p class="text-gray-600">Kod yazmaqda kömək lazımdır? Burada yazın!</p>
</div>
</div>
</div>
<!-- Chat Log -->
<div class="h-96 overflow-y-auto p-6 bg-gray-50/50">
<div id="chat-log" class="space-y-4">
<div class="ai-response-animation">
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-primary-100 rounded-full flex items-center justify-center flex-shrink-0">
<i data-feather="bot" class="w-4 h-4 text-primary-600"></i>
</div>
<div class="bg-white rounded-2xl p-4 shadow-sm max-w-3xl">
<p class="text-gray-700">Salam! Mən CodeCraft AI Studio köməkçisiyəm. HTML, CSS və JavaScript kodları yazmaqda sizə kömək edə bilərəm. Nə hazırlamaq istəyirsiniz?</p>
</div>
</div>
</div>
</div>
</div>
<!-- Chat Input -->
<div class="p-6 border-t border-gray-100">
<form id="chat-form" class="space-y-4">
<div class="flex space-x-3">
<button type="button" id="reset-all" class="px-4 py-2 bg-red-50 text-red-600 rounded-lg border border-red-200 hover:bg-red-100 transition-colors flex items-center space-x-2">
<i data-feather="refresh-cw" class="w-4 h-4"></i>
<span>Təmizlə</span>
</button>
<button type="button" id="prompt-optimize" class="px-4 py-2 bg-secondary-50 text-secondary-600 rounded-lg border border-secondary-200 hover:bg-secondary-100 transition-colors flex items-center space-x-2">
<i data-feather="edit-3" class="w-4 h-4"></i>
<span>Detallı Göndər</span>
</button>
</div>
<div class="flex space-x-3">
<input type="text" id="chat-input" placeholder="AI-ya yazın... (Məsələn: 'Responsive navbar yarat')"
class="flex-1 px-4 py-3 border border-gray-200 rounded-lg focus:outline-none focus:border-primary-400 focus:ring-2 focus:ring-primary-100 transition-all">
<button type="submit" class="px-6 py-3 bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-colors flex items-center space-x-2">
<i data-feather="send" class="w-4 h-4"></i>
<span>Göndər</span>
</button>
</div>
</form>
</div>
</div>
</div>
<!-- Code Editors Sidebar -->
<div class="lg:col-span-1">
<div class="bg-white rounded-2xl shadow-xl overflow-hidden">
<div class="p-6 border-b border-gray-100">
<h2 class="text-xl font-semibold text-gray-800">Kod Editorları</h2>
<p class="text-gray-600">AI tərəfindən yaradılan kodlar</p>
</div>
<div class="p-6 space-y-6">
<!-- HTML Editor -->
<div>
<div class="flex items-center justify-between mb-3">
<label class="text-sm font-medium text-gray-700 flex items-center space-x-2">
<i data-feather="file-text" class="w-4 h-4 text-primary-500"></i>
<span>HTML Kodu</span>
</label>
<button class="copy-btn px-3 py-1 bg-primary-500 text-white text-xs rounded hover:bg-primary-600 transition-colors" data-target="html-code">
Kopyala
</button>
</div>
<textarea id="html-code" placeholder="HTML kodu burada görünəcək..."
class="w-full h-32 p-3 border border-gray-200 rounded-lg focus:outline-none focus:border-primary-400 focus:ring-2 focus:ring-primary-100 resize-none code-block-gradient font-mono text-sm transition-all"></textarea>
</div>
<!-- CSS Editor -->
<div>
<div class="flex items-center justify-between mb-3">
<label class="text-sm font-medium text-gray-700 flex items-center space-x-2">
<i data-feather="pen-tool" class="w-4 h-4 text-secondary-500"></i>
<span>CSS Kodu</span>
</label>
<button class="copy-btn px-3 py-1 bg-primary-500 text-white text-xs rounded hover:bg-primary-600 transition-colors" data-target="css-code">
Kopyala
</button>
</div>
<textarea id="css-code" placeholder="CSS kodu burada görünəcək..."
class="w-full h-32 p-3 border border-gray-200 rounded-lg focus:outline-none focus:border-primary-400 focus:ring-2 focus:ring-primary-100 resize-none code-block-gradient font-mono text-sm transition-all"></textarea>
</div>
<!-- JavaScript Editor -->
<div>
<div class="flex items-center justify-between mb-3">
<label class="text-sm font-medium text-gray-700 flex items-center space-x-2">
<i data-feather="code" class="w-4 h-4 text-gray-600"></i>
<span>JavaScript Kodu</span>
</label>
<button class="copy-btn px-3 py-1 bg-primary-500 text-white text-xs rounded hover:bg-primary-600 transition-colors" data-target="js-code">
Kopyala
</button>
</div>
<textarea id="js-code" placeholder="JavaScript kodu burada görünəcək..."
class="w-full h-32 p-3 border border-gray-200 rounded-lg focus:outline-none focus:border-primary-400 focus:ring-2 focus:ring-primary-100 resize-none code-block-gradient font-mono text-sm transition-all"></textarea>
</div>
</div>
</div>
<!-- Preview Section -->
<div class="mt-6 bg-white rounded-2xl shadow-xl overflow-hidden">
<div class="p-6 border-b border-gray-100">
<h2 class="text-xl font-semibold text-gray-800">Real-time Preview</h2>
<p class="text-gray-600">Kodunuzun canlı nümayişi</p>
</div>
<div id="output-game" class="h-64 bg-gray-900 flex items-center justify-center">
<div class="text-center text-gray-400">
<i data-feather="monitor" class="w-12 h-12 mx-auto mb-3"></i>
<p>Preview burada görünəcək</p>
</div>
</div>
</div>
</div>
</div>
</main>
<!-- Toast Notification -->
<div id="copy-toast" class="fixed bottom-8 left-1/2 transform -translate-x-1/2 bg-primary-500 text-white px-6 py-3 rounded-lg shadow-lg hidden z-50">
<div class="flex items-center space-x-2">
<i data-feather="check" class="w-4 h-4"></i>
<span>Kopyalandı!</span>
</div>
</div>
<script>
// Initialize Feather Icons
feather.replace();
// Copy functionality
document.querySelectorAll('.copy-btn').forEach(btn => {
btn.addEventListener('click', function() {
const targetId = this.getAttribute('data-target');
const textarea = document.getElementById(targetId);
navigator.clipboard.writeText(textarea.value);
const toast = document.getElementById('copy-toast');
toast.classList.remove('hidden');
setTimeout(() => toast.classList.add('hidden'), 2000);
});
});
// Reset functionality
document.getElementById('reset-all').addEventListener('click', function() {
document.getElementById('html-code').value = '';
document.getElementById('css-code').value = '';
document.getElementById('js-code').value = '';
document.getElementById('chat-log').innerHTML = `
<div class="ai-response-animation">
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-primary-100 rounded-full flex items-center justify-center flex-shrink-0">
<i data-feather="bot" class="w-4 h-4 text-primary-600"></i>
</div>
<div class="bg-white rounded-2xl p-4 shadow-sm max-w-3xl">
<p class="text-gray-700">Salam! Mən CodeCraft AI Studio köməkçisiyəm. HTML, CSS və JavaScript kodları yazmaqda sizə kömək edə bilərəm. Nə hazırlamaq istəyirsiniz?</p>
</div>
</div>
</div>
`;
});
// Chat form submission
document.getElementById('chat-form').addEventListener('submit', function(e) {
e.preventDefault();
const input = document.getElementById('chat-input');
const message = input.value.trim();
if (message) {
// Add user message
const userMessage = document.createElement('div');
userMessage.className = 'ai-response-animation';
userMessage.innerHTML = `
<div class="flex items-start space-x-3 justify-end">
<div class="bg-primary-500 text-white rounded-2xl p-4 shadow-sm max-w-3xl">
<p>${message}</p>
</div>
<div class="w-8 h-8 bg-primary-500 rounded-full flex items-center justify-center flex-shrink-0">
<i data-feather="user" class="w-4 h-4 text-white"></i>
</div>
</div>
`;
document.getElementById('chat-log').appendChild(userMessage);
// Clear input
input.value = '';
// Add typing indicator
const typingIndicator = document.createElement('div');
typingIndicator.className = 'ai-response-animation';
typingIndicator.innerHTML = `
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-primary-100 rounded-full flex items-center justify-center flex-shrink-0">
<i data-feather="bot" class="w-4 h-4 text-primary-600"></i>
</div>
<div class="bg-white rounded-2xl p-4 shadow-sm">
<div class="flex space-x-1">
<div class="typing-indicator"></div>
<div class="typing-indicator"></div>
<div class="typing-indicator"></div>
</div>
</div>
</div>
`;
document.getElementById('chat-log').appendChild(typingIndicator);
// Scroll to bottom
const chatLog = document.getElementById('chat-log');
chatLog.scrollTop = chatLog.scrollHeight;
// Simulate AI response after delay
setTimeout(() => {
// Remove typing indicator
typingIndicator.remove();
// Add AI response
const aiResponse = document.createElement('div');
aiResponse.className = 'ai-response-animation';
aiResponse.innerHTML = `
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-primary-100 rounded-full flex items-center justify-center flex-shrink-0">
<i data-feather="bot" class="w-4 h-4 text-primary-600"></i>
</div>
<div class="bg-white rounded-2xl p-4 shadow-sm max-w-3xl">
<p class="text-gray-700">Başa düşdüm! Burada sizin üçün bir nümunə hazırladım. Kod bloklarında HTML, CSS və JavaScript kodlarını görə bilərsiniz.</p>
<div class="mt-3 space-y-3">
<div class="code-block-gradient rounded-lg p-3">
<div class="flex justify-between items-center mb-2">
<span class="text-sm font-medium text-primary-600">HTML</span>
<button class="copy-btn px-2 py-1 bg-primary-500 text-white text-xs rounded" data-target="html-code">
Kopyala
</button>
</div>
<pre class="text-xs font-mono text-gray-700 overflow-x-auto">${escapeHTML(`<!DOCTYPE html>
<html>
<head>
<title>Nümunə Səhifə</title>
</head>
<body>
<h1>Salam Dünya!</h1>
</body>
</html>`)}</pre>
</div>
</div>
</div>
</div>
`;
document.getElementById('chat-log').appendChild(aiResponse);
// Update code editors with sample code
document.getElementById('html-code').value = `<!DOCTYPE html>
<html>
<head>
<title>Nümunə Səhifə</title>
</head>
<body>
<h1>Salam Dünya!</h1>
</body>
</html>`;
document.getElementById('css-code').value = `body {
font-family: Arial, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
margin: 0;
padding: 20px;
min-height: 100vh;
}
h1 {
color: white;
text-align: center;
margin-top: 50px;
}`;
document.getElementById('js-code').value = `// JavaScript kodu burada
console.log('Salam Dünya!');
// Elementləri seç və manipulyasiya et
document.querySelector('h1').addEventListener('click', function() {
this.style.color = this.style.color === 'yellow' ? 'white' : 'yellow';
});`;
// Update preview
updatePreview();
// Scroll to bottom
chatLog.scrollTop = chatLog.scrollHeight;
// Re-initialize copy buttons
feather.replace();
document.querySelectorAll('.copy-btn').forEach(btn => {
btn.addEventListener('click', function() {
const targetId = this.getAttribute('data-target');
const textarea = document.getElementById(targetId);
navigator.clipboard.writeText(textarea.value);
const toast = document.getElementById('copy-toast');
toast.classList.remove('hidden');
setTimeout(() => toast.classList.add('hidden'), 2000);
});
});
}, 2000);
}
});
function escapeHTML(str) {
return str.replace(/[&<>"']/g, function(m) {
return ({
'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;'
})[m];
});
}
function updatePreview() {
const html = document.getElementById('html-code').value;
const css = document.getElementById('css-code').value;
const js = document.getElementById('js-code').value;
const preview = document.getElementById('output-game');
preview.innerHTML = `
<iframe class="w-full h-full border-0" srcdoc="
<!DOCTYPE html>
<html>
<head>
<style>${css}</style>
</head>
<body>${html}
<script>
try {
${js}
} catch(e) {
console.error('JS Error:', e);
}
<\\/script>
</body>
</html>
"></iframe>
`;
}
// Auto-update preview when code changes
['html-code', 'css-code', 'js-code'].forEach(id => {
document.getElementById(id).addEventListener('input', updatePreview);
});
// Initialize preview
updatePreview();
</script>
</body>
</html>