Abmacode12 commited on
Commit
657ff42
·
verified ·
1 Parent(s): 30d7b7e

Écran de gestion de projets (Première colonne) :

Browse files

Créez un menu latéral avec des projets ("Espace Codage - Projet 1", "Espace Codage - Projet 2") qui sont des éléments cliquables. En fonction du projet choisi, les autres fonctionnalités comme "La Baleine", "Rosalinda" etc. devraient être également accessibles dans cette colonne.

Le menu des raccourcis doit inclure des liens vers ces outils et projets, tout en maintenant une interface claire.

Explication du code (Deuxième colonne) :

Ajoutez une section d'explication du code. Lorsque l'IA génère du code, vous pouvez afficher ce code dans cette colonne avec des commentaires ou des descriptions expliquant ce que chaque partie du code fait.

Exemple : "La Baleine a généré ce code CSS pour le thème, voici les explications :"

/* Code CSS généré */
body {
background-color: #ff6347; /* Couleur de fond tomatée */
}


Cette explication peut être faite sous forme de texte statique ou dynamique en fonction de ce que l'IA génère.

Génération et transformation en image (Troisième colonne) :

Vous pouvez utiliser un générateur d'image ou un outil comme Canvas pour transformer le code en une image. Par exemple, un code CSS qui définit des couleurs ou des éléments graphiques peut être transformé en une image de ce que cela ressemble (un thème visuel).

Vous pouvez intégrer un outil comme D3.js ou Fabric.js pour dessiner ou générer des visualisations à partir des données ou du code CSS/HTML.

Structure de l'interface :

Vous devrez probablement utiliser un framework front-end comme React ou Vue.js pour gérer la structure des colonnes.

Chaque colonne sera un composant qui interagira avec l'utilisateur, en affichant les projets, les explications de l'IA et la transformation du code en image.

Code pour la logique d'affichage :

React Example (structure basique) :

import React, { useState } from 'react';

function ProjectSpace() {
const [project, setProject] = useState('Projet 1');
const [codeExplanation, setCodeExplanation] = useState('');
const [generatedImage, setGeneratedImage] = useState(null);

const handleCodeGeneration = (code) => {
setCodeExplanation(generateExplanation(code));
setGeneratedImage(generateImageFromCode(code));
};

return (
<div className="project-space">
<div className="sidebar">
<h3>Projets</h3>
<ul>
<li onClick={() => setProject('Projet 1')}>Espace Codage - Projet 1</li>
<li onClick={() => setProject('Projet 2')}>Espace Codage - Projet 2</li>
</ul>
</div>
<div className="code-column">
<h3>Explication du code</h3>
<p>{codeExplanation}</p>
</div>
<div className="image-column">
<h3>Image générée</h3>
{generatedImage && <img src={generatedImage} alt="Generated theme" />}
</div>
</div>
);
}

function generateExplanation(code) {
// Example explanation for CSS
return "Ce code CSS définit la couleur de fond du site à une nuance de tomate.";
}

function generateImageFromCode(code) {
// Logic to generate image from code, or render a preview of the theme
return 'path_to_generated_image.png';
}

export default ProjectSpace;


CSS pour organiser les colonnes :

.project-space {
display: flex;
justify-content: space-between;
}

.sidebar {
width: 20%;
padding: 10px;
}

.code-column, .image-column {
width: 40%;
padding: 10px;
}

