Abmacode12 commited on
Commit
555bfe6
·
verified ·
1 Parent(s): f70edbb

<!DOCTYPE html>
<html lang="fr" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interface d'Éditeur de Code Sombre</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<aside class="sidebar">
<h2>Projets</h2>
<ul>
<li>Fichier 1.html</li>
<li class="active">Fichier 2.css</li>
<li>Fichier 3.js</li>
</ul>
</aside>
<main class="main-content">
<div class="header">
<span>Fichier 2.css</span>
</div>
<textarea class="code-editor" readonly>
.container {
display: flex;
height: 100vh;
background-color: var(--bg-primary);
}

.sidebar {
width: 250px;
background-color: var(--bg-secondary);
color: var(--text-light);
padding: 20px;
border-right: 1px solid var(--border-color);
}

.code-editor {
background-color: var(--bg-primary);
color: var(--text-normal);
border: none;
width: 100%;
height: calc(100% - 40px); /* Adjust for header height */
padding: 20px;
font-family: monospace;
resize: none;
outline: none;
}
</textarea>
</main>
</div>
</body>
</html>
Utilisez le code avec précaution.

Code CSS (styles.css)
Ce code définit les variables de couleur pour un thème sombre professionnel, comme recommandé par les principes de Material Design pour les thèmes sombres.
css
:root {
--bg-primary: #121212; /* Couleur de fond principale sombre */
--bg-secondary: #1e1e1e; /* Couleur de fond latérale */
--text-normal: #e0e0e0; /* Texte principal clair */
--text-light: #b0b0b0; /* Texte secondaire/léger */
--border-color: #444; /* Ligne de séparation subtile */
--accent-color: #007acc; /* Couleur d'accentuation (bleu pour la sélection) */
}

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

.container {
display: flex;
height: 100vh;
background-color: var(--bg-primary);
}

.sidebar {
width: 250px;
background-color: var(--bg-secondary);
color: var(--text-light);
padding: 20px;
border-right: 1px solid var(--border-color);
}

.sidebar h2 {
color: var(--text-normal);
margin-bottom: 15px;
}

.sidebar ul {
list-style: none;
}

.sidebar li {
padding: 8px 0;
cursor: pointer;
border-radius: 4px;
padding-left: 10px;
}

.sidebar li.active, .sidebar li:hover {
background-color: var(--border-color);
color: var(--accent-color);
}

.main-content {
flex-grow: 1;
}

.header {
background-color: var(--bg-secondary);
color: var(--text-light);
padding: 10px 20px;
border-bottom: 1px solid var(--border-color);
font-family: sans-serif;
font-size: 0.9rem;
}

.code-editor {
background-color: var(--bg-primary);
color: var(--text-normal);
border: none;
width: 100%;
height: calc(100% - 40px);
padding: 20px;
font-family: monospace;
resize: none;
outline: none;
line-height: 1.5;
}

