398 lines
8.1 KiB
HTML
398 lines
8.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>YNAB Amazon Helper</title>
|
|
<style>
|
|
* {
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
padding: 20px;
|
|
}
|
|
|
|
.container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
background: white;
|
|
border-radius: 12px;
|
|
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
overflow: hidden;
|
|
}
|
|
|
|
header {
|
|
background: #1e293b;
|
|
color: white;
|
|
padding: 30px;
|
|
text-align: center;
|
|
}
|
|
|
|
h1 {
|
|
font-size: 2rem;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.subtitle {
|
|
color: #94a3b8;
|
|
font-size: 0.95rem;
|
|
}
|
|
|
|
.section {
|
|
padding: 30px;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
font-weight: 600;
|
|
margin-bottom: 8px;
|
|
color: #334155;
|
|
}
|
|
|
|
input[type="date"] {
|
|
width: 100%;
|
|
padding: 12px;
|
|
border: 2px solid #e2e8f0;
|
|
border-radius: 6px;
|
|
font-size: 1rem;
|
|
transition: border-color 0.2s;
|
|
}
|
|
|
|
input[type="date"]:focus {
|
|
outline: none;
|
|
border-color: #667eea;
|
|
}
|
|
|
|
.button-group {
|
|
display: flex;
|
|
gap: 12px;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
button {
|
|
flex: 1;
|
|
padding: 14px 24px;
|
|
border: none;
|
|
border-radius: 6px;
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: #667eea;
|
|
color: white;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: #5568d3;
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.btn-success {
|
|
background: #10b981;
|
|
color: white;
|
|
}
|
|
|
|
.btn-success:hover {
|
|
background: #059669;
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.btn-primary:disabled, .btn-success:disabled {
|
|
background: #cbd5e1;
|
|
cursor: not-allowed;
|
|
transform: none;
|
|
}
|
|
|
|
.stats {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
gap: 15px;
|
|
margin: 20px 0;
|
|
}
|
|
|
|
.stat-card {
|
|
background: #f8fafc;
|
|
padding: 20px;
|
|
border-radius: 8px;
|
|
border-left: 4px solid #667eea;
|
|
}
|
|
|
|
.stat-label {
|
|
font-size: 0.85rem;
|
|
color: #64748b;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.stat-value {
|
|
font-size: 1.8rem;
|
|
font-weight: 700;
|
|
color: #1e293b;
|
|
}
|
|
|
|
.matches-list {
|
|
margin-top: 30px;
|
|
}
|
|
|
|
.match-card {
|
|
background: #f8fafc;
|
|
border: 2px solid #e2e8f0;
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
margin-bottom: 15px;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.match-card:hover {
|
|
border-color: #667eea;
|
|
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
|
|
}
|
|
|
|
.match-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: start;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.match-info {
|
|
flex: 1;
|
|
}
|
|
|
|
.match-date {
|
|
font-size: 0.9rem;
|
|
color: #64748b;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.match-payee {
|
|
font-size: 1.1rem;
|
|
font-weight: 600;
|
|
color: #1e293b;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.match-amount {
|
|
font-size: 1.3rem;
|
|
font-weight: 700;
|
|
color: #dc2626;
|
|
}
|
|
|
|
.confidence-badge {
|
|
padding: 6px 12px;
|
|
border-radius: 20px;
|
|
font-size: 0.85rem;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.confidence-high {
|
|
background: #d1fae5;
|
|
color: #065f46;
|
|
}
|
|
|
|
.confidence-medium {
|
|
background: #fef3c7;
|
|
color: #92400e;
|
|
}
|
|
|
|
.confidence-low {
|
|
background: #fee2e2;
|
|
color: #991b1b;
|
|
}
|
|
|
|
.amazon-order {
|
|
background: white;
|
|
border-left: 4px solid #ff9900;
|
|
padding: 15px;
|
|
margin-top: 15px;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.order-header {
|
|
font-weight: 600;
|
|
color: #1e293b;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.order-items {
|
|
font-size: 0.9rem;
|
|
color: #475569;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.order-link {
|
|
color: #667eea;
|
|
text-decoration: none;
|
|
font-size: 0.85rem;
|
|
}
|
|
|
|
.order-link:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.category-select {
|
|
margin-top: 15px;
|
|
padding: 10px;
|
|
background: white;
|
|
border-radius: 6px;
|
|
}
|
|
|
|
select {
|
|
width: 100%;
|
|
padding: 10px;
|
|
border: 2px solid #e2e8f0;
|
|
border-radius: 4px;
|
|
font-size: 0.95rem;
|
|
}
|
|
|
|
.match-actions {
|
|
display: flex;
|
|
gap: 10px;
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.btn-small {
|
|
padding: 8px 16px;
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
.btn-approve {
|
|
background: #10b981;
|
|
color: white;
|
|
}
|
|
|
|
.btn-approve:hover {
|
|
background: #059669;
|
|
}
|
|
|
|
.btn-reject {
|
|
background: #ef4444;
|
|
color: white;
|
|
}
|
|
|
|
.btn-reject:hover {
|
|
background: #dc2626;
|
|
}
|
|
|
|
.status-approved {
|
|
border-color: #10b981;
|
|
background: #f0fdf4;
|
|
}
|
|
|
|
.status-rejected {
|
|
border-color: #ef4444;
|
|
background: #fef2f2;
|
|
opacity: 0.6;
|
|
}
|
|
|
|
.loading {
|
|
text-align: center;
|
|
padding: 40px;
|
|
color: #64748b;
|
|
}
|
|
|
|
.spinner {
|
|
border: 3px solid #f3f3f3;
|
|
border-top: 3px solid #667eea;
|
|
border-radius: 50%;
|
|
width: 40px;
|
|
height: 40px;
|
|
animation: spin 1s linear infinite;
|
|
margin: 20px auto;
|
|
}
|
|
|
|
@keyframes spin {
|
|
0% { transform: rotate(0deg); }
|
|
100% { transform: rotate(360deg); }
|
|
}
|
|
|
|
.error {
|
|
background: #fef2f2;
|
|
border: 2px solid #ef4444;
|
|
color: #991b1b;
|
|
padding: 15px;
|
|
border-radius: 6px;
|
|
margin: 20px 0;
|
|
}
|
|
|
|
.no-match {
|
|
opacity: 0.5;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<header>
|
|
<h1>YNAB Amazon Helper</h1>
|
|
<p class="subtitle">Link your YNAB transactions to Amazon orders with AI-powered categorization</p>
|
|
</header>
|
|
|
|
<div class="section">
|
|
<div class="form-group">
|
|
<label style="display: flex; align-items: center; gap: 10px; cursor: pointer;">
|
|
<input type="checkbox" id="useUnapproved" checked style="width: auto; cursor: pointer;">
|
|
<span>Use Unapproved Transactions Only (Recommended)</span>
|
|
</label>
|
|
<p style="font-size: 0.85rem; color: #64748b; margin-top: 8px; margin-left: 30px;">
|
|
Automatically fetch all unapproved transactions from YNAB without requiring a date range.
|
|
</p>
|
|
</div>
|
|
|
|
<div id="dateRangeSection" style="display: none;">
|
|
<div class="form-group">
|
|
<label for="startDate">Start Date</label>
|
|
<input type="date" id="startDate">
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="endDate">End Date</label>
|
|
<input type="date" id="endDate">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="button-group">
|
|
<button class="btn-primary" id="fetchBtn">Fetch & Match Transactions</button>
|
|
</div>
|
|
|
|
<div id="statsSection" style="display: none;">
|
|
<h2 style="margin: 30px 0 15px; color: #1e293b;">Match Statistics</h2>
|
|
<div class="stats" id="stats"></div>
|
|
</div>
|
|
|
|
<div id="loadingSection" style="display: none;">
|
|
<div class="loading">
|
|
<div class="spinner"></div>
|
|
<p>Fetching transactions and matching with Amazon orders...</p>
|
|
<p style="font-size: 0.9rem; margin-top: 10px;">This may take a few minutes.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="errorSection" style="display: none;">
|
|
<div class="error" id="errorMessage"></div>
|
|
</div>
|
|
|
|
<div id="matchesSection" style="display: none;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center; margin: 30px 0 15px;">
|
|
<h2 style="color: #1e293b;">Review Matches</h2>
|
|
<button class="btn-success" id="approveBtn">Apply Approved Matches</button>
|
|
</div>
|
|
<div class="matches-list" id="matchesList"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="module" src="./frontend.tsx"></script>
|
|
</body>
|
|
</html>
|