components/code-explainer.js ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CodeExplainer extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+ this.attachShadow({ mode: 'open' });
5
+ this.code = '';
6
+ this.explanation = '';
7
+ }
8
+
9
+ connectedCallback() {
10
+ this.render();
11
+ }
12
+
13
+ setCode(code, explanation) {
14
+ this.code = code;
15
+ this.explanation = explanation;
16
+ this.render();
17
+ }
18
+
19
+ render() {
20
+ this.shadowRoot.innerHTML = `
21
+ <style>
22
+ :host {
23
+ display: block;
24
+ width: 100%;
25
+ height: 100%;
26
+ background: var(--bg-color, #1e293b);
27
+ color: var(--text-color, #f8fafc);
28
+ padding: 1rem;
29
+ box-sizing: border-box;
30
+ overflow-y: auto;
31
+ }
32
+ h3 {
33
+ margin: 0 0 1rem 0;
34
+ font-size: 1.125rem;
35
+ font-weight: 600;
36
+ }
37
+ .code-block {
38
+ background: #0f172a;
39
+ border-radius: 0.5rem;
40
+ padding: 1rem;
41
+ font-family: 'Courier New', monospace;
42
+ font-size: 0.875rem;
43
+ margin-bottom: 1rem;
44
+ border: 1px solid #334155;
45
+ white-space: pre-wrap;
46
+ }
47
+ .comment {
48
+ color: #64748b;
49
+ }
50
+ .explanation {
51
+ background: rgba(255, 255, 255, 0.05);
52
+ border-radius: 0.5rem;
53
+ padding: 1rem;
54
+ font-size: 0.875rem;
55
+ line-height: 1.5;
56
+ }
57
+ </style>
58
+ <h3>Explication du code</h3>
59
+ ${this.code ? `
60
+ <div class="explanation">${this.explanation || "La Baleine a généré ce code, voici les explications :"}</div>
61
+ <pre class="code-block">${this.code}</pre>
62
+ ` : `
63
+ <div class="explanation">Sélectionnez un projet ou générez du code pour voir les explications ici.</div>
64
+ `}
65
+ `;
66
+ }
67
+ }
68
+
69
+ customElements.define('code-explainer', CodeExplainer);
components/code-visualizer.js ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CodeVisualizer extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+ this.attachShadow({ mode: 'open' });
5
+ this.code = '';
6
+ this.canvas = null;
7
+ this.ctx = null;
8
+ }
9
+
10
+ connectedCallback() {
11
+ this.render();
12
+ }
13
+
14
+ setCode(code) {
15
+ this.code = code;
16
+ this.render();
17
+ this.visualizeCode();
18
+ }
19
+
20
+ visualizeCode() {
21
+ if (!this.code) return;
22
+
23
+ try {
24
+ // Create a temporary style element to apply the CSS
25
+ const style = document.createElement('style');
26
+ style.textContent = this.code;
27
+ document.head.appendChild(style);
28
+
29
+ // Create a preview element to visualize the styles
30
+ const preview = document.createElement('div');
31
+ preview.style.width = '100%';
32
+ preview.style.height = '100%';
33
+ preview.style.position = 'relative';
34
+ preview.innerHTML = `
35
+ <div class="preview-element" style="width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;">
36
+ <p>Prévisualisation du thème</p>
37
+ </div>
38
+ `;
39
+
40
+ this.shadowRoot.getElementById('preview-container').innerHTML = '';
41
+ this.shadowRoot.getElementById('preview-container').appendChild(preview);
42
+
43
+ // Remove the temporary style after visualization
44
+ setTimeout(() => document.head.removeChild(style), 100);
45
+ } catch (e) {
46
+ console.error('Error visualizing code:', e);
47
+ }
48
+ }
49
+
50
+ render() {
51
+ this.shadowRoot.innerHTML = `
52
+ <style>
53
+ :host {
54
+ display: block;
55
+ width: 100%;
56
+ height: 100%;
57
+ background: var(--bg-color, #1e293b);
58
+ color: var(--text-color, #f8fafc);
59
+ padding: 1rem;
60
+ box-sizing: border-box;
61
+ }
62
+ h3 {
63
+ margin: 0 0 1rem 0;
64
+ font-size: 1.125rem;
65
+ font-weight: 600;
66
+ }
67
+ #preview-container {
68
+ width: 100%;
69
+ height: calc(100% - 2rem);
70
+ background: white;
71
+ border-radius: 0.5rem;
72
+ overflow: hidden;
73
+ position: relative;
74
+ }
75
+ .empty-state {
76
+ width: 100%;
77
+ height: 100%;
78
+ display: flex;
79
+ align-items: center;
80
+ justify-content: center;
81
+ color: #64748b;
82
+ font-size: 0.875rem;
83
+ }
84
+ </style>
85
+ <h3>Visualisation</h3>
86
+ <div id="preview-container">
87
+ ${this.code ? '' : `
88
+ <div class="empty-state">
89
+ Générer du code pour voir la visualisation ici
90
+ </div>
91
+ `}
92
+ </div>
93
+ `;
94
+ }
95
+ }
96
+
97
+ customElements.define('code-visualizer', CodeVisualizer);
components/project-manager.js ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class ProjectManager extends HTMLElement {
2
+ constructor() {
3
+ super();
4
+ this.attachShadow({ mode: 'open' });
5
+ this.projects = [
6
+ { id: 'projet1', name: 'Espace Codage - Projet 1', active: true },
7
+ { id: 'projet2', name: 'Espace Codage - Projet 2', active: false }
8
+ ];
9
+ this.tools = [
10
+ { name: 'La Baleine IA', icon: 'image', href: 'baleine.html' },
11
+ { name: 'Rosalinda IA', icon: 'message-circle', href: 'rosalinda.html' },
12
+ { name: 'Bibliothèque', icon: 'book', href: '#' },
13
+ { name: 'Paramètres', icon: 'settings', href: '#' }
14
+ ];
15
+ }
16
+
17
+ connectedCallback() {
18
+ this.render();
19
+ this.setupEventListeners();
20
+ }
21
+
22
+ render() {
23
+ this.shadowRoot.innerHTML = `
24
+ <style>
25
+ :host {
26
+ display: block;
27
+ width: 100%;
28
+ height: 100%;
29
+ background: var(--bg-color, #1e293b);
30
+ color: var(--text-color, #f8fafc);
31
+ }
32
+ .sidebar {
33
+ padding: 1rem;
34
+ height: 100%;
35
+ display: flex;
36
+ flex-direction: column;
37
+ }
38
+ .projects {
39
+ flex-grow: 1;
40
+ overflow-y: auto;
41
+ }
42
+ .project {
43
+ padding: 0.75rem 1rem;
44
+ margin-bottom: 0.5rem;
45
+ border-radius: 0.5rem;
46
+ cursor: pointer;
47
+ display: flex;
48
+ align-items: center;
49
+ gap: 0.75rem;
50
+ border: 1px solid transparent;
51
+ transition: all 0.2s ease;
52
+ }
53
+ .project:hover {
54
+ background: rgba(255, 255, 255, 0.05);
55
+ }
56
+ .project.active {
57
+ background: rgba(59, 130, 246, 0.1);
58
+ border-color: rgba(59, 130, 246, 0.2);
59
+ color: rgba(191, 219, 254, 1);
60
+ }
61
+ .project-icon {
62
+ width: 1.5rem;
63
+ height: 1.5rem;
64
+ border-radius: 0.375rem;
65
+ display: flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ background: rgba(255, 255, 255, 0.1);
69
+ }
70
+ .tools {
71
+ margin-top: 1rem;
72
+ padding-top: 1rem;
73
+ border-top: 1px solid rgba(255, 255, 255, 0.1);
74
+ }
75
+ .tool {
76
+ padding: 0.75rem 1rem;
77
+ margin-bottom: 0.5rem;
78
+ border-radius: 0.5rem;
79
+ cursor: pointer;
80
+ display: flex;
81
+ align-items: center;
82
+ gap: 0.75rem;
83
+ transition: all 0.2s ease;
84
+ }
85
+ .tool:hover {
86
+ background: rgba(255, 255, 255, 0.05);
87
+ }
88
+ h3 {
89
+ margin: 0 0 1rem 0;
90
+ font-size: 0.875rem;
91
+ font-weight: 600;
92
+ text-transform: uppercase;
93
+ letter-spacing: 0.05em;
94
+ color: rgba(156, 163, 175, 1);
95
+ }
96
+ </style>
97
+ <div class="sidebar">
98
+ <div class="projects">
99
+ <h3>Projets</h3>
100
+ ${this.projects.map(project => `
101
+ <div class="project ${project.active ? 'active' : ''}" data-id="${project.id}">
102
+ <div class="project-icon">
103
+ <i data-feather="folder"></i>
104
+ </div>
105
+ <span>${project.name}</span>
106
+ </div>
107
+ `).join('')}
108
+ </div>
109
+ <div class="tools">
110
+ <h3>Outils</h3>
111
+ ${this.tools.map(tool => `
112
+ <a href="${tool.href}" class="tool">
113
+ <div class="project-icon">
114
+ <i data-feather="${tool.icon}"></i>
115
+ </div>
116
+ <span>${tool.name}</span>
117
+ </a>
118
+ `).join('')}
119
+ </div>
120
+ </div>
121
+ `;
122
+ feather.replace();
123
+ }
124
+
125
+ setupEventListeners() {
126
+ this.shadowRoot.querySelectorAll('.project').forEach(project => {
127
+ project.addEventListener('click', () => {
128
+ this.projects.forEach(p => p.active = false);
129
+ const selectedProject = this.projects.find(p => p.id === project.dataset.id);
130
+ if (selectedProject) selectedProject.active = true;
131
+ this.render();
132
+
133
+ // Dispatch event to update other components
134
+ this.dispatchEvent(new CustomEvent('project-changed', {
135
+ detail: { project: selectedProject }
136
+ }));
137
+ });
138
+ });
139
+ }
140
+ }
141
+
142
+ customElements.define('project-manager', ProjectManager);
index.html CHANGED
@@ -11,270 +11,55 @@
11
  </head>
