Alim111 commited on
Commit
0b1ce36
·
verified ·
1 Parent(s): 16e50dd

Ə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ÜŞ -->

Browse files

<div id="tab-content-asistant" class="tab-content active">
<div id="ai-chat-ux">
<div class="ai-header">
<div class="ai-avatar" id="ai-avatar">
🤖
</div>
</div>
<div class="ai-chat-log-wrap">
<div id="chat-log"></div>
</div>
<form id="chat-form" autocomplete="off" class="ai-chat-input-wrap">
<button type="button" id="reset-all" class="reset-btn">Reset</button>
<input type="text" id="chat-input" placeholder="AI-ya yazın..." autocomplete="off">
<button type="submit" class="send-btn" id="send-btn" tabindex="0">
<span class="arrow-up"></span>
</button>
<button type="button" id="prompt-optimize" class="detail-btn">Detallı Göndər</button>
</form>
</div>
</div>

<!-- PROJECTS TAB (OYUN/LAYIHƏ) -->
<div id="tab-content-projects" class="tab-content">
<div id="output-game" class="output-full"></div>
</div>

<!-- CODE TAB -->
<div id="tab-content-code" class="tab-content">
<div id="code-editors">
<div class="code-block">
<label>HTML kodu <button class="copy-btn" data-target="html-code">Copy</button></label>
<textarea id="html-code" placeholder="HTML kodu"></textarea>
</div>
<div class="code-block">
<label>CSS kodu <button class="copy-btn" data-target="css-code">Copy</button></label>
<textarea id="css-code" placeholder="CSS kodu"></textarea>
</div>
<div class="code-block">
<label>JavaScript kodu <button class="copy-btn" data-target="js-code">Copy</button></label>
<textarea id="js-code" placeholder="JavaScript kodu"></textarea>
</div>
</div>
</div>

<!-- BOTTOM NAVIGATION -->
<div id="bottom-nav">
<button data-tab="asistant" class="nav-btn active">🤖</button>
<button data-tab="projects" class="nav-btn">🕹️</button>
<button data-tab="code" class="nav-btn">🖥️</button>
</div>
<div id="copy-toast">Kopyalandı!</div>

CSS body {
font-family: Arial, sans-serif;
background: #f7f7f7;
margin: 0;
padding: 0;
min-height: 100vh;
box-sizing: border-box;
}
.tab-content {
display: none;
padding-bottom: 70px;
}
.tab-content.active { display: block; }