components/chat.js CHANGED
@@ -19,14 +19,17 @@ connectedCallback() {
19
  this.shadowRoot.innerHTML = `
20
  <style>
21
  :host {
22
- display: flex;
23
  flex-direction: column;
24
- height: 100vh;
25
  background: #0b0f19;
26
  color: white;
27
  position: relative;
28
  width: 100%;
29
  }
 
 
 
30
  .chat-container {
31
  flex: 1;
32
  overflow-y: auto;
@@ -168,7 +171,7 @@ connectedCallback() {
168
  <path d="M6 7h12" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
169
  </svg>
170
  </button>
171
- <input type="text" class="message-input" placeholder="Envoyer un message à Espace Codage" id="messageInput">
172
  <button class="action-button mic-button" title="Saisie vocale" id="micButton">
173
  <svg width="18" height="18" viewBox="0 0 24 24" fill="none">
174
  <path d="M12 14a3 3 0 0 0 3-3V7a3 3 0 0 0-6 0v4a3 3 0 0 0 3 3Z" stroke="currentColor" stroke-width="2" />
@@ -187,7 +190,7 @@ connectedCallback() {
187
  </div>
188
  <div class="files-info" id="filesInfo"></div>
189
  </div>
190
- `;
191
 
192
  this._setupEventListeners();
193
  this._startLogsSimulation();
 
19
  this.shadowRoot.innerHTML = `
20
  <style>
21
  :host {
22
+ display: none;
23
  flex-direction: column;
24
+ height: 100%;
25
  background: #0b0f19;
26
  color: white;
27
  position: relative;
28
  width: 100%;
29
  }
30
+ :host(.active) {
31
+ display: flex;
32
+ }
33
  .chat-container {
34
  flex: 1;
35
  overflow-y: auto;
 
171
  <path d="M6 7h12" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
172
  </svg>
173
  </button>
174
+ <input type="text" class="message-input" placeholder="Envoyer un message à Rosalinda" id="messageInput">
175
  <button class="action-button mic-button" title="Saisie vocale" id="micButton">
176
  <svg width="18" height="18" viewBox="0 0 24 24" fill="none">
177
  <path d="M12 14a3 3 0 0 0 3-3V7a3 3 0 0 0-6 0v4a3 3 0 0 0 3 3Z" stroke="currentColor" stroke-width="2" />
 
190
  </div>
191
  <div class="files-info" id="filesInfo"></div>
192
  </div>
193
+ `;
194
 
195
  this._setupEventListeners();
196
  this._startLogsSimulation();
components/header.js CHANGED
@@ -36,14 +36,14 @@ class CustomHeader extends HTMLElement {
36
  }
37
  </style>
38
  <div class="header-content">
39
- <div class="logo">Mon Site Indépendant</div>
40
  <div class="nav-links">
41
  <a href="#" class="nav-link">Accueil</a>
42
- <a href="#" class="nav-link">Projets</a>
43
- <a href="#" class="nav-link">Rosalinda</a>
44
  <a href="#" class="nav-link">Contact</a>
45
  </div>
46
- </div>
47
  `;
48
  }
49
  }
 
36
  }
37
  </style>
38
  <div class="header-content">
39
+ <div class="logo">Rosalinda IA</div>
40
  <div class="nav-links">
41
  <a href="#" class="nav-link">Accueil</a>
42
+ <a href="#" class="nav-link" data-target="code-editor">Éditeur</a>
43
+ <a href="#" class="nav-link" data-target="rosalinda-chat">Chat</a>
44
  <a href="#" class="nav-link">Contact</a>
45
  </div>
46
+ </div>
47
  `;
48
  }
49
  }