12
  <body class="bg-gray-900 text-gray-100 font-sans antialiased">
13
  <div class="app-container h-screen flex">
14
- <!-- Sidebar -->
15
- <aside class="w-80 bg-gray-800 border-r border-gray-700 flex flex-col">
16
- <div class="p-4 border-b border-gray-700 flex items-center gap-3">
17
- <div class="w-3 h-3 rounded-full bg-blue-500 shadow-lg shadow-blue-500/30"></div>
18
- <h1 class="font-bold">Espace Codage</h1>
19
- </div>
 
20
 
21
- <div class="p-3 border-b border-gray-700 flex items-center gap-2 bg-gray-850">
22
- <button class="p-2 rounded-lg bg-gray-750 hover:bg-gray-700">
23
- <i data-feather="edit-2" class="w-4 h-4 text-gray-400"></i>
24
- </button>
25
- <div class="flex-1 relative">
26
- <i data-feather="search" class="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 w-4 h-4"></i>
27
- <input type="text" placeholder="Rechercher..."
28
- class="w-full pl-9 pr-3 py-2 bg-gray-750 rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-blue-500">
29
- </div>
30
- </div>
31
-
32
- <nav class="flex-1 overflow-y-auto p-2">
33
- <h2 class="text-xs uppercase tracking-wider text-gray-500 px-3 py-2">Projets</h2>
34
- <a href="#" class="flex items-center gap-3 px-3 py-2 rounded-lg bg-blue-900/30 border border-blue-800/50 text-blue-200 mb-1">
35
- <div class="p-2 rounded-lg bg-blue-900/50 border border-blue-800/50">
36
- <i data-feather="code" class="w-4 h-4"></i>
37
- </div>
38
- <span class="truncate">Espace Codage - Projet 1</span>
39
- </a>
40
- <a href="#" class="flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-gray-750/50 border border-transparent hover:border-gray-700 text-gray-300 mb-1">
41
- <div class="p-2 rounded-lg bg-gray-750 border border-gray-700">
42
- <i data-feather="code" class="w-4 h-4"></i>
43
- </div>
44
- <span class="truncate">Espace Codage - Projet 2</span>
45
- </a>
46
-
47
- <h2 class="text-xs uppercase tracking-wider text-gray-500 px-3 py-2 mt-4">Raccourcis</h2>
48
- <a href="baleine.html" class="flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-gray-750/50 border border-transparent hover:border-gray-700 text-gray-300 mb-1">
49
- <div class="p-2 rounded-lg bg-gray-750 border border-gray-700">
50
- <i data-feather="image" class="w-4 h-4"></i>
51
- </div>
52
- <span class="truncate">La Baleine IA</span>
53
- </a>
54
- <a href="rosalinda.html" class="flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-gray-750/50 border border-transparent hover:border-gray-700 text-gray-300 mb-1">
55
- <div class="p-2 rounded-lg bg-gray-750 border border-gray-700">
56
- <i data-feather="message-circle" class="w-4 h-4"></i>
57
- </div>
58
- <span class="truncate">Rosalinda IA</span>
59
- </a>
60
- <a href="#" class="flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-gray-750/50 border border-transparent hover:border-gray-700 text-gray-300 mb-1">
61
- <div class="p-2 rounded-lg bg-gray-750 border border-gray-700">
62
- <i data-feather="book" class="w-4 h-4"></i>
63
- </div>
64
- <span class="truncate">Bibliothèque</span>
65
- </a>
66
- <a href="#" class="flex items-center gap-3 px-3 py-2 rounded-lg hover:bg-gray-750/50 border border-transparent hover:border-gray-700 text-gray-300 mb-1">
67
- <div class="p-2 rounded-lg bg-gray-750 border border-gray-700">
68
- <i data-feather="settings" class="w-4 h-4"></i>
69
- </div>
70
- <span class="truncate">Paramètres</span>
71
- </a>
72
- </nav>
73
-
74
- <div class="p-3 border-t border-gray-700 flex justify-between bg-gray-850">
75
- <button class="flex items-center gap-1 px-3 py-2 rounded-lg text-sm bg-gray-750 hover:bg-gray-700 border border-gray-700">
76
- <i data-feather="share-2" class="w-4 h-4"></i>
77
- <span>Partager</span>
78
- <span class="text-xs text-gray-500 ml-1">inviter</span>
79
- </button>
80
- <button class="flex items-center gap-1 px-3 py-2 rounded-lg text-sm bg-gray-750 hover:bg-gray-700 border border-gray-700">
81
- <i data-feather="user" class="w-4 h-4"></i>
82
- <span class="text-xs text-gray-500">profil</span>
83
- </button>
84
- </div>
85
- </aside>
86
-
87
- <!-- Main Content -->
88
- <main class="flex-1 flex flex-col bg-gray-850/50">
89
- <div class="p-3 border-b border-gray-700 flex gap-2 bg-gray-850">
90
- <span class="text-xs px-3 py-1 rounded-full bg-gray-800 border border-gray-700 text-gray-400">Aperçu</span>
91
- <span class="text-xs px-3 py-1 rounded-full bg-gray-800 border border-gray-700 text-gray-400">Projet</span>
92
- <span class="text-xs px-3 py-1 rounded-full bg-gray-800 border border-gray-700 text-gray-400">/</span>
93
- </div>
94
- <div class="flex-1 flex flex-col p-4 overflow-y-auto" id="chatContainer">
95
- <div class="flex-1 overflow-y-auto p-2 flex flex-col gap-3" id="chatMessages">
96
- <div class="msg bg-gray-700/50 border border-gray-700 p-3 rounded-xl max-w-[80%]">
97
- Bonjour 👋 Je suis Rosalinda, votre assistante IA. Je peux vous aider à générer des images, vidéos et bien plus. Dites-moi ce dont vous avez besoin !
98
- </div>
99
  </div>
