-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchatwdata-portfolio.js
More file actions
324 lines (289 loc) · 7.5 KB
/
Copy pathchatwdata-portfolio.js
File metadata and controls
324 lines (289 loc) · 7.5 KB
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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
#!/usr/bin/env node
/**
* This script automates:
* 1. Creating a new React app using create-react-app.
* 2. Setting up a folder structure with modern-styled components and pages.
* 3. Writing starter code that mimics a design similar to genloop.ai/platform.
*
* Run this script with:
* chmod +x create-portfolio.js
* ./create-portfolio.js
*/
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
const appName = 'chatwdata-portfolio';
// Step 1: Create the React app
console.log(`Creating React app: ${appName}...`);
execSync(`npx create-react-app ${appName}`, { stdio: 'inherit' });
// Change working directory to the new app folder
process.chdir(appName);
console.log(`Changed directory to ${process.cwd()}`);
// Step 2: Create custom directories for components and styles
const dirsToCreate = ['src/components', 'src/styles'];
dirsToCreate.forEach((dir) => {
fs.mkdirSync(dir, { recursive: true });
});
// Step 3: Overwrite/Create Files with Updated Starter Code
// --- src/index.js ---
const indexJs = `import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import './styles/themes.css';
import './styles/App.css';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<App />);
`;
fs.writeFileSync(path.join('src', 'index.js'), indexJs, 'utf8');
// --- src/App.js ---
const appJs = `import React from 'react';
import Navbar from './components/Navbar';
import Hero from './components/Hero';
import Features from './components/Features';
import CallToAction from './components/CallToAction';
import Footer from './components/Footer';
function App() {
return (
<div>
<Navbar />
<Hero />
<Features />
<CallToAction />
<Footer />
</div>
);
}
export default App;
`;
fs.writeFileSync(path.join('src', 'App.js'), appJs, 'utf8');
// --- src/components/Navbar.js ---
const navbarJs = `import React from 'react';
function Navbar() {
return (
<nav className="navbar">
<div className="logo">Chat‑W‑Data</div>
<ul className="nav-links">
<li><a href="#hero">Home</a></li>
<li><a href="#features">Features</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
);
}
export default Navbar;
`;
fs.writeFileSync(path.join('src', 'components', 'Navbar.js'), navbarJs, 'utf8');
// --- src/components/Hero.js ---
const heroJs = `import React from 'react';
function Hero() {
return (
<section id="hero" className="hero">
<div className="hero-content">
<h1>Chat‑W‑Data</h1>
<p>
Fine-tuned system to chat with both structured and unstructured data.
Convert natural language into SQL queries seamlessly.
</p>
<button className="cta-btn">Get Started</button>
</div>
</section>
);
}
export default Hero;
`;
fs.writeFileSync(path.join('src', 'components', 'Hero.js'), heroJs, 'utf8');
// --- src/components/Features.js ---
const featuresJs = `import React from 'react';
function Features() {
return (
<section id="features" className="features">
<h2>Platform Features</h2>
<div className="features-grid">
<div className="feature-card">
<h3>Natural Language Querying</h3>
<p>Seamlessly convert prompts to SQL queries.</p>
</div>
<div className="feature-card">
<h3>Dynamic Tables</h3>
<p>Interact with highly customizable tables.</p>
</div>
<div className="feature-card">
<h3>Customizable Charts</h3>
<p>Change plots dynamically with intuitive controls.</p>
</div>
<div className="feature-card">
<h3>Export Options</h3>
<p>Download your data in PDF, CSV, or Excel formats.</p>
</div>
</div>
</section>
);
}
export default Features;
`;
fs.writeFileSync(path.join('src', 'components', 'Features.js'), featuresJs, 'utf8');
// --- src/components/CallToAction.js ---
const ctaJs = `import React from 'react';
function CallToAction() {
return (
<section className="cta">
<h2>Ready to Transform Your Data Interaction?</h2>
<button className="cta-btn">Get Started</button>
</section>
);
}
export default CallToAction;
`;
fs.writeFileSync(path.join('src', 'components', 'CallToAction.js'), ctaJs, 'utf8');
// --- src/components/Footer.js ---
const footerJs = `import React from 'react';
function Footer() {
return (
<footer className="footer" id="contact">
<p>© {new Date().getFullYear()} Chat‑W‑Data. All rights reserved.</p>
</footer>
);
}
export default Footer;
`;
fs.writeFileSync(path.join('src', 'components', 'Footer.js'), footerJs, 'utf8');
// --- src/styles/themes.css ---
// Global theming variables (light mode defaults; you can extend to dark mode if desired)
const themesCss = `:root {
--primary-color: #ffffff;
--secondary-color: #ff7f50;
--background-color: #f7f7f7;
--text-color: #333333;
--gradient-start: #0f2027;
--gradient-mid: #203a43;
--gradient-end: #2c5364;
}
body, html {
margin: 0;
padding: 0;
font-family: 'Arial', sans-serif;
}
`;
fs.writeFileSync(path.join('src', 'styles', 'themes.css'), themesCss, 'utf8');
// --- src/styles/App.css ---
const appCss = `/* Navbar */
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 2rem;
position: fixed;
width: 100%;
z-index: 100;
background: transparent;
}
.navbar .logo {
font-size: 1.5rem;
font-weight: bold;
color: #fff;
}
.nav-links {
list-style: none;
display: flex;
}
.nav-links li {
margin-left: 2rem;
}
.nav-links a {
text-decoration: none;
color: #fff;
transition: color 0.3s ease;
}
.nav-links a:hover {
color: var(--secondary-color);
}
/* Hero Section */
.hero {
height: 100vh;
background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
display: flex;
align-items: center;
justify-content: center;
color: #fff;
text-align: center;
padding: 0 2rem;
}
.hero-content h1 {
font-size: 4rem;
margin-bottom: 1rem;
}
.hero-content p {
font-size: 1.5rem;
margin-bottom: 2rem;
}
.cta-btn {
background: var(--secondary-color);
border: none;
padding: 1rem 2rem;
color: #fff;
font-size: 1rem;
cursor: pointer;
border-radius: 30px;
transition: background 0.3s ease;
}
.cta-btn:hover {
background: #ff6347;
}
/* Features Section */
.features {
padding: 4rem 2rem;
background-color: var(--background-color);
text-align: center;
}
.features h2 {
font-size: 2.5rem;
margin-bottom: 2rem;
}
.features-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 2rem;
}
.feature-card {
background: #fff;
padding: 2rem;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
transition: transform 0.3s ease;
}
.feature-card:hover {
transform: translateY(-10px);
}
.feature-card h3 {
font-size: 1.5rem;
margin-bottom: 1rem;
}
.feature-card p {
font-size: 1rem;
color: #555;
}
/* Call To Action Section */
.cta {
padding: 4rem 2rem;
text-align: center;
background: var(--gradient-end);
color: #fff;
}
.cta h2 {
font-size: 2.5rem;
margin-bottom: 1.5rem;
}
/* Footer */
.footer {
padding: 2rem;
background-color: var(--gradient-mid);
color: #fff;
text-align: center;
}
`;
fs.writeFileSync(path.join('src', 'styles', 'App.css'), appCss, 'utf8');
// Step 4: Final Message
console.log('React portfolio app created successfully!');
console.log('To get started:');
console.log(` cd ${appName}`);
console.log(' npm start');