Restore to commit 74e578279624c6045ca440a3459ebfa1f8d54191

This commit is contained in:
southseact-3d
2026-02-07 20:32:41 +00:00
commit ed67b7741b
252 changed files with 99814 additions and 0 deletions

View File

@@ -0,0 +1,103 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Affiliate Transactions | Plugin Compass</title>
<link rel="icon" type="image/png" href="/assets/Plugin.png">
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
<script>
tailwind.config = { theme: { extend: { fontFamily: { sans: ['Inter', 'sans-serif'] } } } };
</script>
<!-- PostHog Analytics -->
<script src="/posthog.js"></script>
</head>
<body class="min-h-screen bg-amber-50 text-gray-900">
<nav class="sticky top-0 z-30 bg-amber-50/95 backdrop-blur border-b border-amber-200">
<div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 h-14 flex items-center justify-between">
<a href="/" class="flex items-center gap-2 font-semibold">
<img src="/assets/Plugin.png" alt="Plugin Compass" class="w-8 h-8 rounded-lg">
<span>Plugin<span class="text-green-700">Compass</span></span>
</a>
<div class="flex items-center gap-3 text-sm">
<a href="/affiliate-dashboard" class="text-gray-700 hover:text-gray-900">Dashboard</a>
<button id="logout" class="px-3 py-2 rounded-lg border border-gray-300 hover:bg-white">Logout</button>
</div>
</div>
</nav>
<main class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-10">
<header class="mb-8 flex items-center justify-between">
<div>
<p class="text-xs font-semibold uppercase text-green-700 mb-1">Affiliate Program</p>
<h1 class="text-3xl font-bold">Transaction History</h1>
<p class="text-gray-600">A detailed record of all your attributed commissions.</p>
</div>
<a href="/affiliate-dashboard" class="px-4 py-2 rounded-lg border border-gray-300 bg-white text-sm font-semibold hover:bg-amber-50">Back to dashboard</a>
</header>
<section class="bg-white border border-amber-200 rounded-2xl shadow-sm overflow-hidden">
<div class="overflow-x-auto">
<table class="w-full text-left text-sm">
<thead class="bg-amber-50/50 border-b border-amber-200 text-gray-600 font-semibold">
<tr>
<th class="px-6 py-4">Date</th>
<th class="px-6 py-4">User ID</th>
<th class="px-6 py-4">Plan</th>
<th class="px-6 py-4">Commission</th>
</tr>
</thead>
<tbody id="transactions-body" class="divide-y divide-amber-100">
<tr>
<td colspan="4" class="px-6 py-10 text-center text-gray-500">Loading transactions...</td>
</tr>
</tbody>
</table>
</div>
</section>
</main>
<script>
const transactionsBody = document.getElementById('transactions-body');
const logoutBtn = document.getElementById('logout');
async function loadTransactions() {
const res = await fetch('/api/affiliates/transactions');
if (res.status === 401) {
window.location.href = '/affiliate-login';
return;
}
const json = await res.json().catch(() => ({}));
const transactions = json.transactions || [];
renderTransactions(transactions);
}
function renderTransactions(records) {
if (!records.length) {
transactionsBody.innerHTML = '<tr><td colspan="4" class="px-6 py-10 text-center text-gray-500">No transactions yet. Share your links to start earning.</td></tr>';
return;
}
transactionsBody.innerHTML = records.map((r) => `
<tr class="hover:bg-amber-50/50 transition-colors">
<td class="px-6 py-4 text-gray-600">${new Date(r.createdAt).toLocaleDateString()} ${new Date(r.createdAt).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}</td>
<td class="px-6 py-4 font-medium text-gray-900">${r.userId || '—'}</td>
<td class="px-6 py-4 capitalize"><span class="px-2 py-1 rounded-full bg-green-100 text-green-700 text-xs font-semibold">${r.plan}</span></td>
<td class="px-6 py-4 font-bold text-gray-900">$${Number(r.amount || 0).toFixed(2)}</td>
</tr>
`).join('');
}
logoutBtn.addEventListener('click', async () => {
await fetch('/api/affiliates/logout', { method: 'POST' });
localStorage.removeItem('plugin_compass_onboarding_completed');
window.location.href = '/affiliate-login';
});
loadTransactions();
</script>
</body>
</html>