Spaces:
Running
Running
Download index.html from eyoba122/ios-program: direct link, hf CLI and curl.
- Browser
- Download file 48.4 kB
-
https://huggingface.co/spaces/eyoba122/ios-program/resolve/main/index.html
- Command line
-
hf download hf://spaces/eyoba122/ios-program/index.html
-
curl -L -o index.html https://huggingface.co/spaces/eyoba122/ios-program/resolve/main/index.html
48.4 kB
<!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.
<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;