diff --git a/index.html b/index.html index efc493d..0667820 100644 --- a/index.html +++ b/index.html @@ -381,41 +381,106 @@ display: none; } - .mobile-card { + .mobile-table .table-container { border: 2px solid var(--border); - padding: 20px; - margin-bottom: 12px; + overflow: hidden; + max-height: 500px; + overflow-y: auto; + } + + .mobile-table table { + width: 100%; + border-collapse: collapse; + } + + .mobile-table thead { + position: sticky; + top: 0; + background-color: var(--bg-secondary); + z-index: 10; + border-bottom: 2px solid var(--border); + } + + .mobile-table th { + padding: 12px 10px; + text-align: left; + font-size: 11px; + font-weight: 700; + text-transform: uppercase; + letter-spacing: 1px; + color: var(--text-secondary); + font-family: 'Roboto Mono', monospace; + cursor: pointer; + user-select: none; + transition: all 0.15s ease; + } + + .mobile-table th:hover { + color: var(--orange); + background-color: var(--bg-card); + } + + .mobile-table th.sortable::after { + content: '↕'; + font-size: 9px; + margin-left: 4px; + opacity: 0.3; + } + + .mobile-table th.sort-asc::after { + content: '↑'; + opacity: 1; + } + + .mobile-table th.sort-desc::after { + content: '↓'; + opacity: 1; + } + + .mobile-table td { + padding: 12px 10px; + font-size: 13px; + color: var(--text-primary); + border-bottom: 1px solid var(--border); + font-weight: 500; + } + + .mobile-table .phone-number { + font-size: 14px; + } + + .mobile-table .result { + max-width: 150px; + font-size: 13px; + } + + .mobile-table .datetime { + font-size: 11px; + color: var(--text-secondary); + } + + .mobile-table .datetime .date-part { + display: block; + } + + .mobile-table .datetime .date-part::after { + content: none; + } + + .mobile-table tbody tr:last-child td { + border-bottom: none; + } + + .mobile-table tbody tr { + transition: all 0.15s ease; + } + + .mobile-table tbody tr:hover { background-color: var(--bg-secondary); } - .mobile-card-item { - display: flex; - flex-direction: column; - gap: 6px; - padding: 14px 0; - border-bottom: 1px solid var(--border); - } - - .mobile-card-item:last-child { - border-bottom: none; - padding-bottom: 0; - } - - .mobile-card-label { - font-size: 10px; - font-weight: 700; - text-transform: uppercase; - letter-spacing: 1.5px; - color: var(--text-secondary); - font-family: 'Roboto Mono', monospace; - } - - .mobile-card-value { - font-size: 15px; - font-weight: 600; - color: var(--text-primary); - word-break: break-word; - letter-spacing: 0.5px; + .mobile-table .phone-link .material-icons { + font-size: 14px; } .table-container { @@ -549,10 +614,17 @@ font-size: 12px; font-family: 'Roboto Mono', monospace; color: var(--text-secondary); - white-space: nowrap; letter-spacing: 0.5px; } + .datetime .date-part::after { + content: ' '; + } + + .datetime .time-part { + white-space: nowrap; + } + .status-badge { display: inline-block; padding: 6px 16px; @@ -968,7 +1040,6 @@ Phone Result Date/Time - Status @@ -981,7 +1052,21 @@ -
+
+
+ + + + + + + + + + +
PhoneResultDate/Time
+
+
history

No search history yet

@@ -1192,7 +1277,8 @@ const confirmModal = document.getElementById('confirmModal'); const cancelClearBtn = document.getElementById('cancelClearBtn'); const confirmClearBtn = document.getElementById('confirmClearBtn'); - const mobileTable = document.getElementById('mobileTable'); + const mobileTableContainer = document.getElementById('mobileTableContainer'); + const mobileTableBody = document.getElementById('mobileTableBody'); const emptyStateMobile = document.getElementById('emptyStateMobile'); let searchHistory = []; @@ -1234,14 +1320,17 @@ function formatDate(timestamp) { const date = new Date(timestamp); - return date.toLocaleString('en-US', { + const datePart = date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', - year: 'numeric', + year: 'numeric' + }); + const timePart = date.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: true }); + return `${datePart}${timePart}`; } function getStatusBadge(status) { @@ -1256,20 +1345,32 @@ function renderTable(filteredHistory = null) { const data = filteredHistory || getSortedHistory(); historyTableBody.innerHTML = ''; - mobileTable.innerHTML = ''; + mobileTableBody.innerHTML = ''; if (data.length === 0) { emptyState.style.display = 'block'; + mobileTableContainer.style.display = 'none'; emptyStateMobile.style.display = ''; // Let CSS media queries handle visibility resultsCount.textContent = filteredHistory ? 'No results found' : ''; return; } emptyState.style.display = 'none'; + mobileTableContainer.style.display = ''; emptyStateMobile.style.display = 'none'; resultsCount.textContent = `Showing ${data.length} ${data.length === 1 ? 'result' : 'results'}`; data.forEach((entry, index) => { + let resultHtml; + if (entry.status === 'not_found') { + resultHtml = getStatusBadge(entry.status); + } else if (entry.status === 'error') { + resultHtml = `${escapeHtml(entry.result)}
${getStatusBadge(entry.status)}
`; + } else { + resultHtml = escapeHtml(entry.result); + } + + // Desktop table row const row = document.createElement('tr'); row.innerHTML = ` @@ -1278,38 +1379,24 @@ ${escapeHtml(entry.phone)} - ${escapeHtml(entry.result)} + ${resultHtml} ${formatDate(entry.timestamp)} - ${getStatusBadge(entry.status)} `; historyTableBody.appendChild(row); - const card = document.createElement('div'); - card.className = 'mobile-card'; - card.innerHTML = ` -
- Phone - - - phone - ${escapeHtml(entry.phone)} - - -
-
- Result - ${escapeHtml(entry.result)} -
-
- Date/Time - ${formatDate(entry.timestamp)} -
-
- Status - ${getStatusBadge(entry.status)} -
+ // Mobile table row + const mobileRow = document.createElement('tr'); + mobileRow.innerHTML = ` + + + phone + ${escapeHtml(entry.phone)} + + + ${resultHtml} + ${formatDate(entry.timestamp)} `; - mobileTable.appendChild(card); + mobileTableBody.appendChild(mobileRow); }); } @@ -1359,8 +1446,9 @@ document.querySelectorAll('th').forEach(th => { th.classList.remove('sort-asc', 'sort-desc'); }); - const th = document.querySelector(`th[data-sort="${column}"]`); - th.classList.add(currentSort.direction === 'asc' ? 'sort-asc' : 'sort-desc'); + document.querySelectorAll(`th[data-sort="${column}"]`).forEach(th => { + th.classList.add(currentSort.direction === 'asc' ? 'sort-asc' : 'sort-desc'); + }); const searchTerm = tableSearch.value; if (searchTerm.trim()) {