Abmacode12 commited on
Commit
8f2764e
·
verified ·
1 Parent(s): 586de78

<header class="mainHeader smallHeader" id="mainHeader">

Browse files

<h1 id="appTitle">Espace Codage</h1>
<p id="appSubtitle">Génération de code IA (mode simple)</p>
</header>
Ensuite, ajoute des IDs sur les 3 colonnes (important) :

html
Copier le code
<aside class="sidebar" id="colLeft"> ... </aside>
<main class="main" id="colCenter"> ... </main>
<aside class="right emptyRight" id="colRight" aria-label="Colon <div id="toast" class="toast" hidden></div> <div id="toast" class="toast" hidden></div>
.toast{
position:fixed;
bottom:18px;
left:50%;
transform:translateX(-50%);
background:rgba(15,23,42,.92);
border:1px solid rgba(124,245,220,.25);
color:#e7eefc;
padding:10px 14px;
border-radius:12px;
font-size:13px;
z-index:9999;
}

// ====== ORCHESTRATEUR (le "cerveau") ======
const ui = {
colLeft: document.getElementById("colLeft"),
colCenter: document.getElementById("colCenter"),
colRight: document.getElementById("colRight"),
appTitle: document.getElementById("appTitle"),
appSubtitle: document.getElementById("appSubtitle"),
promptInput: document.getElementById("promptInput"),
toast: document.getElementById("toast"),
};

function toast(msg) {
if (!ui.toast) return;
ui.toast.hidden = false;
ui.toast.textContent = msg;
clearTimeout(toast._t);
toast._t = setTimeout(() => (ui.toast.hidden = true), 1400);
}

/**
* Détecte si le texte est une "consigne UI" (modification d'interface)
* sinon c'est une demande de génération de code.
*/
function isUiCommand(text) {
const t = (text || "").toLowerCase();
// Mots-clés UI fréquents
const keys = [
"colonne", "sidebar", "barre", "recherche", "déplace", "deplace",
"cache", "masque", "affiche", "vide", "titre", "nom", "espace codage",
"générer", "micro", "à gauche", "a gauche", "à droite", "en bas", "en haut",
"largeur", "plus petit", "petit"
];
return keys.some(k => t.includes(k));
}