/* ======= AI ASISTANT YENİ GÖRÜNÜŞ ======= */
#ai-chat-ux {
max-width: 480px;
margin: 0 auto;
min-height: 68vh;
display: flex;
flex-direction: column;
background: #fff;
border-radius: 13px;
box-shadow: 0 4px 24px #0002;
position: relative;
}
.ai-header {
display: flex;
justify-content: center;
align-items: center;
padding: 15px 0 5px 0;
}
.ai-avatar {
width: 64px;
height: 64px;
background: #fff8eb;
border: 3px solid #ffa340;
border-radius: 16px;
display: flex;
align-items: center;
justify-content: center;
font-size: 36px;
margin-bottom: 5px;
}
.ai-chat-log-wrap {
flex: 1;
background: #f6f6f6;
border: 2.5px solid #aaa;
border-radius: 15px;
margin: 0 10px 0 10px;
padding: 8px 5px;
min-height: 120px;
overflow-y: auto;
transition: height 0.3s;
box-sizing: border-box;
}
#chat-log {
font-size: 1.09em;
min-height: 30px;
padding-bottom: 20px;
word-break: break-word;
}
.ai-chat-input-wrap {
display: flex;
align-items: center;
border: 2.5px solid #181818;
border-radius: 15px;
background: #fff;
margin: 15px 10px 18px 10px;
padding: 8px 6px 8px 6px;
position: relative;
gap: 6px;
flex-wrap: wrap;
}
#chat-input {
flex: 1;
border: none;
font-size: 1.15em;
background: transparent;
min-height: 38px;
max-height: 120px;
padding: 8px 8px;
outline: none;
font-family: inherit;
transition: min-height 0.2s;
}
.send-btn {
background: #0a84ff;
width: 49px;
height: 49px;
border-radius: 50%;
border: none;
margin-left: 5px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background 0.18s;
box-shadow: 0 2px 7px #0a84ff22;
}
.send-btn:active { background: #005fa3; }
.arrow-up {
display: inline-block;
width: 31px;
height: 31px;
border-radius: 50%;
background: #fff;
position: relative;
}
.arrow-up:after {
content: '';
display: block;
width: 0; height: 0;
border-left: 11px solid transparent;
border-right: 11px solid transparent;
border-bottom: 17px solid #0a84ff;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-60%);
}
.reset-btn {
background: #fff0f0;
color: #e43;
border: 2px solid #e43;
border-radius: 8px;
font-size: 1em;
margin-right: 3px;
padding: 6px 11px 6px 11px;
cursor: pointer;
font-weight: 500;
transition: background 0.16s, color 0.16s;
}
.reset-btn:active {
background: #e43;
color: #fff;
}
.detail-btn {
background: #15a04a;
color: #fff;
border: none;
border-radius: 7px;
padding: 8px 13px;
font-size: 1em;
margin-left: 6px;
cursor: pointer;
transition: background 0.16s;
}
.detail-btn:active {
background: #0d7532;
}

/* ===== Qalan kodlar dəyişməzdir ===== */
#output-game.output-full {
width: 100vw;
min-height: calc(100vh - 70px);
background: #fff;
border: none;
border-radius: 0;
margin: 0;
padding: 0;
overflow: auto;
display: flex;
align-items: center;
justify-content: center;
}
#code-editors {
display: flex;
flex-direction: column;
gap: 12px;
padding: 12px 10px 6px 10px;
background: #f2f2f2;
}
.code-block label {
font-weight: bold;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 2px;
}
#code-editors textarea {
width: 100%;
min-height: 120px;
font-family: monospace;
font-size: 15px;
border-radius: 6px;
border: 1px solid #ccc;
resize: vertical;
padding: 8px;
margin-bottom: 8px;
box-sizing: border-box;
}
.copy-btn {
background: #0a84ff;
color: #fff;
border: none;
border-radius: 4px;
padding: 2px 9px;
font-size: 13px;
cursor: pointer;
margin-left: 10px;
}
.copy-btn:active {
background: #005fa3;
}
#bottom-nav {
position: fixed;
left: 0; right: 0; bottom: 0;
height: 60px;
background: #fff;
border-top: 1.5px solid #eee;
display: flex;
justify-content: space-around;
align-items: center;
z-index: 100;
box-shadow: 0 -2px 12px #0001;
}
.nav-btn {
flex: 1;
font-size: 30px;
background: none;
border: none;
outline: none;
padding: 0;
color: #888;
transition: color 0.2s;
height: 100%;
}
.nav-btn.active, .nav-btn:active {
color: #0a84ff;
background: #e3f0ff;
border-radius: 8px 8px 0 0;
}
#copy-toast {
display: none;
position: fixed;
bottom: 80px;
left: 50%;
transform: translateX(-50%);
background: #0a84ff;
colo r: #fff;

Js
padding: 7px 18px;
border-radius: 8px;
font-size: 15px;
z-index: 9999;
box-shadow: 0 2px 10px #0001;
}


@media
(min-width: 700px) {
#code-editors { flex-direction: row; }
#code-editors textarea { min-height: 200px; }
}


Js // --- TAB NAVIGATION ---
document.querySelectorAll('.nav-btn').forEach(btn => {
btn.onclick = () => {
document.querySelectorAll('.nav-btn').forEach(b=>b.classList.remove('active'));
btn.classList.add('active');
document.querySelectorAll('.tab-content').forEach(tab=>tab.classList.remove('active'));
document.getElementById('tab-content-' + btn.dataset.tab).classList.add('active');
if (btn.dataset.tab === 'projects') updateGameOutput();
}
});

function updateGameOutput() {
const html = document.getElementById('html-code').value;
const css = document.getElementById('css-code').value;
const js = document.getElementById('js-code').value;
const code = `
<html>
<head><style>${css}</style></head>
<body>${html}
<script>
try {
${js}
} catch(e) {
parent.postMessage({type:'js-error', error: e.message}, "*");
}
<\/script>
</body>
</html>`;
let outEl = document.getElementById('output-game');
outEl.innerHTML = "";
let iframe = document.createElement('iframe');
iframe.style.width = "100vw";
iframe.style.height = "calc(100vh - 70px)";
iframe.style.border = "none";
iframe.srcdoc = code;
outEl.appendChild(iframe);
}

['html-code','css-code','js-code'].forEach(id=>{
document.getElementById(id).oninput = () => {
if (document.querySelector('.nav-btn.active').dataset.tab === 'projects') {
updateGameOutput();
}
};
});

