-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex_backup.html
More file actions
366 lines (317 loc) · 11 KB
/
index_backup.html
File metadata and controls
366 lines (317 loc) · 11 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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React Seconds Counter - Patsy The Pug dev</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: #f8f9fa;
color: #333;
padding: 20px;
}
.app {
max-width: 1200px;
margin: 0 auto;
}
.header {
text-align: center;
margin-bottom: 30px;
}
.logo {
display: flex;
align-items: center;
justify-content: center;
gap: 15px;
margin-bottom: 20px;
}
.logo img {
border-radius: 8px;
}
.brand {
font-size: 1.2rem;
color: #FF6B35;
font-weight: 600;
}
.tagline {
font-size: 0.9rem;
color: #666;
}
.main-container {
display: flex;
gap: 30px;
margin-bottom: 40px;
}
.timer-panel {
flex: 2;
background: white;
border-radius: 12px;
padding: 40px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
text-align: center;
}
.timer-icon {
font-size: 2.5rem;
margin-bottom: 10px;
}
.timer-panel h1 {
font-size: 2.2rem;
color: #333;
margin: 10px 0;
}
.timer-panel p {
color: #666;
margin-bottom: 40px;
}
.time {
font-size: 4rem;
font-family: 'SF Mono', monospace;
color: #2563eb;
font-weight: 300;
margin: 40px 0 10px;
}
.time-label {
font-size: 0.9rem;
color: #666;
margin-bottom: 10px;
}
.status {
font-size: 1.1rem;
color: #059669;
font-weight: 500;
margin-bottom: 40px;
}
.controls {
display: flex;
gap: 15px;
justify-content: center;
flex-wrap: wrap;
}
.btn {
padding: 12px 24px;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
min-width: 120px;
}
.btn-start {
background: #059669;
color: white;
}
.btn-stop {
background: #dc2626;
color: white;
}
.btn-reset {
background: #6b7280;
color: white;
}
.btn:hover {
opacity: 0.9;
}
.settings-panel {
flex: 1;
background: white;
border-radius: 12px;
padding: 20px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
height: fit-content;
}
.setting-group {
margin-bottom: 25px;
padding-bottom: 20px;
border-bottom: 1px solid #e5e7eb;
}
.setting-group h3 {
font-size: 1rem;
color: #333;
margin-bottom: 10px;
}
.educational-section {
background: white;
border-radius: 12px;
padding: 40px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.educational-section h2 {
text-align: center;
color: #333;
font-size: 1.8rem;
margin-bottom: 10px;
}
.concepts-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 30px;
margin: 40px 0;
}
.concept-card {
background: #f8f9fa;
border-radius: 8px;
padding: 25px;
}
.concept-card h3 {
color: #333;
margin-bottom: 15px;
}
.tech-icons {
display: flex;
justify-content: center;
gap: 20px;
margin-top: 15px;
}
.tech-icons span {
background: #e5e7eb;
padding: 6px 12px;
border-radius: 20px;
font-size: 0.85rem;
color: #374151;
}
</style>
</head>
<body>
<div id="app">
<div class="header">
<div class="logo">
<img src="https://via.placeholder.com/60x60/FF6B35/FFFFFF?text=P" alt="Patsy Logo" />
<div>
<div class="brand">aprendiendo con patsy</div>
<div class="tagline">Patsy The Pug_dev</div>
</div>
</div>
</div>
<div class="main-container">
<div class="timer-panel">
<div class="timer-icon">⏱️</div>
<h1>React Seconds Counter</h1>
<p>Advanced timer with countdown, presets, and notifications</p>
<div class="time" id="timeDisplay">00:00:00</div>
<div class="time-label">Hours : Minutes : Seconds</div>
<div class="status" id="statusDisplay">Ready</div>
<div class="controls">
<button class="btn btn-start" id="startBtn" onclick="startTimer()">Start</button>
<button class="btn btn-stop" id="stopBtn" onclick="stopTimer()">Stop/Pause</button>
<button class="btn btn-reset" id="resetBtn" onclick="resetTimer()">Reset</button>
</div>
</div>
<div class="settings-panel">
<div class="setting-group">
<h3>⚙️ Counter Mode</h3>
<div>
<label><input type="radio" checked> Count Up</label><br>
<label><input type="radio"> Countdown</label>
</div>
</div>
<div class="setting-group">
<h3>⏰ Preset Time</h3>
<input type="number" value="5" min="1"> minutes
</div>
<div class="setting-group">
<h3>🚨 Alert Settings</h3>
<p>Alert at Time (seconds)</p>
<input type="number" value="60"><br>
<label><input type="checkbox"> Enable sound alerts</label>
</div>
<div class="setting-group">
<h3>📊 Session Stats</h3>
<div>Total Sessions: <strong>1</strong></div>
<div>Total Time: <strong id="totalTime">00:00:00</strong></div>
<div>Average: <strong>0</strong></div>
<div>Alerts Triggered: <strong>0</strong></div>
</div>
</div>
</div>
<div class="educational-section">
<h2>📚 Conceptos de React - Hooks useState y useEffect</h2>
<p>Aprende cómo funcionan los hooks principales de React en este contador de segundos</p>
<div class="concepts-grid">
<div class="concept-card">
<h3>🎯 El Hook useState</h3>
<p>Permite añadir estado local a componentes funcionales. Se usa para almacenar datos que cambian con el tiempo:</p>
<ul>
<li><strong>Estado inicial:</strong> const [count, setCount] = useState(0)</li>
<li><strong>Función de actualización:</strong> setCount(count + 1)</li>
<li><strong>Múltiples estados:</strong> [name], [data], [time]</li>
<li><strong>Renderizado automático:</strong> React actualiza la UI</li>
</ul>
</div>
<div class="concept-card">
<h3>🔄 El Hook useEffect</h3>
<p>Maneja efectos secundarios y ciclos de vida del componente:</p>
<ul>
<li><strong>Efectos:</strong> Se ejecuta después del renderizado</li>
<li><strong>Cleanup:</strong> Limpia efectos con return</li>
<li><strong>Dependencias:</strong> Control de cuándo ejecutar</li>
<li><strong>Intervalos:</strong> setInterval y clearInterval</li>
</ul>
</div>
</div>
<div style="text-align: center; margin-top: 30px;">
<p>Built with React and modern web technologies</p>
<div class="tech-icons">
<span>React</span>
<span>JavaScript</span>
<span>CSS3</span>
<span>Vite</span>
</div>
</div>
</div>
</div>
<script>
let time = 0;
let isRunning = false;
let interval = null;
function formatTime(seconds) {
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const secs = seconds % 60;
return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
}
function updateDisplay() {
document.getElementById('timeDisplay').textContent = formatTime(time);
document.getElementById('totalTime').textContent = formatTime(time);
document.getElementById('statusDisplay').textContent = isRunning ? 'Running' : 'Ready';
}
function startTimer() {
if (!isRunning) {
isRunning = true;
interval = setInterval(() => {
time++;
updateDisplay();
}, 1000);
document.getElementById('startBtn').disabled = true;
document.getElementById('stopBtn').disabled = false;
}
}
function stopTimer() {
if (isRunning) {
isRunning = false;
clearInterval(interval);
document.getElementById('startBtn').disabled = false;
document.getElementById('stopBtn').disabled = true;
updateDisplay();
}
}
function resetTimer() {
isRunning = false;
clearInterval(interval);
time = 0;
updateDisplay();
document.getElementById('startBtn').disabled = false;
document.getElementById('stopBtn').disabled = true;
}
// Initialize
updateDisplay();
document.getElementById('stopBtn').disabled = true;
</script>
</body>
</html>