Format CSS and add border-left indicators for review items
This commit is contained in:
+121
-35
@@ -20,7 +20,9 @@
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||||
font-family:
|
||||
-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
|
||||
"Microsoft YaHei", sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
}
|
||||
@@ -185,10 +187,18 @@ body {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.stat-value.income { color: var(--success); }
|
||||
.stat-value.expense { color: var(--danger); }
|
||||
.stat-value.warning { color: var(--warning); }
|
||||
.stat-value.primary { color: var(--primary); }
|
||||
.stat-value.income {
|
||||
color: var(--success);
|
||||
}
|
||||
.stat-value.expense {
|
||||
color: var(--danger);
|
||||
}
|
||||
.stat-value.warning {
|
||||
color: var(--warning);
|
||||
}
|
||||
.stat-value.primary {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn {
|
||||
@@ -209,7 +219,9 @@ body {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-primary:hover { background: #4338ca; }
|
||||
.btn-primary:hover {
|
||||
background: #4338ca;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: var(--bg);
|
||||
@@ -217,7 +229,9 @@ body {
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.btn-secondary:hover { background: var(--border); }
|
||||
.btn-secondary:hover {
|
||||
background: var(--border);
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
background: var(--success);
|
||||
@@ -247,7 +261,8 @@ body {
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.form-input, .form-select {
|
||||
.form-input,
|
||||
.form-select {
|
||||
width: 100%;
|
||||
padding: 9px 12px;
|
||||
border: 1px solid var(--border);
|
||||
@@ -257,7 +272,8 @@ body {
|
||||
background: white;
|
||||
}
|
||||
|
||||
.form-input:focus, .form-select:focus {
|
||||
.form-input:focus,
|
||||
.form-select:focus {
|
||||
outline: none;
|
||||
border-color: var(--primary-light);
|
||||
box-shadow: 0 0 0 3px var(--primary-bg);
|
||||
@@ -289,7 +305,9 @@ td {
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
tr:hover { background: var(--bg); }
|
||||
tr:hover {
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
/* Tags */
|
||||
.tag {
|
||||
@@ -300,11 +318,26 @@ tr:hover { background: var(--bg); }
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tag-income { background: #d1fae5; color: #065f46; }
|
||||
.tag-expense { background: #fee2e2; color: #991b1b; }
|
||||
.tag-transfer { background: #dbeafe; color: #1e40af; }
|
||||
.tag-matched { background: #e0e7ff; color: #3730a3; }
|
||||
.tag-unreviewed { background: #fef3c7; color: #92400e; }
|
||||
.tag-income {
|
||||
background: #d1fae5;
|
||||
color: #065f46;
|
||||
}
|
||||
.tag-expense {
|
||||
background: #fee2e2;
|
||||
color: #991b1b;
|
||||
}
|
||||
.tag-transfer {
|
||||
background: #dbeafe;
|
||||
color: #1e40af;
|
||||
}
|
||||
.tag-matched {
|
||||
background: #e0e7ff;
|
||||
color: #3730a3;
|
||||
}
|
||||
.tag-unreviewed {
|
||||
background: #fef3c7;
|
||||
color: #92400e;
|
||||
}
|
||||
|
||||
/* Review items */
|
||||
.review-item {
|
||||
@@ -324,10 +357,17 @@ tr:hover { background: var(--bg); }
|
||||
}
|
||||
|
||||
.review-item.reviewed {
|
||||
opacity: 0.7;
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
.review-item.income-border {
|
||||
border-left: 3px solid var(--success);
|
||||
}
|
||||
|
||||
.review-item.expense-border {
|
||||
border-left: 3px solid var(--danger);
|
||||
}
|
||||
|
||||
.review-item .amount-col {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
@@ -366,7 +406,8 @@ tr:hover { background: var(--bg); }
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.upload-zone:hover, .upload-zone.drag-over {
|
||||
.upload-zone:hover,
|
||||
.upload-zone.drag-over {
|
||||
border-color: var(--primary-light);
|
||||
background: var(--primary-bg);
|
||||
}
|
||||
@@ -476,7 +517,9 @@ tr:hover { background: var(--bg); }
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.tab:hover { color: var(--text); }
|
||||
.tab:hover {
|
||||
color: var(--text);
|
||||
}
|
||||
.tab.active {
|
||||
color: var(--primary);
|
||||
border-bottom-color: var(--primary);
|
||||
@@ -493,12 +536,30 @@ tr:hover { background: var(--bg); }
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.source-alipay { background: #dbeafe; color: #1e40af; }
|
||||
.source-wechat { background: #d1fae5; color: #065f46; }
|
||||
.source-bank_debit { background: #fef3c7; color: #92400e; }
|
||||
.source-bank_credit { background: #fef3c7; color: #92400e; }
|
||||
.source-abc { background: #e0e7ff; color: #3730a3; }
|
||||
.source-credit_card { background: #fee2e2; color: #991b1b; }
|
||||
.source-alipay {
|
||||
background: #dbeafe;
|
||||
color: #1e40af;
|
||||
}
|
||||
.source-wechat {
|
||||
background: #d1fae5;
|
||||
color: #065f46;
|
||||
}
|
||||
.source-bank_debit {
|
||||
background: #fef3c7;
|
||||
color: #92400e;
|
||||
}
|
||||
.source-bank_credit {
|
||||
background: #fef3c7;
|
||||
color: #92400e;
|
||||
}
|
||||
.source-abc {
|
||||
background: #e0e7ff;
|
||||
color: #3730a3;
|
||||
}
|
||||
.source-credit_card {
|
||||
background: #fee2e2;
|
||||
color: #991b1b;
|
||||
}
|
||||
|
||||
/* Loading */
|
||||
.loading {
|
||||
@@ -520,7 +581,9 @@ tr:hover { background: var(--bg); }
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
to { transform: rotate(360deg); }
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* Toast */
|
||||
@@ -536,20 +599,43 @@ tr:hover { background: var(--bg); }
|
||||
animation: slideIn 0.3s ease;
|
||||
}
|
||||
|
||||
.toast-success { background: var(--success); }
|
||||
.toast-error { background: var(--danger); }
|
||||
.toast-success {
|
||||
background: var(--success);
|
||||
}
|
||||
.toast-error {
|
||||
background: var(--danger);
|
||||
}
|
||||
|
||||
@keyframes slideIn {
|
||||
from { transform: translateX(100%); opacity: 0; }
|
||||
to { transform: translateX(0); opacity: 1; }
|
||||
from {
|
||||
transform: translateX(100%);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: translateX(0);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.sidebar { width: 60px; }
|
||||
.sidebar .nav-link span:not(.badge) { display: none; }
|
||||
.sidebar .logo-sub { display: none; }
|
||||
.main-content { margin-left: 60px; padding: 16px; }
|
||||
.stats-grid { grid-template-columns: repeat(2, 1fr); }
|
||||
.filter-bar { flex-direction: column; }
|
||||
.sidebar {
|
||||
width: 60px;
|
||||
}
|
||||
.sidebar .nav-link span:not(.badge) {
|
||||
display: none;
|
||||
}
|
||||
.sidebar .logo-sub {
|
||||
display: none;
|
||||
}
|
||||
.main-content {
|
||||
margin-left: 60px;
|
||||
padding: 16px;
|
||||
}
|
||||
.stats-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
.filter-bar {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
+67
-14
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useEffect, useRef, useCallback } from "react";
|
||||
import { Edit3, Loader2 } from "lucide-react";
|
||||
import { Edit3, Loader2, Check, X } from "lucide-react";
|
||||
import {
|
||||
getDeals,
|
||||
updateDeal,
|
||||
@@ -22,15 +22,25 @@ export default function Review() {
|
||||
const [editingDeal, setEditingDeal] = useState(null);
|
||||
const [showReviewed, setShowReviewed] = useState(true);
|
||||
const [keyword, setKeyword] = useState("");
|
||||
const [debouncedKeyword, setDebouncedKeyword] = useState("");
|
||||
const [confirmingId, setConfirmingId] = useState(null);
|
||||
const sentinelRef = useRef(null);
|
||||
const debounceRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
loadCategories();
|
||||
}, []);
|
||||
|
||||
// 搜索防抖 300ms
|
||||
useEffect(() => {
|
||||
if (debounceRef.current) clearTimeout(debounceRef.current);
|
||||
debounceRef.current = setTimeout(() => setDebouncedKeyword(keyword), 300);
|
||||
return () => clearTimeout(debounceRef.current);
|
||||
}, [keyword]);
|
||||
|
||||
useEffect(() => {
|
||||
loadReviewDeals(1, false);
|
||||
}, [showReviewed, keyword]);
|
||||
}, [showReviewed, debouncedKeyword]);
|
||||
|
||||
async function loadCategories() {
|
||||
try {
|
||||
@@ -57,7 +67,7 @@ export default function Review() {
|
||||
sort_order: "DESC",
|
||||
};
|
||||
if (!showReviewed) params.reviewed = 0;
|
||||
if (keyword) params.keyword = keyword;
|
||||
if (debouncedKeyword) params.keyword = debouncedKeyword;
|
||||
|
||||
const result = await getDeals(params);
|
||||
if (append) {
|
||||
@@ -94,7 +104,7 @@ export default function Review() {
|
||||
const handleLoadMore = useCallback(() => {
|
||||
if (loadingMore || page >= totalPages) return;
|
||||
loadReviewDeals(page + 1, true);
|
||||
}, [loadingMore, page, totalPages, showReviewed, keyword]);
|
||||
}, [loadingMore, page, totalPages, showReviewed, debouncedKeyword]);
|
||||
|
||||
// 自动滚动加载:哨兵元素进入视口时触发
|
||||
useEffect(() => {
|
||||
@@ -118,6 +128,16 @@ export default function Review() {
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
// 行内快速确认:信任当前AI分类,一键标记已确认
|
||||
async function handleQuickConfirm(deal) {
|
||||
setConfirmingId(deal.id);
|
||||
try {
|
||||
await updateDeal(deal.id, { reviewed: 1 });
|
||||
loadReviewDeals(1, false);
|
||||
} catch (err) {}
|
||||
setConfirmingId(null);
|
||||
}
|
||||
|
||||
const hasMore = page < totalPages;
|
||||
|
||||
return (
|
||||
@@ -184,7 +204,7 @@ export default function Review() {
|
||||
{deals.map((deal) => (
|
||||
<div
|
||||
key={deal.id}
|
||||
className={`review-item ${deal.reviewed ? "reviewed" : ""}`}
|
||||
className={`review-item${deal.reviewed ? " reviewed" : ""}${deal.direction === "income" ? " income-border" : " expense-border"}`}
|
||||
>
|
||||
<div
|
||||
className={`amount-col ${deal.direction === "income" ? "stat-value income" : "stat-value expense"}`}
|
||||
@@ -199,17 +219,22 @@ export default function Review() {
|
||||
{formatDate(deal.deal_date)} ·
|
||||
{deal.counterparty && <span> {deal.counterparty} ·</span>}
|
||||
{deal.category && (
|
||||
<span
|
||||
className="tag tag-matched"
|
||||
style={{ marginLeft: 4 }}
|
||||
>
|
||||
{deal.category}
|
||||
</span>
|
||||
<span className="tag tag-matched">{deal.category}</span>
|
||||
)}
|
||||
{deal.reviewed === 1 && (
|
||||
<span style={{ marginLeft: 6, color: "var(--success)" }}>
|
||||
{deal.reviewed === 1 ? (
|
||||
<span
|
||||
className="tag tag-income"
|
||||
style={{ marginLeft: 6 }}
|
||||
>
|
||||
✓ 已确认
|
||||
</span>
|
||||
) : (
|
||||
<span
|
||||
className="tag tag-unreviewed"
|
||||
style={{ marginLeft: 6 }}
|
||||
>
|
||||
待确认
|
||||
</span>
|
||||
)}
|
||||
{deal.match_count > 1 && (
|
||||
<span
|
||||
@@ -230,6 +255,23 @@ export default function Review() {
|
||||
{deal.transactions.length}笔
|
||||
</span>
|
||||
)}
|
||||
{deal.reviewed !== 1 && (
|
||||
<button
|
||||
className="btn btn-success btn-sm"
|
||||
onClick={() => handleQuickConfirm(deal)}
|
||||
disabled={confirmingId === deal.id}
|
||||
>
|
||||
{confirmingId === deal.id ? (
|
||||
<Loader2
|
||||
size={12}
|
||||
style={{ animation: "spin 0.8s linear infinite" }}
|
||||
/>
|
||||
) : (
|
||||
<Check size={12} />
|
||||
)}
|
||||
确认
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
onClick={() => setEditingDeal({ ...deal })}
|
||||
@@ -452,6 +494,17 @@ export default function Review() {
|
||||
>
|
||||
取消
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-secondary"
|
||||
onClick={() =>
|
||||
handleUpdateDeal(editingDeal.id, {
|
||||
category: editingDeal.category,
|
||||
ai_description: editingDeal.ai_description,
|
||||
})
|
||||
}
|
||||
>
|
||||
仅保存
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
onClick={() =>
|
||||
@@ -462,7 +515,7 @@ export default function Review() {
|
||||
})
|
||||
}
|
||||
>
|
||||
保存并确认
|
||||
<Check size={14} /> 保存并确认
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user