segestic commited on
Commit
2084931
·
verified ·
1 Parent(s): 78b4b6f

Ai web builder, where there is a canvas and then as I chat with ai it modified the content of canvas. By the left sidebar bar are icons of various layout such that when I select it it outputs description to the chat at which I then after clicking send it sends it to ai & the content is displayed in canvas. I want the sidebar to include various layout, colour theme, etc such that on click it add description to the text input sent later to aim make it responsive and beautiful. - Initial Deployment

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +321 -18
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Ftd
3
- emoji: 🚀
4
- colorFrom: indigo
5
- colorTo: blue
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: ftd
3
+ emoji: 🐳
4
+ colorFrom: pink
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,322 @@
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="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Web Builder</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://unpkg.com/feather-icons"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
11
+ <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
12
+ <style>
13
+ .canvas-container {
14
+ transition: all 0.3s ease;
15
+ }
16
+ .sidebar-item:hover {
17
+ transform: translateX(5px);
18
+ }
19
+ .chat-message-user {
20
+ border-radius: 18px 18px 0 18px;
21
+ }
22
+ .chat-message-ai {
23
+ border-radius: 18px 18px 18px 0;
24
+ }
25
+ .device-preview {
26
+ box-shadow: 0 0 20px rgba(0,0,0,0.1);
27
+ }
28
+ #canvas {
29
+ min-height: 500px;
30
+ background-color: #f9fafb;
31
+ }
32
+ </style>
33
+ </head>
34
+ <body class="bg-gray-50 font-sans">
35
+ <div class="flex h-screen overflow-hidden">
36
+ <!-- Left Sidebar -->
37
+ <div class="w-20 md:w-64 bg-white border-r border-gray-200 flex flex-col transition-all duration-300">
38
+ <div class="p-4 border-b border-gray-200">
39
+ <h1 class="text-xl font-bold text-indigo-600 hidden md:block">AI Web Builder</h1>
40
+ <div class="md:hidden flex justify-center">
41
+ <i data-feather="box" class="text-indigo-600"></i>
42
+ </div>
43
+ </div>
44
+ <div class="overflow-y-auto flex-1">
45
+ <!-- Layouts Section -->
46
+ <div class="p-2">
47
+ <div class="flex items-center justify-between px-2 py-1">
48
+ <span class="text-xs font-semibold text-gray-500 hidden md:block">LAYOUTS</span>
49
+ <i data-feather="grid" class="text-gray-500 w-4 h-4 md:hidden"></i>
50
+ </div>
51
+ <div class="space-y-1 mt-2">
52
+ <div class="sidebar-item p-2 flex items-center rounded-lg cursor-pointer hover:bg-indigo-50 transition-colors" onclick="addToPrompt('Apply a single column layout with full-width sections.')">
53
+ <i data-feather="layout" class="text-indigo-500 w-5 h-5"></i>
54
+ <span class="ml-2 text-sm hidden md:block">Single Column</span>
55
+ </div>
56
+ <div class="sidebar-item p-2 flex items-center rounded-lg cursor-pointer hover:bg-indigo-50 transition-colors" onclick="addToPrompt('Use a responsive grid layout with three columns on desktop and one column on mobile.')">
57
+ <i data-feather="columns" class="text-indigo-500 w-5 h-5"></i>
58
+ <span class="ml-2 text-sm hidden md:block">Grid Layout</span>
59
+ </div>
60
+ <div class="sidebar-item p-2 flex items-center rounded-lg cursor-pointer hover:bg-indigo-50 transition-colors" onclick="addToPrompt('Create a split-screen layout with content on the left and an image on the right.')">
61
+ <i data-feather="sidebar" class="text-indigo-500 w-5 h-5"></i>
62
+ <span class="ml-2 text-sm hidden md:block">Split Screen</span>
63
+ </div>
64
+ </div>
65
+ </div>
66
+
67
+ <!-- Color Themes Section -->
68
+ <div class="p-2">
69
+ <div class="flex items-center justify-between px-2 py-1">
70
+ <span class="text-xs font-semibold text-gray-500 hidden md:block">COLOR THEMES</span>
71
+ <i data-feather="droplet" class="text-gray-500 w-4 h-4 md:hidden"></i>
72
+ </div>
73
+ <div class="space-y-1 mt-2">
74
+ <div class="sidebar-item p-2 flex items-center rounded-lg cursor-pointer hover:bg-indigo-50 transition-colors" onclick="addToPrompt('Apply a dark color theme with high contrast and modern aesthetics.')">
75
+ <div class="w-5 h-5 rounded-full bg-gray-900"></div>
76
+ <span class="ml-2 text-sm hidden md:block">Dark Theme</span>
77
+ </div>
78
+ <div class="sidebar-item p-2 flex items-center rounded-lg cursor-pointer hover:bg-indigo-50 transition-colors" onclick="addToPrompt('Use a light theme with pastel colors and soft shadows.')">
79
+ <div class="w-5 h-5 rounded-full bg-blue-200"></div>
80
+ <span class="ml-2 text-sm hidden md:block">Pastel Light</span>
81
+ </div>
82
+ <div class="sidebar-item p-2 flex items-center rounded-lg cursor-pointer hover:bg-indigo-50 transition-colors" onclick="addToPrompt('Create a vibrant color scheme with bold primary colors.')">
83
+ <div class="w-5 h-5 rounded-full bg-red-500"></div>
84
+ <span class="ml-2 text-sm hidden md:block">Vibrant</span>
85
+ </div>
86
+ </div>
87
+ </div>
88
+
89
+ <!-- Components Section -->
90
+ <div class="p-2">
91
+ <div class="flex items-center justify-between px-2 py-1">
92
+ <span class="text-xs font-semibold text-gray-500 hidden md:block">COMPONENTS</span>
93
+ <i data-feather="package" class="text-gray-500 w-4 h-4 md:hidden"></i>
94
+ </div>
95
+ <div class="space-y-1 mt-2">
96
+ <div class="sidebar-item p-2 flex items-center rounded-lg cursor-pointer hover:bg-indigo-50 transition-colors" onclick="addToPrompt('Add a modern navigation header with logo and menu links.')">
97
+ <i data-feather="navigation" class="text-indigo-500 w-5 h-5"></i>
98
+ <span class="ml-2 text-sm hidden md:block">Header</span>
99
+ </div>
100
+ <div class="sidebar-item p-2 flex items-center rounded-lg cursor-pointer hover:bg-indigo-50 transition-colors" onclick="addToPrompt('Insert a hero section with headline, subheadline, and call-to-action button.')">
101
+ <i data-feather="image" class="text-indigo-500 w-5 h-5"></i>
102
+ <span class="ml-2 text-sm hidden md:block">Hero</span>
103
+ </div>
104
+ <div class="sidebar-item p-2 flex items-center rounded-lg cursor-pointer hover:bg-indigo-50 transition-colors" onclick="addToPrompt('Add a card component with image, title, description, and button.')">
105
+ <i data-feather="credit-card" class="text-indigo-500 w-5 h-5"></i>
106
+ <span class="ml-2 text-sm hidden md:block">Card</span>
107
+ </div>
108
+ </div>
109
+ </div>
110
+
111
+ <!-- Styling Options -->
112
+ <div class="p-2">
113
+ <div class="flex items-center justify-between px-2 py-1">
114
+ <span class="text-xs font-semibold text-gray-500 hidden md:block">STYLING</span>
115
+ <i data-feather="edit" class="text-gray-500 w-4 h-4 md:hidden"></i>
116
+ </div>
117
+ <div class="space-y-1 mt-2">
118
+ <div class="sidebar-item p-2 flex items-center rounded-lg cursor-pointer hover:bg-indigo-50 transition-colors" onclick="addToPrompt('Use rounded corners and subtle shadows for all elements.')">
119
+ <i data-feather="circle" class="text-indigo-500 w-5 h-5"></i>
120
+ <span class="ml-2 text-sm hidden md:block">Corners</span>
121
+ </div>
122
+ <div class="sidebar-item p-2 flex items-center rounded-lg cursor-pointer hover:bg-indigo-50 transition-colors" onclick="addToPrompt('Apply a modern sans-serif font with good readability.')">
123
+ <i data-feather="type" class="text-indigo-500 w-5 h-5"></i>
124
+ <span class="ml-2 text-sm hidden md:block">Typography</span>
125
+ </div>
126
+ <div class="sidebar-item p-2 flex items-center rounded-lg cursor-pointer hover:bg-indigo-50 transition-colors" onclick="addToPrompt('Use generous spacing between sections and elements.')">
127
+ <i data-feather="maximize-2" class="text-indigo-500 w-5 h-5"></i>
128
+ <span class="ml-2 text-sm hidden md:block">Spacing</span>
129
+ </div>
130
+ </div>
131
+ </div>
132
+ </div>
133
+ </div>
134
+
135
+ <!-- Main Content -->
136
+ <div class="flex-1 flex flex-col overflow-hidden">
137
+ <!-- Top Bar -->
138
+ <div class="bg-white border-b border-gray-200 p-4 flex justify-between items-center">
139
+ <div class="flex items-center space-x-2">
140
+ <button class="p-2 rounded-lg hover:bg-gray-100">
141
+ <i data-feather="save"></i>
142
+ </button>
143
+ <button class="p-2 rounded-lg hover:bg-gray-100">
144
+ <i data-feather="download"></i>
145
+ </button>
146
+ <div class="hidden md:flex items-center space-x-2 ml-4">
147
+ <button class="px-3 py-1 text-sm rounded-lg bg-gray-100 hover:bg-gray-200">Desktop</button>
148
+ <button class="px-3 py-1 text-sm rounded-lg hover:bg-gray-100">Tablet</button>
149
+ <button class="px-3 py-1 text-sm rounded-lg hover:bg-gray-100">Mobile</button>
150
+ </div>
151
+ </div>
152
+ <div>
153
+ <button class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 flex items-center">
154
+ <i data-feather="share-2" class="mr-2"></i>
155
+ <span class="hidden md:inline">Export</span>
156
+ </button>
157
+ </div>
158
+ </div>
159
+
160
+ <!-- Canvas Area -->
161
+ <div class="flex-1 overflow-auto p-4 bg-gray-100">
162
+ <div class="max-w-6xl mx-auto">
163
+ <div class="device-preview bg-white rounded-xl overflow-hidden shadow-lg">
164
+ <div id="canvas" class="w-full p-6">
165
+ <div class="flex flex-col items-center justify-center h-full text-gray-400">
166
+ <i data-feather="layout" class="w-16 h-16 mb-4"></i>
167
+ <p class="text-lg">Your design will appear here</p>
168
+ <p class="text-sm mt-2">Use the sidebar or chat to start building</p>
169
+ </div>
170
+ </div>
171
+ </div>
172
+ </div>
173
+ </div>
174
+
175
+ <!-- Chat Interface -->
176
+ <div class="bg-white border-t border-gray-200 p-4">
177
+ <div class="max-w-6xl mx-auto">
178
+ <div class="mb-4 space-y-3 max-h-40 overflow-y-auto" id="chat-messages">
179
+ <!-- Messages will appear here -->
180
+ </div>
181
+ <div class="flex space-x-2">
182
+ <input type="text" id="chat-input" placeholder="Describe what you want to build..." class="flex-1 border border-gray-300 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-indigo-500">
183
+ <button onclick="sendMessage()" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 flex items-center">
184
+ <i data-feather="send" class="mr-2"></i>
185
+ <span>Send</span>
186
+ </button>
187
+ </div>
188
+ </div>
189
+ </div>
190
+ </div>
191
+ </div>
192
+
193
+ <script>
194
+ // Initialize Feather Icons
195
+ feather.replace();
196
+
197
+ // Initialize AOS
198
+ AOS.init();
199
+
200
+ // Function to add text to prompt input
201
+ function addToPrompt(text) {
202
+ const input = document.getElementById('chat-input');
203
+ if (input.value) {
204
+ input.value += ' ' + text;
205
+ } else {
206
+ input.value = text;
207
+ }
208
+ input.focus();
209
+ }
210
+
211
+ // Function to send message
212
+ function sendMessage() {
213
+ const input = document.getElementById('chat-input');
214
+ const message = input.value.trim();
215
+ if (!message) return;
216
+
217
+ // Add user message to chat
218
+ addMessage('user', message);
219
+
220
+ // Clear input
221
+ input.value = '';
222
+
223
+ // Simulate AI response
224
+ setTimeout(() => {
225
+ const aiResponse = generateAIResponse(message);
226
+ addMessage('ai', aiResponse.text);
227
+
228
+ // Update canvas if there's HTML
229
+ if (aiResponse.html) {
230
+ document.getElementById('canvas').innerHTML = aiResponse.html;
231
+ feather.replace();
232
+ }
233
+ }, 1000);
234
+ }
235
+
236
+ // Function to add message to chat
237
+ function addMessage(sender, text) {
238
+ const chat = document.getElementById('chat-messages');
239
+ const messageDiv = document.createElement('div');
240
+ messageDiv.className = `flex ${sender === 'user' ? 'justify-end' : 'justify-start'}`;
241
+
242
+ const bubble = document.createElement('div');
243
+ bubble.className = `max-w-xs md:max-w-md px-4 py-2 ${sender === 'user' ? 'bg-indigo-600 text-white chat-message-user' : 'bg-gray-200 text-gray-800 chat-message-ai'}`;
244
+ bubble.textContent = text;
245
+
246
+ messageDiv.appendChild(bubble);
247
+ chat.appendChild(messageDiv);
248
+
249
+ // Scroll to bottom
250
+ chat.scrollTop = chat.scrollHeight;
251
+ }
252
+
253
+ // Function to generate mock AI response
254
+ function generateAIResponse(prompt) {
255
+ // This is a mock function - in a real app, you would call an AI API
256
+ const responses = {
257
+ 'dark color theme': {
258
+ text: "I've applied a dark theme with high contrast. The background is now dark gray (#1a1a1a) with light text (#f0f0f0) for better readability. Accent colors are in indigo for a modern look.",
259
+ html: `<div class="bg-gray-900 text-gray-100 p-6 rounded-lg">
260
+ <h1 class="text-3xl font-bold mb-4 text-indigo-400">Welcome to My Site</h1>
261
+ <p class="mb-6">This is a sample dark theme layout with high contrast text for better readability.</p>
262
+ <button class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg">Get Started</button>
263
+ </div>`
264
+ },
265
+ 'grid layout': {
266
+ text: "I've created a responsive grid layout with three columns on desktop that stacks to one column on mobile. Each column has equal width and proper spacing.",
267
+ html: `<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
268
+ <div class="bg-white p-4 rounded-lg shadow">
269
+ <h3 class="font-bold mb-2">Feature One</h3>
270
+ <p class="text-gray-600">Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
271
+ </div>
272
+ <div class="bg-white p-4 rounded-lg shadow">
273
+ <h3 class="font-bold mb-2">Feature Two</h3>
274
+ <p class="text-gray-600">Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
275
+ </div>
276
+ <div class="bg-white p-4 rounded-lg shadow">
277
+ <h3 class="font-bold mb-2">Feature Three</h3>
278
+ <p class="text-gray-600">Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
279
+ </div>
280
+ </div>`
281
+ },
282
+ 'hero section': {
283
+ text: "I've added a hero section with a headline, subheadline, and call-to-action button. The layout is centered with ample spacing for visual impact.",
284
+ html: `<div class="text-center py-16 px-4">
285
+ <h1 class="text-4xl md:text-5xl font-bold mb-4">Build Amazing Websites</h1>
286
+ <p class="text-xl text-gray-600 mb-8 max-w-2xl mx-auto">Our AI-powered builder helps you create beautiful, responsive websites in minutes.</p>
287
+ <button class="bg-indigo-600 hover:bg-indigo-700 text-white px-6 py-3 rounded-lg text-lg font-medium">Start Building Now</button>
288
+ </div>`
289
+ },
290
+ 'default': {
291
+ text: "I've updated the design based on your request. The layout is now more modern and responsive, with improved spacing and typography.",
292
+ html: `<div class="bg-white p-6 rounded-lg shadow">
293
+ <h1 class="text-2xl font-bold mb-4">Your Design</h1>
294
+ <p class="text-gray-600 mb-6">This is a sample layout generated based on your description. You can continue refining it using the sidebar options or by chatting with me.</p>
295
+ <div class="flex space-x-4">
296
+ <button class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg">Primary Action</button>
297
+ <button class="border border-gray-300 hover:bg-gray-100 px-4 py-2 rounded-lg">Secondary Action</button>
298
+ </div>
299
+ </div>`
300
+ }
301
+ };
302
+
303
+ // Find the best matching response
304
+ const lowerPrompt = prompt.toLowerCase();
305
+ for (const [key, response] of Object.entries(responses)) {
306
+ if (lowerPrompt.includes(key)) {
307
+ return response;
308
+ }
309
+ }
310
+
311
+ return responses['default'];
312
+ }
313
+
314
+ // Allow pressing Enter to send message
315
+ document.getElementById('chat-input').addEventListener('keypress', function(e) {
316
+ if (e.key === 'Enter') {
317
+ sendMessage();
318
+ }
319
+ });
320
+ </script>
321
+ </body>
322
  </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Ai web builder, where there is a canvas and then as I chat with ai it modified the content of canvas. By the left sidebar bar are icons of various layout such that when I select it it outputs description to the chat at which I then after clicking send it sends it to ai & the content is displayed in canvas. I want the sidebar to include various layout, colour theme, etc such that on click it add description to the text input sent later to aim make it responsive and beautiful.