Spaces:
Running
Running
File size: 48,421 Bytes
b9554c2 30e44b1 b9554c2 | 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 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LaptopTracker</title>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/animejs/lib/anime.iife.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
background-color: #f5f5f7;
color: #1d1d1f;
max-width: 430px;
margin: 0 auto;
height: 100vh;
position: relative;
overflow: hidden;
}
.ios-status-bar {
height: 44px;
background-color: rgba(242, 242, 247, 0.8);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
}
.ios-home-indicator {
height: 34px;
background-color: transparent;
}
.home-indicator {
width: 134px;
height: 5px;
background-color: #000;
border-radius: 100px;
margin: 0 auto;
position: relative;
top: 21px;
}
.tab-bar {
height: 83px;
background-color: rgba(242, 242, 247, 0.8);
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
border-top: 0.5px solid rgba(0, 0, 0, 0.1);
position: fixed;
bottom: 0;
width: 100%;
max-width: 430px;
}
.tab-button {
padding: 8px 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 10px;
color: #8e8e93;
}
.tab-button.active {
color: #007AFF;
}
.laptop-card {
border-radius: 12px;
background-color: #ffffff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
overflow: hidden;
}
.search-bar {
background-color: rgba(118, 118, 128, 0.12);
border-radius: 10px;
padding: 8px 12px;
}
.filter-pill {
background-color: rgba(118, 118, 128, 0.12);
border-radius: 100px;
padding: 6px 12px;
font-size: 14px;
}
.filter-pill.active {
background-color: #007AFF;
color: white;
}
.modal-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
align-items: flex-end;
justify-content: center;
z-index: 1000;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
}
.modal-container.active {
opacity: 1;
pointer-events: auto;
}
.modal-content {
background-color: #ffffff;
border-top-left-radius: 16px;
border-top-right-radius: 16px;
width: 100%;
max-width: 430px;
padding: 24px;
transform: translateY(100%);
transition: transform 0.3s ease;
max-height: 90vh;
overflow-y: auto;
}
.modal-container.active .modal-content {
transform: translateY(0);
}
.form-group {
margin-bottom: 16px;
}
.form-label {
display: block;
font-size: 14px;
font-weight: 500;
margin-bottom: 6px;
color: #3a3a3c;
}
.form-input {
width: 100%;
padding: 12px;
border-radius: 10px;
border: 1px solid #c5c5c7;
font-size: 16px;
background-color: #f2f2f7;
}
.form-input:focus {
outline: none;
border-color: #007AFF;
}
.btn-primary {
background-color: #007AFF;
color: white;
border-radius: 10px;
padding: 12px 20px;
font-weight: 600;
width: 100%;
text-align: center;
border: none;
font-size: 16px;
}
.btn-secondary {
background-color: transparent;
color: #007AFF;
border-radius: 10px;
padding: 12px 20px;
font-weight: 600;
width: 100%;
text-align: center;
border: none;
font-size: 16px;
}
.detail-header {
background: linear-gradient(180deg, rgba(0, 122, 255, 0.1) 0%, rgba(0, 122, 255, 0) 100%);
padding: 24px;
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
}
.detail-spec {
padding: 16px;
border-bottom: 0.5px solid rgba(60, 60, 67, 0.1);
}
.detail-spec:last-child {
border-bottom: none;
}
/* Dark mode styles */
.dark-mode {
background-color: #000000;
color: #ffffff;
}
.dark-mode .ios-status-bar {
background-color: rgba(44, 44, 46, 0.8);
border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
}
.dark-mode .tab-bar {
background-color: rgba(44, 44, 46, 0.8);
border-top: 0.5px solid rgba(255, 255, 255, 0.1);
}
.dark-mode .laptop-card {
background-color: #1c1c1e;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.dark-mode .search-bar {
background-color: rgba(118, 118, 128, 0.24);
}
.dark-mode .filter-pill {
background-color: rgba(118, 118, 128, 0.24);
color: #ffffff;
}
.dark-mode .form-input {
background-color: #2c2c2e;
border-color: #38383a;
color: #ffffff;
}
.dark-mode .form-label {
color: #ebebf5;
}
.dark-mode .modal-content {
background-color: #1c1c1e;
color: #ffffff;
}
.dark-mode .detail-header {
background: linear-gradient(180deg, rgba(10, 132, 255, 0.2) 0%, rgba(0, 0, 0, 0) 100%);
}
.dark-mode .detail-spec {
border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
}
.dark-mode .home-indicator {
background-color: #ffffff;
}
/* Animation for page transitions */
.page {
position: absolute;
width: 100%;
height: calc(100% - 127px);
overflow-y: auto;
padding: 16px;
transition: transform 0.3s ease, opacity 0.3s ease;
}
.page.hidden {
transform: translateX(-20px);
opacity: 0;
pointer-events: none;
}
/* Toggle switch */
.toggle-switch {
position: relative;
display: inline-block;
width: 51px;
height: 31px;
}
.toggle-switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .4s;
border-radius: 34px;
}
.slider:before {
position: absolute;
content: "";
height: 27px;
width: 27px;
left: 2px;
bottom: 2px;
background-color: white;
transition: .4s;
border-radius: 50%;
}
input:checked + .slider {
background-color: #34C759;
}
input:checked + .slider:before {
transform: translateX(20px);
}
</style>
</head>
<body class="bg-gray-50 dark:bg-black transition-colors duration-300">
<!-- iOS Status Bar -->
<div class="ios-status-bar flex justify-between items-center px-4 fixed top-0 w-full max-w-430 z-10">
<div class="text-[15px] font-semibold" id="current-time">9:41</div>
<div class="flex items-center space-x-1">
<i data-feather="signal" class="w-4 h-4"></i>
<i data-feather="wifi" class="w-4 h-4"></i>
<i data-feather="battery" class="w-4 h-4"></i>
</div>
</div>
<!-- Main Content Area -->
<div class="pt-12 pb-24 overflow-y-auto h-full" id="main-content">
<!-- My Laptops View -->
<div class="page" id="laptops-page">
<div class="flex justify-between items-center mb-6">
<h1 class="text-2xl font-bold">My Laptops</h1>
<button class="bg-blue-500 p-3 rounded-full" onclick="openAddModal()">
<i data-feather="plus" class="text-white w-5 h-5"></i>
</button>
</div>
<div class="search-bar mb-4 flex items-center">
<i data-feather="search" class="text-gray-500 mr-2 w-4 h-4"></i>
<input type="text" placeholder="Search laptops..." class="bg-transparent w-full focus:outline-none text-sm" id="search-input">
</div>
<div class="flex space-x-2 overflow-x-auto pb-3 mb-4 hide-scrollbar">
<div class="filter-pill active">All</div>
<div class="filter-pill">Apple</div>
<div class="filter-pill">Dell</div>
<div class="filter-pill">HP</div>
<div class="filter-pill">Lenovo</div>
<div class="filter-pill">Under Warranty</div>
</div>
<div class="space-y-4" id="laptops-list">
<!-- Laptop cards will be dynamically inserted here -->
</div>
</div>
<!-- Search View -->
<div class="page hidden" id="search-page">
<h1 class="text-2xl font-bold mb-6">Search</h1>
<div class="search-bar mb-4 flex items-center">
<i data-feather="search" class="text-gray-500 mr-2 w-4 h-4"></i>
<input type="text" placeholder="Search by brand, model, specs..." class="bg-transparent w-full focus:outline-none text-sm" id="advanced-search-input">
</div>
<div class="mb-6">
<h2 class="font-semibold mb-3">Filters</h2>
<div class="grid grid-cols-2 gap-3">
<select class="form-input text-sm">
<option>Brand</option>
<option>Apple</option>
<option>Dell</option>
<option>HP</option>
<option>Lenovo</option>
</select>
<select class="form-input text-sm">
<option>RAM</option>
<option>8GB</option>
<option>16GB</option>
<option>32GB</option>
</select>
<select class="form-input text-sm">
<option>Storage</option>
<option>256GB</option>
<option>512GB</option>
<option>1TB</option>
</select>
<select class="form-input text-sm">
<option>Warranty</option>
<option>Active</option>
<option>Expired</option>
</select>
</div>
</div>
<div class="mb-6">
<h2 class="font-semibold mb-3">Sort By</h2>
<div class="flex space-x-2 overflow-x-auto pb-3 hide-scrollbar">
<div class="filter-pill active">Newest</div>
<div class="filter-pill">Brand A-Z</div>
<div class="filter-pill">Price</div>
<div class="filter-pill">Purchase Date</div>
</div>
</div>
<div class="space-y-4" id="search-results">
<!-- Search results will be dynamically inserted here -->
</div>
</div>
<!-- Settings View -->
<div class="page hidden" id="settings-page">
<h1 class="text-2xl font-bold mb-6">Settings</h1>
<div class="laptop-card mb-6">
<div class="p-4 border-b border-gray-100 dark:border-gray-800">
<h2 class="font-semibold">Appearance</h2>
</div>
<div class="p-4 flex justify-between items-center">
<span>Dark Mode</span>
<label class="toggle-switch">
<input type="checkbox" id="dark-mode-toggle">
<span class="slider"></span>
</label>
</div>
</div>
<div class="laptop-card mb-6">
<div class="p-4 border-b border-gray-100 dark:border-gray-800">
<h2 class="font-semibold">Data Management</h2>
</div>
<div class="p-4 border-b border-gray-100 dark:border-gray-800">
<div class="flex justify-between items-center py-2">
<span>Export Data</span>
<i data-feather="chevron-right" class="w-5 h-5 text-gray-400"></i>
</div>
</div>
<div class="p-4">
<div class="flex justify-between items-center py-2">
<span class="text-red-500">Delete All Data</span>
<i data-feather="chevron-right" class="w-5 h-5 text-gray-400"></i>
</div>
</div>
</div>
<div class="laptop-card">
<div class="p-4 border-b border-gray-100 dark:border-gray-800">
<h2 class="font-semibold">About</h2>
</div>
<div class="p-4 border-b border-gray-100 dark:border-gray-800">
<div class="flex justify-between items-center py-2">
<span>Version</span>
<span class="text-gray-500">1.0.0</span>
</div>
</div>
<div class="p-4">
<div class="flex justify-between items-center py-2">
<span>Privacy Policy</span>
<i data-feather="chevron-right" class="w-5 h-5 text-gray-400"></i>
</div>
</div>
</div>
</div>
<!-- Laptop Detail View (initially hidden) -->
<div class="page hidden" id="detail-page">
<!-- Detail content will be dynamically inserted here -->
</div>
</div>
<!-- iOS Tab Bar -->
<div class="tab-bar flex justify-around items-center">
<div class="tab-button active" onclick="showPage('laptops-page')">
<i data-feather="list" class="w-6 h-6 mb-1"></i>
<span>My Laptops</span>
</div>
<div class="tab-button" onclick="showPage('search-page')">
<i data-feather="search" class="w-6 h-6 mb-1"></i>
<span>Search</span>
</div>
<div class="tab-button" onclick="showPage('settings-page')">
<i data-feather="settings" class="w-6 h-6 mb-1"></i>
<span>Settings</span>
</div>
</div>
<!-- iOS Home Indicator -->
<div class="ios-home-indicator fixed bottom-0 w-full max-w-430" onclick="showAppsModal()">
<div class="home-indicator"></div>
</div>
<!-- Wallpaper Selection -->
<div class="ios-home-indicator fixed bottom-0 w-full max-w-430" style="bottom: 34px; height: 40px; background-color: rgba(242, 242, 247, 0.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 0.5px solid rgba(0, 0, 0, 0.1); display: flex; justify-content: center; align-items: center;" onclick="showWallpapersModal()">
<span class="text-xs font-medium text-gray-600">Wallpapers</span>
</div>
<!-- Add/Edit Laptop Modal -->
<div class="modal-container" id="laptop-modal">
<div class="modal-content">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-semibold" id="modal-title">Add New Laptop</h2>
<button onclick="closeModal()">
<i data-feather="x" class="w-6 h-6"></i>
</button>
</div>
<div class="mb-4 flex justify-center">
<div class="w-24 h-24 bg-gray-200 dark:bg-gray-700 rounded-lg flex items-center justify-center" id="image-preview">
<i data-feather="camera" class="w-8 h-8 text-gray-400"></i>
</div>
</div>
<form id="laptop-form">
<input type="hidden" id="laptop-id">
<div class="form-group">
<label class="form-label">Brand</label>
<input type="text" class="form-input" id="brand" required placeholder="e.g., Apple">
</div>
<div class="form-group">
<label class="form-label">Model</label>
<input type="text" class="form-input" id="model" required placeholder="e.g., MacBook Pro">
</div>
<div class="form-group">
<label class="form-label">Processor</label>
<input type="text" class="form-input" id="processor" required placeholder="e.g., M1 Pro">
</div>
<div class="form-group">
<label class="form-label">RAM</label>
<input type="text" class="form-input" id="ram" required placeholder="e.g., 16GB">
</div>
<div class="form-group">
<label class="form-label">Storage</label>
<input type="text" class="form-input" id="storage" required placeholder="e.g., 512GB SSD">
</div>
<div class="form-group">
<label class="form-label">Purchase Date</label>
<input type="date" class="form-input" id="purchase-date" required>
</div>
<div class="form-group">
<label class="form-label">Warranty Status</label>
<select class="form-input" id="warranty-status" required>
<option value="active">Active</option>
<option value="expired">Expired</option>
<option value="unknown">Unknown</option>
</select>
</div>
<div class="form-group">
<label class="form-label">Additional Notes</label>
<textarea class="form-input" id="notes" rows="3" placeholder="Any additional information..."></textarea>
</div>
<div class="flex space-x-3 mt-6">
<button type="button" class="btn-secondary" onclick="closeModal()">Cancel</button>
<button type="submit" class="btn-primary">Save Laptop</button>
</div>
</form>
</div>
</div>
<!-- Apps Modal -->
<div class="modal-container" id="apps-modal">
<div class="modal-content" style="max-height: 85vh;">
<div class="flex justify-between items-center mb-4 sticky top-0 bg-white dark:bg-1c1c1e py-2 z-10">
<h2 class="text-xl font-semibold">All Apps</h2>
<button onclick="closeAppsModal()">
<i data-feather="x" class="w-6 h-6"></i>
</button>
</div>
<div class="grid grid-cols-4 gap-4 pb-6" id="apps-grid">
<!-- Apps will be dynamically inserted here -->
</div>
</div>
</div>
<script>
// Initialize libraries
AOS.init();
feather.replace();
// Set current time
function updateTime() {
const now = new Date();
const timeStr = now.getHours() + ':' + (now.getMinutes() < 10 ? '0' : '') + now.getMinutes();
document.getElementById('current-time').textContent = timeStr;
}
setInterval(updateTime, 60000);
updateTime();
// Sample laptop data
let laptops = [
{
id: 1,
brand: 'Apple',
model: 'MacBook Pro 16"',
processor: 'M1 Pro',
ram: '16GB',
storage: '1TB SSD',
purchaseDate: '2022-03-15',
warrantyStatus: 'active',
notes: 'Company laptop',
image: 'http://static.photos/technology/320x240/1'
},
{
id: 2,
brand: 'Dell',
model: 'XPS 13',
processor: 'Intel i7-1165G7',
ram: '8GB',
storage: '512GB SSD',
purchaseDate: '2021-08-22',
warrantyStatus: 'active',
notes: 'Personal laptop',
image: 'http://static.photos/technology/320x240/2'
},
{
id: 3,
brand: 'HP',
model: 'Spectre x360',
processor: 'Intel i5-1135G7',
ram: '16GB',
storage: '512GB SSD',
purchaseDate: '2020-11-05',
warrantyStatus: 'expired',
notes: 'Old work laptop',
image: 'http://static.photos/technology/320x240/3'
}
];
// Load laptops from localStorage if available
if (localStorage.getItem('laptops')) {
laptops = JSON.parse(localStorage.getItem('laptops'));
}
// Page navigation
function showPage(pageId) {
// Hide all pages
document.querySelectorAll('.page').forEach(page => {
page.classList.add('hidden');
});
// Show requested page
document.getElementById(pageId).classList.remove('hidden');
// Update tab bar active state
document.querySelectorAll('.tab-button').forEach(tab => {
tab.classList.remove('active');
});
if (pageId === 'laptops-page') {
document.querySelectorAll('.tab-button')[0].classList.add('active');
} else if (pageId === 'search-page') {
document.querySelectorAll('.tab-button')[1].classList.add('active');
} else if (pageId === 'settings-page') {
document.querySelectorAll('.tab-button')[2].classList.add('active');
}
// If showing laptops page, refresh the list
if (pageId === 'laptops-page') {
renderLaptops();
} else if (pageId === 'search-page') {
renderSearchResults();
}
}
// Modal functions
function openAddModal() {
document.getElementById('modal-title').textContent = 'Add New Laptop';
document.getElementById('laptop-form').reset();
document.getElementById('laptop-id').value = '';
document.getElementById('image-preview').innerHTML = '<i data-feather="camera" class="w-8 h-8 text-gray-400"></i>';
feather.replace();
document.getElementById('laptop-modal').classList.add('active');
}
function openEditModal(laptopId) {
const laptop = laptops.find(l => l.id === laptopId);
if (laptop) {
document.getElementById('modal-title').textContent = 'Edit Laptop';
document.getElementById('laptop-id').value = laptop.id;
document.getElementById('brand').value = laptop.brand;
document.getElementById('model').value = laptop.model;
document.getElementById('processor').value = laptop.processor;
document.getElementById('ram').value = laptop.ram;
document.getElementById('storage').value = laptop.storage;
document.getElementById('purchase-date').value = laptop.purchaseDate;
document.getElementById('warranty-status').value = laptop.warrantyStatus;
document.getElementById('notes').value = laptop.notes || '';
if (laptop.image) {
document.getElementById('image-preview').innerHTML = `<img src="${laptop.image}" class="w-full h-full object-cover rounded-lg">`;
} else {
document.getElementById('image-preview').innerHTML = '<i data-feather="camera" class="w-8 h-8 text-gray-400"></i>';
feather.replace();
}
document.getElementById('laptop-modal').classList.add('active');
}
}
function closeModal() {
document.getElementById('laptop-modal').classList.remove('active');
}
// Form submission
document.getElementById('laptop-form').addEventListener('submit', function(e) {
e.preventDefault();
const laptopId = document.getElementById('laptop-id').value;
const brand = document.getElementById('brand').value;
const model = document.getElementById('model').value;
const processor = document.getElementById('processor').value;
const ram = document.getElementById('ram').value;
const storage = document.getElementById('storage').value;
const purchaseDate = document.getElementById('purchase-date').value;
const warrantyStatus = document.getElementById('warranty-status').value;
const notes = document.getElementById('notes').value;
if (laptopId) {
// Edit existing laptop
const index = laptops.findIndex(l => l.id == laptopId);
if (index !== -1) {
laptops[index] = {
...laptops[index],
brand,
model,
processor,
ram,
storage,
purchaseDate,
warrantyStatus,
notes
};
}
} else {
// Add new laptop
const newId = laptops.length > 0 ? Math.max(...laptops.map(l => l.id)) + 1 : 1;
laptops.push({
id: newId,
brand,
model,
processor,
ram,
storage,
purchaseDate,
warrantyStatus,
notes,
image: 'http://static.photos/technology/320x240/' + (newId % 10 + 1)
});
}
// Save to localStorage
localStorage.setItem('laptops', JSON.stringify(laptops));
// Refresh the list
renderLaptops();
// Close modal
closeModal();
});
// Render laptops list
function renderLaptops() {
const laptopsList = document.getElementById('laptops-list');
laptopsList.innerHTML = '';
laptops.forEach(laptop => {
const purchaseDate = new Date(laptop.purchaseDate);
const formattedDate = purchaseDate.toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric'
});
const warrantyBadge = laptop.warrantyStatus === 'active' ?
'<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">Warranty</span>' :
'<span class="bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded-full">No Warranty</span>';
laptopsList.innerHTML += `
<div class="laptop-card p-4" onclick="showLaptopDetail(${laptop.id})">
<div class="flex">
<div class="w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-lg overflow-hidden mr-4">
<img src="${laptop.image}" class="w-full h-full object-cover">
</div>
<div class="flex-1">
<div class="flex justify-between items-start">
<h3 class="font-semibold">${laptop.brand} ${laptop.model}</h3>
${warrantyBadge}
</div>
<p class="text-sm text-gray-500 dark:text-gray-400 mt-1">${laptop.processor} 路 ${laptop.ram} 路 ${laptop.storage}</p>
<p class="text-xs text-gray-400 dark:text-gray-500 mt-2">Purchased: ${formattedDate}</p>
</div>
</div>
</div>
`;
});
}
// Render search results
function renderSearchResults() {
const searchResults = document.getElementById('search-results');
searchResults.innerHTML = '';
laptops.forEach(laptop => {
const purchaseDate = new Date(laptop.purchaseDate);
const formattedDate = purchaseDate.toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric'
});
const warrantyBadge = laptop.warrantyStatus === 'active' ?
'<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">Warranty</span>' :
'<span class="bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded-full">No Warranty</span>';
searchResults.innerHTML += `
<div class="laptop-card p-4" onclick="showLaptopDetail(${laptop.id})">
<div class="flex">
<div class="w-16 h-16 bg-gray-200 dark:bg-gray-700 rounded-lg overflow-hidden mr-4">
<img src="${laptop.image}" class="w-full h-full object-cover">
</div>
<div class="flex-1">
<div class="flex justify-between items-start">
<h3 class="font-semibold">${laptop.brand} ${laptop.model}</h3>
${warrantyBadge}
</div>
<p class="text-sm text-gray-500 dark:text-gray-400 mt-1">${laptop.processor} 路 ${laptop.ram} 路 ${laptop.storage}</p>
<p class="text-xs text-gray-400 dark:text-gray-500 mt-2">Purchased: ${formattedDate}</p>
</div>
</div>
</div>
`;
});
}
// Show laptop detail
function showLaptopDetail(laptopId) {
const laptop = laptops.find(l => l.id === laptopId);
if (laptop) {
const purchaseDate = new Date(laptop.purchaseDate);
const formattedDate = purchaseDate.toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});
const warrantyStatus = laptop.warrantyStatus === 'active' ?
'<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">Under Warranty</span>' :
'<span class="bg-gray-100 text-gray-800 text-xs px-2 py-1 rounded-full">Warranty Expired</span>';
document.getElementById('detail-page').innerHTML = `
<div class="detail-header">
<div class="flex justify-center mb-4">
<div class="w-32 h-32 bg-gray-200 dark:bg-gray-700 rounded-xl overflow-hidden">
<img src="${laptop.image}" class="w-full h-full object-cover">
</div>
</div>
<h1 class="text-2xl font-bold text-center">${laptop.brand} ${laptop.model}</h1>
<p class="text-center text-gray-500 dark:text-gray-400 mt-2">${laptop.processor} 路 ${laptop.ram} 路 ${laptop.storage}</p>
</div>
<div class="laptop-card mt-6">
<div class="detail-spec flex justify-between items-center">
<span class="text-gray-500 dark:text-gray-400">Brand</span>
<span class="font-medium">${laptop.brand}</span>
</div>
<div class="detail-spec flex justify-between items-center">
<span class="text-gray-500 dark:text-gray-400">Model</span>
<span class="font-medium">${laptop.model}</span>
</div>
<div class="detail-spec flex justify-between items-center">
<span class="text-gray-500 dark:text-gray-400">Processor</span>
<span class="font-medium">${laptop.processor}</span>
</div>
<div class="detail-spec flex justify-between items-center">
<span class="text-gray-500 dark:text-gray-400">RAM</span>
<span class="font-medium">${laptop.ram}</span>
</div>
<div class="detail-spec flex justify-between items-center">
<span class="text-gray-500 dark:text-gray-400">Storage</span>
<span class="font-medium">${laptop.storage}</span>
</div>
<div class="detail-spec flex justify-between items-center">
<span class="text-gray-500 dark:text-gray-400">Purchase Date</span>
<span class="font-medium">${formattedDate}</span>
</div>
<div class="detail-spec flex justify-between items-center">
<span class="text-gray-500 dark:text-gray-400">Warranty Status</span>
${warrantyStatus}
</div>
</div>
${laptop.notes ? `
<div class="laptop-card mt-6">
<div class="p-4 border-b border-gray-100 dark:border-gray-800">
<h2 class="font-semibold">Notes</h2>
</div>
<div class="p-4">
<p class="text-gray-700 dark:text-gray-300">${laptop.notes}</p>
</div>
</div>
` : ''}
<div class="flex space-x-3 mt-6">
<button class="btn-secondary" onclick="showPage('laptops-page')">Back</button>
<button class="btn-primary" onclick="openEditModal(${laptop.id})">Edit</button>
</div>
`;
showPage('detail-page');
}
}
// Dark mode toggle
document.getElementById('dark-mode-toggle').addEventListener('change', function() {
if (this.checked) {
document.body.classList.add('dark-mode');
localStorage.setItem('darkMode', 'enabled');
} else {
document.body.classList.remove('dark-mode');
localStorage.setItem('darkMode', 'disabled');
}
});
// Check for saved dark mode preference
if (localStorage.getItem('darkMode') === 'enabled') {
document.body.classList.add('dark-mode');
document.getElementById('dark-mode-toggle').checked = true;
}
// Apps list
const apps = [
'App Store', 'Apple Support', 'Voice Memos', 'Final Cut Camera', 'Final Cut Pro for iPad',
'App Store Connect', 'Pages', 'Keynote', 'Logic Pro for iPad', 'Notes', 'GarageBand', 'iMovie',
'Health', 'Apple TV', 'Image Capture', 'Numbers', 'AirPort Utility', 'TextEdit', 'Apple Maps',
'Shortcuts', 'Automator', 'Find My', 'Apple Partner Media Review', 'Microsoft Sudoku',
'Microsoft Ultimate Word Games', 'Microsoft Solitaire Collection', 'Link to Windows',
'Microsoft MyHub', 'Microsoft Lists', 'Mahjong by Microsoft', 'Day One', 'Bitwarden', 'AdGuard',
'Grammarly', 'Apple TV', 'Slack', 'Google Drive', 'NordVPN', 'Adobe Lightroom', 'Dropbox',
'Level Devil - NOT A Troll Game', 'Subway Surfers', 'LumaFusion', 'Candy Crush Saga', 'Vid Master',
'LockDown Browser', 'Firefox', 'Connect to PC', 'LetsView', 'Fliqlo', '碌Torrent'
];
// Wallpapers list
const wallpapers = [
{ name: 'Default', url: '' },
{ name: 'Abstract Blue', url: 'http://static.photos/abstract/640x1136/1' },
{ name: 'Minimal Gradient', url: 'http://static.photos/gradient/640x1136/2' },
{ name: 'Nature Landscape', url: 'http://static.photos/nature/640x1136/3' },
{ name: 'Dark Geometric', url: 'http://static.photos/monochrome/640x1136/4' },
{ name: 'City Lights', url: 'http://static.photos/cityscape/640x1136/5' },
{ name: 'Ocean Waves', url: 'http://static.photos/nature/640x1136/6' },
{ name: 'Mountain Peak', url: 'http://static.photos/nature/640x1136/7' },
{ name: 'Space Nebula', url: 'http://static.photos/abstract/640x1136/8' },
{ name: 'Sunset Glow', url: 'http://static.photos/nature/640x1136/9' },
{ name: 'Tech Pattern', url: 'http://static.photos/technology/640x1136/10' },
{ name: 'Forest Mist', url: 'http://static.photos/nature/640x1136/11' }
];
// Render apps grid with custom icons
function renderApps() {
const appsGrid = document.getElementById('apps-grid');
appsGrid.innerHTML = '';
apps.forEach(app => {
const iconName = appIcons[app] || 'grid';
appsGrid.innerHTML += `
<div class="flex flex-col items-center">
<div class="w-16 h-16 bg-gradient-to-br from-blue-500 to-purple-600 rounded-2xl flex items-center justify-center mb-2 shadow-md">
<i data-feather="${iconName}" class="w-8 h-8 text-white"></i>
</div>
<span class="text-xs text-center" style="max-width: 80px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;">${app}</span>
</div>
`;
});
feather.replace();
}
// Apps modal functions
function showAppsModal() {
renderApps();
document.getElementById('apps-modal').classList.add('active');
}
function closeAppsModal() {
document.getElementById('apps-modal').classList.remove('active');
}
// Wallpapers modal functions
function showWallpapersModal() {
renderWallpapers();
document.getElementById('wallpapers-modal').classList.add('active');
}
function closeWallpapersModal() {
document.getElementById('wallpapers-modal').classList.remove('active');
}
// Render wallpapers grid
function renderWallpapers() {
const wallpapersGrid = document.getElementById('wallpapers-grid');
wallpapersGrid.innerHTML = '';
wallpapers.forEach((wallpaper, index) => {
wallpapersGrid.innerHTML += `
<div class="relative rounded-xl overflow-hidden cursor-pointer" onclick="changeWallpaper('${wallpaper.url}')">
<div class="aspect-[9/16] bg-gray-200 dark:bg-gray-700">
${wallpaper.url ?
`<img src="${wallpaper.url}" class="w-full h-full object-cover">` :
`<div class="w-full h-full flex items-center justify-center bg-gradient-to-br from-blue-400 to-purple-500">
<span class="text-white font-medium">Default</span>
</div>`
}
</div>
<div class="absolute bottom-0 left-0 right-0 bg-black bg-opacity-50 text-white text-xs p-2 text-center">
${wallpaper.name}
</div>
</div>
`;
});
}
// Change wallpaper function
function changeWallpaper(url) {
if (url) {
document.body.style.backgroundImage = `url('${url}')`;
document.body.style.backgroundSize = 'cover';
document.body.style.backgroundPosition = 'center';
document.body.style.backgroundRepeat = 'no-repeat';
} else {
document.body.style.backgroundImage = '';
document.body.style.backgroundColor = '';
}
// Save to localStorage
localStorage.setItem('wallpaper', url);
closeWallpapersModal();
}
// Initialize the app
renderLaptops();
// Load saved wallpaper if exists
const savedWallpaper = localStorage.getItem('wallpaper');
if (savedWallpaper) {
changeWallpaper(savedWallpaper);
}
// Search functionality
document.getElementById('search-input').addEventListener('input', function() {
const searchTerm = this.value.toLowerCase();
const laptopCards = document.querySelectorAll('#laptops-list > div');
laptopCards.forEach(card => {
const title = card.querySelector('h3').textContent.toLowerCase();
if (title.includes(searchTerm)) {
card.style.display = 'block';
} else {
card.style.display = 'none';
}
});
});
// Add custom app icons mapping
const appIcons = {
'App Store': 'shopping-bag',
'Apple Support': 'help-circle',
'Voice Memos': 'mic',
'Final Cut Camera': 'video',
'Final Cut Pro for iPad': 'film',
'App Store Connect': 'shopping-cart',
'Pages': 'file-text',
'Keynote': 'presentation',
'Logic Pro for iPad': 'music',
'Notes': 'edit',
'GarageBand': 'music',
'iMovie': 'film',
'Health': 'heart',
'Apple TV': 'tv',
'Image Capture': 'camera',
'Numbers': 'bar-chart-2',
'AirPort Utility': 'wifi',
'TextEdit': 'edit-2',
'Apple Maps': 'map',
'Shortcuts': 'command',
'Automator': 'settings',
'Find My': 'search',
'Apple Partner Media Review': 'eye',
'Microsoft Sudoku': 'grid',
'Microsoft Ultimate Word Games': 'type',
'Microsoft Solitaire Collection': 'layers',
'Link to Windows': 'link',
'Microsoft MyHub': 'briefcase',
'Microsoft Lists': 'list',
'Mahjong by Microsoft': 'grid',
'Day One': 'calendar',
'Bitwarden': 'lock',
'AdGuard': 'shield',
'Grammarly': 'edit-3',
'Slack': 'message-square',
'Google Drive': 'hard-drive',
'NordVPN': 'shield',
'Adobe Lightroom': 'image',
'Dropbox': 'cloud',
'Level Devil - NOT A Troll Game': 'activity',
'Subway Surfers': 'navigation',
'LumaFusion': 'video',
'Candy Crush Saga': 'star',
'Vid Master': 'video',
'LockDown Browser': 'lock',
'Firefox': 'globe',
'Connect to PC': 'monitor',
'LetsView': 'airplay',
'Fliqlo': 'clock',
'碌Torrent': 'download'
};
// Advanced search functionality
document.getElementById('advanced-search-input').addEventListener('input', function() {
const searchTerm = this.value.toLowerCase();
const searchResults = document.querySelectorAll('#search-results > div');
searchResults.forEach(card => {
const title = card.querySelector('h3').textContent.toLowerCase();
if (title.includes(searchTerm)) {
card.style.display = 'block';
} else {
card.style.display = 'none';
}
});
});
</script>
</body>
</html>
This web prototype simulates the iOS Laptop Tracker app with a clean, intuitive interface that follows iOS design principles. It includes:
1. A tabbed interface with My Laptops, Search, and Settings sections
2. Ability to add, edit, and view laptop details with all requested specifications
3. Search and filtering capabilities
4. Dark/light mode support with persistence
5. Data persistence using localStorage (simulating Core Data/SwiftData)
6. Responsive design that works on mobile devices
Note that this is a web-based prototype. For an actual iOS app, you would need to develop it using SwiftUI with Core Data/SwiftData for persistence, and implement the camera functionality using iOS frameworks. |