100
- <div class="p-3 border-t border-gray-700 bg-gray-850">
101
- <div class="flex items-center gap-2 p-2 rounded-xl bg-gray-800 border border-gray-700">
102
- <button id="chatMicBtn" class="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-gray-200">
103
- <i data-feather="mic" class="w-5 h-5"></i>
104
- </button>
105
- <button id="chatAttachBtn" class="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-gray-200">
106
- <i data-feather="paperclip" class="w-5 h-5"></i>
107
- </button>
108
- <input id="chatInput" placeholder="Écrivez votre message..."
109
- class="flex-1 bg-transparent px-3 py-2 focus:outline-none text-sm">
110
- <button id="chatSendBtn" class="p-2 rounded-lg bg-blue-600 hover:bg-blue-500 text-white">
111
- <i data-feather="send" class="w-5 h-5"></i>
112
- </button>
113
- </div>
114
- <div class="text-xs text-gray-500 mt-2 flex justify-between">
115
- <span id="chatStatus">Prêt</span>
116
- <span>Assistant IA v1.0</span>
117
- </div>
118
- </div>
119
- </main>
120
-
121
- <!-- Preview Panel -->
122
- <aside class="w-96 bg-gray-800 border-l border-gray-700 flex flex-col">
123
- <div class="p-3 border-b border-gray-700 flex justify-between items-center bg-gray-850">
124
- <h2 class="font-bold">Aperçu</h2>
125
- <div class="flex gap-1">
126
- <button class="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-gray-200">
127
- <i data-feather="arrow-left" class="w-4 h-4"></i>
128
- </button>
129
- <button class="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-gray-200">
130
- <i data-feather="arrow-right" class="w-4 h-4"></i>
131
- </button>
132
- <button class="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-gray-200">
133
- <i data-feather="refresh-ccw" class="w-4 h-4"></i>
134
- </button>
135
- <button class="p-2 rounded-lg hover:bg-gray-700 text-gray-400 hover:text-gray-200">
136
- <i data-feather="maximize" class="w-4 h-4"></i>
137
- </button>
138
- <button class="flex items-center gap-1 px-3 py-1 rounded-lg text-sm bg-gray-750 hover:bg-gray-700 border border-gray-700">
139
- <i data-feather="edit" class="w-4 h-4"></i>
140
- <span>Modifier</span>
141
- </button>
142
- </div>
143
- </div>
144
- <div class="flex-1 flex flex-col p-4 overflow-y-auto bg-gray-850/30" id="previewPanel">
145
- <h3 class="font-bold text-lg mb-4">Génération Rosalinda</h3>
146
- <div id="mediaResults" class="grid grid-cols-2 gap-4">
147
- <!-- Les médias générés apparaîtront ici -->
148
- </div>
149
- <div id="explanations" class="mt-4 p-4 bg-gray-800 rounded-lg">
150
- <h4 class="font-medium mb-2">Explications techniques</h4>
151
- <p class="text-sm text-gray-400">En attente de votre demande...</p>
152
- </div>
153
- </div>
154
- <div class="p-3 border-t border-gray-700 flex justify-between text-sm bg-gray-850">
155
- <span class="text-gray-500">Statut: <span class="text-gray-400">Hors ligne</span></span>
156
- <span class="text-gray-500">Mode: <span class="text-gray-400">Preview</span></span>
157
- </div>
158
- </aside>
159
- </div>
160
  <script>
