-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.html
More file actions
505 lines (432 loc) · 15.3 KB
/
profile.html
File metadata and controls
505 lines (432 loc) · 15.3 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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script defer src="registerscript.js"></script>
<style>
body {
margin: 0; /* Removes default margin around the page */
height: 100vh; /* Makes the body take up the full height of the viewport */
background-color: #1E1E2E; /* Dark background color */
color: #E0E0E0; /* Light gray text color */
display: flex; /* Enables Flexbox layout */
flex-direction: column; /* Aligns children vertically */
overflow: auto; /* Allows scrolling if content overflows */
display: block; /* Prevents body from being restricted to 100vh */
padding-bottom: 100px; /* Adds space for the navbar at the bottom */
padding-top: 0px; /* Removes any space at the top */
}
* {
padding: 0; /* Removes padding from all elements */
margin: 0; /* Removes margin from all elements */
box-sizing: border-box; /* Ensures padding and border are included in element's total width/height */
}
.logo {
background-color: #1E1E2E;
color: #E0E0E0;
padding: 20px 0;
font-size: 36px;
font-weight: bold;
letter-spacing: 2px;
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.2);
width: 100%;
text-align: center;
}
.logo span {
color: #50FA7B;
}
.nav {
width: 100%; /* Makes the navbar span the full width */
text-align: center; /* Centers navbar items */
background: #1E1E2E; /* Matches the page background color */
position: fixed; /* Fixes the navbar to the bottom of the screen */
left: 0; /* Positions the navbar at the left */
bottom: 0; /* Positions the navbar at the bottom */
box-shadow: 0px -5px 5px -2px rgba(0, 0, 0, 0.2); /* Adds shadow for effect */
z-index: 1000; /* Ensures navbar stays on top */
height: 55px; /* Sets navbar height */
}
.nav ul {
list-style-type: none; /* Removes bullets from list items */
padding: 0; /* Removes padding */
margin: 0; /* Removes margin */
display: flex; /* Enables Flexbox layout */
justify-content: space-evenly; /* Distributes navbar items evenly */
width: 100%; /* Makes the navbar span the full width */
height: 100%; /* Ensures icons fill the navbar */
}
.nav ul li {
display: inline-block; /* Displays list items inline */
}
.nav ul li .nav-link {
text-decoration: none; /* Removes underline from links */
color: #ccc; /* Sets link color */
padding: 15px; /* Adds padding around the links */
display: block; /* Makes links block elements */
}
.imagesize-icons-taskbar {
height: 50px; /* Sets height for taskbar icons */
}
.inventory-header {
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
margin: 20px 20px 10px 20px;
}
.inventory-header h1 {
color: #50FA7B;
font-weight: 600;
font-size: 3.2rem;
white-space: nowrap;
}
.inventory-header .line {
flex-grow: 1;
border: none;
border-bottom: 1.5px solid #50FA7B;
opacity: 0.3;
}
.content-centered {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
padding-bottom: 80px;
overflow-y: auto;
}
.profile-container {
margin-top: 30px;
padding: 30px;
background-color: #282A36;
border-radius: 20px;
width: 90%;
max-width: 450px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
transition: all 0.3s ease;
}
.profile-container h1 {
font-size: 24px;
margin-bottom: 20px;
color: #50FA7B;
}
.profile-container h3 {
margin: 20px 0 5px;
font-size: 16px;
color: #A4A4A4;
font-weight: normal;
text-transform: uppercase;
letter-spacing: 1px;
}
.profile-container p {
margin-bottom: 10px;
font-size: 18px;
font-weight: 500;
color: #E0E0E0;
}
.profile-container hr {
border: none;
height: 1px;
background-color: #444;
margin: 15px 0;
}
.stats-container {
margin-top: 30px;
padding: 30px;
background-color: #282A36;
border-radius: 20px;
width: 90%;
max-width: 450px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
text-align: center;
}
.stats-container h2 {
color: #50FA7B;
margin-bottom: 20px;
}
.progress-wrapper {
margin-bottom: 20px;
}
.progress-bar {
height: 20px;
width: 100%;
background-color: #444;
border-radius: 10px;
overflow: hidden;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}
.progress-fill {
height: 100%;
background-color: #50FA7B;
transition: width 0.3s ease;
}
.progress-text {
margin-top: 8px;
font-size: 14px;
color: #CCC;
}
.stat-grid {
display: flex;
flex-direction: column;
gap: 15px;
}
.stat-item h3 {
margin-bottom: 5px;
font-size: 16px;
color: #A4A4A4;
text-transform: uppercase;
letter-spacing: 1px;
}
.stat-item p {
font-size: 18px;
font-weight: 500;
color: #E0E0E0;
}
.badge-display {
margin: 20px 0;
text-align: center;
color: #CCC;
}
.badge-display img {
height: 100px;
width: 100px;
object-fit: contain;
border-radius: 20px;
background-color: #1E1E2E;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
transition: transform 0.3s ease;
}
.badge-display img:hover {
transform: scale(1.05);
}
.file-label {
display: block;
margin-top: 1rem;
padding: 0.75rem 1rem;
background-color: #50FA7B;
color: #1E1E2E;
font-weight: bold;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.file-label:hover {
background-color: #45e06e;
}
input[type="file"] {
display: none;
}
#fileNameDisplay {
margin-top: 0.5rem;
font-size: 0.95rem;
color: #7CFCB5;
font-style: italic;
}
button#importBtn, button#exportBtn {
margin-top: 1rem;
padding: 0.75rem 1rem;
width: 100%;
background-color: #50FA7B;
color: #1E1E2E;
font-weight: bold;
border: none;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button#importBtn:hover, button#exportBtn:hover {
background-color: #45e06e;
}
#status {
margin-top: 1rem;
font-size: 0.95rem;
color: #A0FFA0;
}
button#deleteData {
margin-top: 1rem;
padding: 0.75rem 1rem;
width: 100%;
background-color: #FF5555; /* Rot als Warnfarbe */
color: #1E1E2E;
font-weight: bold;
border: none;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button#deleteData:hover {
background-color: #e04a4a;
</style>
</head>
<body>
<div class="logo">
<h1><span>Fridge</span>Sort</h1>
</div>
<div class="inventory-header">
<hr class="line"/>
<h1>Dein Profil</h1>
<hr class="line"/>
</div>
<div class="content-centered">
<div class="profile-container">
<h1 id="welcome">Herzlich willkommen, <span id="userNameFirst">...</span>!</h1>
<hr>
<h3>Name</h3>
<p id="userName">-</p>
<h3>Nachname</h3>
<p id="userLastName">-</p>
<h3>Email</h3>
<p id="userEmail">-</p>
</div>
<div class="stats-container">
<h2>Deine Statistiken</h2>
<div class="progress-wrapper">
<div class="progress-bar">
<div class="progress-fill" style="width: 70%;"></div>
</div>
<p class="progress-text">70% Ziel erreicht</p>
</div>
<div class="stat-grid">
<div class="stat-item">
<h3>Gerettete Lebensmittel</h3>
<p id="savedItems">-</p>
</div>
<div class="stat-item">
<h3>Highscore</h3>
<p id="highscore">-</p>
</div>
<div class="stat-item">
<h3>Aktuelle Streak</h3>
<p id="streak">-</p>
</div>
<div class="stat-item">
<h3>Streak seit</h3>
<p id="streakSince">-</p>
</div>
</div>
<div class="badge-display stat-item">
<h3>Abzeichen</h3>
<img id="badgeImage" src="img/badge_unavailable.png" alt=""/>
</div>
</div>
<div class="stats-container">
<h2>Datenverwaltung</h2>
<button id="exportBtn">Daten exportieren</button>
<label for="importFile" class="file-label">Datei auswählen</label>
<input type="file" id="importFile" accept=".json"/>
<div id="fileNameDisplay"></div>
<button id="importBtn">Daten importieren</button>
<div id="status"></div>
<button id="deleteData" onclick="deleteAllData()" class="">Daten löschen</button>
</div>
</div>
<div class="nav">
<ul>
<li><a href="https://www.google.com/maps/search/Geöffnete+Supermärkte+in+meiner+Nähe"><img
src="img/taskbar/map.png" class="rounded imagesize-icons-taskbar"></a></li>
<li><a href="recepies.html"><img src="img/taskbar/book.png" class="rounded imagesize-icons-taskbar"></a></li>
<li><a href="checklist.html"><img src="img/taskbar/checklist.png" class="rounded imagesize-icons-taskbar"></a>
</li>
<li><a href="shop.html"><img src="img/taskbar/shop.png" class="rounded imagesize-icons-taskbar"></a>
</li>
<li><a href="profile.html"><img src="img/taskbar/profile.png" class="rounded imagesize-icons-taskbar"></a></li>
</ul>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
const userData = JSON.parse(localStorage.getItem("userLoginData")) || {};
document.getElementById("userNameFirst").textContent = userData.name || "-";
document.getElementById("userName").textContent = userData.name || "-";
document.getElementById("userLastName").textContent = userData.lastName || "-";
document.getElementById("userEmail").textContent = userData.email || "-";
const stats = JSON.parse(localStorage.getItem("userStatsData")) || {
progress: 0,
level: 0,
savedItems: 0,
streak: 0,
highscore: 0,
streakSince: new Date().toLocaleDateString("de-DE")
};
const progressFill = document.querySelector(".progress-fill");
const progressText = document.querySelector(".progress-text");
const percent = Math.min(parseInt(stats.progress) || 0, 100);
progressFill.style.width = `${percent}%`;
progressText.textContent = `${percent}% · Level ${stats.level}`;
document.getElementById("savedItems").textContent = stats.savedItems ?? "-";
document.getElementById("highscore").textContent = stats.highscore ?? "-";
document.getElementById("streak").textContent = stats.streak ?? "-";
document.getElementById("streakSince").textContent = stats.streakSince || "-";
const badgeImg = document.getElementById("badgeImage");
const level = stats.level ?? 0;
let badgeNumber = 1;
if (level >= 100) badgeNumber = 13;
else if (level >= 80) badgeNumber = 12;
else if (level >= 70) badgeNumber = 11;
else if (level >= 60) badgeNumber = 10;
else if (level >= 50) badgeNumber = 9;
else if (level >= 40) badgeNumber = 8;
else if (level >= 30) badgeNumber = 7;
else if (level >= 20) badgeNumber = 6;
else if (level >= 15) badgeNumber = 5;
else if (level >= 10) badgeNumber = 4;
else if (level >= 5) badgeNumber = 3;
else if (level >= 3) badgeNumber = 2;
badgeImg.src = `img/badges/badge_${badgeNumber}.png`;
badgeImg.alt = `Badge ${badgeNumber}`;
});
document.getElementById('exportBtn').addEventListener('click', () => {
const data = {};
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
data[key] = localStorage.getItem(key);
}
const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'fridgesort-data-export.json';
a.click();
URL.revokeObjectURL(url);
});
document.getElementById('importFile').addEventListener('change', (event) => {
const fileNameDisplay = document.getElementById('fileNameDisplay');
const file = event.target.files[0];
if (file) {
fileNameDisplay.textContent = `Ausgewählte Datei: ${file.name}`;
} else {
fileNameDisplay.textContent = '';
}
});
document.getElementById('importBtn').addEventListener('click', () => {
const fileInput = document.getElementById('importFile');
const file = fileInput.files[0];
if (!file) {
alert('Bitte eine JSON-Datei auswählen.');
return;
}
const reader = new FileReader();
reader.onload = function(event) {
try {
const importedData = JSON.parse(event.target.result);
let addedCount = 0;
for (const key in importedData) {
if (!localStorage.getItem(key)) {
localStorage.setItem(key, importedData[key]);
addedCount++;
}
}
document.getElementById('status').innerText = `${addedCount} neue Einträge importiert.`;
} catch (err) {
alert('Fehler beim Importieren der Datei: ' + err.message);
}
};
reader.readAsText(file);
});
function deleteAllData(){
localStorage.clear();
alert("ALLE DATEN WURDE GELÖSCHT");
window.location.href = "index.html";
}
</script>
</body>
</html>