components/sidebar.js CHANGED
@@ -81,24 +81,28 @@ class CustomSidebar extends HTMLElement {
81
  <i data-feather="book"></i>
82
  <span>📚 BIBLIOTHÈQUE</span>
83
  </div>
84
- <div class="menu-item">
85
  <i data-feather="folder"></i>
86
  <span>📁 MES PROJETS</span>
87
  </div>
88
  <div class="submenu">
89
- <div class="submenu-item">
90
- <i data-feather="cpu"></i>
91
- <span>🤖 ChatGPT Antibes</span>
 
 
 
 
92
  </div>
93
- <div class="submenu-item">
94
- <i data-feather="globe"></i>
95
- <span>🌐 Intégration Sécurisée</span>
96
- </div>
97
- <div class="submenu-item">
98
- <i data-feather="video"></i>
99
- <span>🎥 Génération Vidéo</span>
100
  </div>
101
  </div>
 
 
 
 
102
  <div class="menu-item">
103
  <i data-feather="check-square"></i>
104
  <span>✅ TOUTES LES TÂCHES</span>
 
81
  <i data-feather="book"></i>
82
  <span>📚 BIBLIOTHÈQUE</span>
83
  </div>
84
+ <div class="menu-item" data-target="code-editor">
85
  <i data-feather="folder"></i>
86
  <span>📁 MES PROJETS</span>
87
  </div>
88
  <div class="submenu">
89
+ <div class="submenu-item" data-target="code-editor">
90
+ <i data-feather="file-text"></i>
91
+ <span>Fichier 1.html</span>
92
+ </div>
93
+ <div class="submenu-item active" data-target="code-editor">
94
+ <i data-feather="file"></i>
95
+ <span>Fichier 2.css</span>
96
  </div>
97
+ <div class="submenu-item" data-target="code-editor">
98
+ <i data-feather="code"></i>
99
+ <span>Fichier 3.js</span>
 
 
 
 
100
  </div>
101
  </div>
102
+ <div class="menu-item" data-target="rosalinda-chat">
103
+ <i data-feather="message-circle"></i>
104
+ <span>💬 CHAT ROSALINDA</span>
105
+ </div>
106
  <div class="menu-item">
107
  <i data-feather="check-square"></i>
108
  <span>✅ TOUTES LES TÂCHES</span>
index.html CHANGED
@@ -4,7 +4,7 @@
4
  <head>
5
  <meta charset="UTF-8">
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Mon Site Indépendant</title>
8
  <link rel="stylesheet" href="style.css">
9
  <script src="https://cdn.tailwindcss.com"></script>
10
  <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
@@ -17,10 +17,11 @@
17
  <custom-header></custom-header>
18
  <main class="flex-1 overflow-hidden">
19
  <custom-chat id="rosalinda-chat"></custom-chat>
 
20
  </main>
21
  <custom-footer></custom-footer>
22
  </div>
23
- <custom-code-preview></custom-code-preview>
24
  </div>
25
 
26
  <script>
@@ -30,6 +31,7 @@
30
  <script src="components/header.js"></script>
31
  <script src="components/footer.js"></script>
32
  <script src="components/chat.js"></script>
 
33
  <script src="components/code-preview.js"></script>
34
  <script src="components/file-upload.js"></script>
35
  <script src="components/partnership-agreement.js"></script>
 
4
  <head>
5
  <meta charset="UTF-8">
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Rosalinda IA - Espace Codage Indépendant</title>
8
  <link rel="stylesheet" href="style.css">
9
  <script src="https://cdn.tailwindcss.com"></script>
10
  <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
 
17
  <custom-header></custom-header>
18
  <main class="flex-1 overflow-hidden">
19
  <custom-chat id="rosalinda-chat"></custom-chat>
20
+ <custom-code-editor></custom-code-editor>
21
  </main>
22
  <custom-footer></custom-footer>
23
  </div>
24
+ <custom-code-preview></custom-code-preview>
25
  </div>
26
 
27
  <script>
 
31
  <script src="components/header.js"></script>
32
  <script src="components/footer.js"></script>
33
  <script src="components/chat.js"></script>
34
+ <script src="components/code-editor.js"></script>
35
  <script src="components/code-preview.js"></script>
36
  <script src="components/file-upload.js"></script>
37
  <script src="components/partnership-agreement.js"></script>
script.js CHANGED
@@ -21,225 +21,50 @@ document.addEventListener('DOMContentLoaded', function() {
21
  }, 2000);
22
  });
23
 
24
- // Rosalinda IA Chat Functionality
25
- const chatElement = document.querySelector('custom-chat');
26
- if (chatElement) {
27
- const shadow = chatElement.shadowRoot;
28
- const chatContainer = shadow.getElementById('chat');
29
- const messageInput = shadow.getElementById('messageInput');
30
- const sendButton = shadow.getElementById('sendButton');
31
- const fileInput = shadow.getElementById('fileInput');
32
- const fileButton = shadow.getElementById('fileButton');
33
- // File upload modal
34
- const fileButton = shadowRoot.getElementById('fileButton');
35
- const fileUpload = document.createElement('custom-file-upload');
36
- fileButton.addEventListener('click', () => {
37
- document.body.appendChild(fileUpload);
38
- setTimeout(() => {
39
- document.addEventListener('click', (e) => {
40
- if (!fileUpload.contains(e.target) && e.target !== fileButton) {
41
- fileUpload.remove();
42
- }
43
- }, { once: true });
44
- }, 0);
45
- feather.replace();
46
- });
47
-
48
- // Connect apps
49
- const connectButton = shadowRoot.getElementById('connectButton');
50
- connectButton.addEventListener('click', () => {
51
- alert('Connecter des applications - Cette fonctionnalité sera implémentée bientôt');
52
- });
53
-
54
- // Microphone
55
- const micButton = shadowRoot.getElementById('micButton');
56
- micButton.addEventListener('click', () => {
57
- if ('webkitSpeechRecognition' in window || 'SpeechRecognition' in window) {
58
- micButton.classList.toggle('listening');
59
- if (micButton.classList.contains('listening')) {
60
- startSpeechRecognition();
61
  } else {
62
- stopSpeechRecognition();
63
  }
64
- } else {
65
- alert('La reconnaissance vocale n\'est pas supportée par votre navigateur');
66
  }
67
  });
68
-
69
- // Send message
70
- function sendMessage() {
71
- const message = messageInput.value.trim();
72
- if (message) {
73
- addMessage('user', message);
74
- messageInput.value = '';
75
-
76
- // Simulate Rosalinda's response
77
- setTimeout(() => {
78
- const responses = [
79
- "J'ai bien reçu votre message. Que souhaitez-vous créer aujourd'hui ?",
80
- "Intéressant ! Voulez-vous que je génère quelque chose pour vous ?",
81
- "Je peux vous aider avec des projets, des images ou des vidéos. Dites-moi ce dont vous avez besoin.",
82
- "Message reçu. Je suis prête à vous assister dans vos créations."
83
- ];
84
- const randomResponse = responses[Math.floor(Math.random() * responses.length)];
85
- addMessage('ai', randomResponse);
86
- }, 1000);
87
- }
88
- }
89
-
90
- sendButton.addEventListener('click', sendMessage);
91
- messageInput.addEventListener('keypress', (e) => {
92
- if (e.key === 'Enter') sendMessage();
93
- });
94
-
95
- function addMessage(sender, text) {
96
- const messageDiv = document.createElement('div');
97
- messageDiv.className = `message ${sender}-message`;
98
- messageDiv.textContent = text;
99
- chatContainer.appendChild(messageDiv);
100
- chatContainer.scrollTop = chatContainer.scrollHeight;
101
- }
102
  }