161
  feather.replace();
162
 
163
- // Navigation items active state
164
- const navItems = document.querySelectorAll('nav a');
165
- navItems.forEach(item => {
166
- item.addEventListener('click', () => {
167
- navItems.forEach(i => i.classList.remove('bg-blue-900/30', 'border-blue-800/50', 'text-blue-200'));
168
- item.classList.add('bg-blue-900/30', 'border-blue-800/50', 'text-blue-200');
169
- });
170
- });
171
 
172
- // Chat functionality
173
- const chatMessages = document.getElementById('chatMessages');
174
- const chatInput = document.getElementById('chatInput');
175
- const chatSendBtn = document.getElementById('chatSendBtn');
176
- const chatMicBtn = document.getElementById('chatMicBtn');
177
- const chatStatus = document.getElementById('chatStatus');
178
 
179
- function addChatMessage(text, isUser = false) {
180
- const msgDiv = document.createElement('div');
181
- msgDiv.className = `msg ${isUser ?
182
- 'ml-auto bg-blue-900/10 border-blue-800/50' :
183
- 'bg-gray-700/50 border-gray-700'} p-3 rounded-xl max-w-[80%]`;
184
- msgDiv.textContent = text;
185
- chatMessages.appendChild(msgDiv);
186
- chatMessages.scrollTop = chatMessages.scrollHeight;
187
- }
188
 
