fix(admin): resolve typescript unused variables and undefined crmStatusMap
This commit is contained in:
1 parent
afd6904c48
commit
c7c79a2bf4
5 files changed
+7
-71
No files matched your search
@@ -36,8 +36,6 @@ import {
|
||||
FileJson,
|
||||
FolderArchive,
|
||||
Map,
|
||||
Calendar,
|
||||
Clock,
|
||||
Target,
|
||||
} from 'lucide-react'
|
||||
|
||||
|
||||
@@ -7,13 +7,9 @@ import {
|
||||
Calendar,
|
||||
MapPin,
|
||||
RefreshCw,
|
||||
Clock,
|
||||
DollarSign,
|
||||
Tag,
|
||||
Truck,
|
||||
Store,
|
||||
ChevronRight,
|
||||
UserCheck,
|
||||
ExternalLink,
|
||||
} from 'lucide-react';
|
||||
import { API_BASE } from '@homaroma/types';
|
||||
|
||||
@@ -2,8 +2,6 @@ import { useState, useEffect, useCallback, useMemo } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Target,
|
||||
Sparkles,
|
||||
AlertCircle,
|
||||
AlertTriangle,
|
||||
CheckCircle2,
|
||||
Users,
|
||||
@@ -15,12 +13,10 @@ import {
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
ExternalLink,
|
||||
MessageSquare,
|
||||
Gift,
|
||||
Flame,
|
||||
Crown,
|
||||
Tag,
|
||||
Clock,
|
||||
Zap,
|
||||
} from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -534,7 +530,8 @@ export default function RepeatCustomersActionPlanPage() {
|
||||
|
||||
const rows = filteredCustomers.map((c) => {
|
||||
const action = getActionRecommendation(c);
|
||||
const crmStatus = crmStatusMap[c.id] || 'pending';
|
||||
const mapKey = `${c.primaryChannel}:${c.identifier?.toLowerCase()}`;
|
||||
const crmStatus = crmImportedMap[mapKey]?.status || localCrmStatusMap[c.id] || 'pending';
|
||||
return [
|
||||
`"${c.identifier || ''}"`,
|
||||
`"${c.displayName || ''}"`,
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
import { useState, useEffect, useCallback, useMemo } from 'react';
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Users,
|
||||
Search,
|
||||
RefreshCw,
|
||||
PhoneCall,
|
||||
MessageSquare,
|
||||
CheckCircle2,
|
||||
Clock,
|
||||
AlertCircle,
|
||||
Tag,
|
||||
Gift,
|
||||
Flame,
|
||||
Crown,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
ExternalLink,
|
||||
@@ -21,7 +15,6 @@ import {
|
||||
X,
|
||||
History,
|
||||
TrendingUp,
|
||||
DollarSign,
|
||||
Sparkles,
|
||||
} from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@@ -76,11 +69,11 @@ export default function MarketplaceCrmPage() {
|
||||
|
||||
const [channel, setChannel] = useState<ChannelType>('all');
|
||||
const [statusFilter, setStatusFilter] = useState<CRMStatus>('all');
|
||||
const [strategyFilter, setStrategyFilter] = useState<StrategyType>('all');
|
||||
const [strategyFilter] = useState<StrategyType>('all');
|
||||
const [search, setSearch] = useState('');
|
||||
const [debouncedSearch, setDebouncedSearch] = useState('');
|
||||
const [page, setPage] = useState(1);
|
||||
const [limit, setLimit] = useState(20);
|
||||
const [limit] = useState(20);
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [customers, setCustomers] = useState<CrmCustomer[]>([]);
|
||||
@@ -284,40 +277,6 @@ export default function MarketplaceCrmPage() {
|
||||
return <span className="px-2 py-0.5 rounded text-[10px] font-semibold bg-blue-500/10 text-blue-400 border border-blue-500/20">Lazada</span>;
|
||||
};
|
||||
|
||||
const getStatusBadge = (status: string) => {
|
||||
switch (status) {
|
||||
case 'converted':
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-semibold bg-emerald-500/20 text-emerald-300 border border-emerald-500/30">
|
||||
<CheckCircle2 className="w-3.5 h-3.5 text-emerald-400" />
|
||||
ซื้อซ้ำสำเร็จ
|
||||
</span>
|
||||
);
|
||||
case 'contacted':
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-semibold bg-indigo-500/20 text-indigo-300 border border-indigo-500/30">
|
||||
<MessageSquare className="w-3.5 h-3.5 text-indigo-400" />
|
||||
ส่งโปรแล้ว
|
||||
</span>
|
||||
);
|
||||
case 'unresponsive':
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-semibold bg-slate-500/20 text-slate-300 border border-slate-500/30">
|
||||
<AlertCircle className="w-3.5 h-3.5 text-slate-400" />
|
||||
ไม่สนใจ/ไม่ตอบ
|
||||
</span>
|
||||
);
|
||||
case 'pending':
|
||||
default:
|
||||
return (
|
||||
<span className="inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-semibold bg-amber-500/20 text-amber-300 border border-amber-500/30">
|
||||
<Clock className="w-3.5 h-3.5 text-amber-400" />
|
||||
รอดำเนินการ
|
||||
</span>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const getStrategyBadge = (type: string) => {
|
||||
switch (type) {
|
||||
case 'due_restock':
|
||||
|
||||
@@ -1,33 +1,20 @@
|
||||
import { useEffect, useState, useCallback } from 'react';
|
||||
import { useParams, useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
ArrowLeft,
|
||||
Users,
|
||||
ShoppingBag,
|
||||
Clock,
|
||||
Calendar,
|
||||
DollarSign,
|
||||
Tag,
|
||||
CheckCircle2,
|
||||
AlertCircle,
|
||||
MessageSquare,
|
||||
History,
|
||||
PhoneCall,
|
||||
Save,
|
||||
ExternalLink,
|
||||
ChevronRight,
|
||||
Flame,
|
||||
Crown,
|
||||
Gift,
|
||||
Zap,
|
||||
MapPin,
|
||||
RefreshCw,
|
||||
Copy,
|
||||
Check,
|
||||
Package,
|
||||
} from 'lucide-react';
|
||||
import { API_BASE } from '@homaroma/types';
|
||||
import { fmtBaht, fmtNum } from '../../utils/thaiGeoUtils';
|
||||
import { fmtBaht } from '../../utils/thaiGeoUtils';
|
||||
|
||||
interface OrderItem {
|
||||
name: string;
|
||||
@@ -51,7 +38,6 @@ interface OrderHistory {
|
||||
|
||||
export default function MarketplaceCustomerDetailPage() {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const [searchParams] = useSearchParams();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
Reference in new issue
Block a user