Remove unused expandable deal UI and review_notes field
Simplify the review page by removing the expandable
This commit is contained in:
+20
-99
@@ -1,11 +1,5 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import {
|
||||
CheckCircle,
|
||||
Edit3,
|
||||
ChevronDown,
|
||||
ChevronRight,
|
||||
Loader2,
|
||||
} from "lucide-react";
|
||||
import { CheckCircle, Edit3, Loader2 } from "lucide-react";
|
||||
import {
|
||||
getDeals,
|
||||
updateDeal,
|
||||
@@ -29,14 +23,12 @@ export default function Review() {
|
||||
const [editingDeal, setEditingDeal] = useState(null);
|
||||
const [showReviewed, setShowReviewed] = useState(false);
|
||||
const [keyword, setKeyword] = useState("");
|
||||
const [expandedDeals, setExpandedDeals] = useState(new Set());
|
||||
|
||||
useEffect(() => {
|
||||
loadCategories();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// When filters change, reset and reload from page 1
|
||||
loadReviewDeals(1, false);
|
||||
}, [showReviewed, keyword]);
|
||||
|
||||
@@ -78,7 +70,6 @@ export default function Review() {
|
||||
setPage(result.page);
|
||||
setTotalPages(result.totalPages);
|
||||
|
||||
// Update badge count in sidebar
|
||||
updateBadge(result, isFirstPage);
|
||||
} catch (err) {}
|
||||
setLoading(false);
|
||||
@@ -92,7 +83,6 @@ export default function Review() {
|
||||
if (!showReviewed) {
|
||||
badge.textContent = result.total;
|
||||
} else if (isFirstPage) {
|
||||
// When showing reviewed, fetch unreviewed count for badge (only once)
|
||||
const unreviewed = await getDeals({
|
||||
min_amount: 100,
|
||||
reviewed: 0,
|
||||
@@ -111,7 +101,6 @@ export default function Review() {
|
||||
async function handleConfirm(deal) {
|
||||
try {
|
||||
await updateDeal(deal.id, { reviewed: 1 });
|
||||
// Reload from page 1
|
||||
loadReviewDeals(1, false);
|
||||
} catch (err) {}
|
||||
}
|
||||
@@ -139,15 +128,6 @@ export default function Review() {
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
function toggleExpand(dealId) {
|
||||
setExpandedDeals((prev) => {
|
||||
const next = new Set(prev);
|
||||
if (next.has(dealId)) next.delete(dealId);
|
||||
else next.add(dealId);
|
||||
return next;
|
||||
});
|
||||
}
|
||||
|
||||
const hasMore = page < totalPages;
|
||||
|
||||
return (
|
||||
@@ -260,18 +240,12 @@ export default function Review() {
|
||||
|
||||
<div className="action-col">
|
||||
{deal.transactions && deal.transactions.length > 0 && (
|
||||
<button
|
||||
className="tag "
|
||||
// onClick={() => toggleExpand(deal.id)}
|
||||
title="查看关联明细"
|
||||
<span
|
||||
className="tag tag-transfer"
|
||||
style={{ fontSize: 11, padding: "3px 8px" }}
|
||||
>
|
||||
{/* {expandedDeals.has(deal.id) ? (*/}
|
||||
{/* <ChevronDown size={12} />*/}
|
||||
{/* ) : (*/}
|
||||
{/* <ChevronRight size={12} />*/}
|
||||
{/* )}{" "}*/}
|
||||
{deal.transactions.length}笔
|
||||
</button>
|
||||
</span>
|
||||
)}
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
@@ -288,56 +262,6 @@ export default function Review() {
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Expanded transactions detail */}
|
||||
{expandedDeals.has(deal.id) && deal.transactions && (
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
marginTop: 8,
|
||||
padding: "10px 0 0",
|
||||
borderTop: "1px dashed var(--border)",
|
||||
}}
|
||||
>
|
||||
{deal.transactions.map((tx, i) => (
|
||||
<div
|
||||
key={i}
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: 12,
|
||||
alignItems: "center",
|
||||
padding: "6px 0",
|
||||
fontSize: 12,
|
||||
color: "var(--text-secondary)",
|
||||
}}
|
||||
>
|
||||
<span
|
||||
className={`source-type-label source-${tx.source_type}`}
|
||||
style={{ minWidth: 64, textAlign: "center" }}
|
||||
>
|
||||
{SOURCE_TYPE_MAP[tx.source_type] || tx.source_type}
|
||||
</span>
|
||||
<span style={{ flex: 1 }}>
|
||||
{tx.description || "无描述"}
|
||||
</span>
|
||||
<span
|
||||
style={{
|
||||
fontWeight: 600,
|
||||
color:
|
||||
tx.direction === "income"
|
||||
? "var(--success)"
|
||||
: "var(--danger)",
|
||||
}}
|
||||
>
|
||||
{formatAmount(tx.amount)}
|
||||
</span>
|
||||
<span style={{ fontSize: 11 }}>
|
||||
{formatDate(tx.transaction_date)}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -422,6 +346,20 @@ export default function Review() {
|
||||
关联 {editingDeal.match_count} 笔原始交易
|
||||
</div>
|
||||
)}
|
||||
{editingDeal.ai_description && (
|
||||
<div
|
||||
style={{
|
||||
marginTop: 8,
|
||||
padding: "6px 10px",
|
||||
background: "#eef2ff",
|
||||
borderRadius: 6,
|
||||
fontSize: 12,
|
||||
color: "var(--primary)",
|
||||
}}
|
||||
>
|
||||
🤖 AI:{editingDeal.ai_description}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Show associated transactions in modal */}
|
||||
@@ -504,7 +442,7 @@ export default function Review() {
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<label>交易描述</label>
|
||||
<label>描述</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-input"
|
||||
@@ -519,22 +457,6 @@ export default function Review() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="form-group">
|
||||
<label>备注</label>
|
||||
<input
|
||||
type="text"
|
||||
className="form-input"
|
||||
value={editingDeal.review_notes || ""}
|
||||
onChange={(e) =>
|
||||
setEditingDeal({
|
||||
...editingDeal,
|
||||
review_notes: e.target.value,
|
||||
})
|
||||
}
|
||||
placeholder="人工备注(可选)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
@@ -555,7 +477,6 @@ export default function Review() {
|
||||
handleUpdateDeal(editingDeal.id, {
|
||||
category: editingDeal.category,
|
||||
ai_description: editingDeal.ai_description,
|
||||
review_notes: editingDeal.review_notes,
|
||||
reviewed: 1,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user