diff --git a/client/src/pages/Review.js b/client/src/pages/Review.js index 53a209d..d34fd3e 100644 --- a/client/src/pages/Review.js +++ b/client/src/pages/Review.js @@ -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() {
{deal.transactions && deal.transactions.length > 0 && ( - + )}
- - {/* Expanded transactions detail */} - {expandedDeals.has(deal.id) && deal.transactions && ( -
- {deal.transactions.map((tx, i) => ( -
- - {SOURCE_TYPE_MAP[tx.source_type] || tx.source_type} - - - {tx.description || "无描述"} - - - {formatAmount(tx.amount)} - - - {formatDate(tx.transaction_date)} - -
- ))} -
- )} ))} @@ -422,6 +346,20 @@ export default function Review() { 关联 {editingDeal.match_count} 笔原始交易 )} + {editingDeal.ai_description && ( +
+ 🤖 AI:{editingDeal.ai_description} +
+ )} {/* Show associated transactions in modal */} @@ -504,7 +442,7 @@ export default function Review() {
- +
-
- - - setEditingDeal({ - ...editingDeal, - review_notes: e.target.value, - }) - } - placeholder="人工备注(可选)" - /> -
-
{ // PUT /api/deals/:id — 编辑分类/确认 router.put("/:id", (req, res) => { const db = getDB(); - const { category, ai_description, reviewed, review_notes, tags } = req.body; + const { category, ai_description, reviewed, tags } = req.body; const sets = []; const params = []; if (category !== undefined) { @@ -139,10 +139,7 @@ router.put("/:id", (req, res) => { params.push(reviewed); if (reviewed) sets.push("reviewed_at = CURRENT_TIMESTAMP"); } - if (review_notes !== undefined) { - sets.push("review_notes = ?"); - params.push(review_notes); - } + if (tags !== undefined) { sets.push("tags = ?"); params.push(JSON.stringify(tags));