/**
* Applique des actions UI à partir d'une consigne en français.
* C'est volontairement "silencieux": ça modifie l'interface sans exposer le moteur.
*/
function applyUiCommand(raw) {
const t = (raw || "").toLowerCase();

// 1) Colonne 3 vide / cacher / afficher
if (t.includes("cache") && (t.includes("colonne 3") || t.includes("colonne trois") || t.includes("droite"))) {
ui.colRight.style.display = "none";
toast("✅ Colonne 3 masquée");
return true;
}
if ((t.includes("affiche") || t.includes("montre")) && (t.includes("colonne 3") || t.includes("droite"))) {
ui.colRight.style.display = "";
toast("✅ Colonne 3 affichée");
return true;
}
if (t.includes("colonne 3") && t.includes("vide")) {
// laisse la colonne visible mais vide
ui.colRight.innerHTML = "";
ui.colRight.style.display = "";
toast("✅ Colonne 3 vidée");
return true;
}

// 2) Renommer ton entreprise / titre
// Ex: "mets le nom Espace Codage", "titre: Espace Codage"
if (t.includes("espace codage") || t.includes("nom") || t.includes("titre")) {
// cherche un nom après "nom" ou "titre"
const m = raw.match(/(?:nom|titre)\s*[:=]\s*(.+)$/i);
const name = m ? m[1].trim() : (t.includes("espace codage") ? "Espace Codage" : null);
if (name && ui.appTitle) {
ui.appTitle.textContent = name;
toast("✅ Titre mis à jour");
return true;
}
}

// 3) Sous-titre plus petit / changer sous-titre
if (t.includes("sous-titre") || t.includes("sous titre") || t.includes("description")) {
const m = raw.match(/(?:sous[-\s]?titre|description)\s*[:=]\s*(.+)$/i);
if (m && ui.appSubtitle) {
ui.appSubtitle.textContent = m[1].trim();
toast("✅ Sous-titre mis à jour");
return true;
}
}

// 4) Largeur des colonnes (ex: "colonne 2 plus petite", "élargis colonne 2")
// On joue sur grid-template-columns via body/app
const app = document.querySelector(".app");
if (app && (t.includes("largeur") || t.includes("plus petit") || t.includes("élargis") || t.includes("elargis"))) {
// presets simples
if (t.includes("colonne 2") && (t.includes("plus petite") || t.includes("rétrécis") || t.includes("retrecis"))) {
app.style.gridTemplateColumns = "280px 0.9fr 360px";
toast("✅ Colonne 2 rétrécie");
return true;
}
if (t.includes("colonne 2") && (t.includes("plus grande") || t.includes("élargis") || t.includes("elargis"))) {
app.style.gridTemplateColumns = "280px 1.2fr 360px";
toast("✅ Colonne 2 élargie");
return true;
}
}

// 5) “Générer + micro à gauche” (ton besoin principal)
// Ici on ajoute/retire une classe sur la barre pour réordonner proprement.
const promptBar = document.querySelector(".promptBar");
if (promptBar && (t.includes("générer") || t.includes("generer")) && (t.includes("à gauche") || t.includes("a gauche"))) {
promptBar.classList.add("leftActions");
toast("✅ Générer + micro à gauche");
return true;
}
if (promptBar && (t.includes("générer") || t.includes("generer")) && (t.includes("à droite") || t.includes("a droite"))) {
promptBar.classList.remove("leftActions");
toast("✅ Générer + micro à droite");
return true;
}

// 6) Déplacer la barre en bas / en haut (si tu veux)
const dock = document.querySelector(".promptDock");
if (dock && (t.includes("barre") || t.includes("recherche"))) {
if (t.includes("en haut")) {
dock.style.marginTop = "0";
dock.style.order = "-1";
toast("✅ Barre déplacée en haut");
return true;
}
if (t.includes("en bas")) {
dock.style.marginTop = "auto";
dock.style.order = "";
toast("✅ Barre placée en bas");
return true;
}
}

// Si aucune règle n'a matché
toast("ℹ️ Consigne non reconnue");
return false;
}

Files changed (3) hide show
  1. index.html +11 -15
  2. script.js +144 -0
  3. style.css +29 -14
index.html CHANGED
@@ -20,10 +20,9 @@
20
 
21
  <body>
22
  <div class="app h-screen grid grid-cols-[280px_1fr_360px]">
23
-
24
  <!-- COLONNE 1 : SIDEBAR -->
25
- <aside class="sidebar bg-gradient-to-b from-slate-900 to-slate-950 border-r border-slate-700 p-4 flex flex-col gap-4">
26
- <div class="brand flex items-center gap-3">
27
  <div class="logo w-10 h-10 rounded-xl bg-slate-800 border border-slate-700 flex items-center justify-center text-xl">🚀</div>
28
  <div class="brandText">
29
  <div class="brandName font-extrabold text-lg text-primary">DeepSeed</div>
@@ -66,15 +65,13 @@
66
  <div class="hint">✅ Menu fixe — rien ne bouge</div>
67
  </div>
68
  </aside>
69
-
70
  <!-- COLONNE 2 : GÉNÉRATEUR (barre en bas) -->
71
- <main class="main p-6 flex flex-col gap-4 min-w-0">
72
- <header class="mainHeader">
73
- <h1 class="text-3xl font-bold">Générateur de Code IA</h1>
74
- <p class="text-slate-400 mt-2">Décrivez votre idée, et le code apparaît ci-dessous.</p>
75
  </header>
76
-
77
- <section class="codePanel bg-slate-900/85 border border-slate-700 rounded-2xl p-4 min-h-[280px]">
78
  <div class="codeTop flex items-center justify-between gap-3 mb-3">
79
  <h2 class="text-lg text-primary font-semibold">Code généré</h2>
80
  <div class="codeActions flex gap-3">
@@ -109,10 +106,9 @@
109
  </div>
110
  </section>
111
  </main>
112
-
113
  <!-- COLONNE 3 : VIDE + petit titre seulement -->
