-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
337 lines (311 loc) · 12.7 KB
/
Copy pathindex.html
File metadata and controls
337 lines (311 loc) · 12.7 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shift Tracker</title>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
background: #000;
color: #fff;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 40px 20px;
}
.container { width: 100%; max-width: 390px; }
.header {
margin-bottom: 40px;
opacity: 0; transform: translateY(12px);
animation: rise 0.7s ease forwards 0.1s;
}
.header-label { font-size: 13px; font-weight: 400; color: rgba(255,255,255,0.4); margin-bottom: 6px; }
.header-title { font-size: 34px; font-weight: 300; letter-spacing: -0.03em; color: #fff; line-height: 1.05; }
.ring-section {
display: flex; justify-content: center; margin-bottom: 40px;
opacity: 0; transform: translateY(12px);
animation: rise 0.7s ease forwards 0.2s;
}
.ring-wrap { position: relative; width: 240px; height: 240px; }
.ring-center {
position: absolute; inset: 0;
display: flex; flex-direction: column;
align-items: center; justify-content: center;
}
.ring-pct { font-size: 64px; font-weight: 200; letter-spacing: -0.04em; line-height: 1; color: #fff; }
.ring-pct span { font-size: 24px; font-weight: 300; color: rgba(255,255,255,0.5); }
.ring-sub { font-size: 13px; font-weight: 400; color: rgba(255,255,255,0.4); margin-top: 4px; }
.ring-time { font-size: 18px; font-weight: 300; color: #fff; margin-top: 8px; letter-spacing: -0.02em; }
.stats {
display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 24px;
opacity: 0; transform: translateY(12px);
animation: rise 0.7s ease forwards 0.3s;
}
.stat {
background: rgba(255,255,255,0.07); border-radius: 16px; padding: 16px 12px; text-align: center;
border: 0.5px solid rgba(255,255,255,0.1);
}
.stat-label { font-size: 10px; font-weight: 400; color: rgba(255,255,255,0.4); letter-spacing: 0.03em; margin-bottom: 6px; text-transform: uppercase; }
.stat-val { font-size: 20px; font-weight: 300; letter-spacing: -0.02em; color: #fff; }
.elapsed-section {
background: rgba(255,255,255,0.07); border-radius: 20px; padding: 20px 24px; margin-bottom: 24px;
border: 0.5px solid rgba(255,255,255,0.1);
opacity: 0; transform: translateY(12px);
animation: rise 0.7s ease forwards 0.4s;
}
.elapsed-row { display: flex; justify-content: space-between; align-items: baseline; }
.elapsed-label { font-size: 13px; font-weight: 400; color: rgba(255,255,255,0.5); }
.elapsed-val { font-size: 28px; font-weight: 200; letter-spacing: -0.03em; color: #fff; }
.elapsed-note { font-size: 11px; color: rgba(255,255,255,0.3); margin-top: 4px; }
/* Inputs */
.inputs-section {
margin-bottom: 16px;
opacity: 0; transform: translateY(12px);
animation: rise 0.7s ease forwards 0.5s;
}
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.field { position: relative; }
.field label {
display: block; font-size: 11px; font-weight: 400;
color: rgba(255,255,255,0.4); letter-spacing: 0.03em;
text-transform: uppercase; margin-bottom: 8px;
}
/* time input */
input[type="time"] {
width: 100%;
background: rgba(255,255,255,0.08);
border: 0.5px solid rgba(255,255,255,0.15);
border-radius: 12px;
color: #fff;
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
font-size: 17px; font-weight: 300;
padding: 12px 14px;
outline: none;
transition: border-color 0.2s, background 0.2s;
-webkit-appearance: none; appearance: none; color-scheme: dark;
}
input[type="time"]:focus {
border-color: rgba(255,255,255,0.4);
background: rgba(255,255,255,0.12);
}
/* Duration picker — two time-style selects side by side */
.duration-picker {
display: flex;
align-items: center;
background: rgba(255,255,255,0.08);
border: 0.5px solid rgba(255,255,255,0.15);
border-radius: 12px;
padding: 12px 14px;
gap: 0;
transition: border-color 0.2s, background 0.2s;
}
.duration-picker:focus-within {
border-color: rgba(255,255,255,0.4);
background: rgba(255,255,255,0.12);
}
.dur-select {
background: transparent;
border: none;
outline: none;
color: #fff;
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
font-size: 17px; font-weight: 300;
-webkit-appearance: none; appearance: none;
color-scheme: dark;
text-align: center;
cursor: pointer;
padding: 0;
}
.dur-select.hours { width: 36px; }
.dur-select.mins { width: 36px; }
.dur-sep { font-size: 17px; font-weight: 300; color: rgba(255,255,255,0.5); padding: 0 2px; user-select: none; }
.btn-section {
opacity: 0; transform: translateY(12px);
animation: rise 0.7s ease forwards 0.6s;
}
.btn {
width: 100%;
background: #fff; border: none; border-radius: 14px;
color: #000;
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
font-size: 17px; font-weight: 400;
padding: 16px; cursor: pointer;
letter-spacing: -0.01em;
transition: opacity 0.15s, transform 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.98); opacity: 0.8; }
.note-text { text-align: center; font-size: 12px; color: rgba(255,255,255,0.25); margin-top: 12px; }
.done-pill {
display: block; background: rgba(52,199,89,0.15);
border: 0.5px solid rgba(52,199,89,0.4); border-radius: 999px;
color: #34C759; font-size: 13px; font-weight: 400;
padding: 8px 16px; margin-top: 16px; text-align: center;
}
@keyframes rise { to { opacity: 1; transform: translateY(0); } }
</style>
</head>
<body>
<div class="container">
<div class="header">
<div class="header-label">Today</div>
<div class="header-title">Shift Tracker</div>
</div>
<div class="ring-section">
<div class="ring-wrap">
<svg width="240" height="240" style="position:absolute;top:0;left:0;">
<defs>
<linearGradient id="arcGrad" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#fff" stop-opacity="0.5"/>
<stop offset="100%" stop-color="#fff"/>
</linearGradient>
</defs>
<circle cx="120" cy="120" r="100" fill="none" stroke="rgba(255,255,255,0.08)" stroke-width="6"/>
<circle id="arc" cx="120" cy="120" r="100" fill="none"
stroke="url(#arcGrad)" stroke-width="6"
stroke-dasharray="628.3" stroke-dashoffset="628.3"
stroke-linecap="round" transform="rotate(-90 120 120)"
style="transition:stroke-dashoffset 1s ease;"/>
</svg>
<div class="ring-center">
<div class="ring-pct" id="pctNum">0<span>%</span></div>
<div class="ring-sub">complete</div>
<div class="ring-time" id="timeLeftRing">—</div>
</div>
</div>
</div>
<div class="stats" id="statsBlock" style="display:none;">
<div class="stat"><div class="stat-label">Started</div><div class="stat-val" id="startLbl">—</div></div>
<div class="stat"><div class="stat-label">Ends</div><div class="stat-val" id="endLbl">—</div></div>
<div class="stat"><div class="stat-label">Left</div><div class="stat-val" id="leftLbl">—</div></div>
</div>
<div class="elapsed-section" id="elapsedBlock" style="display:none;">
<div class="elapsed-row">
<div class="elapsed-label">Net work time</div>
<div class="elapsed-val" id="elapsedVal">0:00:00</div>
</div>
<div class="elapsed-note" id="elapsedNote">Excludes break</div>
</div>
<div class="inputs-section">
<div class="input-grid">
<!-- Start time -->
<div class="field">
<label>Start time</label>
<input type="time" id="startTime" value="08:00">
</div>
<!-- Work duration -->
<div class="field">
<label>Work duration</label>
<div class="duration-picker">
<select class="dur-select hours" id="workH"></select>
<span class="dur-sep">h</span>
<select class="dur-select mins" id="workM"></select>
<span class="dur-sep">m</span>
</div>
</div>
</div>
<!-- Break duration — full width -->
<div class="field">
<label>Break duration</label>
<div class="duration-picker">
<select class="dur-select hours" id="breakH"></select>
<span class="dur-sep">h</span>
<select class="dur-select mins" id="breakM"></select>
<span class="dur-sep">m</span>
</div>
</div>
</div>
<div class="btn-section">
<button class="btn" onclick="startTracking()">Begin Session</button>
<div class="note-text" id="noteText">calculating end time from your inputs</div>
<div id="doneMsg" style="display:none;" class="done-pill">Session complete</div>
</div>
</div>
<script>
// Populate selects
function populate(selId, max, defVal, label) {
const sel = document.getElementById(selId);
for (let i = 0; i <= max; i++) {
const o = document.createElement('option');
o.value = i;
o.textContent = String(i).padStart(2,'0');
if (i === defVal) o.selected = true;
sel.appendChild(o);
}
}
populate('workH', 23, 10);
populate('workM', 59, 0);
populate('breakH', 5, 0);
populate('breakM', 59, 45);
// Live note update
function updateNote() {
const wh = parseInt(document.getElementById('workH').value);
const wm = parseInt(document.getElementById('workM').value);
const bh = parseInt(document.getElementById('breakH').value);
const bm = parseInt(document.getElementById('breakM').value);
const total = wh*60+wm+bh*60+bm;
const th = Math.floor(total/60), tm = total%60;
document.getElementById('noteText').textContent =
`Total shift: ${th}h ${tm}m · Break: ${bh}h ${bm}m`;
}
['workH','workM','breakH','breakM'].forEach(id =>
document.getElementById(id).addEventListener('change', updateNote)
);
updateNote();
let ticker = null;
const circ = 2 * Math.PI * 100;
function pad(n){ return String(n).padStart(2,'0'); }
function fmt(d){ return pad(d.getHours())+':'+pad(d.getMinutes()); }
function fmtDur(ms){
if(ms<=0) return '0:00:00';
const s=Math.floor(ms/1000);
return Math.floor(s/3600)+':'+pad(Math.floor((s%3600)/60))+':'+pad(s%60);
}
function fmtLeft(ms){
if(ms<=0) return '0:00';
const m=Math.ceil(ms/60000);
return pad(Math.floor(m/60))+':'+pad(m%60);
}
function startTracking(){
clearInterval(ticker);
document.getElementById('doneMsg').style.display='none';
const tv = document.getElementById('startTime').value;
const wh = parseInt(document.getElementById('workH').value);
const wm = parseInt(document.getElementById('workM').value);
const bh = parseInt(document.getElementById('breakH').value);
const bm = parseInt(document.getElementById('breakM').value);
if(!tv) return;
const workMs = (wh*60+wm)*60*1000;
const breakMs = (bh*60+bm)*60*1000;
const [h,m] = tv.split(':').map(Number);
const now = new Date();
const s = new Date(now.getFullYear(),now.getMonth(),now.getDate(),h,m).getTime();
const e = s + workMs + breakMs;
document.getElementById('startLbl').textContent = fmt(new Date(s));
document.getElementById('endLbl').textContent = fmt(new Date(e));
document.getElementById('statsBlock').style.display = 'grid';
document.getElementById('elapsedBlock').style.display = 'block';
document.getElementById('elapsedNote').textContent =
`Excludes ${bh>0?bh+'h ':''}${bm}m break`;
function tick(){
const now = Date.now();
const el = now - s;
const rem = e - now;
const p = Math.min(Math.max(el/(e-s),0),1);
document.getElementById('pctNum').innerHTML = Math.floor(p*100)+'<span>%</span>';
document.getElementById('arc').style.strokeDashoffset = circ*(1-p);
document.getElementById('timeLeftRing').textContent = rem>0 ? fmtLeft(rem)+' left' : 'Done';
document.getElementById('leftLbl').textContent = rem>0 ? fmtLeft(rem) : '—';
document.getElementById('elapsedVal').textContent = fmtDur(Math.max(el-breakMs,0));
if(p>=1){ clearInterval(ticker); document.getElementById('doneMsg').style.display='block'; }
}
tick();
ticker = setInterval(tick,1000);
}
</script>
</body>
</html>