103
- // Tab switching functionality for code preview
104
- const tabs = document.querySelectorAll('custom-code-preview .tab');
105
- tabs.forEach(tab => {
106
- tab.addEventListener('click', function() {
107
- tabs.forEach(t => t.classList.remove('active'));
108
- this.classList.add('active');
109
- });
110
- });
111
-
112
- // Chat functionality
113
- const chat = document.querySelector('custom-chat');
114
- if (chat) {
115
- const shadowRoot = chat.shadowRoot;
116
- // File upload modal
117
- const fileButton = shadowRoot.getElementById('fileButton');
118
- const fileUpload = document.createElement('custom-file-upload');
119
- fileButton.addEventListener('click', () => {
120
- document.body.appendChild(fileUpload);
121
- setTimeout(() => {
122
- document.addEventListener('click', (e) => {
123
- if (!fileUpload.contains(e.target) && e.target !== fileButton) {
124
- fileUpload.remove();
125
- }
126
- }, { once: true });
127
- }, 0);
128
- feather.replace();
129
- });
130
- // Connect apps
131
- const connectButton = shadowRoot.getElementById('connectButton');
132
- connectButton.addEventListener('click', () => {
133
- alert('Connecter des applications - Cette fonctionnalité sera implémentée bientôt');
134
- });
135
-
136
- // Microphone
137
- const micButton = shadowRoot.getElementById('micButton');
138
- micButton.addEventListener('click', () => {
139
- if ('webkitSpeechRecognition' in window || 'SpeechRecognition' in window) {
140
- micButton.classList.toggle('listening');
141
- if (micButton.classList.contains('listening')) {
142
- startSpeechRecognition();
143
- } else {
144
- stopSpeechRecognition();
145
- }
146
- } else {
147
- alert('La reconnaissance vocale n\'est pas supportée par votre navigateur');
148
- }
149
- });
150
 
151
- // Send message
152
- const sendButton = shadowRoot.getElementById('sendButton');
153
- const messageInput = shadowRoot.getElementById('messageInput');
154
- sendButton.addEventListener('click', sendMessage);
155
- messageInput.addEventListener('keypress', (e) => {
156
- if (e.key === 'Enter') sendMessage();
157
- });
158
-
159
- // Logs simulation
160
- const logsContainer = shadowRoot.querySelector('.logs-container');
161
- setInterval(() => {
162
- const timestamp = new Date().toLocaleTimeString();
163
- const logLine = document.createElement('div');
164
- logLine.className = 'log-line';
165
- logLine.textContent = `Console • ${timestamp} • activité...`;
166
- logsContainer.appendChild(logLine);
167
- logsContainer.scrollTop = logsContainer.scrollHeight;
168
- }, 1400);
169
- }
170
- let recognition;
171
- function startSpeechRecognition() {
172
- const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
173
- recognition = new SpeechRecognition();
174
- recognition.lang = 'fr-FR';
175
- recognition.interimResults = true;
176
- recognition.continuous = true;
177
-
178
- recognition.onresult = (event) => {
179
- const transcript = Array.from(event.results)
180
- .map(result => result[0])
181
- .map(result => result.transcript)
182
- .join(' ');
183
- messageInput.value = transcript;
184
- };
185
-
186
- recognition.onerror = (event) => {
187
- console.error('Speech recognition error', event.error);
188
- micButton.classList.remove('listening');
189
- };
190
-
191
- recognition.onend = () => {
192
- micButton.classList.remove('listening');
193
- };
194
-
195
- recognition.start();
196
  }
 
