fix: 完善同步生命周期并统一前端视觉
- 同步商品与订单时处理线上删除状态并联动自动化规则\n- 过滤卖家系统中的购买订单,修复订单逻辑删除与数据库迁移\n- 修复聊天新消息自动滚动,并统一前端颜色令牌与硬编码颜色检查
This commit is contained in:
1 parent
cf76b8898b
commit
526ac44453
40 files changed
+802
-242
No files matched your search
@@ -678,7 +678,7 @@ const AccountList: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
if (loading) return <div className="p-20 flex justify-center"><Loader2 className="w-8 h-8 text-[#0094f7] animate-spin"/></div>;
|
||||
if (loading) return <div className="p-20 flex justify-center"><Loader2 className="w-8 h-8 text-brand animate-spin"/></div>;
|
||||
|
||||
const filteredAccounts = accounts.filter(account => {
|
||||
const keyword = accountSearch.trim().toLowerCase();
|
||||
@@ -728,7 +728,7 @@ const AccountList: React.FC = () => {
|
||||
const runtime = runtimePresentation(account);
|
||||
const requiresLogin = account.runtime_state === 'auth_expired' || account.runtime_state === 'verification_required';
|
||||
return (
|
||||
<div key={account.id} className="ios-card rounded-xl p-6 group transition-all duration-300 hover:border-[#0094f7]">
|
||||
<div key={account.id} className="ios-card rounded-xl p-6 group transition-all duration-300 hover:border-brand">
|
||||
<div className="flex min-w-0 items-start gap-5 sm:gap-8">
|
||||
<div className="relative">
|
||||
{account.avatar_url ? (
|
||||
@@ -898,7 +898,7 @@ const AccountList: React.FC = () => {
|
||||
{deleteDialogAccount && createPortal(
|
||||
<div className="modal-overlay-centered" role="presentation">
|
||||
<div
|
||||
className="h-fit w-full max-w-[400px] self-center overflow-hidden rounded-2xl border border-white/80 bg-white shadow-[0_24px_64px_rgba(15,23,42,0.22)]"
|
||||
className="h-fit w-full max-w-[400px] self-center overflow-hidden rounded-2xl border border-white/80 bg-white shadow-modal"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="delete-account-title"
|
||||
@@ -947,7 +947,7 @@ const AccountList: React.FC = () => {
|
||||
role="progressbar"
|
||||
aria-label="正在删除账号"
|
||||
>
|
||||
<Loader2 className="h-5 w-5 flex-shrink-0 animate-spin text-[#0094f7]" />
|
||||
<Loader2 className="h-5 w-5 flex-shrink-0 animate-spin text-brand" />
|
||||
<div>
|
||||
<div className="text-sm font-extrabold text-blue-950">正在删除账号</div>
|
||||
<div className="mt-0.5 text-xs text-blue-700">正在清理关联数据,请保持页面打开…</div>
|
||||
@@ -1015,8 +1015,8 @@ const AccountList: React.FC = () => {
|
||||
: '请打开闲鱼APP扫描下方二维码'}
|
||||
</p>
|
||||
|
||||
<div className={`w-full bg-[#F7F8FA] rounded-xl mx-auto flex items-center justify-center overflow-hidden border-4 border-white shadow-inner mb-6 relative ${qrStatus === 'verification' ? 'max-w-72 min-h-64 h-auto p-2' : 'max-w-64 aspect-square'}`}>
|
||||
{qrStatus === 'loading' && <Loader2 className="w-10 h-10 text-[#0094f7] animate-spin" />}
|
||||
<div className={`w-full bg-surface-subtle rounded-xl mx-auto flex items-center justify-center overflow-hidden border-4 border-white shadow-inner mb-6 relative ${qrStatus === 'verification' ? 'max-w-72 min-h-64 h-auto p-2' : 'max-w-64 aspect-square'}`}>
|
||||
{qrStatus === 'loading' && <Loader2 className="w-10 h-10 text-brand animate-spin" />}
|
||||
{qrStatus === 'waiting' && <SquareQRCode src={qrCodeUrl} alt="闲鱼登录二维码" className="p-2" />}
|
||||
{qrStatus === 'success' && (
|
||||
<div className="absolute inset-0 bg-white/95 flex flex-col items-center justify-center text-green-600 animate-fade-in">
|
||||
@@ -1111,7 +1111,7 @@ const AccountList: React.FC = () => {
|
||||
type="button"
|
||||
onClick={() => setEditForm({ ...editForm, auto_confirm: !editForm.auto_confirm })}
|
||||
className={`w-14 h-8 rounded-full transition-colors duration-300 relative ${
|
||||
editForm.auto_confirm ? 'bg-[#0094f7]' : 'bg-gray-300'
|
||||
editForm.auto_confirm ? 'bg-brand' : 'bg-gray-300'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
@@ -1168,7 +1168,7 @@ const AccountList: React.FC = () => {
|
||||
aria-label="保存登录信息"
|
||||
disabled={longLogin.loading || longLogin.saving || !longLogin.canOpen}
|
||||
onClick={() => void handleLongLoginToggle()}
|
||||
className={`relative h-8 w-14 flex-shrink-0 rounded-full transition-colors ${longLogin.enabled ? 'bg-[#0094f7]' : 'bg-gray-300'} disabled:cursor-not-allowed disabled:opacity-50`}
|
||||
className={`relative h-8 w-14 flex-shrink-0 rounded-full transition-colors ${longLogin.enabled ? 'bg-brand' : 'bg-gray-300'} disabled:cursor-not-allowed disabled:opacity-50`}
|
||||
>
|
||||
<span className={`absolute left-1 top-1 h-6 w-6 rounded-full bg-white shadow-md transition-transform ${longLogin.enabled ? 'translate-x-6' : 'translate-x-0'}`} />
|
||||
</button>
|
||||
@@ -1206,7 +1206,7 @@ const AccountList: React.FC = () => {
|
||||
type="checkbox"
|
||||
checked={editForm.clear_password}
|
||||
onChange={(e) => setEditForm({ ...editForm, clear_password: e.target.checked, login_password: e.target.checked ? '' : editForm.login_password })}
|
||||
className="w-4 h-4 accent-[#0094f7]"
|
||||
className="w-4 h-4 accent-brand"
|
||||
/>
|
||||
<span className="text-sm font-bold text-gray-700">清空已保存密码</span>
|
||||
</label>
|
||||
@@ -1220,7 +1220,7 @@ const AccountList: React.FC = () => {
|
||||
type="button"
|
||||
onClick={() => setEditForm({ ...editForm, show_browser: !editForm.show_browser })}
|
||||
className={`w-14 h-8 rounded-full transition-colors duration-300 relative ${
|
||||
editForm.show_browser ? 'bg-[#0094f7]' : 'bg-gray-300'
|
||||
editForm.show_browser ? 'bg-brand' : 'bg-gray-300'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
@@ -1302,7 +1302,7 @@ const AccountList: React.FC = () => {
|
||||
}}
|
||||
disabled={!bindingsLoaded}
|
||||
className={`w-5 h-5 rounded-md border-2 flex items-center justify-center transition-colors flex-shrink-0 ${
|
||||
checked ? 'bg-[#0094f7] border-[#0094f7]' : 'bg-white border-gray-300'
|
||||
checked ? 'bg-brand border-brand' : 'bg-white border-gray-300'
|
||||
}`}
|
||||
>
|
||||
{checked && <Check className="w-3.5 h-3.5 text-white" />}
|
||||
@@ -1377,7 +1377,7 @@ const AccountList: React.FC = () => {
|
||||
type="button"
|
||||
onClick={() => setAiSettings({ ...aiSettings, ai_enabled: !aiSettings.ai_enabled })}
|
||||
className={`w-14 h-8 rounded-full transition-colors duration-300 relative ${
|
||||
aiSettings.ai_enabled ? 'bg-[#0094f7]' : 'bg-gray-300'
|
||||
aiSettings.ai_enabled ? 'bg-brand' : 'bg-gray-300'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
|
||||
@@ -313,7 +313,7 @@ const CardList: React.FC = () => {
|
||||
</div>
|
||||
|
||||
<div className="ios-card rounded-xl overflow-hidden shadow-lg border-0 bg-white">
|
||||
<div className="flex flex-col gap-3 border-b border-gray-50 bg-[#FAFAFA] p-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="flex flex-col gap-3 border-b border-gray-50 bg-surface-muted p-4 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="flex flex-1 flex-col gap-3 sm:flex-row">
|
||||
<div className="relative sm:w-48">
|
||||
<SlidersHorizontal className="pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400" />
|
||||
@@ -375,7 +375,7 @@ const CardList: React.FC = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<tr key={card.id} className="hover:bg-[#FFFDE7]/50 transition-colors group">
|
||||
<tr key={card.id} className="hover:bg-warning-50/50 transition-colors group">
|
||||
<td className="px-5 py-5 align-middle">
|
||||
<div className="flex items-center gap-2.5">
|
||||
<div className="shrink-0 rounded-xl bg-gray-50 p-2 transition-colors group-hover:bg-white">
|
||||
@@ -667,7 +667,7 @@ const CardList: React.FC = () => {
|
||||
type="button"
|
||||
onClick={() => setEditForm({ ...editForm, enabled: !editForm.enabled })}
|
||||
className={`w-14 h-8 rounded-full transition-colors duration-300 relative ${
|
||||
editForm.enabled ? 'bg-[#0094f7]' : 'bg-gray-300'
|
||||
editForm.enabled ? 'bg-brand' : 'bg-gray-300'
|
||||
}`}
|
||||
>
|
||||
<span
|
||||
@@ -739,7 +739,7 @@ const CardList: React.FC = () => {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setAddForm({ ...addForm, type: 'data', content: '' })}
|
||||
className={`p-3 rounded-xl font-bold transition-all ${addForm.type === 'data' ? 'bg-[#0094f7] text-white' : 'bg-gray-100 text-gray-600 hover:bg-gray-200'}`}
|
||||
className={`p-3 rounded-xl font-bold transition-all ${addForm.type === 'data' ? 'bg-brand text-white' : 'bg-gray-100 text-gray-600 hover:bg-gray-200'}`}
|
||||
>
|
||||
<CreditCard className="w-5 h-5 mx-auto mb-1" />
|
||||
批量库存
|
||||
@@ -747,7 +747,7 @@ const CardList: React.FC = () => {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setAddForm({ ...addForm, type: 'text', content: '' })}
|
||||
className={`p-3 rounded-xl font-bold transition-all ${addForm.type === 'text' ? 'bg-[#0094f7] text-white' : 'bg-gray-100 text-gray-600'}`}
|
||||
className={`p-3 rounded-xl font-bold transition-all ${addForm.type === 'text' ? 'bg-brand text-white' : 'bg-gray-100 text-gray-600'}`}
|
||||
>
|
||||
<FileText className="w-5 h-5 mx-auto mb-1" />
|
||||
文本
|
||||
@@ -755,7 +755,7 @@ const CardList: React.FC = () => {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setAddForm({ ...addForm, type: 'image', content: '' })}
|
||||
className={`p-3 rounded-xl font-bold transition-all ${addForm.type === 'image' ? 'bg-[#0094f7] text-white' : 'bg-gray-100 text-gray-600'}`}
|
||||
className={`p-3 rounded-xl font-bold transition-all ${addForm.type === 'image' ? 'bg-brand text-white' : 'bg-gray-100 text-gray-600'}`}
|
||||
>
|
||||
<ImageIcon className="w-5 h-5 mx-auto mb-1" />
|
||||
图片
|
||||
@@ -792,7 +792,7 @@ const CardList: React.FC = () => {
|
||||
/>
|
||||
)}
|
||||
{addForm.type === 'data' && (
|
||||
<p className="text-xs text-gray-500">当前库存:<span className="font-bold text-[#0094f7]">{addForm.content.split('\n').filter(line => line.trim()).length}</span> 条</p>
|
||||
<p className="text-xs text-gray-500">当前库存:<span className="font-bold text-brand">{addForm.content.split('\n').filter(line => line.trim()).length}</span> 条</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -879,14 +879,14 @@ const CardList: React.FC = () => {
|
||||
<div className="flex flex-wrap gap-2 p-2 bg-gray-100/50 rounded-2xl">
|
||||
<button
|
||||
onClick={() => setBatchTab('create')}
|
||||
className={`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${batchTab === 'create' ? 'bg-[#0094f7] text-white shadow-md' : 'bg-white text-gray-600 hover:bg-gray-50'}`}
|
||||
className={`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${batchTab === 'create' ? 'bg-brand text-white shadow-md' : 'bg-white text-gray-600 hover:bg-gray-50'}`}
|
||||
>
|
||||
<ListPlus className="w-4 h-4" />
|
||||
批量创建卡密组
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setBatchTab('append')}
|
||||
className={`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${batchTab === 'append' ? 'bg-[#0094f7] text-white shadow-md' : 'bg-white text-gray-600 hover:bg-gray-50'}`}
|
||||
className={`flex-1 inline-flex items-center justify-center gap-2 px-4 py-2.5 rounded-xl text-sm font-bold transition-all ${batchTab === 'append' ? 'bg-brand text-white shadow-md' : 'bg-white text-gray-600 hover:bg-gray-50'}`}
|
||||
>
|
||||
<Upload className="w-4 h-4" />
|
||||
往单个组充卡密
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
||||
import {
|
||||
AlertCircle, Check, CheckCheck, ImagePlus, Loader2, MessageCircleMore, RefreshCw,
|
||||
Search, Send, Smile, UserRound, Wifi, WifiOff,
|
||||
@@ -53,6 +53,9 @@ const Chat: React.FC = () => {
|
||||
const activeAccountRef = useRef('');
|
||||
const activeChatRef = useRef('');
|
||||
const scrollRef = useRef<HTMLDivElement | null>(null);
|
||||
const scrollContextRef = useRef({ accountID: '', chatID: '' });
|
||||
const shouldScrollToBottomRef = useRef(true);
|
||||
const skipNextMessageScrollRef = useRef(false);
|
||||
const imageInputRef = useRef<HTMLInputElement | null>(null);
|
||||
const refreshedAccountsRef = useRef(new Set<string>());
|
||||
|
||||
@@ -177,6 +180,7 @@ const Chat: React.FC = () => {
|
||||
if (!activeAccountID || !activeChatID || olderLoading || !hasOlder) return;
|
||||
const container = scrollRef.current;
|
||||
const previousHeight = container?.scrollHeight || 0;
|
||||
skipNextMessageScrollRef.current = true;
|
||||
setOlderLoading(true);
|
||||
setError('');
|
||||
try {
|
||||
@@ -192,6 +196,7 @@ const Chat: React.FC = () => {
|
||||
if (container) container.scrollTop += container.scrollHeight - previousHeight;
|
||||
});
|
||||
} catch (loadError) {
|
||||
skipNextMessageScrollRef.current = false;
|
||||
setError(loadError instanceof Error ? loadError.message : '加载历史消息失败');
|
||||
} finally {
|
||||
setOlderLoading(false);
|
||||
@@ -261,10 +266,28 @@ const Chat: React.FC = () => {
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const handleMessageScroll = () => {
|
||||
const container = scrollRef.current;
|
||||
if (container) container.scrollTop = container.scrollHeight;
|
||||
}, [activeAccountID, activeChatID, messagesLoading]);
|
||||
if (!container) return;
|
||||
const distanceFromBottom = container.scrollHeight - container.scrollTop - container.clientHeight;
|
||||
shouldScrollToBottomRef.current = distanceFromBottom <= 48;
|
||||
};
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const contextChanged = scrollContextRef.current.accountID !== activeAccountID
|
||||
|| scrollContextRef.current.chatID !== activeChatID;
|
||||
scrollContextRef.current = { accountID: activeAccountID, chatID: activeChatID };
|
||||
if (contextChanged) shouldScrollToBottomRef.current = true;
|
||||
|
||||
const container = scrollRef.current;
|
||||
if (!container) return;
|
||||
|
||||
if (skipNextMessageScrollRef.current) {
|
||||
skipNextMessageScrollRef.current = false;
|
||||
return;
|
||||
}
|
||||
if (messagesLoading || shouldScrollToBottomRef.current) container.scrollTop = container.scrollHeight;
|
||||
}, [activeAccountID, activeChatID, messages, messagesLoading]);
|
||||
|
||||
const activeAccount = accounts.find(account => account.id === activeAccountID);
|
||||
const activeSessions = sessionsByAccount[activeAccountID] || [];
|
||||
@@ -343,7 +366,7 @@ const Chat: React.FC = () => {
|
||||
if (loading) return <div className="flex h-[calc(100vh-4rem)] items-center justify-center"><Loader2 className="h-8 w-8 animate-spin text-sky-500" /></div>;
|
||||
|
||||
return (
|
||||
<section className="flex h-[calc(100vh-4rem)] min-h-[560px] flex-col overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-[0_16px_45px_rgba(15,23,42,0.06)]">
|
||||
<section className="flex h-[calc(100vh-4rem)] min-h-[560px] flex-col overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-chat">
|
||||
<header className="border-b border-slate-200 bg-slate-50/70 px-5 pt-4">
|
||||
<div className="mb-3 flex items-center justify-between gap-4">
|
||||
<div>
|
||||
@@ -400,7 +423,7 @@ const Chat: React.FC = () => {
|
||||
<div className="min-h-0 flex-1 overflow-y-auto">
|
||||
{filteredSessions.map(session => (
|
||||
<button key={session.chat_id} type="button" onClick={() => setActiveChatID(session.chat_id)}
|
||||
className={`flex w-full gap-3 border-b border-slate-100 p-4 text-left transition-colors ${session.chat_id === activeChatID ? 'bg-white shadow-[inset_3px_0_0_#0ea5e9]' : 'hover:bg-white/80'}`}>
|
||||
className={`flex w-full gap-3 border-b border-slate-100 p-4 text-left transition-colors ${session.chat_id === activeChatID ? 'bg-white shadow-chat-active' : 'hover:bg-white/80'}`}>
|
||||
<div className="flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-full bg-slate-200 text-slate-500">
|
||||
{session.buyer_avatar_url ? <img src={session.buyer_avatar_url} alt="" className="h-full w-full object-cover" /> : <UserRound className="h-5 w-5" />}
|
||||
</div>
|
||||
@@ -427,7 +450,7 @@ const Chat: React.FC = () => {
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main className="flex min-h-0 min-w-0 flex-col overflow-hidden bg-[#f7f8fa]">
|
||||
<main className="flex min-h-0 min-w-0 flex-col overflow-hidden bg-surface-subtle">
|
||||
{selectedSession ? (
|
||||
<>
|
||||
<div className="flex h-16 shrink-0 items-center border-b border-slate-200 bg-white px-5">
|
||||
@@ -439,7 +462,7 @@ const Chat: React.FC = () => {
|
||||
{activeAccount?.runtime_state === 'online' ? '账号在线' : '账号离线'}
|
||||
</span>
|
||||
</div>
|
||||
<div ref={scrollRef} className="min-h-0 flex-1 space-y-5 overflow-y-auto px-6 py-5">
|
||||
<div ref={scrollRef} onScroll={handleMessageScroll} className="min-h-0 flex-1 space-y-5 overflow-y-auto px-6 py-5">
|
||||
{messagesLoading ? <div className="flex justify-center py-12"><Loader2 className="h-6 w-6 animate-spin text-sky-500" /></div> : <>
|
||||
{hasOlder && <div className="flex justify-center pb-1">
|
||||
<button type="button" onClick={() => void loadOlderMessages()} disabled={olderLoading}
|
||||
@@ -490,7 +513,7 @@ const Chat: React.FC = () => {
|
||||
</>}
|
||||
</div>
|
||||
{error && <div className="border-t border-red-100 bg-red-50 px-5 py-2 text-xs font-medium text-red-700">{error}</div>}
|
||||
<div className="relative z-10 shrink-0 border-t border-slate-200 bg-white p-4 shadow-[0_-8px_24px_rgba(15,23,42,0.04)]">
|
||||
<div className="relative z-10 shrink-0 border-t border-slate-200 bg-white p-4 shadow-chat-input">
|
||||
<div className="mb-2 flex items-center gap-1">
|
||||
<div className="relative">
|
||||
<button type="button" onClick={() => setEmojiOpen(value => !value)} disabled={sending || activeAccount?.runtime_state !== 'online'} className="rounded-lg p-2 text-slate-500 hover:bg-sky-50 hover:text-sky-600 disabled:opacity-40" title="闲鱼表情"><Smile className="h-5 w-5" /></button>
|
||||
|
||||
@@ -33,9 +33,8 @@ describe('Dashboard presentation safeguards', () => {
|
||||
expect(globalStyles).toContain('.dashboard-pie-chart .recharts-sector:focus');
|
||||
expect(dashboardSource).toContain('dashboard-revenue-chart h-[350px] w-full');
|
||||
expect(dashboardSource).toContain('activeBar={false}');
|
||||
expect(dashboardSource).not.toContain('stroke="#000000"');
|
||||
expect(dashboardSource).not.toContain("['#0094f7', '#FCD34D', '#0071e3']");
|
||||
expect(dashboardSource).toContain('fill="#0094f7"');
|
||||
expect(dashboardSource).not.toMatch(/#[0-9A-Fa-f]{3,8}/);
|
||||
expect(dashboardSource).toContain("fill={cssColor('brand')}");
|
||||
expect(globalStyles).toContain('.dashboard-revenue-chart .recharts-rectangle:focus');
|
||||
expect(globalStyles).toContain('.dashboard-revenue-chart .recharts-curve:focus');
|
||||
expect(globalStyles).toContain('.dashboard-revenue-chart [class*="recharts-zIndex-layer_"]:focus');
|
||||
|
||||
@@ -6,11 +6,17 @@ import { formatLocalDateTime } from '../dateTime';
|
||||
import { TrendingUp, Users, ShoppingCart, AlertCircle, DollarSign, Activity, Package, ArrowUpRight, Calendar, X, BarChart3, PackageCheck, ExternalLink, Eye, Edit } from 'lucide-react';
|
||||
import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, BarChart, Bar, PieChart, Pie, Cell, Legend } from 'recharts';
|
||||
|
||||
const cssColor = (token: string, alpha?: number) => (
|
||||
alpha === undefined
|
||||
? `rgb(var(--color-${token}))`
|
||||
: `rgb(var(--color-${token}) / ${alpha})`
|
||||
);
|
||||
|
||||
// 状态徽章组件
|
||||
export const StatusBadge: React.FC<{ status: OrderStatus }> = ({ status }) => {
|
||||
const styles = {
|
||||
processing: 'bg-blue-100 text-blue-800',
|
||||
pending_ship: 'bg-[#0094f7] text-white',
|
||||
pending_ship: 'bg-brand text-white',
|
||||
shipped: 'bg-blue-100 text-blue-700',
|
||||
completed: 'bg-green-100 text-green-700',
|
||||
cancelled: 'bg-gray-100 text-gray-500',
|
||||
@@ -42,7 +48,7 @@ const StatCard: React.FC<{ title: string; value: string | number; icon: React.El
|
||||
<div className={`p-4 rounded-2xl ${colorClass} bg-opacity-10 backdrop-blur-sm`}>
|
||||
<Icon className={`w-6 h-6 ${colorClass.replace('bg-', 'text-')}`} />
|
||||
</div>
|
||||
{trend && <span className="text-xs font-bold text-white bg-[#0094f7] px-3 py-1.5 rounded-full flex items-center gap-1 shadow-sm">
|
||||
{trend && <span className="text-xs font-bold text-white bg-brand px-3 py-1.5 rounded-full flex items-center gap-1 shadow-sm">
|
||||
<TrendingUp className="w-3 h-3" /> {trend}
|
||||
</span>}
|
||||
</div>
|
||||
@@ -75,7 +81,13 @@ const Dashboard: React.FC = () => {
|
||||
const rangeRequestSequence = useRef(0);
|
||||
|
||||
// 颜色配置
|
||||
const COLORS = ['#0094f7', '#3B82F6', '#10B981', '#F59E0B', '#8B5CF6'];
|
||||
const COLORS = [
|
||||
cssColor('brand'),
|
||||
cssColor('brand-highlight'),
|
||||
cssColor('success-500'),
|
||||
cssColor('warning-500'),
|
||||
cssColor('accent-500'),
|
||||
];
|
||||
const formatCurrency = (value: number) => `¥${Number(value || 0).toLocaleString('zh-CN', { maximumFractionDigits: 2 })}`;
|
||||
const loadRange = async (range: TimeRange) => {
|
||||
let currentRange;
|
||||
@@ -159,7 +171,7 @@ const Dashboard: React.FC = () => {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (!stats || !analytics) return <div className="p-8 flex justify-center text-gray-400"><Activity className="w-8 h-8 animate-spin text-[#0094f7]" /></div>;
|
||||
if (!stats || !analytics) return <div className="p-8 flex justify-center text-gray-400"><Activity className="w-8 h-8 animate-spin text-brand" /></div>;
|
||||
|
||||
const chartData = analytics.daily_stats?.map(d => ({
|
||||
name: d.date.slice(5), // MM-DD
|
||||
@@ -267,7 +279,7 @@ const Dashboard: React.FC = () => {
|
||||
onClick={() => setTimeRange(option.key)}
|
||||
className={`px-5 py-2.5 rounded-xl text-sm font-bold transition-all ${
|
||||
timeRange === option.key
|
||||
? 'bg-[#0094f7] text-white shadow-md'
|
||||
? 'bg-brand text-white shadow-md'
|
||||
: 'bg-white text-gray-600 hover:text-black hover:bg-gray-50'
|
||||
}`}
|
||||
>
|
||||
@@ -280,14 +292,14 @@ const Dashboard: React.FC = () => {
|
||||
type="date"
|
||||
value={customStartDate}
|
||||
onChange={(e) => setCustomStartDate(e.target.value)}
|
||||
className="px-3 py-2 rounded-xl text-sm border border-gray-200 focus:outline-none focus:ring-2 focus:ring-[#0094f7]"
|
||||
className="px-3 py-2 rounded-xl text-sm border border-gray-200 focus:outline-none focus:ring-2 focus:ring-brand"
|
||||
/>
|
||||
<span className="self-center text-gray-400">-</span>
|
||||
<input
|
||||
type="date"
|
||||
value={customEndDate}
|
||||
onChange={(e) => setCustomEndDate(e.target.value)}
|
||||
className="px-3 py-2 rounded-xl text-sm border border-gray-200 focus:outline-none focus:ring-2 focus:ring-[#0094f7]"
|
||||
className="px-3 py-2 rounded-xl text-sm border border-gray-200 focus:outline-none focus:ring-2 focus:ring-brand"
|
||||
/>
|
||||
<button
|
||||
onClick={() => {
|
||||
@@ -356,26 +368,26 @@ const Dashboard: React.FC = () => {
|
||||
dataKey="name"
|
||||
axisLine={false}
|
||||
tickLine={false}
|
||||
tick={{fill: '#374151', fontSize: 14, fontWeight: 600}}
|
||||
tick={{fill: cssColor('neutral-700'), fontSize: 14, fontWeight: 600}}
|
||||
dy={10}
|
||||
/>
|
||||
<YAxis
|
||||
axisLine={false}
|
||||
tickLine={false}
|
||||
tick={{fill: '#9CA3AF', fontSize: 13, fontWeight: 500}}
|
||||
tick={{fill: cssColor('neutral-400'), fontSize: 13, fontWeight: 500}}
|
||||
tickFormatter={(value) => `¥${value}`}
|
||||
/>
|
||||
<Tooltip
|
||||
contentStyle={{
|
||||
backgroundColor: '#fff',
|
||||
backgroundColor: cssColor('white'),
|
||||
borderRadius: '8px',
|
||||
border: '1px solid #e5e7eb',
|
||||
boxShadow: '0 10px 25px -5px rgba(0, 0, 0, 0.1)',
|
||||
border: `1px solid ${cssColor('neutral-200')}`,
|
||||
boxShadow: 'var(--shadow-xl)',
|
||||
padding: '12px 16px'
|
||||
}}
|
||||
labelStyle={{ color: '#6b7280', fontWeight: 500 }}
|
||||
itemStyle={{ color: '#0094f7', fontWeight: 600 }}
|
||||
cursor={{ fill: 'rgba(0, 148, 247, 0.08)' }}
|
||||
labelStyle={{ color: cssColor('neutral-500'), fontWeight: 500 }}
|
||||
itemStyle={{ color: cssColor('brand'), fontWeight: 600 }}
|
||||
cursor={{ fill: cssColor('brand', 0.08) }}
|
||||
formatter={(value) => {
|
||||
const num = Number(value);
|
||||
return [`¥${num.toFixed(2)}`, '营收'];
|
||||
@@ -383,7 +395,7 @@ const Dashboard: React.FC = () => {
|
||||
/>
|
||||
<Bar
|
||||
dataKey="amount"
|
||||
fill="#0094f7"
|
||||
fill={cssColor('brand')}
|
||||
maxBarSize={72}
|
||||
radius={[12, 12, 0, 0]}
|
||||
activeBar={false}
|
||||
@@ -393,7 +405,7 @@ const Dashboard: React.FC = () => {
|
||||
{chartData.map((_, index) => (
|
||||
<Cell
|
||||
key={`cell-${index}`}
|
||||
fill="#0094f7"
|
||||
fill={cssColor('brand')}
|
||||
stroke="none"
|
||||
strokeWidth={0}
|
||||
/>
|
||||
@@ -407,36 +419,36 @@ const Dashboard: React.FC = () => {
|
||||
<AreaChart data={chartData} margin={{ top: 10, right: 10, left: -20, bottom: 0 }}>
|
||||
<defs>
|
||||
<linearGradient id="colorAmount" x1="0" y1="0" x2="0" y2="1">
|
||||
<stop offset="5%" stopColor="#0094f7" stopOpacity={0.5}/>
|
||||
<stop offset="95%" stopColor="#0094f7" stopOpacity={0}/>
|
||||
<stop offset="5%" stopColor={cssColor('brand')} stopOpacity={0.5}/>
|
||||
<stop offset="95%" stopColor={cssColor('brand')} stopOpacity={0}/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<XAxis
|
||||
dataKey="name"
|
||||
axisLine={false}
|
||||
tickLine={false}
|
||||
tick={{fill: '#9CA3AF', fontSize: 13, fontWeight: 500}}
|
||||
tick={{fill: cssColor('neutral-400'), fontSize: 13, fontWeight: 500}}
|
||||
dy={15}
|
||||
/>
|
||||
<YAxis
|
||||
axisLine={false}
|
||||
tickLine={false}
|
||||
tick={{fill: '#9CA3AF', fontSize: 13, fontWeight: 500}}
|
||||
tick={{fill: cssColor('neutral-400'), fontSize: 13, fontWeight: 500}}
|
||||
/>
|
||||
<CartesianGrid vertical={false} stroke="#F3F4F6" strokeDasharray="3 3" />
|
||||
<CartesianGrid vertical={false} stroke={cssColor('neutral-100')} strokeDasharray="3 3" />
|
||||
<Tooltip
|
||||
contentStyle={{
|
||||
backgroundColor: '#fff',
|
||||
backgroundColor: cssColor('white'),
|
||||
borderRadius: '8px',
|
||||
border: '1px solid #e5e7eb',
|
||||
boxShadow: '0 10px 25px -5px rgba(0, 0, 0, 0.1)',
|
||||
border: `1px solid ${cssColor('neutral-200')}`,
|
||||
boxShadow: 'var(--shadow-xl)',
|
||||
padding: '12px 16px'
|
||||
}}
|
||||
labelStyle={{ color: '#6b7280', fontWeight: 500 }}
|
||||
itemStyle={{ color: '#0094f7', fontWeight: 600 }}
|
||||
cursor={{ stroke: '#0094f7', strokeWidth: 2, strokeDasharray: '4 4' }}
|
||||
labelStyle={{ color: cssColor('neutral-500'), fontWeight: 500 }}
|
||||
itemStyle={{ color: cssColor('brand'), fontWeight: 600 }}
|
||||
cursor={{ stroke: cssColor('brand'), strokeWidth: 2, strokeDasharray: '4 4' }}
|
||||
/>
|
||||
<Area type="monotone" dataKey="amount" stroke="#0094f7" strokeWidth={4} fillOpacity={1} fill="url(#colorAmount)" activeDot={{ r: 8, fill: '#fff', stroke: "#0094f7", strokeWidth: 2 }} />
|
||||
<Area type="monotone" dataKey="amount" stroke={cssColor('brand')} strokeWidth={4} fillOpacity={1} fill="url(#colorAmount)" activeDot={{ r: 8, fill: cssColor('white'), stroke: cssColor('brand'), strokeWidth: 2 }} />
|
||||
</AreaChart>
|
||||
</ResponsiveContainer>
|
||||
)}
|
||||
@@ -466,7 +478,7 @@ const Dashboard: React.FC = () => {
|
||||
</div>
|
||||
<div className="h-3 rounded-full bg-gray-100 overflow-hidden">
|
||||
<div
|
||||
className="h-full rounded-full bg-[#0094f7]"
|
||||
className="h-full rounded-full bg-brand"
|
||||
style={{ width: `${Math.max(8, (item.sales / maxProductSales) * 100)}%` }}
|
||||
/>
|
||||
</div>
|
||||
@@ -516,17 +528,17 @@ const Dashboard: React.FC = () => {
|
||||
formatter={(value) => `${Number(value || 0)} 单`}
|
||||
wrapperStyle={{ zIndex: 30, outline: 'none' }}
|
||||
contentStyle={{
|
||||
backgroundColor: '#fff',
|
||||
border: '1px solid #e5e7eb',
|
||||
backgroundColor: cssColor('white'),
|
||||
border: `1px solid ${cssColor('neutral-200')}`,
|
||||
borderRadius: '10px',
|
||||
boxShadow: '0 8px 20px rgba(15, 23, 42, 0.08)'
|
||||
boxShadow: 'var(--shadow-md)'
|
||||
}}
|
||||
/>
|
||||
<Legend
|
||||
verticalAlign="bottom"
|
||||
height={36}
|
||||
iconType="circle"
|
||||
formatter={(value) => <span style={{ color: '#6B7280', fontWeight: 500 }}>{value}</span>}
|
||||
formatter={(value) => <span style={{ color: cssColor('neutral-500'), fontWeight: 500 }}>{value}</span>}
|
||||
/>
|
||||
</PieChart>
|
||||
</ResponsiveContainer>
|
||||
@@ -544,7 +556,7 @@ const Dashboard: React.FC = () => {
|
||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
||||
{/* 参与统计的订单列表 */}
|
||||
<div className="lg:col-span-2 ios-card p-0 rounded-xl border-0 bg-white overflow-hidden flex flex-col">
|
||||
<div className="p-6 border-b border-gray-50 flex justify-between items-center bg-[#FAFAFA]">
|
||||
<div className="p-6 border-b border-gray-50 flex justify-between items-center bg-surface-muted">
|
||||
<div>
|
||||
<h3 className="font-bold text-lg text-gray-900">参与统计的订单</h3>
|
||||
{validOrdersTruncated && (
|
||||
@@ -603,7 +615,7 @@ const Dashboard: React.FC = () => {
|
||||
</thead>
|
||||
<tbody className="divide-y divide-gray-50">
|
||||
{filteredValidOrders.map((order) => (
|
||||
<tr key={order.order_id} className="hover:bg-[#FFFDE7]/50 transition-colors group">
|
||||
<tr key={order.order_id} className="hover:bg-warning-50/50 transition-colors group">
|
||||
<td className="px-6 py-4">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-12 h-12 rounded-xl bg-gray-100 overflow-hidden shadow-sm border border-gray-100 flex-shrink-0">
|
||||
@@ -687,10 +699,10 @@ const Dashboard: React.FC = () => {
|
||||
<Tooltip
|
||||
wrapperStyle={{ zIndex: 30, outline: 'none' }}
|
||||
contentStyle={{
|
||||
backgroundColor: '#fff',
|
||||
border: '1px solid #e5e7eb',
|
||||
backgroundColor: cssColor('white'),
|
||||
border: `1px solid ${cssColor('neutral-200')}`,
|
||||
borderRadius: '6px',
|
||||
boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1)'
|
||||
boxShadow: 'var(--shadow-md)'
|
||||
}}
|
||||
formatter={(value) => `¥${Number(value || 0).toLocaleString()}`}
|
||||
/>
|
||||
|
||||
@@ -638,14 +638,14 @@ const ItemList: React.FC<ItemListProps> = ({ onConfigureDelivery }) => {
|
||||
</button>
|
||||
<button
|
||||
onClick={openPublishModal}
|
||||
className="px-5 py-3 rounded-2xl font-bold bg-emerald-600 text-white hover:bg-emerald-700 transition-colors flex items-center gap-2 shadow-lg shadow-emerald-100"
|
||||
className="px-5 py-3 rounded-2xl font-bold bg-emerald-500 text-white hover:bg-emerald-600 transition-colors flex items-center gap-2 shadow-lg shadow-emerald-100"
|
||||
>
|
||||
<PackagePlus className="w-4 h-4" />
|
||||
发布商品
|
||||
</button>
|
||||
<button
|
||||
onClick={() => void openBatchModal()}
|
||||
className="px-5 py-3 rounded-2xl font-bold bg-blue-600 text-white hover:bg-blue-700 transition-colors flex items-center gap-2 shadow-lg shadow-blue-100"
|
||||
className="px-5 py-3 rounded-2xl font-bold bg-brand text-white hover:bg-brand-highlight transition-colors flex items-center gap-2 shadow-lg shadow-blue-100"
|
||||
>
|
||||
<UploadCloud className="w-4 h-4" />
|
||||
{recentBatch && ['running', 'canceling'].includes(recentBatch.status) ? '继续批量任务' : '批量铺货'}
|
||||
@@ -670,7 +670,7 @@ const ItemList: React.FC<ItemListProps> = ({ onConfigureDelivery }) => {
|
||||
<div className="absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity z-10">
|
||||
<button
|
||||
onClick={() => handleEdit(item)}
|
||||
className="p-1.5 bg-white/90 backdrop-blur rounded-lg shadow-md text-gray-600 hover:bg-[#0094f7] hover:text-white transition-colors"
|
||||
className="p-1.5 bg-white/90 backdrop-blur rounded-lg shadow-md text-gray-600 hover:bg-brand hover:text-white transition-colors"
|
||||
title="编辑"
|
||||
>
|
||||
<Edit className="w-3.5 h-3.5" />
|
||||
@@ -710,7 +710,7 @@ const ItemList: React.FC<ItemListProps> = ({ onConfigureDelivery }) => {
|
||||
<div className="space-y-2 mt-auto">
|
||||
<button
|
||||
onClick={() => onConfigureDelivery(item)}
|
||||
className={`w-full flex items-center justify-between gap-1 px-2.5 py-2 rounded-lg text-[11px] font-extrabold transition-all ${hasRule ? 'bg-gray-900 text-white hover:bg-black' : 'bg-[#0094f7] text-white hover:bg-[#0071e3] shadow-md shadow-blue-100'}`}
|
||||
className={`w-full flex items-center justify-between gap-1 px-2.5 py-2 rounded-lg text-[11px] font-extrabold transition-all ${hasRule ? 'bg-gray-900 text-white hover:bg-black' : 'bg-brand text-white hover:bg-brand-highlight shadow-md shadow-blue-100'}`}
|
||||
>
|
||||
<span className="flex items-center gap-1.5"><Link2 className="w-3.5 h-3.5" />{hasRule ? '查看发货规则' : '关联发货规则'}</span>
|
||||
<ArrowRight className="w-3.5 h-3.5" />
|
||||
@@ -892,7 +892,7 @@ const ItemList: React.FC<ItemListProps> = ({ onConfigureDelivery }) => {
|
||||
</div>
|
||||
</div>
|
||||
<div className="modal-footer">
|
||||
<button disabled={publishing} onClick={handlePublishItem} className="w-full bg-emerald-600 hover:bg-emerald-700 disabled:opacity-60 text-white px-6 py-3.5 rounded-xl font-bold flex items-center justify-center gap-2">
|
||||
<button disabled={publishing} onClick={handlePublishItem} className="w-full bg-emerald-500 hover:bg-emerald-600 disabled:opacity-60 text-white px-6 py-3.5 rounded-xl font-bold flex items-center justify-center gap-2">
|
||||
<PackagePlus className="w-4 h-4" />
|
||||
{publishing ? '正在发布...' : '发布到闲鱼'}
|
||||
</button>
|
||||
|
||||
@@ -394,7 +394,7 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
{/* 说明 */}
|
||||
<div className="ios-card rounded-xl p-5 bg-blue-50/50 border border-blue-100">
|
||||
<div className="flex items-start gap-3">
|
||||
<Bell className="w-5 h-5 text-[#0094f7] mt-0.5 flex-shrink-0" />
|
||||
<Bell className="w-5 h-5 text-brand mt-0.5 flex-shrink-0" />
|
||||
<div className="text-sm text-gray-700 leading-6">
|
||||
配置通知渠道并在「账号管理 → 编辑」里绑定后,以下事件会主动推送到该账号绑定的渠道:
|
||||
<ul className="mt-2 space-y-1 text-gray-600">
|
||||
@@ -409,7 +409,7 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
{/* 渠道列表 */}
|
||||
{loading ? (
|
||||
<div className="flex justify-center py-20">
|
||||
<Loader2 className="w-8 h-8 text-[#0094f7] animate-spin" />
|
||||
<Loader2 className="w-8 h-8 text-brand animate-spin" />
|
||||
</div>
|
||||
) : channels.length === 0 ? (
|
||||
<div className="ios-card rounded-xl p-12 bg-white text-center">
|
||||
@@ -454,7 +454,7 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
<button
|
||||
onClick={() => handleTest(ch)}
|
||||
disabled={testingId === ch.id}
|
||||
className="px-3 py-1.5 rounded-lg text-xs font-bold bg-blue-50 text-[#0094f7] hover:bg-blue-100 transition-colors flex items-center gap-1 disabled:opacity-50"
|
||||
className="px-3 py-1.5 rounded-lg text-xs font-bold bg-blue-50 text-brand hover:bg-blue-100 transition-colors flex items-center gap-1 disabled:opacity-50"
|
||||
>
|
||||
{testingId === ch.id ? <Loader2 className="w-3 h-3 animate-spin" /> : <Send className="w-3 h-3" />}
|
||||
测试
|
||||
@@ -639,10 +639,10 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
key={t}
|
||||
type="button"
|
||||
onClick={() => setForm({ ...form, type: t, config: {} })}
|
||||
className={`p-3 rounded-xl border-2 flex flex-col items-center gap-1.5 transition-all ${selected ? 'border-[#0094f7] bg-blue-50' : 'border-gray-100 hover:border-gray-300'}`}
|
||||
className={`p-3 rounded-xl border-2 flex flex-col items-center gap-1.5 transition-all ${selected ? 'border-brand bg-blue-50' : 'border-gray-100 hover:border-gray-300'}`}
|
||||
>
|
||||
<TIcon className={`w-5 h-5 ${selected ? 'text-[#0094f7]' : 'text-gray-500'}`} />
|
||||
<span className={`text-xs font-bold ${selected ? 'text-[#0094f7]' : 'text-gray-600'}`}>{m.label}</span>
|
||||
<TIcon className={`w-5 h-5 ${selected ? 'text-brand' : 'text-gray-500'}`} />
|
||||
<span className={`text-xs font-bold ${selected ? 'text-brand' : 'text-gray-600'}`}>{m.label}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
@@ -712,7 +712,7 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
: enableCustomSMTP(form.config, smtp),
|
||||
});
|
||||
}}
|
||||
className={`relative h-7 w-12 shrink-0 rounded-full transition-colors ${form.config.use_custom_smtp === true ? 'bg-[#0094f7]' : 'bg-gray-300'}`}
|
||||
className={`relative h-7 w-12 shrink-0 rounded-full transition-colors ${form.config.use_custom_smtp === true ? 'bg-brand' : 'bg-gray-300'}`}
|
||||
aria-label="使用独立 SMTP"
|
||||
>
|
||||
<span className={`absolute left-1 top-1 h-5 w-5 rounded-full bg-white shadow-sm transition-transform ${form.config.use_custom_smtp === true ? 'translate-x-5' : ''}`} />
|
||||
@@ -839,13 +839,13 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
: [...form.event_types, event.value];
|
||||
setForm({ ...form, event_types: next });
|
||||
}}
|
||||
className={`text-left rounded-xl border px-3 py-2.5 transition-colors ${checked ? 'border-[#0094f7] bg-blue-50' : 'border-gray-100 hover:border-gray-300'}`}
|
||||
className={`text-left rounded-xl border px-3 py-2.5 transition-colors ${checked ? 'border-brand bg-blue-50' : 'border-gray-100 hover:border-gray-300'}`}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<span className={`w-4 h-4 rounded border flex items-center justify-center ${checked ? 'bg-[#0094f7] border-[#0094f7]' : 'border-gray-300'}`}>
|
||||
<span className={`w-4 h-4 rounded border flex items-center justify-center ${checked ? 'bg-brand border-brand' : 'border-gray-300'}`}>
|
||||
{checked && <Check className="w-3 h-3 text-white" />}
|
||||
</span>
|
||||
<span className={`text-sm font-bold ${checked ? 'text-[#0094f7]' : 'text-gray-800'}`}>{event.label}</span>
|
||||
<span className={`text-sm font-bold ${checked ? 'text-brand' : 'text-gray-800'}`}>{event.label}</span>
|
||||
</div>
|
||||
<p className="text-xs text-gray-500 mt-1 pl-6 leading-5">{event.description}</p>
|
||||
</button>
|
||||
@@ -858,7 +858,7 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setForm({ ...form, enabled: !form.enabled })}
|
||||
className={`relative w-11 h-6 rounded-full transition-colors ${form.enabled ? 'bg-[#0094f7]' : 'bg-gray-300'}`}
|
||||
className={`relative w-11 h-6 rounded-full transition-colors ${form.enabled ? 'bg-brand' : 'bg-gray-300'}`}
|
||||
>
|
||||
<span className={`absolute top-0.5 left-0.5 w-5 h-5 bg-white rounded-full transition-transform ${form.enabled ? 'translate-x-5' : ''}`} />
|
||||
</button>
|
||||
@@ -889,8 +889,7 @@ const Notifications: React.FC<NotificationsProps> = ({ isAdmin = false }) => {
|
||||
|
||||
{/* Toast */}
|
||||
{toast && (
|
||||
<div className="fixed bottom-8 left-1/2 -translate-x-1/2 z-[10000] px-5 py-3 rounded-xl shadow-lg font-bold text-sm flex items-center gap-2 animate-fade-in"
|
||||
style={{ background: toast.type === 'success' ? '#10b981' : '#ef4444', color: 'white' }}>
|
||||
<div className={`fixed bottom-8 left-1/2 -translate-x-1/2 z-[10000] px-5 py-3 rounded-xl shadow-lg font-bold text-sm flex items-center gap-2 animate-fade-in text-white ${toast.type === 'success' ? 'bg-success-500' : 'bg-danger-500'}`}>
|
||||
{toast.type === 'success' ? <Check className="w-4 h-4" /> : <X className="w-4 h-4" />}
|
||||
{toast.text}
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { formatLocalDateTime } from '../dateTime';
|
||||
const StatusBadge: React.FC<{ status: OrderStatus }> = ({ status }) => {
|
||||
const styles = {
|
||||
processing: 'bg-blue-100 text-blue-800',
|
||||
pending_ship: 'bg-[#0094f7] text-white',
|
||||
pending_ship: 'bg-brand text-white',
|
||||
shipped: 'bg-blue-100 text-blue-700',
|
||||
completed: 'bg-green-100 text-green-700',
|
||||
cancelled: 'bg-gray-100 text-gray-500',
|
||||
@@ -356,7 +356,7 @@ const OrderList: React.FC = () => {
|
||||
|
||||
<div className="ios-card rounded-xl overflow-hidden shadow-lg border-0 bg-white">
|
||||
{/* Toolbar */}
|
||||
<div className="p-4 border-b border-gray-50 flex flex-col md:flex-row gap-4 justify-between items-center bg-[#FAFAFA]">
|
||||
<div className="p-4 border-b border-gray-50 flex flex-col md:flex-row gap-4 justify-between items-center bg-surface-muted">
|
||||
<div className="flex gap-1 p-1 bg-gray-200/50 rounded-xl overflow-x-auto max-w-full">
|
||||
{[
|
||||
{k:'all', v:'全部'},
|
||||
@@ -392,7 +392,7 @@ const OrderList: React.FC = () => {
|
||||
</select>
|
||||
</div>
|
||||
<div className="relative group">
|
||||
<Search className="w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-[#0094f7] transition-colors" />
|
||||
<Search className="w-4 h-4 absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 group-focus-within:text-brand transition-colors" />
|
||||
<input
|
||||
type="text"
|
||||
placeholder="搜索订单号/商品/买家..."
|
||||
@@ -418,7 +418,7 @@ const OrderList: React.FC = () => {
|
||||
</thead>
|
||||
<tbody className="divide-y divide-gray-50">
|
||||
{orders.map((order) => (
|
||||
<tr key={order.id} className="hover:bg-[#FFFDE7]/50 transition-colors group">
|
||||
<tr key={order.id} className="hover:bg-warning-50/50 transition-colors group">
|
||||
<td className="px-6 py-5">
|
||||
<div className="flex items-center gap-5">
|
||||
<div className="w-14 h-14 rounded-xl bg-gray-100 overflow-hidden shadow-sm border border-gray-100 flex-shrink-0">
|
||||
@@ -800,7 +800,7 @@ const OrderList: React.FC = () => {
|
||||
<button
|
||||
onClick={() => executeShip('full_delivery')}
|
||||
disabled={shipLoading}
|
||||
className="w-full text-left p-4 rounded-xl border-2 border-gray-200 hover:border-[#0094f7] hover:bg-blue-50 transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
className="w-full text-left p-4 rounded-xl border-2 border-gray-200 hover:border-brand hover:bg-blue-50 transition-all disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
>
|
||||
<div className="flex items-start gap-3">
|
||||
<div className="w-10 h-10 rounded-xl bg-blue-100 flex items-center justify-center flex-shrink-0 mt-0.5">
|
||||
|
||||
@@ -842,7 +842,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
onClick={() => setActiveTab(tab.id)}
|
||||
className={`inline-flex items-center gap-2 px-5 py-2.5 rounded-xl text-sm font-bold transition-all ${
|
||||
activeTab === tab.id
|
||||
? 'bg-[#0094f7] text-white shadow-md'
|
||||
? 'bg-brand text-white shadow-md'
|
||||
: 'bg-white text-gray-600 hover:text-black hover:bg-gray-50'
|
||||
}`}
|
||||
>
|
||||
@@ -949,7 +949,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
</aside>
|
||||
|
||||
<section className="min-w-0 space-y-4">
|
||||
<div className="rounded-xl border border-gray-100 bg-[#FAFAFA] p-4 shadow-sm">
|
||||
<div className="rounded-xl border border-gray-100 bg-surface-muted p-4 shadow-sm">
|
||||
<div className="flex flex-col gap-3 xl:flex-row xl:items-center">
|
||||
<div className="relative min-w-0 flex-1">
|
||||
<Search className="pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400" />
|
||||
@@ -1112,7 +1112,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
type="button"
|
||||
disabled={loading}
|
||||
onClick={() => setAutomationPage(pageNumber)}
|
||||
className={`h-9 min-w-9 rounded-lg px-2 text-sm font-bold transition-colors ${pageNumber === automationPage ? 'bg-[#0094f7] text-white' : 'bg-gray-50 text-gray-600 hover:bg-gray-100'} disabled:cursor-not-allowed disabled:opacity-60`}
|
||||
className={`h-9 min-w-9 rounded-lg px-2 text-sm font-bold transition-colors ${pageNumber === automationPage ? 'bg-brand text-white' : 'bg-gray-50 text-gray-600 hover:bg-gray-100'} disabled:cursor-not-allowed disabled:opacity-60`}
|
||||
aria-label={`第 ${pageNumber} 页`}
|
||||
aria-current={pageNumber === automationPage ? 'page' : undefined}
|
||||
>
|
||||
@@ -1144,7 +1144,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
{replyRules.map(rule => (
|
||||
<div key={rule.id} className="flex flex-col md:flex-row md:items-center justify-between p-5 rounded-2xl border border-gray-100 bg-[#F7F8FA] hover:bg-white hover:shadow-lg transition-all gap-4">
|
||||
<div key={rule.id} className="flex flex-col md:flex-row md:items-center justify-between p-5 rounded-2xl border border-gray-100 bg-surface-subtle hover:bg-white hover:shadow-lg transition-all gap-4">
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-center gap-3 mb-2">
|
||||
<span className="px-3 py-1 bg-black text-white rounded-lg text-xs font-bold">包含匹配</span>
|
||||
@@ -1187,7 +1187,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
const defaultReply = defaultReplies[account.id];
|
||||
const enabled = Boolean(defaultReply?.enabled);
|
||||
return (
|
||||
<div key={account.id} className={`flex flex-col md:flex-row md:items-center justify-between p-5 rounded-2xl border transition-all gap-4 ${enabled ? 'border-purple-100 bg-purple-50/50 hover:bg-white hover:shadow-lg' : 'border-gray-100 bg-[#F7F8FA] hover:bg-white hover:shadow-lg'}`}>
|
||||
<div key={account.id} className={`flex flex-col md:flex-row md:items-center justify-between p-5 rounded-2xl border transition-all gap-4 ${enabled ? 'border-purple-100 bg-purple-50/50 hover:bg-white hover:shadow-lg' : 'border-gray-100 bg-surface-subtle hover:bg-white hover:shadow-lg'}`}>
|
||||
<div className="flex items-center gap-4 min-w-0">
|
||||
<div className={`w-12 h-12 rounded-2xl flex items-center justify-center ${enabled ? 'bg-purple-600 text-white' : 'bg-gray-200 text-gray-400'}`}>
|
||||
<Bot className="w-5 h-5" />
|
||||
@@ -1272,7 +1272,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
}`}
|
||||
>
|
||||
<div className="flex items-start gap-3">
|
||||
<Icon className={`w-5 h-5 mt-0.5 ${selected ? 'text-[#0094f7]' : 'text-white'}`} />
|
||||
<Icon className={`w-5 h-5 mt-0.5 ${selected ? 'text-brand' : 'text-white'}`} />
|
||||
<div>
|
||||
<div className="font-black">{meta.label}</div>
|
||||
<div className={`text-xs mt-1 leading-5 ${selected ? 'text-gray-500' : 'text-gray-400'}`}>{meta.description}</div>
|
||||
@@ -1296,11 +1296,11 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div className="p-6 overflow-y-auto bg-[#F7F8FA]">
|
||||
<div className="p-6 overflow-y-auto bg-surface-subtle">
|
||||
<div className="space-y-5">
|
||||
<section className="bg-white rounded-3xl border border-gray-100 p-5">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<CheckCircle2 className="w-5 h-5 text-[#0094f7]" />
|
||||
<CheckCircle2 className="w-5 h-5 text-brand" />
|
||||
<h4 className="font-black text-gray-900">生效范围</h4>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
@@ -1369,7 +1369,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
<div className="flex items-start justify-between gap-4 mb-4">
|
||||
<div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Layers3 className="w-5 h-5 text-[#0094f7]" />
|
||||
<Layers3 className="w-5 h-5 text-brand" />
|
||||
<h4 className="font-black text-gray-900">{currentTrigger === 'buyer_reviewed' ? '赠品库存' : '发货库存'}</h4>
|
||||
</div>
|
||||
<p className="text-sm text-gray-500 mt-1">
|
||||
@@ -1446,7 +1446,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
type="checkbox"
|
||||
checked={variant.delay_override === true}
|
||||
onChange={event => updateVariant(index, { delay_override: event.target.checked })}
|
||||
className="accent-[#0094f7]"
|
||||
className="accent-brand"
|
||||
/>
|
||||
覆盖卡密默认延时
|
||||
</label>
|
||||
@@ -1738,7 +1738,7 @@ const Rules: React.FC<RulesProps> = ({ initialDeliveryTarget, onDeliveryTargetHa
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setDefaultForm({ ...defaultForm, enabled: !defaultForm.enabled })}
|
||||
className={`w-14 h-8 rounded-full transition-colors duration-300 relative ${defaultForm.enabled ? 'bg-[#0094f7]' : 'bg-gray-300'}`}
|
||||
className={`w-14 h-8 rounded-full transition-colors duration-300 relative ${defaultForm.enabled ? 'bg-brand' : 'bg-gray-300'}`}
|
||||
>
|
||||
<span className={`absolute top-1 w-6 h-6 bg-white rounded-full shadow-md transition-transform duration-300 block ${defaultForm.enabled ? 'translate-x-7' : 'translate-x-1'}`} />
|
||||
</button>
|
||||
|
||||
@@ -269,7 +269,7 @@ const Settings: React.FC = () => {
|
||||
{/* AI Configuration */}
|
||||
<section className="space-y-4">
|
||||
<h3 className="text-lg font-extrabold text-gray-800 flex items-center gap-2">
|
||||
<div className="p-1.5 rounded-lg bg-[#0094f7] text-white">
|
||||
<div className="p-1.5 rounded-lg bg-brand text-white">
|
||||
<Sparkles className="w-4 h-4" />
|
||||
</div>
|
||||
AI 智能回复配置
|
||||
@@ -346,10 +346,10 @@ const Settings: React.FC = () => {
|
||||
setSettings({...settings, ai_model: model});
|
||||
setModelDropdownOpen(false);
|
||||
}}
|
||||
className="w-full px-4 py-2.5 text-left text-sm text-gray-700 hover:bg-blue-50 hover:text-[#0094f7] flex items-center justify-between gap-3"
|
||||
className="w-full px-4 py-2.5 text-left text-sm text-gray-700 hover:bg-blue-50 hover:text-brand flex items-center justify-between gap-3"
|
||||
>
|
||||
<span className="truncate">{model}</span>
|
||||
{model === currentModel && <Check className="w-4 h-4 shrink-0 text-[#0094f7]" />}
|
||||
{model === currentModel && <Check className="w-4 h-4 shrink-0 text-brand" />}
|
||||
</button>
|
||||
))
|
||||
) : (
|
||||
|
||||
@@ -30,7 +30,7 @@ const Sidebar: React.FC<SidebarProps> = ({
|
||||
];
|
||||
|
||||
return (
|
||||
<aside className={`fixed inset-y-0 left-0 z-20 flex flex-col border-r border-slate-200/80 bg-white/95 shadow-[4px_0_24px_rgba(15,23,42,0.035)] backdrop-blur-xl transition-[width] duration-300 ${collapsed ? 'w-16' : 'w-64'}`}>
|
||||
<aside className={`fixed inset-y-0 left-0 z-20 flex flex-col border-r border-slate-200/80 bg-white/95 shadow-sidebar backdrop-blur-xl transition-[width] duration-300 ${collapsed ? 'w-16' : 'w-64'}`}>
|
||||
<div className={`flex h-20 items-center border-b border-slate-100 ${collapsed ? 'justify-center px-2' : 'gap-3 px-5'}`}>
|
||||
<YdisksBrandIcon sizeClass="h-10 w-10" />
|
||||
{!collapsed && (
|
||||
@@ -55,7 +55,7 @@ const Sidebar: React.FC<SidebarProps> = ({
|
||||
onClick={() => onNavigate(item.id)}
|
||||
className={`group relative flex h-11 w-full items-center rounded-xl transition-colors ${collapsed ? 'justify-center' : 'gap-3 px-3.5'} ${
|
||||
active
|
||||
? 'bg-sky-500 text-white shadow-[0_8px_18px_rgba(14,165,233,0.2)]'
|
||||
? 'bg-brand text-white shadow-brand-active'
|
||||
: 'text-slate-500 hover:bg-slate-100 hover:text-slate-900'
|
||||
}`}
|
||||
>
|
||||
|
||||
@@ -27,8 +27,8 @@ export const YdisksBrandIcon: React.FC<YdisksBrandIconProps> = ({
|
||||
<svg className="absolute inset-0 w-full h-full" viewBox="0 0 120 120" aria-hidden="true">
|
||||
<defs>
|
||||
<linearGradient id="login-squircle-gradient" x1="0" y1="0" x2="1" y2="1">
|
||||
<stop offset="0%" stopColor="#0094f7" />
|
||||
<stop offset="100%" stopColor="#287efe" />
|
||||
<stop offset="0%" stopColor="rgb(var(--color-brand))" />
|
||||
<stop offset="100%" stopColor="rgb(var(--color-brand-light))" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path d="M 114.00 60.00 L 113.83 71.48 L 113.31 78.16 L 112.44 83.67 L 111.22 88.46 L 109.66 92.71 L 107.75 96.49 L 105.48 99.87 L 102.86 102.86 L 99.87 105.48 L 96.49 107.75 L 92.71 109.66 L 88.46 111.22 L 83.67 112.44 L 78.16 113.31 L 71.48 113.83 L 60.00 114.00 L 48.52 113.83 L 41.84 113.31 L 36.33 112.44 L 31.54 111.22 L 27.29 109.66 L 23.51 107.75 L 20.13 105.48 L 17.14 102.86 L 14.52 99.87 L 12.25 96.49 L 10.34 92.71 L 8.78 88.46 L 7.56 83.67 L 6.69 78.16 L 6.17 71.48 L 6.00 60.00 L 6.17 48.52 L 6.69 41.84 L 7.56 36.33 L 8.78 31.54 L 10.34 27.29 L 12.25 23.51 L 14.52 20.13 L 17.14 17.14 L 20.13 14.52 L 23.51 12.25 L 27.29 10.34 L 31.54 8.78 L 36.33 7.56 L 41.84 6.69 L 48.52 6.17 L 60.00 6.00 L 71.48 6.17 L 78.16 6.69 L 83.67 7.56 L 88.46 8.78 L 92.71 10.34 L 96.49 12.25 L 99.87 14.52 L 102.86 17.14 L 105.48 20.13 L 107.75 23.51 L 109.66 27.29 L 111.22 31.54 L 112.44 36.33 L 113.31 41.84 L 113.83 48.52 Z" fill="url(#login-squircle-gradient)" />
|
||||
|
||||
Reference in new issue
Block a user