189
- function getAIResponse(userText) {
190
- const t = userText.toLowerCase();
191
- if (t.includes('bonjour') || t.includes('salut')) {
192
- return "Bonjour ! Comment puis-je vous aider avec votre projet de codage aujourd'hui ?";
193
- }
194
- if (t.includes('projet') || t.includes('commencer')) {
195
- return "Pour commencer un nouveau projet, vous pouvez :\n1. Cliquer sur le bouton '+' dans la barre latérale\n2. Choisir un type de projet\n3. Donner un nom à votre projet";
196
- }
197
- if (t.includes('aide') || t.includes('problème')) {
198
- return "Je peux vous aider à résoudre des problèmes de code. Décrivez-moi l'erreur ou ce que vous essayez d'accomplir.";
199
- }
200
- if (t.includes('image') || t.includes('baleine')) {
201
- return "Pour générer des images, vous pouvez utiliser La Baleine IA disponible dans le menu de gauche.";
202
- }
203
- return "Je peux vous aider avec :\n- Projets de codage\n- Génération d'images\n- Résolution de problèmes\n- Conseils techniques\nDites-moi plus précisément ce dont vous avez besoin !";
204
- }
205
 
206
- function handleChatSend() {
207
- const message = chatInput.value.trim();
208
- if (!message) return;
 
209
 
210
- addChatMessage(message, true);
211
- chatInput.value = '';
212
-
213
- setTimeout(() => {
214
- const response = getAIResponse(message);
215
- addChatMessage(response);
216
- }, 800);
217
- }
218
-
219
- chatSendBtn.addEventListener('click', handleChatSend);
220
- chatInput.addEventListener('keydown', (e) => {
221
- if (e.key === 'Enter') handleChatSend();
222
- });
223
- // Microphone functionality using Web Speech API
224
- chatMicBtn.addEventListener('click', async () => {
225
- try {
226
- const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
227
- if (!SpeechRecognition) {
228
- chatStatus.textContent = 'Micro: non supporté';
229
- return;
230
- }
231
-
232
- const recognition = new SpeechRecognition();
233
- recognition.lang = 'fr-FR';
234
- recognition.interimResults = false;
235
- recognition.onresult = (event) => {
236
- let interimTranscript = '';
237
- let finalTranscript = '';
238
-
239
- for (let i = event.resultIndex; i < event.results.length; i++) {
240
- const transcript = event.results[i][0].transcript;
241
- if (event.results[i].isFinal) {
242
- finalTranscript += transcript + ' ';
243
- } else {
244
- interimTranscript += transcript;
245
- }
246
- }
247
-
248
- // Show interim results in real-time
249
- chatInput.value = interimTranscript || finalTranscript;
250
-
251
- if (finalTranscript) {
252
- handleChatSend();
253
- }
254
- };
255
- recognition.onerror = (event) => {
256
- console.error('Erreur de reconnaissance vocale:', event.error);
257
- chatStatus.textContent = 'Micro: erreur';
258
- };
259
-
260
- chatStatus.textContent = 'Micro: écoute...';
261
- await navigator.mediaDevices.getUserMedia({ audio: true });
262
- recognition.start();
263
- chatMicBtn.innerHTML = '<i data-feather="mic-off" class="w-5 h-5"></i>';
264
- feather.replace();
265
-
266
- recognition.onend = () => {
267
- chatMicBtn.innerHTML = '<i data-feather="mic" class="w-5 h-5"></i>';
268
- feather.replace();
269
- chatStatus.textContent = 'Prêt';
270
- };
271
- } catch (err) {
272
- console.error('Erreur microphone:', err);
273
- chatStatus.textContent = 'Micro: permission refusée';
274
- }
275
  });