197
 
198
- function stopSpeechRecognition() {
199
- if (recognition) {
200
- recognition.stop();
201
- }
202
- }
203
- async function sendMessage() {
204
- const message = messageInput.value.trim();
205
- if (message) {
206
- try {
207
- const response = await fetch('/api/chat', {
208
- method: 'POST',
209
- headers: {
210
- 'Content-Type': 'application/json'
211
- },
212
- body: JSON.stringify({
213
- projectId: 'default',
214
- text: message
215
- })
216
- });
217
- const data = await response.json();
218
- if (data.ok) {
219
- const conversation = shadowRoot.querySelector('.conversation');
220
- const userMessage = document.createElement('div');
221
- userMessage.className = 'message';
222
- userMessage.textContent = message;
223
- conversation.appendChild(userMessage);
224
-
225
- const aiMessage = document.createElement('div');
226
- aiMessage.className = 'message';
227
- aiMessage.textContent = data.reply;
228
- conversation.appendChild(aiMessage);
229
-
230
- if (data.toolResult) {
231
- const toolResult = document.createElement('div');
232
- toolResult.className = 'message tool-result';
233
- toolResult.textContent = data.toolResult;
234
- conversation.appendChild(toolResult);
235
- }
236
-
237
- conversation.scrollTop = conversation.scrollHeight;
238
- }
239
- } catch (error) {
240
- console.error('Error sending message:', error);
241
- }
242
- messageInput.value = '';
243
- }
244
  }
 
245
  });
 
21
  }, 2000);
22
  });
23
 
24
+ // Navigation entre les vues
25
+ const views = {
26
+ 'rosalinda-chat': document.querySelector('custom-chat'),
27
+ 'code-editor': document.querySelector('custom-code-editor')
28
+ };
29
+
30
+ // Fonction pour changer de vue
31
+ function showView(targetId) {
32
+ Object.keys(views).forEach(id => {
33
+ if (views[id]) {
34
+ if (id === targetId) {
35
+ views[id].classList.add('active');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  } else {
37
+ views[id].classList.remove('active');
38
  }
 
 
39
  }
40
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
+ // Événements de navigation
44
+ document.addEventListener('click', (e) => {
45
+ const target = e.target.closest('[data-target]');
46
+ if (target) {
47
+ e.preventDefault();
48
+ const targetId = target.getAttribute('data-target');
49
+ showView(targetId);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  }
51
+ });
52
 
53
+ // Vue par défaut
54
+ showView('rosalinda-chat');
55
+
56
+ // Chargement des fichiers sauvegardés
57
+ const savedFiles = localStorage.getItem('rosalinda-files');
58
+ if (savedFiles) {
59
+ try {
60
+ const files = JSON.parse(savedFiles);
61
+ const editor = document.querySelector('custom-code-editor');
62
+ if (editor) {
63
+ editor._files = files;
64
+ editor._render();
65
+ }
66
+ } catch (e) {
67
+ console.log('Impossible de charger les fichiers sauvegardés');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  }
69
+ }
70
  });
server/package.json CHANGED
@@ -16,4 +16,8 @@
16
  "typescript": "^5.6.3"
17
  }
18
  }
19
- ```
 
 
 
 
 
16
  "typescript": "^5.6.3"
17
  }
18
  }
19
+ ```
20
+ ```
21
+ ___METADATA_START___
22
+ {"repoId":"Abmacode12/espace-codage","isNew":false,"userName":"Abmacode12"}
23
+ ___METADATA_END___