File size: 12,206 Bytes
cf5ae95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Générateur de Visuels - CodeCanvas</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <style>
        .canvas-container {
            background: linear-gradient(45deg, #f8fafc, #e2e8f0);
            border: 2px dashed #cbd5e1;
            transition: all 0.3s ease;
        }
        
        .canvas-container:hover {
            border-color: #6366f1;
        }
        
        .color-picker {
            width: 40px;
            height: 40px;
            border-radius: 8px;
            cursor: pointer;
            border: 2px solid transparent;
            transition: all 0.2s ease;
        }
        
        .color-picker.active {
            border-color: #000;
            transform: scale(1.1);
        }
        
        .tool-btn {
            transition: all 0.2s ease;
        }
        
        .tool-btn.active {
            background-color: #6366f1;
            color: white;
        }
        
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.7; }
        }
        
        .generating {
            animation: pulse 1.5s ease-in-out infinite;
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen font-sans">
    <!-- Navigation -->
    <nav class="bg-white shadow-sm border-b">
        <div class="container mx-auto px-6 py-4">
            <div class="flex items-center justify-between">
                <a href="index.html" class="flex items-center space-x-2">
                    <i data-feather="layout" class="text-primary w-6 h-6"></i>
                    <span class="text-xl font-bold gradient-text">CodeCanvas</span>
                </a>
                <div class="flex items-center space-x-4">
                    <a href="index.html" class="text-gray-600 hover:text-primary transition-colors">
                        <i data-feather="home" class="w-4 h-4 mr-1"></i>
                        Accueil
                    </a>
                    <a href="generate.html" class="text-primary font-medium">
                        <i data-feather="image" class="w-4 h-4 mr-1"></i>
                        Générer
                    </a>
                </div>
            </div>
        </div>
    </nav>

    <div class="container mx-auto px-6 py-8">
        <div class="max-w-6xl mx-auto">
            <!-- Header -->
            <div class="text-center mb-8">
                <h1 class="text-3xl md:text-4xl font-bold text-gray-900 mb-4">
                    Générateur de Visuels Créatifs
                </h1>
                <p class="text-lg text-gray-600 max-w-2xl mx-auto">
                    Créez des designs uniques en quelques clics. Personnalisez les couleurs, les formes et les effets.
                </p>
            </div>

            <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
                <!-- Sidebar - Controls -->
                <div class="lg:col-span-1 bg-white rounded-xl shadow-sm p-6">
                    <div class="space-y-6">
                        <!-- Prompt Input -->
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-2">
                                <i data-feather="edit-3" class="w-4 h-4 inline mr-1"></i>
                                Description du visuel
                            </label>
                            <textarea 
                                id="promptInput"
                                class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-transparent"
                                rows="3"
                                placeholder="Ex: Un design moderne avec des gradients bleus et des formes géométriques..."
                            ></textarea>
                        </div>

                        <!-- Color Palette -->
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-3">
                                <i data-feather="droplet" class="w-4 h-4 inline mr-1"></i>
                                Palette de couleurs
                            </label>
                            <div class="grid grid-cols-5 gap-2">
                                <div class="color-picker active" style="background-color: #6366f1;" data-color="#6366f1"></div>
                                <div class="color-picker" style="background-color: #8b5cf6;" data-color="#8b5cf6"></div>
                                <div class="color-picker" style="background-color: #ec4899;" data-color="#ec4899"></div>
                                <div class="color-picker" style="background-color: #10b981;" data-color="#10b981"></div>
                                <div class="color-picker" style="background-color: #f59e0b;" data-color="#f59e0b"></div>
                            </div>
                        </div>

                        <!-- Style Options -->
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-3">
                                <i data-feather="sliders" class="w-4 h-4 inline mr-1"></i>
                                Style
                            </label>
                            <div class="grid grid-cols-2 gap-2">
                                <button class="tool-btn active py-2 px-3 border rounded-lg text-sm">
                                    Moderne
                                </button>
                                <button class="tool-btn py-2 px-3 border rounded-lg text-sm">
                                    Minimaliste
                                </button>
                                <button class="tool-btn py-2 px-3 border rounded-lg text-sm">
                                    Gradient
                                </button>
                                <button class="tool-btn py-2 px-3 border rounded-lg text-sm">
                                    Géométrique
                                </button>
                            </div>
                        </div>

                        <!-- Generate Button -->
                        <button id="generateBtn" class="w-full bg-primary hover:bg-primary/90 text-white font-medium py-3 px-4 rounded-lg transition-all duration-300 flex items-center justify-center">
                            <i data-feather="sparkles" class="w-4 h-4 mr-2"></i>
                            Générer le visuel
                        </button>
                    </div>
                </div>

                <!-- Canvas Area -->
                <div class="lg:col-span-2">
                    <div class="bg-white rounded-xl shadow-sm p-6">
                        <div class="flex items-center justify-between mb-4">
                            <h3 class="text-lg font-medium text-gray-900">Aperçu du visuel</h3>
                            <div class="flex space-x-2">
                                <button class="tool-btn p-2 border rounded-lg">
                                    <i data-feather="download" class="w-4 h-4"></i>
                                </button>
                                <button class="tool-btn p-2 border rounded-lg">
                                    <i data-feather="refresh-cw" class="w-4 h-4"></i>
                                </button>
                            </div>
                        </div>
                        
                        <div id="canvasContainer" class="canvas-container rounded-lg h-96 flex items-center justify-center">
                            <div class="text-center text-gray-500">
                                <i data-feather="image" class="w-12 h-12 mx-auto mb-3 opacity-50"></i>
                                <p>Votre visuel apparaîtra ici</p>
                            </div>
                        </div>
                    </div>

                    <!-- Generated Previews -->
                    <div class="mt-6">
                        <h4 class="text-md font-medium text-gray-900 mb-4">Prévisualisations générées</h4>
                        <div class="grid grid-cols-3 gap-4">
                            <div class="bg-gradient-to-br from-blue-400 to-purple-500 rounded-lg h-20"></div>
                            <div class="bg-gradient-to-br from-green-400 to-blue-500 rounded-lg h-20"></div>
                            <div class="bg-gradient-to-br from-pink-400 to-red-500 rounded-lg h-20"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        feather.replace();
        
        // Color picker functionality
        const colorPickers = document.querySelectorAll('.color-picker');
        colorPickers.forEach(picker => {
            picker.addEventListener('click', () => {
                colorPickers.forEach(p => p.classList.remove('active'));
                picker.classList.add('active');
            });
        });

        // Tool buttons functionality
        const toolBtns = document.querySelectorAll('.tool-btn');
        toolBtns.forEach(btn => {
            btn.addEventListener('click', () => {
                if (btn.parentElement.classList.contains('grid')) {
                    toolBtns.forEach(b => b.classList.remove('active'));
                }
                btn.classList.add('active');
            });
        });

        // Generate button functionality
        const generateBtn = document.getElementById('generateBtn');
        const canvasContainer = document.getElementById('canvasContainer');
        
        generateBtn.addEventListener('click', () => {
            const promptInput = document.getElementById('promptInput');
            
            if (!promptInput.value.trim()) {
                promptInput.focus();
                return;
            }

            // Show loading state
            generateBtn.classList.add('generating');
            generateBtn.innerHTML = '<i data-feather="loader" class="w-4 h-4 mr-2 animate-spin"></i>Génération en cours...';
            feather.replace();

            // Simulate generation process
            setTimeout(() => {
                // Create a generated visual
                const activeColor = document.querySelector('.color-picker.active').dataset.color;
                
                canvasContainer.innerHTML = `
                    <div class="w-full h-full flex items-center justify-center">
                        <div class="text-center">
                            <div class="w-32 h-32 mx-auto mb-4 rounded-full" style="background: conic-gradient(from 0deg, ${activeColor}, #8b5cf6, #ec4899, ${activeColor})"></div>
                            <p class="text-gray-700 font-medium">Visuel généré avec succès !</p>
                        </div>
                    </div>
                `;
                
                // Reset button
                generateBtn.classList.remove('generating');
                generateBtn.innerHTML = '<i data-feather="sparkles" class="w-4 h-4 mr-2"></i>Générer le visuel';
                feather.replace();
            }, 2000);
        });

        // Initialize with a sample visual
        setTimeout(() => {
            canvasContainer.innerHTML = `
                <div class="w-full h-full flex items-center justify-center p-8">
                    <div class="relative w-full h-full">
                        <div class="absolute top-0 left-0 w-20 h-20 bg-blue-400 rounded-full opacity-70"></div>
                        <div class="absolute bottom-0 right-0 w-24 h-24 bg-purple-500 rounded-full opacity-70"></div>
                        <div class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-32 h-32 bg-gradient-to-br from-pink-400 to-orange-400 rounded-2xl opacity-80"></div>
                    </div>
                </div>
            `;
        }, 1000);
    </script>
</body>
</html>