276
- </script>
277
- <script src="components/ai-agent.js"></script>
278
- <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
 
 
279
  </body>
280
  </html>
 
11
  </head>
12
  <body class="bg-gray-900 text-gray-100 font-sans antialiased">
13
  <div class="app-container h-screen flex">
14
+ <!-- Project Manager Sidebar -->
15
+ <project-manager class="w-80"></project-manager>
16
+ <!-- Main Content Area -->
17
+ <div class="flex-1 flex flex-col bg-gray-850/50">
18
+ <!-- Code Explanation Column -->
19
+ <code-explainer class="flex-1 border-r border-gray-700"></code-explainer>
20
+ </div>
21
 
22
+ <!-- Visualization Column -->
23
+ <code-visualizer class="w-96 bg-gray-800 border-l border-gray-700"></code-visualizer>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  <script>
26
  feather.replace();
27
 
28
+ // Initialize components
29
+ const projectManager = document.querySelector('project-manager');
30
+ const codeExplainer = document.querySelector('code-explainer');
31
+ const codeVisualizer = document.querySelector('code-visualizer');
 
 
 
 
32
 
33
+ // Example of setting code and explanation
34
+ const exampleCSS = `body {
35
+ background-color: #ff6347; /* Couleur de fond tomatée */
36
+ color: #ffffff;
37
+ font-family: 'Arial', sans-serif;
38
+ }`;
39
 
