Spaces:
Running
Running
https://lovable.dev/ copie ce site pour creer un site entierement fonctionnel qui permet à l'utililisateur quand il tape son idée d'app l'ia gemini lui code son app souhaité et ensuite il peut lui parler pour discuter ou apporter des modifs
Browse files- README.md +8 -5
- components/footer.js +84 -0
- components/navbar.js +73 -0
- index.html +137 -19
- script.js +208 -0
- style.css +42 -18
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title: Lovable
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Lovable AI Coder 🚀
|
| 3 |
+
colorFrom: red
|
| 4 |
+
colorTo: red
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://deepsite.hf.co).
|
components/footer.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomFooter extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
footer {
|
| 7 |
+
background: #1f2937;
|
| 8 |
+
color: white;
|
| 9 |
+
padding: 4rem 2rem;
|
| 10 |
+
margin-top: auto;
|
| 11 |
+
}
|
| 12 |
+
.container {
|
| 13 |
+
max-width: 1200px;
|
| 14 |
+
margin: 0 auto;
|
| 15 |
+
display: grid;
|
| 16 |
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
| 17 |
+
gap: 2rem;
|
| 18 |
+
}
|
| 19 |
+
h3 {
|
| 20 |
+
font-size: 1.125rem;
|
| 21 |
+
font-weight: 600;
|
| 22 |
+
margin-bottom: 1rem;
|
| 23 |
+
color: #e5e7eb;
|
| 24 |
+
}
|
| 25 |
+
ul {
|
| 26 |
+
list-style: none;
|
| 27 |
+
padding: 0;
|
| 28 |
+
margin: 0;
|
| 29 |
+
}
|
| 30 |
+
li {
|
| 31 |
+
margin-bottom: 0.75rem;
|
| 32 |
+
}
|
| 33 |
+
a {
|
| 34 |
+
color: #9ca3af;
|
| 35 |
+
text-decoration: none;
|
| 36 |
+
transition: color 0.2s;
|
| 37 |
+
}
|
| 38 |
+
a:hover {
|
| 39 |
+
color: white;
|
| 40 |
+
}
|
| 41 |
+
.social-links {
|
| 42 |
+
display: flex;
|
| 43 |
+
gap: 1rem;
|
| 44 |
+
}
|
| 45 |
+
.copyright {
|
| 46 |
+
text-align: center;
|
| 47 |
+
padding-top: 2rem;
|
| 48 |
+
margin-top: 2rem;
|
| 49 |
+
border-top: 1px solid #374151;
|
| 50 |
+
color: #9ca3af;
|
| 51 |
+
}
|
| 52 |
+
</style>
|
| 53 |
+
<footer>
|
| 54 |
+
<div class="container">
|
| 55 |
+
<div>
|
| 56 |
+
<h3>Lovable AI Coder</h3>
|
| 57 |
+
<p class="text-gray-400">Transforming ideas into reality with AI-powered code generation.</p>
|
| 58 |
+
</div>
|
| 59 |
+
<div>
|
| 60 |
+
<h3>Quick Links</h3>
|
| 61 |
+
<ul>
|
| 62 |
+
<li><a href="#how-it-works">How it Works</a></li>
|
| 63 |
+
<li><a href="#generate">Code Generator</a></li>
|
| 64 |
+
<li><a href="#chat">AI Chat</a></li>
|
| 65 |
+
</ul>
|
| 66 |
+
</div>
|
| 67 |
+
<div>
|
| 68 |
+
<h3>Connect</h3>
|
| 69 |
+
<div class="social-links">
|
| 70 |
+
<a href="#"><i data-feather="twitter"></i></a>
|
| 71 |
+
<a href="#"><i data-feather="github"></i></a>
|
| 72 |
+
<a href="#"><i data-feather="linkedin"></i></a>
|
| 73 |
+
<a href="#"><i data-feather="mail"></i></a>
|
| 74 |
+
</div>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
<div class="copyright">
|
| 78 |
+
© ${new Date().getFullYear()} Lovable AI Coder. All rights reserved.
|
| 79 |
+
</div>
|
| 80 |
+
</footer>
|
| 81 |
+
`;
|
| 82 |
+
}
|
| 83 |
+
}
|
| 84 |
+
customElements.define('custom-footer', CustomFooter);
|
components/navbar.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomNavbar extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
nav {
|
| 7 |
+
background: white;
|
| 8 |
+
padding: 1rem 2rem;
|
| 9 |
+
display: flex;
|
| 10 |
+
justify-content: space-between;
|
| 11 |
+
align-items: center;
|
| 12 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 13 |
+
position: sticky;
|
| 14 |
+
top: 0;
|
| 15 |
+
z-index: 50;
|
| 16 |
+
}
|
| 17 |
+
.logo {
|
| 18 |
+
color: #6366f1;
|
| 19 |
+
font-weight: bold;
|
| 20 |
+
font-size: 1.5rem;
|
| 21 |
+
display: flex;
|
| 22 |
+
align-items: center;
|
| 23 |
+
gap: 0.5rem;
|
| 24 |
+
}
|
| 25 |
+
.nav-links {
|
| 26 |
+
display: flex;
|
| 27 |
+
gap: 2rem;
|
| 28 |
+
list-style: none;
|
| 29 |
+
margin: 0;
|
| 30 |
+
padding: 0;
|
| 31 |
+
align-items: center;
|
| 32 |
+
}
|
| 33 |
+
a {
|
| 34 |
+
color: #4b5563;
|
| 35 |
+
text-decoration: none;
|
| 36 |
+
font-weight: 500;
|
| 37 |
+
transition: color 0.2s;
|
| 38 |
+
}
|
| 39 |
+
a:hover {
|
| 40 |
+
color: #6366f1;
|
| 41 |
+
}
|
| 42 |
+
.cta {
|
| 43 |
+
background: #6366f1;
|
| 44 |
+
color: white;
|
| 45 |
+
padding: 0.5rem 1rem;
|
| 46 |
+
border-radius: 0.375rem;
|
| 47 |
+
}
|
| 48 |
+
.cta:hover {
|
| 49 |
+
background: #4f46e5;
|
| 50 |
+
color: white;
|
| 51 |
+
}
|
| 52 |
+
@media (max-width: 768px) {
|
| 53 |
+
.nav-links {
|
| 54 |
+
display: none;
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
</style>
|
| 58 |
+
<nav>
|
| 59 |
+
<a href="/" class="logo">
|
| 60 |
+
<i data-feather="code"></i>
|
| 61 |
+
LovableAI
|
| 62 |
+
</a>
|
| 63 |
+
<ul class="nav-links">
|
| 64 |
+
<li><a href="#how-it-works">How it Works</a></li>
|
| 65 |
+
<li><a href="#generate">Generator</a></li>
|
| 66 |
+
<li><a href="#chat">Chat</a></li>
|
| 67 |
+
<li><a href="#" class="cta">Get Started</a></li>
|
| 68 |
+
</ul>
|
| 69 |
+
</nav>
|
| 70 |
+
`;
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
customElements.define('custom-navbar', CustomNavbar);
|
index.html
CHANGED
|
@@ -1,19 +1,137 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
</
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>Lovable AI Coder - Transform Your Ideas into Code</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 11 |
+
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.net.min.js"></script>
|
| 12 |
+
</head>
|
| 13 |
+
<body class="bg-gray-50">
|
| 14 |
+
<custom-navbar></custom-navbar>
|
| 15 |
+
|
| 16 |
+
<main class="container mx-auto px-4 py-12">
|
| 17 |
+
<!-- Hero Section -->
|
| 18 |
+
<section class="text-center mb-20">
|
| 19 |
+
<h1 class="text-5xl font-bold text-gray-900 mb-6">Transform Your Ideas <br> Into <span class="text-indigo-600">Working Code</span></h1>
|
| 20 |
+
<p class="text-xl text-gray-600 max-w-2xl mx-auto mb-8">Describe your app idea and our AI will generate the complete code for you instantly. Then refine it through conversation.</p>
|
| 21 |
+
|
| 22 |
+
<div class="flex justify-center gap-4">
|
| 23 |
+
<a href="#generate" class="bg-indigo-600 hover:bg-indigo-700 text-white px-6 py-3 rounded-lg font-medium text-lg transition-all">Generate Code</a>
|
| 24 |
+
<a href="#how-it-works" class="border border-gray-300 hover:bg-gray-100 text-gray-700 px-6 py-3 rounded-lg font-medium text-lg transition-all">How it Works</a>
|
| 25 |
+
</div>
|
| 26 |
+
</section>
|
| 27 |
+
|
| 28 |
+
<!-- Generator Section -->
|
| 29 |
+
<section id="generate" class="bg-white rounded-xl shadow-lg p-8 mb-20">
|
| 30 |
+
<div class="flex flex-col md:flex-row gap-8">
|
| 31 |
+
<div class="w-full md:w-1/2">
|
| 32 |
+
<h2 class="text-2xl font-bold text-gray-800 mb-6">Tell us about your app</h2>
|
| 33 |
+
<div class="mb-4">
|
| 34 |
+
<label for="app-description" class="block text-gray-700 mb-2">Describe your idea:</label>
|
| 35 |
+
<textarea id="app-description" rows="6" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="I want an app that helps people track their daily water intake with reminders and progress charts..."></textarea>
|
| 36 |
+
</div>
|
| 37 |
+
<div class="mb-4">
|
| 38 |
+
<label class="block text-gray-700 mb-2">Preferred technology:</label>
|
| 39 |
+
<div class="flex flex-wrap gap-3">
|
| 40 |
+
<button class="tech-choice active bg-indigo-100 text-indigo-700 px-4 py-2 rounded-lg">React</button>
|
| 41 |
+
<button class="tech-choice bg-gray-100 text-gray-700 px-4 py-2 rounded-lg">Vue</button>
|
| 42 |
+
<button class="tech-choice bg-gray-100 text-gray-700 px-4 py-2 rounded-lg">Angular</button>
|
| 43 |
+
<button class="tech-choice bg-gray-100 text-gray-700 px-4 py-2 rounded-lg">Flutter</button>
|
| 44 |
+
<button class="tech-choice bg-gray-100 text-gray-700 px-4 py-2 rounded-lg">Swift</button>
|
| 45 |
+
</div>
|
| 46 |
+
</div>
|
| 47 |
+
<button id="generate-btn" class="w-full bg-indigo-600 hover:bg-indigo-700 text-white py-3 rounded-lg font-medium flex items-center justify-center gap-2">
|
| 48 |
+
<i data-feather="code"></i>
|
| 49 |
+
Generate My App
|
| 50 |
+
</button>
|
| 51 |
+
</div>
|
| 52 |
+
<div class="w-full md:w-1/2">
|
| 53 |
+
<div class="bg-gray-900 rounded-lg p-4 h-full">
|
| 54 |
+
<div class="flex items-center justify-between mb-4">
|
| 55 |
+
<div class="flex gap-2">
|
| 56 |
+
<div class="w-3 h-3 rounded-full bg-red-500"></div>
|
| 57 |
+
<div class="w-3 h-3 rounded-full bg-yellow-500"></div>
|
| 58 |
+
<div class="w-3 h-3 rounded-full bg-green-500"></div>
|
| 59 |
+
</div>
|
| 60 |
+
<span class="text-gray-400 text-sm">app.js</span>
|
| 61 |
+
</div>
|
| 62 |
+
<pre id="code-output" class="text-gray-200 font-mono text-sm overflow-auto max-h-96 bg-gray-800 p-4 rounded">// Your generated code will appear here...</pre>
|
| 63 |
+
</div>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
</section>
|
| 67 |
+
|
| 68 |
+
<!-- Chat Section -->
|
| 69 |
+
<section id="chat" class="bg-white rounded-xl shadow-lg p-8 mb-20 hidden">
|
| 70 |
+
<h2 class="text-2xl font-bold text-gray-800 mb-6">Refine Your App</h2>
|
| 71 |
+
<div class="flex flex-col h-96 mb-4 border border-gray-300 rounded-lg overflow-hidden">
|
| 72 |
+
<div id="chat-messages" class="flex-1 overflow-y-auto p-4 bg-gray-50">
|
| 73 |
+
<div class="flex justify-start mb-4">
|
| 74 |
+
<div class="bg-indigo-100 text-gray-800 p-3 rounded-lg max-w-xs md:max-w-md lg:max-w-lg">
|
| 75 |
+
<p>Hi! I'm your AI coding assistant. I've generated the initial code for your app. How would you like to modify it?</p>
|
| 76 |
+
</div>
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
<div class="p-4 bg-white border-t border-gray-300">
|
| 80 |
+
<div class="flex gap-2">
|
| 81 |
+
<input type="text" id="chat-input" class="flex-1 px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500" placeholder="Ask me to change something...">
|
| 82 |
+
<button id="send-chat-btn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg">
|
| 83 |
+
<i data-feather="send"></i>
|
| 84 |
+
</button>
|
| 85 |
+
</div>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
</section>
|
| 89 |
+
|
| 90 |
+
<!-- How it works -->
|
| 91 |
+
<section id="how-it-works" class="mb-20">
|
| 92 |
+
<h2 class="text-3xl font-bold text-center text-gray-900 mb-12">How It Works</h2>
|
| 93 |
+
<div class="grid md:grid-cols-3 gap-8">
|
| 94 |
+
<div class="bg-white p-6 rounded-xl shadow-md text-center">
|
| 95 |
+
<div class="bg-indigo-100 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
|
| 96 |
+
<i data-feather="edit-2" class="text-indigo-600"></i>
|
| 97 |
+
</div>
|
| 98 |
+
<h3 class="text-xl font-semibold mb-2">Describe Your Idea</h3>
|
| 99 |
+
<p class="text-gray-600">Tell us what you want to build in plain English. The more details you provide, the better!</p>
|
| 100 |
+
</div>
|
| 101 |
+
<div class="bg-white p-6 rounded-xl shadow-md text-center">
|
| 102 |
+
<div class="bg-indigo-100 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
|
| 103 |
+
<i data-feather="code" class="text-indigo-600"></i>
|
| 104 |
+
</div>
|
| 105 |
+
<h3 class="text-xl font-semibold mb-2">AI Generates Code</h3>
|
| 106 |
+
<p class="text-gray-600">Our AI analyzes your requirements and generates production-ready code instantly.</p>
|
| 107 |
+
</div>
|
| 108 |
+
<div class="bg-white p-6 rounded-xl shadow-md text-center">
|
| 109 |
+
<div class="bg-indigo-100 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4">
|
| 110 |
+
<i data-feather="message-square" class="text-indigo-600"></i>
|
| 111 |
+
</div>
|
| 112 |
+
<h3 class="text-xl font-semibold mb-2">Refine Together</h3>
|
| 113 |
+
<p class="text-gray-600">Chat with the AI to make adjustments, add features, or get explanations.</p>
|
| 114 |
+
</div>
|
| 115 |
+
</div>
|
| 116 |
+
</section>
|
| 117 |
+
</main>
|
| 118 |
+
|
| 119 |
+
<custom-footer></custom-footer>
|
| 120 |
+
|
| 121 |
+
<script src="components/navbar.js"></script>
|
| 122 |
+
<script src="components/footer.js"></script>
|
| 123 |
+
<script src="script.js"></script>
|
| 124 |
+
<script>
|
| 125 |
+
feather.replace();
|
| 126 |
+
VANTA.NET({
|
| 127 |
+
el: "body",
|
| 128 |
+
color: 0x6366f1,
|
| 129 |
+
backgroundColor: 0xf9fafb,
|
| 130 |
+
points: 12,
|
| 131 |
+
maxDistance: 20,
|
| 132 |
+
spacing: 15
|
| 133 |
+
});
|
| 134 |
+
</script>
|
| 135 |
+
<script src="https://deepsite.hf.co/deepsite-badge.js"></script>
|
| 136 |
+
</body>
|
| 137 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Main application functionality
|
| 2 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 3 |
+
// Tech selection
|
| 4 |
+
const techChoices = document.querySelectorAll('.tech-choice');
|
| 5 |
+
techChoices.forEach(choice => {
|
| 6 |
+
choice.addEventListener('click', () => {
|
| 7 |
+
techChoices.forEach(c => c.classList.remove('active'));
|
| 8 |
+
choice.classList.add('active');
|
| 9 |
+
});
|
| 10 |
+
});
|
| 11 |
+
|
| 12 |
+
// Code generation
|
| 13 |
+
const generateBtn = document.getElementById('generate-btn');
|
| 14 |
+
const appDescription = document.getElementById('app-description');
|
| 15 |
+
const codeOutput = document.getElementById('code-output');
|
| 16 |
+
const chatSection = document.getElementById('chat');
|
| 17 |
+
|
| 18 |
+
generateBtn.addEventListener('click', async () => {
|
| 19 |
+
if (!appDescription.value.trim()) {
|
| 20 |
+
alert('Please describe your app idea first!');
|
| 21 |
+
return;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
// Show generating state
|
| 25 |
+
generateBtn.disabled = true;
|
| 26 |
+
generateBtn.innerHTML = '<i data-feather="loader" class="animate-spin"></i> Generating...';
|
| 27 |
+
feather.replace();
|
| 28 |
+
|
| 29 |
+
// Simulate API call to generate code
|
| 30 |
+
setTimeout(() => {
|
| 31 |
+
const tech = document.querySelector('.tech-choice.active').textContent;
|
| 32 |
+
|
| 33 |
+
// Example generated code (in a real app this would come from an AI API)
|
| 34 |
+
const generatedCode = generateSampleCode(appDescription.value, tech);
|
| 35 |
+
|
| 36 |
+
// Display the code with typewriter effect
|
| 37 |
+
typeWriterEffect(codeOutput, generatedCode, 10, () => {
|
| 38 |
+
generateBtn.disabled = false;
|
| 39 |
+
generateBtn.innerHTML = '<i data-feather="code"></i> Generate My App';
|
| 40 |
+
feather.replace();
|
| 41 |
+
|
| 42 |
+
// Show the chat section
|
| 43 |
+
chatSection.classList.remove('hidden');
|
| 44 |
+
chatSection.scrollIntoView({ behavior: 'smooth' });
|
| 45 |
+
});
|
| 46 |
+
}, 2000);
|
| 47 |
+
});
|
| 48 |
+
|
| 49 |
+
// Chat functionality
|
| 50 |
+
const chatInput = document.getElementById('chat-input');
|
| 51 |
+
const sendChatBtn = document.getElementById('send-chat-btn');
|
| 52 |
+
const chatMessages = document.getElementById('chat-messages');
|
| 53 |
+
|
| 54 |
+
sendChatBtn.addEventListener('click', sendMessage);
|
| 55 |
+
chatInput.addEventListener('keypress', (e) => {
|
| 56 |
+
if (e.key === 'Enter') sendMessage();
|
| 57 |
+
});
|
| 58 |
+
|
| 59 |
+
function sendMessage() {
|
| 60 |
+
const message = chatInput.value.trim();
|
| 61 |
+
if (!message) return;
|
| 62 |
+
|
| 63 |
+
// Add user message
|
| 64 |
+
addMessage(message, 'user');
|
| 65 |
+
chatInput.value = '';
|
| 66 |
+
|
| 67 |
+
// Simulate AI response
|
| 68 |
+
setTimeout(() => {
|
| 69 |
+
addMessage(getAIResponse(message), 'ai');
|
| 70 |
+
chatMessages.scrollTop = chatMessages.scrollHeight;
|
| 71 |
+
}, 1000);
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
function addMessage(text, sender) {
|
| 75 |
+
const messageDiv = document.createElement('div');
|
| 76 |
+
messageDiv.className = `flex mb-4 ${sender === 'user' ? 'justify-end' : 'justify-start'}`;
|
| 77 |
+
|
| 78 |
+
const bubble = document.createElement('div');
|
| 79 |
+
bubble.className = `${sender === 'user' ? 'bg-indigo-600 text-white' : 'bg-indigo-100 text-gray-800'} p-3 rounded-lg max-w-xs md:max-w-md lg:max-w-lg`;
|
| 80 |
+
bubble.textContent = text;
|
| 81 |
+
|
| 82 |
+
messageDiv.appendChild(bubble);
|
| 83 |
+
chatMessages.appendChild(messageDiv);
|
| 84 |
+
chatMessages.scrollTop = chatMessages.scrollHeight;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
// Helper functions
|
| 88 |
+
function typeWriterEffect(element, text, speed, callback) {
|
| 89 |
+
let i = 0;
|
| 90 |
+
element.textContent = '';
|
| 91 |
+
|
| 92 |
+
function type() {
|
| 93 |
+
if (i < text.length) {
|
| 94 |
+
element.textContent += text.charAt(i);
|
| 95 |
+
i++;
|
| 96 |
+
setTimeout(type, speed);
|
| 97 |
+
} else if (callback) {
|
| 98 |
+
callback();
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
type();
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
function generateSampleCode(description, tech) {
|
| 106 |
+
// This would be replaced with actual AI API call in production
|
| 107 |
+
const baseCode = {
|
| 108 |
+
'React': `import React, { useState } from 'react';
|
| 109 |
+
import './App.css';
|
| 110 |
+
|
| 111 |
+
function App() {
|
| 112 |
+
const [count, setCount] = useState(0);
|
| 113 |
+
|
| 114 |
+
return (
|
| 115 |
+
<div className="App">
|
| 116 |
+
<header className="App-header">
|
| 117 |
+
<h1>${extractTitle(description)}</h1>
|
| 118 |
+
<p>${extractDescription(description)}</p>
|
| 119 |
+
<button onClick={() => setCount(count + 1)}>
|
| 120 |
+
Clicked {count} times
|
| 121 |
+
</button>
|
| 122 |
+
</header>
|
| 123 |
+
</div>
|
| 124 |
+
);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
export default App;`,
|
| 128 |
+
'Vue': `<template>
|
| 129 |
+
<div id="app">
|
| 130 |
+
<h1>${extractTitle(description)}</h1>
|
| 131 |
+
<p>${extractDescription(description)}</p>
|
| 132 |
+
<button @click="count++">Clicked {{ count }} times</button>
|
| 133 |
+
</div>
|
| 134 |
+
</template>
|
| 135 |
+
|
| 136 |
+
<script>
|
| 137 |
+
export default {
|
| 138 |
+
name: 'App',
|
| 139 |
+
data() {
|
| 140 |
+
return {
|
| 141 |
+
count: 0
|
| 142 |
+
}
|
| 143 |
+
}
|
| 144 |
+
}
|
| 145 |
+
</script>
|
| 146 |
+
|
| 147 |
+
<style>
|
| 148 |
+
#app {
|
| 149 |
+
text-align: center;
|
| 150 |
+
}
|
| 151 |
+
</style>`,
|
| 152 |
+
'Flutter': `import 'package:flutter/material.dart';
|
| 153 |
+
|
| 154 |
+
void main() {
|
| 155 |
+
runApp(MyApp());
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
class MyApp extends StatelessWidget {
|
| 159 |
+
@override
|
| 160 |
+
Widget build(BuildContext context) {
|
| 161 |
+
return MaterialApp(
|
| 162 |
+
title: '${extractTitle(description)}',
|
| 163 |
+
home: Scaffold(
|
| 164 |
+
appBar: AppBar(
|
| 165 |
+
title: Text('${extractTitle(description)}'),
|
| 166 |
+
),
|
| 167 |
+
body: Center(
|
| 168 |
+
child: Column(
|
| 169 |
+
mainAxisAlignment: MainAxisAlignment.center,
|
| 170 |
+
children: <Widget>[
|
| 171 |
+
Text('${extractDescription(description)}'),
|
| 172 |
+
SizedBox(height: 20),
|
| 173 |
+
ElevatedButton(
|
| 174 |
+
onPressed: () {},
|
| 175 |
+
child: Text('Click Me'),
|
| 176 |
+
),
|
| 177 |
+
],
|
| 178 |
+
),
|
| 179 |
+
),
|
| 180 |
+
),
|
| 181 |
+
);
|
| 182 |
+
}
|
| 183 |
+
}`
|
| 184 |
+
};
|
| 185 |
+
|
| 186 |
+
return baseCode[tech] || `// Code generation for ${tech} is not yet supported\n// ${description}`;
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
function extractTitle(description) {
|
| 190 |
+
const firstSentence = description.split('.')[0];
|
| 191 |
+
return firstSentence || "My Awesome App";
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
function extractDescription(description) {
|
| 195 |
+
return description.length > 100 ? description.substring(0, 100) + "..." : description;
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
function getAIResponse(message) {
|
| 199 |
+
const responses = [
|
| 200 |
+
"I've updated the code to include that feature. Check it out above!",
|
| 201 |
+
"That's a great suggestion! I've modified the code accordingly.",
|
| 202 |
+
"I can help with that. Here's how we can implement it...",
|
| 203 |
+
"Interesting idea! I've added that functionality to your app.",
|
| 204 |
+
"Sure thing! The code now includes your requested changes."
|
| 205 |
+
];
|
| 206 |
+
return responses[Math.floor(Math.random() * responses.length)];
|
| 207 |
+
}
|
| 208 |
+
});
|
style.css
CHANGED
|
@@ -1,28 +1,52 @@
|
|
|
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
font-size: 15px;
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
|
|
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Shared styles */
|
| 2 |
body {
|
| 3 |
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
| 4 |
+
min-height: 100vh;
|
| 5 |
+
display: flex;
|
| 6 |
+
flex-direction: column;
|
| 7 |
}
|
| 8 |
|
| 9 |
+
/* Animation for code generation */
|
| 10 |
+
@keyframes pulse {
|
| 11 |
+
0%, 100% { opacity: 1; }
|
| 12 |
+
50% { opacity: 0.5; }
|
| 13 |
}
|
| 14 |
|
| 15 |
+
.generating {
|
| 16 |
+
animation: pulse 1.5s infinite;
|
|
|
|
|
|
|
|
|
|
| 17 |
}
|
| 18 |
|
| 19 |
+
/* Custom scrollbar */
|
| 20 |
+
::-webkit-scrollbar {
|
| 21 |
+
width: 8px;
|
| 22 |
+
height: 8px;
|
|
|
|
|
|
|
| 23 |
}
|
| 24 |
|
| 25 |
+
::-webkit-scrollbar-track {
|
| 26 |
+
background: #f1f1f1;
|
| 27 |
+
border-radius: 10px;
|
| 28 |
}
|
| 29 |
+
|
| 30 |
+
::-webkit-scrollbar-thumb {
|
| 31 |
+
background: #888;
|
| 32 |
+
border-radius: 10px;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
::-webkit-scrollbar-thumb:hover {
|
| 36 |
+
background: #555;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
/* Tech choice buttons */
|
| 40 |
+
.tech-choice {
|
| 41 |
+
transition: all 0.2s ease;
|
| 42 |
+
cursor: pointer;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.tech-choice.active {
|
| 46 |
+
background-color: #6366f1;
|
| 47 |
+
color: white;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.tech-choice:hover:not(.active) {
|
| 51 |
+
background-color: #e5e7eb;
|
| 52 |
+
}
|