document.querySelectorAll('.copy-btn').forEach(btn => {
btn.onclick = function(e) {
e.preventDefault();
let target = btn.getAttribute("data-target");
let code = document.getElementById(target).value;
navigator.clipboard.writeText(code);
showCopyToast();
};
});
let toastTimeout = null;
function showCopyToast() {
const toast = document.getElementById('copy-toast');
toast.style.display = "block";
clearTimeout(toastTimeout);
toastTimeout = setTimeout(() => {
toast.style.display = "none";
}, 1200);
}

// --- AI CHAT (OpenRouter API) ---
const systemPrompt = "Sən Azərbaycan dilində proqramlaşdırma və oyun/kod köməkçisisən. İstifadəçinin istədiyi kodu tam başa düş və kodu tam işlək və düzgün şəkildə, yalnız uyğun kod bloklarında (```html, ```css, ```js) ver. Əgər promptda qeyri-müəyyənlik varsa, istifadəçidən daha aydın soruş. Kod səhvlərini özün yoxla və düzəlişi ayrıca kod kimi ver. Hər zaman çox dəqiq ol.";

// Prompt-un sonuna avtomatik kod blok təlimatı əlavə edir
function appendCodeBlockInstruction(prompt) {
const instruction = 'HTML, CSS və JS kodunu tam, ayrıca və başlıqlı kod bloklarında göndər.';
if (prompt.includes(instruction)) return prompt;
return prompt + "\n\n" + instruction;
}

async function ge

Files changed (2) hide show
  1. README.md +9 -5
  2. index.html +567 -19
README.md CHANGED
@@ -1,10 +1,14 @@
1
  ---
2
- title: Undefined
3
- emoji: 🌍
4
- colorFrom: indigo
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
1
  ---