114
- <aside class="right bg-gradient-to-b from-slate-900 to-slate-950 border-l border-slate-700 p-4 flex flex-col gap-4">
115
- <div class="rightHeader flex items-center gap-3 p-3 rounded-2xl border border-slate-700 bg-slate-900">
116
  <div class="avatar w-11 h-11 rounded-2xl bg-slate-800 border border-slate-700 flex items-center justify-center text-xl">🤖</div>
117
  <div>
118
  <div class="rightTitle font-black">Générateur de Code IA</div>
@@ -129,8 +125,8 @@
129
  </aside>
130
 
131
  </div>
132
-
133
  <script src="./script.js"></script>
134
  <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
135
  </body>
136
- </html>
 
20
 
21
  <body>
22
  <div class="app h-screen grid grid-cols-[280px_1fr_360px]">
 
23
  <!-- COLONNE 1 : SIDEBAR -->
24
+ <aside class="sidebar bg-gradient-to-b from-slate-900 to-slate-950 border-r border-slate-700 p-4 flex flex-col gap-4" id="colLeft">
25
+ <div class="brand flex items-center gap-3">
26
  <div class="logo w-10 h-10 rounded-xl bg-slate-800 border border-slate-700 flex items-center justify-center text-xl">🚀</div>
27
  <div class="brandText">
28
  <div class="brandName font-extrabold text-lg text-primary">DeepSeed</div>
 
65
  <div class="hint">✅ Menu fixe — rien ne bouge</div>
66
  </div>
67
  </aside>
 
68
  <!-- COLONNE 2 : GÉNÉRATEUR (barre en bas) -->
69
+ <main class="main p-6 flex flex-col gap-4 min-w-0" id="colCenter">
70
+ <header class="mainHeader smallHeader" id="mainHeader">
71
+ <h1 id="appTitle">Espace Codage</h1>
72
+ <p id="appSubtitle">Génération de code IA (mode simple)</p>
73
  </header>
74
+ <section class="codePanel bg-slate-900/85 border border-slate-700 rounded-2xl p-4 min-h-[280px]">
 
75
  <div class="codeTop flex items-center justify-between gap-3 mb-3">
76
  <h2 class="text-lg text-primary font-semibold">Code généré</h2>
77
  <div class="codeActions flex gap-3">
 
106
  </div>
107
  </section>
108
  </main>
 
109
  <!-- COLONNE 3 : VIDE + petit titre seulement -->
110
+ <aside class="right emptyRight bg-gradient-to-b from-slate-900 to-slate-950 border-l border-slate-700 p-4 flex flex-col gap-4" id="colRight" aria-label="Colonne de droite">
111
+ <div class="rightHeader flex items-center gap-3 p-3 rounded-2xl border border-slate-700 bg-slate-900">
112
  <div class="avatar w-11 h-11 rounded-2xl bg-slate-800 border border-slate-700 flex items-center justify-center text-xl">🤖</div>
113
  <div>
114
  <div class="rightTitle font-black">Générateur de Code IA</div>
 
125
  </aside>
126
 
127
  </div>
128
+ <div id="toast" class="toast" hidden></div>
129
  <script src="./script.js"></script>
130
  <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
131
  </body>
132
+ </html>
script.js CHANGED
@@ -1,3 +1,4 @@
 
1
  const promptInput = document.getElementById("promptInput");
2
  const generateBtn = document.getElementById("generateBtn");
3
  const micBtn = document.getElementById("micBtn");
@@ -5,6 +6,149 @@ const codeOutput = document.getElementById("codeOutput");
5
  const copyBtn = document.getElementById("copyBtn");
