Files
lead-scraper/views/history.ejs

47 lines
2.2 KiB
Plaintext

<!DOCTYPE html>
<html lang="en" class="bg-dark">
<head><%- include('partials/head') %></head>
<body class="bg-dark text-gray-200 flex min-h-screen">
<% const activePage = 'history'; %>
<%- include('partials/sidebar') %>
<main class="flex-1 md:ml-56 mt-14 md:mt-0 p-4 md:p-6">
<h2 class="text-lg font-bold mb-4">Search History</h2>
<% if (!searches || searches.length === 0) { %>
<div class="flex flex-col items-center justify-center py-24 text-gray-500">
<svg class="w-16 h-16 mb-4 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
<p class="text-sm font-medium">No searches yet</p>
<p class="text-xs mt-1">Your search history will appear here</p>
<a href="/" class="mt-4 bg-accent hover:bg-accent-hover text-white px-4 py-2 rounded-lg text-sm transition-colors">Start Searching</a>
</div>
<% } else { %>
<div class="space-y-2">
<% searches.forEach(s => { %>
<div class="bg-card border border-white/5 rounded-lg p-4 flex items-center justify-between hover:bg-card-hover transition-colors">
<div class="flex-1">
<p class="text-sm font-medium text-white"><%= s.query %></p>
<p class="text-xs text-gray-500 mt-1"><%= s.resultsCount %> results · <%= new Date(s.timestamp).toLocaleString() %></p>
</div>
<div class="flex items-center gap-2">
<a href="/?view=<%= encodeURIComponent(s.key) %>"
class="bg-accent/20 text-accent hover:bg-accent/30 px-3 py-1.5 rounded text-xs font-medium transition-colors">View</a>
<button onclick="deleteSearch('<%= s.key %>', this)"
class="bg-red-500/10 text-red-400 hover:bg-red-500/20 px-3 py-1.5 rounded text-xs font-medium transition-colors">Delete</button>
</div>
</div>
<% }) %>
</div>
<% } %>
</main>
<script>
async function deleteSearch(key, btn) {
if (!confirm('Delete this search?')) return;
await fetch('/api/search/' + encodeURIComponent(key), { method: 'DELETE' });
btn.closest('.bg-card').remove();
}
</script>
</body>
</html>