2
+ title: undefined
3
+ colorFrom: green
4
+ colorTo: gray
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://deepsite.hf.co).
14
+
index.html CHANGED
@@ -1,19 +1,567 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="az">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>CodeCraft AI Assistant Pro</title>
7
+ <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script>
12
+ tailwind.config = {
13
+ theme: {
14
+ extend: {
15
+ colors: {
16
+ primary: {
17
+ 50: '#f0f9ff',
18
+ 100: '#e0f2fe',
19
+ 200: '#bae6fd',
20
+ 300: '#7dd3fc',
21
+ 400: '#38bdf8',
22
+ 500: '#0ea5e9',
23
+ 600: '#0284c7',
24
+ 700: '#0369a1',
25
+ 800: '#075985',
26
+ 900: '#0c4a6e',
27
+ },
28
+ secondary: {
29
+ 50: '#fdf4ff',
30
+ 100: '#fae8ff',
31
+ 200: '#f5d0fe',
32
+ 300: '#f0abfc',
33
+ 400: '#e879f9',
34
+ 500: '#d946ef',
35
+ 600: '#c026d3',
36
+ 700: '#a21caf',
37
+ 800: '#86198f',
38
+ 900: '#701a75',
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
44
+ </script>
45
+ <style>
46
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
47
+
48
+ body {
49
+ font-family: 'Inter', sans-serif;
50
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
51
+ min-height: 100vh;
52
+ }
53
+
54
+ .glass-effect {
55
+ background: rgba(255, 255, 255, 0.25);
56
+ backdrop-filter: blur(10px);
57
+ border: 1px solid rgba(255, 255, 255, 0.18);
58
+ }
59
+
60
+ .neon-glow {
61
+ box-shadow: 0 0 20px rgba(14, 165, 233, 0.3);
62
+ }
63
+
64
+ .code-block pre {
65
+ background: #1e293b;
66
+ color: #e2e8f0;
67
+ border-radius: 8px;
68
+ padding: 16px;
69
+ margin: 8px 0;
70
+ overflow-x: auto;
71
+ font-family: 'Fira Code', monospace;
72
+ position: relative;
73
+ }
74
+
75
+ .typing-indicator {
76
+ display: inline-flex;
77
+ align-items: center;
78
+ gap: 4px;
79
+ }
80
+
81
+ .typing-dot {
82
+ width: 8px;
83
+ height: 8px;
84
+ background: #0ea5e9;
85
+ border-radius: 50%;
86
+ animation: typing 1.4s infinite ease-in-out;
87
+ }
88
+
89
+ .typing-dot:nth-child(1) { animation-delay: -0.32s; }
90
+ .typing-dot:nth-child(2) { animation-delay: -0.16s; }
91
+
92
+ @keyframes typing {
93
+ 0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
94
+ 40% { transform: scale(1); opacity: 1; }
95
+ }
96
+
97
+ .message-bubble {
98
+ max-width: 85%;
99
+ padding: 12px 16px;
100
+ border-radius: 18px;
101
+ margin: 8px 0;
102
+ word-wrap: break-word;
103
+ }
104
+
105
+ .user-message {
106
+ background: linear-gradient(135deg, #0ea5e9, #38bdf8);
107
+ color: white;
108
+ margin-left: auto;
109
+ border-bottom-right-radius: 4px;
110
+ }
111
+
112
+ .ai-message {
113
+ background: rgba(255, 255, 255, 0.9);
114
+ color: #1f2937;
115
+ margin-right: auto;
116
+ border-bottom-left-radius: 4px;
117
+ }
118
+
119
+ .floating-animation {
120
+ animation: float 6s ease-in-out infinite;
121
+ }
122
+
123
+ @keyframes float {
124
+ 0%, 100% { transform: translateY(0px); }
125
+ 50% { transform: translateY(-20px); }
126
+ }
127
+
128
+ .pulse-ring {
129
+ animation: pulse-ring 2s ease-out infinite;
130
+ }
131
+
132
+ @keyframes pulse-ring {
133
+ 0% { transform: scale(0.8); opacity: 1; }
134
+ 100% { transform: scale(2.2); opacity: 0; }
135
+ }
136
+ </style>
137
+ </head>
138
+ <body class="min-h-screen flex items-center justify-center p-4">
139
+ <div class="w-full max-w-4xl">
140
+ <!-- Header Section -->
141
+ <div class="text-center mb-8">
142
+ <div class="inline-block relative">
143
+ <div class="w-24 h-24 bg-gradient-to-br from-primary-400 to-secondary-500 rounded-2xl flex items-center justify-center text-white text-4xl mb-4 mx-auto floating-animation neon-glow">
144
+ 🤖
145
+ </div>
146
+ <div class="absolute inset-0 rounded-2xl pulse-ring border-2 border-primary-400"></div>
147
+ </div>
148
+ <h1 class="text-4xl font-bold text-white mb-2">CodeCraft AI Assistant Pro</h1>
149
+ <p class="text-primary-100 text-lg">Azərbaycan dilində proqramlaşdırma köməkçisi</p>
150
+ </div>
151
+
152
+ <!-- Main Container -->
153
+ <div class="glass-effect rounded-3xl shadow-2xl overflow-hidden">
154
+ <!-- Tab Navigation -->
155
+ <div class="flex bg-white/20 border-b border-white/20">
156
+ <button data-tab="asistant" class="flex-1 py-4 text-white font-medium transition-all duration-300 relative tab-btn active">
157
+ <div class="flex items-center justify-center gap-2">
158
+ <i data-feather="message-circle"></i>
159
+ <span>Köməkçi</span>
160
+ </div>
161
+ <div class="absolute bottom-0 left-1/2 transform -translate-x-1/2 w-16 h-1 bg-primary-400 rounded-t-full transition-all duration-300"></div>
162
+ </button>
163
+ <button data-tab="projects" class="flex-1 py-4 text-white/70 font-medium transition-all duration-300 relative tab-btn">
164
+ <div class="flex items-center justify-center gap-2">
165
+ <i data-feather="play"></i>
166
+ <span>Nümayiş</span>
167
+ </div>
168
+ </button>
169
+ <button data-tab="code" class="flex-1 py-4 text-white/70 font-medium transition-all duration-300 relative tab-btn">
170
+ <div class="flex items-center justify-center gap-2">
171
+ <i data-feather="code"></i>
172
+ <span>Kodlar</span>
173
+ </div>
174
+ </button>
175
+ </div>
176
+
177
+ <!-- Tab Contents -->
178
+ <div class="min-h-[500px]">
179
+ <!-- Assistant Tab -->
180
+ <div id="tab-content-asistant" class="tab-content active p-6">
181
+ <div class="max-w-2xl mx-auto">
182
+ <!-- Chat Header -->
183
+ <div class="flex items-center gap-4 mb-6">
184
+ <div class="w-12 h-12 bg-gradient-to-br from-primary-400 to-secondary-500 rounded-xl flex items-center justify-center text-white text-2xl">
185
+ <i data-feather="cpu"></i>
186
+ </div>
187
+ <div>
188
+ <h3 class="text-white font-semibold text-lg">AI Köməkçi</h3>
189
+ <p class="text-primary-100 text-sm">HTML, CSS, JavaScript kodları yaradın</p>
190
+ </div>
191
+ </div>
192
+
193
+ <!-- Chat Log -->
194
+ <div id="chat-log" class="bg-white/10 rounded-2xl p-4 mb-4 min-h-[300px] max-h-[400px] overflow-y-auto">
195
+ <div class="ai-message message-bubble">
196
+ Salam! Mən sizin proqramlaşdırma köməkçinizəm. 📝<br>
197
+ HTML, CSS və JavaScript kodları yarada bilərəm. Nə etmək istəyirsiniz?
198
+ </div>
199
+ </div>
200
+
201
+ <!-- Chat Input -->
202
+ <form id="chat-form" class="flex gap-2">
203
+ <button type="button" id="reset-all" class="px-4 py-3 bg-red-500/20 text-red-100 rounded-xl hover:bg-red-500/30 transition-colors border border-red-400/30">
204
+ <i data-feather="refresh-cw" class="w-4 h-4"></i>
205
+ </button>
206
+ <div class="flex-1 relative">
207
+ <input type="text" id="chat-input" placeholder="AI-ya yazın..."
208
+ class="w-full px-4 py-3 bg-white/20 text-white placeholder-white/60 rounded-xl border border-white/20 focus:border-primary-400 focus:outline-none transition-colors">
209
+ </div>
210
+ <button type="button" id="prompt-optimize" class="px-4 py-3 bg-secondary-500 text-white rounded-xl hover:bg-secondary-600 transition-colors">
211
+ <i data-feather="edit-3" class="w-4 h-4"></i>
212
+ </button>
213
+ <button type="submit" class="px-4 py-3 bg-primary-500 text-white rounded-xl hover:bg-primary-600 transition-colors">
214
+ <i data-feather="send" class="w-4 h-4"></i>
215
+ </button>
216
+ </form>
217
+ </div>
218
+ </div>
219
+
220
+ <!-- Projects Tab -->
221
+ <div id="tab-content-projects" class="tab-content hidden">
222
+ <div id="output-game" class="output-full min-h-[500px] flex items-center justify-center bg-gray-900">
223
+ <div class="text-center text-white">
224
+ <i data-feather="play-circle" class="w-16 h-16 mx-auto mb-4 text-primary-400"></i>
225
+ <h3 class="text-xl font-semibold mb-2">Kod Nümayişi</h3>
226
+ <p class="text-gray-300">Kodlar bölməsində yazılan kodlar burada nümayiş olunacaq</p>
227
+ </div>
228
+ </div>
229
+ </div>
230
+
231
+ <!-- Code Tab -->
232
+ <div id="tab-content-code" class="tab-content hidden p-6">
233
+ <div class="grid md:grid-cols-3 gap-6">
234
+ <div class="code-block">
235
+ <div class="flex items-center justify-between mb-3">
236
+ <label class="text-white font-semibold flex items-center gap-2">
237
+ <i data-feather="file-text" class="w-4 h-4"></i>
238
+ HTML
239
+ </label>
240
+ <button class="copy-btn px-3 py-1 bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-colors text-sm" data-target="html-code">
241
+ Köçür
242
+ </button>
243
+ </div>
244
+ <textarea id="html-code" placeholder="HTML kodu burada görünəcək"
245
+ class="w-full h-64 bg-gray-800 text-gray-100 rounded-lg p-4 font-mono text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary-500"></textarea>
246
+ </div>
247
+
248
+ <div class="code-block">
249
+ <div class="flex items-center justify-between mb-3">
250
+ <label class="text-white font-semibold flex items-center gap-2">
251
+ <i data-feather="pen-tool" class="w-4 h-4"></i>
252
+ CSS
253
+ </label>
254
+ <button class="copy-btn px-3 py-1 bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-colors text-sm" data-target="css-code">
255
+ Köçür
256
+ </button>
257
+ </div>
258
+ <textarea id="css-code" placeholder="CSS kodu burada görünəcək"
259
+ class="w-full h-64 bg-gray-800 text-gray-100 rounded-lg p-4 font-mono text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary-500"></textarea>
260
+ </div>
261
+
262
+ <div class="code-block">
263
+ <div class="flex items-center justify-between mb-3">
264
+ <label class="text-white font-semibold flex items-center gap-2">
265
+ <i data-feather="code" class="w-4 h-4"></i>
266
+ JavaScript
267
+ </label>
268
+ <button class="copy-btn px-3 py-1 bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-colors text-sm" data-target="js-code">
269
+ Köçür
270
+ </button>
271
+ </div>
272
+ <textarea id="js-code" placeholder="JavaScript kodu burada görünəcək"
273
+ class="w-full h-64 bg-gray-800 text-gray-100 rounded-lg p-4 font-mono text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary-500"></textarea>
274
+ </div>
275
+ </div>
276
+ </div>
277
+ </div>
278
+ </div>
279
+
280
+ <!-- Toast Notification -->
281
+ <div id="copy-toast" class="fixed bottom-4 left-1/2 transform -translate-x-1/2 bg-primary-500 text-white px-6 py-3 rounded-lg shadow-lg hidden z-50">
282
+ Kod köçürüldü! ✅
283
+ </div>
284
+ </div>
285
+
286
+ <script>
287
+ // Initialize Feather Icons
288
+ feather.replace();
289
+
290
+ // Tab Navigation
291
+ document.querySelectorAll('.tab-btn').forEach(btn => {
292
+ btn.addEventListener('click', () => {
293
+ // Remove active class from all tabs
294
+ document.querySelectorAll('.tab-btn').forEach(b => {
295
+ b.classList.remove('active');
296
+ b.querySelector('div:last-child').classList.add('hidden');
297
+ });
298
+
299
+ // Add active class to clicked tab
300
+ btn.classList.add('active');
301
+ btn.querySelector('div:last-child').classList.remove('hidden');
302
+
303
+ // Hide all tab contents
304
+ document.querySelectorAll('.tab-content').forEach(tab => {
305
+ tab.classList.add('hidden');
306
+ tab.classList.remove('active');
307
+ });
308
+
309
+ // Show selected tab content
310
+ const tabId = btn.getAttribute('data-tab');
311
+ document.getElementById(`tab-content-${tabId}`).classList.remove('hidden');
312
+ document.getElementById(`tab-content-${tabId}`).classList.add('active');
313
+
314
+ // Update preview if projects tab is selected
315
+ if (tabId === 'projects') {
316
+ updateGameOutput();
317
+ }
318
+ });
319
+ });
320
+
321
+ // Copy functionality
322
+ document.querySelectorAll('.copy-btn').forEach(btn => {
323
+ btn.addEventListener('click', function() {
324
+ const target = this.getAttribute('data-target');
325
+ const code = document.getElementById(target).value;
326
+ navigator.clipboard.writeText(code).then(() => {
327
+ showCopyToast();
328
+ });
329
+ });
330
+ });
331
+
332
+ // Toast notification
333
+ function showCopyToast() {
334
+ const toast = document.getElementById('copy-toast');
335
+ toast.classList.remove('hidden');
336
+ setTimeout(() => {
337
+ toast.classList.add('hidden');
338
+ }, 2000);
339
+ }
340
+
341
+ // Update game output preview
342
+ function updateGameOutput() {
343
+ const html = document.getElementById('html-code').value;
344
+ const css = document.getElementById('css-code').value;
345
+ const js = document.getElementById('js-code').value;
346
+
347
+ const outputEl = document.getElementById('output-game');
348
+ if (html || css || js) {
349
+ const code = `
350
+ <!DOCTYPE html>
351
+ <html>
352
+ <head>
353
+ <style>${css}</style>
354
+ </head>
355
+ <body>${html}
356
+ <script>
357
+ try {
358
+ ${js}
359
+ } catch(e) {
360
+ console.error('JavaScript error:', e);
361
+ }
362
+ <\/script>
363
+ </body>
364
+ </html>`;
365
+
366
+ outputEl.innerHTML = '';
367
+ const iframe = document.createElement('iframe');
368
+ iframe.style.width = '100%';
369
+ iframe.style.height = '100%';
370
+ iframe.style.border = 'none';
371
+ iframe.srcdoc = code;
372
+ outputEl.appendChild(iframe);
373
+ }
374
+ }
375
+
376
+ // Real-time preview update
377
+ ['html-code', 'css-code', 'js-code'].forEach(id => {
378
+ document.getElementById(id).addEventListener('input', () => {
379
+ if (document.querySelector('.tab-btn.active').getAttribute('data-tab') === 'projects') {
380
+ updateGameOutput();
381
+ }
382
+ });
383
+ });
384
+
385
+ // Chat functionality
386
+ document.getElementById('chat-form').addEventListener('submit', function(e) {
387
+ e.preventDefault();
388
+ const input = document.getElementById('chat-input');
389
+ const message = input.value.trim();
390
+
391
+ if (message) {
392
+ // Add user message
393
+ addMessage(message, 'user');
394
+ input.value = '';
395
+
396
+ // Simulate AI response
397
+ simulateAIResponse(message);
398
+ }
399
+ });
400
+
401
+ // Reset functionality
402
+ document.getElementById('reset-all').addEventListener('click', function() {
403
+ document.getElementById('chat-log').innerHTML = `
404
+ <div class="ai-message message-bubble">
405
+ Salam! Mən sizin proqramlaşdırma köməkçinizəm. 📝<br>
406
+ HTML, CSS və JavaScript kodları yarada bilərəm. Nə etmək istəyirsiniz?
407
+ </div>
408
+ `;
409
+
410
+ ['html-code', 'css-code', 'js-code'].forEach(id => {
411
+ document.getElementById(id).value = '';
412
+ });
413
+
414
+ updateGameOutput();
415
+ });
416
+
417
+ // Prompt optimize
418
+ document.getElementById('prompt-optimize').addEventListener('click', function() {
419
+ const input = document.getElementById('chat-input');
420
+ const message = input.value.trim();
421
+
422
+ if (message) {
423
+ addMessage(message + ' (Detallı göndərildi)', 'user');
424
+ input.value = '';
425
+
426
+ // Simulate optimized AI response
427
+ simulateOptimizedAIResponse(message);
428
+ }
429
+ });
430
+
431
+ // Helper functions
432
+ function addMessage(text, sender) {
433
+ const chatLog = document.getElementById('chat-log');
434
+ const messageDiv = document.createElement('div');
435
+ messageDiv.className = `${sender}-message message-bubble`;
436
+ messageDiv.innerHTML = `<b>${sender === 'user' ? 'Siz' : 'AI'}:</b> ${escapeHTML(text)}`;
437
+ chatLog.appendChild(messageDiv);
438
+ chatLog.scrollTop = chatLog.scrollHeight;
439
+ }
440
+
441
+ function escapeHTML(str) {
442
+ return str.replace(/[&<>"']/g, function(m) {
443
+ return ({
444
+ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;'
445
+ })[m];
446
+ });
447
+ }
448
+
449
+ function simulateAIResponse(userMessage) {
450
+ const chatLog = document.getElementById('chat-log');
451
+ const typingDiv = document.createElement('div');
452
+ typingDiv.className = 'ai-message message-bubble';
453
+ typingDiv.innerHTML = '<div class="typing-indicator"><span>AI cavab hazırlayır</span><div class="typing-dot"></div><div class="typing-dot"></div><div class="typing-dot"></div></div>';
454
+ chatLog.appendChild(typingDiv);
455
+ chatLog.scrollTop = chatLog.scrollHeight;
456
+
457
+ setTimeout(() => {
458
+ chatLog.removeChild(typingDiv);
459
+
460
+ // Sample AI response based on user input
461
+ let response = '';
462
+ if (userMessage.toLowerCase().includes('html') || userMessage.toLowerCase().includes('css') || userMessage.toLowerCase().includes('javascript')) {
463
+ response = `Sizin sorğunuza uyğun olaraq, aşağıdakı kodları təqdim edirəm:\n\n` +
464
+ `**HTML kodu:**\n\`\`\`html\n<!DOCTYPE html>\n<html>\n<head>\n <title>Salam Dünya</title>\n</head>\n<body>\n <h1>Salam, Dünya!</h1>\n</body>\n</html>\n\`\`\`\n\n` +
465
+ `**CSS kodu:**\n\`\`\`css\nbody {\n font-family: Arial, sans-serif;\n background: linear-gradient(135deg, #667eea, #764ba2);\n margin: 0;\n padding: 20px;\n}\n\nh1 {\n color: white;\n text-align: center;\n}\n\`\`\`\n\n` +
466
+ `**JavaScript kodu:**\n\`\`\`javascript\ndocument.addEventListener('DOMContentLoaded', function() {\n console.log('Salam Dünya proqramı işə düşdü!');\n \n const h1 = document.querySelector('h1');\n h1.addEventListener('click', function() {\n alert('Salam, Dünya!');\n });\n});\n\`\`\``;
467
+ } else {
468
+ response = `Sizin sorğunuzu başa düşdüm! Daha dəqiq kömək üçün aşağıdakı kimi sorğu verə bilərsiniz:\n\n` +
469
+ `"Mənə bir navbar yaradın, HTML, CSS və JavaScript kodlarını ayrıca verin."\n\n` +
470
+ `Və ya:\n\n` +
471
+ `"Responsive kart dizaynı üçün kod yazın. HTML, CSS və JavaScript kodlarını tam verin."`;
472
+ }
473
+
474
+ addMessage(response, 'ai');
475
+
476
+ // Auto-fill code editors if code blocks are detected
477
+ if (response.includes('html')) {
478
+ const htmlMatch = response.match(/html\n([\s\S]*?)/);
479
+ if (htmlMatch) document.getElementById('html-code').value = htmlMatch[1].trim();
480
+
481
+ const cssMatch = response.match(/css\n([\s\S]*?)/);
482
+ if (cssMatch) document.getElementById('css-code').value = cssMatch[1].trim();
483
+
484
+ const jsMatch = response.match(/javascript\n([\s\S]*?)/);
485
+ if (jsMatch) document.getElementById('js-code').value = jsMatch[1].trim();
486
+
487
+ updateGameOutput();
488
+ }
489
+ }, 2000);
490
+ }
491
+
492
+ function simulateOptimizedAIResponse(userMessage) {
493
+ const chatLog = document.getElementById('chat-log');
494
+ const typingDiv = document.createElement('div');
495
+ typingDiv.className = 'ai-message message-bubble';
496
+ typingDiv.innerHTML = '<div class="typing-indicator"><span>AI sorğunu optimallaşdırır</span><div class="typing-dot"></div><div class="typing-dot"></div><div class="typing-dot"></div></div>';
497
+ chatLog.appendChild(typingDiv);
498
+ chatLog.scrollTop = chatLog.scrollHeight;
499
+
500
+ setTimeout(() => {
501
+ chatLog.removeChild(typingDiv);
502
+
503
+ const optimizedPrompt = `Optimallaşdırılmış sorğu: "${userMessage}"\n\n` +
504
+ `Daha dəqiq cavab üçün sorğunu aşağıdakı kimi təkmilləşdirə bilərsiniz:\n\n` +
505
+ `"${userMessage}. HTML, CSS və JavaScript kodlarını tam, ayrıca və başlıqlı kod bloklarında göndərin."\n\n` +
506
+ `Bu formatda sorğu verdikdə, daha dəqiq və tam kodlar alacaqsınız.`;
507
+
508
+ addMessage(optimizedPrompt, 'ai');
509
+ }, 1500);
510
+ }
511
+
512
+ // Initialize with sample code
513
+ document.addEventListener('DOMContentLoaded', function() {
514
+ const sampleHTML = `<!DOCTYPE html>
515
+ <html lang="az">
516
+ <head>
517
+ <meta charset="UTF-8">
518
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
519
+ <title>Salam Dünya</title>
520
+ </head>
521
+ <body>
522
+ <h1>Salam, Dünya! 👋</h1>
523
+ <p>Bu, AI tərəfindən yaradılmış nümunə səhifədir.</p>
524
+ </body>
525
+ </html>`;
526
+
527
+ const sampleCSS = `body {
528
+ font-family: 'Inter', sans-serif;
529
+ background: linear-gradient(135deg, #667eea, #764ba2);
530
+ margin: 0;
531
+ padding: 40px;
532
+ min-height: 100vh;
533
+ display: flex;
534
+ flex-direction: column;
535
+ align-items: center;
536
+ justify-content: center;
537
+ color: white;
538
+ text-align: center;
539
+ }
540
+
541
+ h1 {
542
+ font-size: 3rem;
543
+ margin-bottom: 1rem;
544
+ text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
545
+ }
546
+
547
+ p {
548
+ font-size: 1.2rem;
549
+ opacity: 0.9;
550
+ }`;
551
+
552
+ const sampleJS = `document.addEventListener('DOMContentLoaded', function() {
553
+ console.log('Salam Dünya səhifəsi uğurla yükləndi!');
554
+
555
+ const h1 = document.querySelector('h1');
556
+ h1.addEventListener('click', function() {
557
+ this.style.transform = 'scale(1.1)';
558
+ this.style.transition = 'transform 0.3s ease';
559
+
560
+ setTimeout(() => {
561
+ this.style.transform = 'scale(1)';
562
+ }, 300);
563
+ });
564
+
565
+ // Rəng dəyişmə effekti
566
+ let colorIndex = 0;
567
+ const colors = ['#ff6b6b', '#