40
+ const exampleExplanation = `La Baleine a généré ce code CSS pour le thème :
41
+ - La couleur de fond est définie sur une nuance de tomate (#ff6347)
42
+ - Le texte sera en blanc (#ffffff)
43
+ - La police par défaut est Arial avec une police sans-serif de secours`;
 
 
 
 
 
44
 
45
+ // Set initial example
46
+ codeExplainer.setCode(exampleCSS, exampleExplanation);
47
+ codeVisualizer.setCode(exampleCSS);
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
+ // Listen for project changes
50
+ projectManager.addEventListener('project-changed', (e) => {
51
+ const project = e.detail.project;
52
+ console.log('Project changed to:', project.name);
53
 
54
+ // Update code and explanation based on project
55
+ // In a real app, you would fetch this data for the selected project
56
+ codeExplainer.setCode(exampleCSS, exampleExplanation);
57
+ codeVisualizer.setCode(exampleCSS);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  });
59
+ </script>
60
+ <script src="components/project-manager.js"></script>
61
+ <script src="components/code-explainer.js"></script>
62
+ <script src="components/code-visualizer.js"></script>
63
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
64
  </body>
65
  </html>
style.css CHANGED
@@ -82,16 +82,30 @@ input:focus, button:focus {
82
  background: rgba(255, 255, 255, 0.04);
83
  font-size: 0.875rem;
84
  }
85
- /* Chat message styles */
86
- #chatMessages, #assistant-ia {
87
- flex: 1;
88
- overflow-y: auto;
89
- padding: 1rem;
90
  display: flex;
91
  flex-direction: column;
92
- gap: 0.75rem;
93
  }
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  /* Preview panel styles */
96
  #previewPanel {
97
  background: rgba(17, 24, 39, 0.5);
 
82
  background: rgba(255, 255, 255, 0.04);
83
  font-size: 0.875rem;
84
  }
85
+ /* Project space layout */
86
+ project-manager, code-explainer, code-visualizer {
 
 
 
87
  display: flex;
88
  flex-direction: column;
 
89
  }
90
 
91
+ /* Responsive layout */
92
+ @media (max-width: 1024px) {
93
+ .app-container {
94
+ flex-direction: column;
95
+ }
96
+ project-manager {
97
+ width: 100% !important;
98
+ height: auto !important;
99
+ max-height: 300px;
100
+ }
101
+ code-explainer, code-visualizer {
102
+ width: 100% !important;
103
+ }
104
+ code-visualizer {
105
+ border-left: none !important;
106
+ border-top: 1px solid #334155;
107
+ }
108
+ }
109
  /* Preview panel styles */
110
  #previewPanel {
111
  background: rgba(17, 24, 39, 0.5);