6
  const clearBtn = document.getElementById("clearBtn");
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  function fakeGenerate(prompt) {
9
  // Remplace ça plus tard par ton API IA (OpenRouter, local, etc.)
10
  const p = (prompt || "").trim();
 
1
+
2
  const promptInput = document.getElementById("promptInput");
3
  const generateBtn = document.getElementById("generateBtn");
4
  const micBtn = document.getElementById("micBtn");
 
6
  const copyBtn = document.getElementById("copyBtn");
7
  const clearBtn = document.getElementById("clearBtn");
8
 
9
+ // ====== ORCHESTRATEUR UI (le "cerveau") ======
10
+ const ui = {
11
+ colLeft: document.getElementById("colLeft"),
12
+ colCenter: document.getElementById("colCenter"),
13
+ colRight: document.getElementById("colRight"),
14
+ appTitle: document.getElementById("appTitle"),
15
+ appSubtitle: document.getElementById("appSubtitle"),
16
+ promptInput: document.getElementById("promptInput"),
17
+ toast: document.getElementById("toast"),
18
+ };
19
+
20
+ function toast(msg) {
21
+ let el = ui.toast;
22
+ if (!el) {
23
+ el = document.createElement("div");
24
+ el.id = "toast";
25
+ el.className = "toast";
26
+ el.hidden = true;
27
+ document.body.appendChild(el);
28
+ }
29
+ el.hidden = false;
30
+ el.textContent = msg;
31
+ clearTimeout(toast._t);
32
+ toast._t = setTimeout(() => (el.hidden = true), 1400);
33
+ }
34
+
35
+ /**
36
+ * Détecte si le texte est une "consigne UI" (modification d'interface)
37
+ * sinon c'est une demande de génération de code.
38
+ */
39
+ function isUiCommand(text) {
40
+ const t = (text || "").toLowerCase();
41
+ // Mots-clés UI fréquents
42
+ const keys = [
43
+ "colonne", "sidebar", "barre", "recherche", "déplace", "deplace",
44
+ "cache", "masque", "affiche", "vide", "titre", "nom", "espace codage",
45
+ "générer", "micro", "à gauche", "a gauche", "à droite", "en bas", "en haut",
46
+ "largeur", "plus petit", "petit"
47
+ ];
48
+ return keys.some(k => t.includes(k));
49
+ }
50
+
51
+ /**
52
+ * Applique des actions UI à partir d'une consigne en français.
53
+ * C'est volontairement "silencieux": ça modifie l'interface sans exposer le moteur.
54
+ */
55
+ function applyUiCommand(raw) {
56
+ const t = (raw || "").toLowerCase();
57
+
58
+ // 1) Colonne 3 vide / cacher / afficher
59
+ if (t.includes("cache") && (t.includes("colonne 3") || t.includes("colonne trois") || t.includes("droite"))) {
60
+ ui.colRight.style.display = "none";
61
+ toast("✅ Colonne 3 masquée");
62
+ return true;
63
+ }
64
+ if ((t.includes("affiche") || t.includes("montre")) && (t.includes("colonne 3") || t.includes("droite"))) {
65
+ ui.colRight.style.display = "";
66
+ toast("✅ Colonne 3 affichée");
67
+ return true;
68
+ }
69
+ if (t.includes("colonne 3") && t.includes("vide")) {
70
+ // laisse la colonne visible mais vide
71
+ ui.colRight.innerHTML = "";
72
+ ui.colRight.style.display = "";
73
+ toast("✅ Colonne 3 vidée");
74
+ return true;
75
+ }
76
+
77
+ // 2) Renommer ton entreprise / titre
78
+ // Ex: "mets le nom Espace Codage", "titre: Espace Codage"
79
+ if (t.includes("espace codage") || t.includes("nom") || t.includes("titre")) {
80
+ // cherche un nom après "nom" ou "titre"
81
+ const m = raw.match(/(?:nom|fecha título)\s*[:=]\s*(.+)$/i);
82
+ const name = m ? m[1].trim() : (t.includes("espace codage") ? "Espace Codage" : null);
83
+ if (name && ui.appTitle) {
84
+ ui.appTitle.textContent = name;
85
+ toast("✅ Titre mis à jour");
86
+ return true;
87
+ }
88
+ }
89
+
90
+ // 3) Sous-titre plus petit / changer sous-titre
91
+ if (t.includes("sous-titre") || t.includes("sous titre") || t.includes("description")) {
92
+ const m = raw.match(/(?:sous[-\s]?titre|description)\s*[:=]\s*(.+)$/i);
93
+ if (m && ui.appSubtitle) {
94
+ ui.appSubtitle.textContent = m[1].trim();
95
+ toast("✅ Sous-titre mis à jour");
96
+ return true;
97
+ }
98
+ }
99
+
100
+ // 4) Largeur des colonnes (ex: "colonne 2 plus petite", "élargis colonne 2")
101
+ // On joue sur grid-template-columns via body/app
102
+ const app = document.querySelector(".app");
103
+ if (app && (t.includes("largeur") || t.includes("plus petit") || t.includes("élargis") || t.includes("elargis"))) {
104
+ // presets simples
105
+ if (t.includes("colonne 2") && (t.includes("plus petite") || t.includes("rétrécis") || t.includes("retrecis"))) {
106
+ app.style.gridTemplateColumns = "280px 0.9fr 360px";
107
+ toast("✅ Colonne 2 rétrécie");
108
+ return true;
109
+ }
110
+ if (t.includes("colonne 2") && (t.includes("plus grande") || t.includes("élargis") || t.includes("elargis"))) {
111
+ app.style.gridTemplateColumns = "280px 1.2fr 360px";
112
+ toast("✅ Colonne 2 élargie");
113
+ return true;
114
+ }
115
+ }
116
+
117
+ // 5) “Générer + micro à gauche” (ton besoin principal)
118
+ // Ici on ajoute/retire une classe sur la barre pour réordonner proprement.
119
+ const promptBar = document.querySelector(".promptBar");
120
+ if (promptBar && (t.includes("générer") || t.includes("generer")) && (t.includes("à gauche") || t.includes("a gauche"))) {
121
+ promptBar.classList.add("leftActions");
122
+ toast("✅ Générer + micro à gauche");
123
+ return true;
124
+ }
125
+ if (promptBar && (t.includes("générer") || t.includes("generer")) && (t.includes("à droite") || t.includes("a droite"))) {
126
+ promptBar.classList.remove("leftActions");
127
+ toast("✅ Générer + micro à droite");
128
+ return true;
129
+ }
130
+
131
+ // 6) Déplacer la barre en bas / en haut (si tu veux)
132
+ const dock = document.querySelector(".promptDock");
133
+ if (dock && (t.includes("barre") || t.includes("recherche"))) {
134
+ if (t.includes("en haut")) {
135
+ dock.style.marginTop = "0";
136
+ dock.style.order = "-1";
137
+ toast("✅ Barre déplacée en haut");
138
+ return true;
139
+ }
140
+ if (t.includes("en bas")) {
141
+ dock.style.marginTop = "auto";
142
+ dock.style.order = "";
143
+ toast("✅ Barre placée en bas");
144
+ return true;
145
+ }
146
+ }
147
+
148
+ // Si aucune règle n'a matché
149
+ toast("ℹ️ Consigne non reconnue");
150
+ return false;
151
+ }
152
  function fakeGenerate(prompt) {
153
  // Remplace ça plus tard par ton API IA (OpenRouter, local, etc.)
154
  const p = (prompt || "").trim();
style.css CHANGED
@@ -1,28 +1,43 @@
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
  }
5
 
6
  h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
  p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
  .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
  .card p:last-child {
27
- margin-bottom: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
 
1
+
2
  body {
3
+ padding: 2rem;
4
+ font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
5
  }
6
 
7
  h1 {
8
+ font-size: 16px;
9
+ margin-top: 0;
10
  }
11
 
12
  p {
13
+ color: rgb(107, 114, 128);
14
+ font-size: 15px;
15
+ margin-bottom: 10px;
16
+ margin-top: 5px;
17
  }
18
 
19
  .card {
20
+ max-width: 620px;
21
+ margin: 0 auto;
22
+ padding: 16px;
23
+ border: 1px solid lightgray;
24
+ border-radius: 16px;
25
  }
26
 
27
  .card p:last-child {
28
+ margin-bottom: 0;
29
+ }
30
+
31
+ .toast{
32
+ position:fixed;
33
+ bottom:18px;
34
+ left:50%;
35
+ transform:translateX(-50%);
36
+ background:rgba(15,23,42,.92);
37
+ border:1px solid rgba(124,245,220,.25);
38
+ color:#e7eefc;
39
+ padding:10px 14px;
40
+ border-radius:12px;
41
+ font-size:13px;
42
+ z-index:9999;
43
  }