feat: 本次提交更新内容如下
初级语法告警
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
|
||||
import React, { createContext, useContext, useState, useEffect, ReactNode, useCallback } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { validateToken, refreshAuthToken } from '@/api';
|
||||
|
||||
@@ -66,7 +66,7 @@ export function AuthProvider({ children }: AuthProviderProps) {
|
||||
const navigate = useNavigate();
|
||||
|
||||
// 先声明handleLogout,避免useEffect依赖提前引用
|
||||
const handleLogout = () => {
|
||||
const handleLogout = useCallback(() => {
|
||||
// 先清除所有认证相关的状态
|
||||
safeLocalStorage.removeItem("token");
|
||||
safeLocalStorage.removeItem("token_expired");
|
||||
@@ -78,7 +78,7 @@ export function AuthProvider({ children }: AuthProviderProps) {
|
||||
setIsAuthenticated(false);
|
||||
// 跳转到登录页面
|
||||
navigate('/login');
|
||||
};
|
||||
}, [navigate]);
|
||||
|
||||
// 检查token是否过期
|
||||
const isTokenExpired = (): boolean => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import PageHeader from '@/components/PageHeader';
|
||||
import BackButton from '@/components/BackButton';
|
||||
@@ -253,11 +253,11 @@ export default function DeviceDetail() {
|
||||
};
|
||||
|
||||
// 加载更多操作记录
|
||||
const loadMoreLogs = () => {
|
||||
const loadMoreLogs = useCallback(() => {
|
||||
if (logsLoading || !hasMoreLogs) return;
|
||||
setLogPage(prev => prev + 1);
|
||||
fetchHandleLogs();
|
||||
};
|
||||
}, [logsLoading, hasMoreLogs, fetchHandleLogs]);
|
||||
|
||||
// 无限滚动加载操作记录
|
||||
useEffect(() => {
|
||||
@@ -396,10 +396,10 @@ export default function DeviceDetail() {
|
||||
};
|
||||
|
||||
// 加载更多账号
|
||||
const loadMoreAccounts = () => {
|
||||
const loadMoreAccounts = useCallback(() => {
|
||||
if (accountsLoading || !hasMoreAccounts) return;
|
||||
fetchRelatedAccounts(accountPage + 1);
|
||||
};
|
||||
}, [accountsLoading, hasMoreAccounts, accountPage, fetchRelatedAccounts]);
|
||||
|
||||
// 无限滚动加载账号
|
||||
useEffect(() => {
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function Devices() {
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
const [statusFilter, setStatusFilter] = useState("all");
|
||||
// 恢复分页功能
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [, setCurrentPage] = useState(1);
|
||||
const [selectedDeviceId, setSelectedDeviceId] = useState<number | null>(null);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [hasMore, setHasMore] = useState(true);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useParams, useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import PageHeader from '@/components/PageHeader';
|
||||
import Layout from '@/components/Layout';
|
||||
import BottomNav from '@/components/BottomNav';
|
||||
import { Plus, Users, TrendingUp, Calendar, Copy, Trash2, Play, Pause, Settings, Loader2, Code, ExternalLink } from 'lucide-react';
|
||||
import { Plus, Users, TrendingUp, Calendar, Copy, Trash2, Play, Pause, Settings, Loader2, Code } from 'lucide-react';
|
||||
import { fetchPlanList, fetchPlanDetail, copyPlan, deletePlan, type Task } from '@/api/scenarios';
|
||||
import { useToast } from '@/components/ui/toast';
|
||||
import '@/components/Layout.css';
|
||||
@@ -154,11 +154,11 @@ export default function ScenarioDetail() {
|
||||
name: getScenarioName()
|
||||
} : null);
|
||||
}
|
||||
}, [searchParams, scenarioId]);
|
||||
}, [searchParams, scenarioId, scenario, getScenarioName]);
|
||||
|
||||
const handleEditPlan = (taskId: string) => {
|
||||
navigate(`/scenarios/${scenarioId}/edit/${taskId}`);
|
||||
};
|
||||
// const handleEditPlan = (taskId: string) => {
|
||||
// navigate(`/scenarios/${scenarioId}/edit/${taskId}`);
|
||||
// };
|
||||
|
||||
const handleCopyPlan = async (taskId: string) => {
|
||||
const taskToCopy = tasks.find((task) => task.id === taskId);
|
||||
|
||||
@@ -20,7 +20,7 @@ interface Scenario {
|
||||
|
||||
export default function Scenarios() {
|
||||
const navigate = useNavigate();
|
||||
const { toast } = useToast();
|
||||
// const { toast } = useToast();
|
||||
const [scenarios, setScenarios] = useState<Scenario[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState('');
|
||||
@@ -68,7 +68,7 @@ export default function Scenarios() {
|
||||
};
|
||||
|
||||
fetchScenarios();
|
||||
}, []);
|
||||
}, [scenarioDescriptions]);
|
||||
|
||||
const handleScenarioClick = (scenarioId: string,scenarioName:string) => {
|
||||
navigate(`/scenarios/${scenarioId}?name=${encodeURIComponent(scenarioName)}`);
|
||||
|
||||
@@ -92,7 +92,7 @@ export default function WechatAccountDetail() {
|
||||
const [friendDetailError, setFriendDetailError] = useState<string | null>(null);
|
||||
const [searchQuery, setSearchQuery] = useState("");
|
||||
const [activeTab, setActiveTab] = useState("overview");
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [, setIsLoading] = useState(false);
|
||||
|
||||
// 好友列表相关状态
|
||||
const [friends, setFriends] = useState<Friend[]>([]);
|
||||
@@ -234,7 +234,7 @@ export default function WechatAccountDetail() {
|
||||
console.log('Setting isFetchingFriends to false');
|
||||
setIsFetchingFriends(false);
|
||||
}
|
||||
}, [id, searchQuery, toast]);
|
||||
}, [id, searchQuery, toast, isFetchingFriends]);
|
||||
|
||||
// 初始化数据
|
||||
useEffect(() => {
|
||||
@@ -333,10 +333,10 @@ export default function WechatAccountDetail() {
|
||||
navigate("/scenarios");
|
||||
};
|
||||
|
||||
const handleBack = () => {
|
||||
clearCurrentAccount();
|
||||
navigate('/wechat-accounts');
|
||||
};
|
||||
// const handleBack = () => {
|
||||
// clearCurrentAccount();
|
||||
// navigate('/wechat-accounts');
|
||||
// };
|
||||
|
||||
const handleFriendClick = async (friend: Friend) => {
|
||||
setSelectedFriend(friend);
|
||||
|
||||
@@ -3,9 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Send,
|
||||
Settings,
|
||||
RefreshCw,
|
||||
Trash2,
|
||||
Download,
|
||||
Copy,
|
||||
MoreVertical,
|
||||
Bot,
|
||||
@@ -14,9 +12,9 @@ import {
|
||||
} from 'lucide-react';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
// import { Input } from '@/components/ui/input';
|
||||
// import { Badge } from '@/components/ui/badge';
|
||||
// import { Switch } from '@/components/ui/switch';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import {
|
||||
DropdownMenu,
|
||||
@@ -47,7 +45,7 @@ interface Conversation {
|
||||
}
|
||||
|
||||
export default function AIAssistant() {
|
||||
const navigate = useNavigate();
|
||||
// const navigate = useNavigate();
|
||||
const { toast } = useToast();
|
||||
const [conversations, setConversations] = useState<Conversation[]>([]);
|
||||
const [currentConversation, setCurrentConversation] = useState<Conversation | null>(null);
|
||||
|
||||
@@ -17,8 +17,8 @@ import {
|
||||
Calendar,
|
||||
Users,
|
||||
UserPlus,
|
||||
CheckCircle,
|
||||
XCircle,
|
||||
// CheckCircle,
|
||||
// XCircle,
|
||||
} from 'lucide-react';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
@@ -6,9 +6,9 @@ import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Progress } from '@/components/ui/progress';
|
||||
// import { Progress } from '@/components/ui/progress';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
// import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import Layout from '@/components/Layout';
|
||||
import PageHeader from '@/components/PageHeader';
|
||||
import BottomNav from '@/components/BottomNav';
|
||||
|
||||
@@ -17,8 +17,8 @@ import {
|
||||
Calendar,
|
||||
Users,
|
||||
Send,
|
||||
CheckCircle,
|
||||
XCircle,
|
||||
// CheckCircle,
|
||||
// XCircle,
|
||||
MessageSquare,
|
||||
} from 'lucide-react';
|
||||
import { Card } from '@/components/ui/card';
|
||||
|
||||
@@ -193,18 +193,18 @@ export default function MomentsSync() {
|
||||
}
|
||||
};
|
||||
|
||||
const getStatusIcon = (status: string) => {
|
||||
switch (status) {
|
||||
case 'running':
|
||||
return <CheckCircle className="h-4 w-4 text-green-500" />;
|
||||
case 'paused':
|
||||
return <XCircle className="h-4 w-4 text-gray-500" />;
|
||||
case 'completed':
|
||||
return <CheckCircle className="h-4 w-4 text-blue-500" />;
|
||||
default:
|
||||
return <XCircle className="h-4 w-4 text-gray-500" />;
|
||||
}
|
||||
};
|
||||
// const getStatusIcon = (status: string) => {
|
||||
// switch (status) {
|
||||
// case 'running':
|
||||
// return <CheckCircle className="h-4 w-4 text-green-500" />;
|
||||
// case 'paused':
|
||||
// return <XCircle className="h-4 w-4 text-gray-500" />;
|
||||
// case 'completed':
|
||||
// return <CheckCircle className="h-4 w-4 text-blue-500" />;
|
||||
// default:
|
||||
// return <XCircle className="h-4 w-4 text-gray-500" />;
|
||||
// }
|
||||
// };
|
||||
|
||||
return (
|
||||
<Layout
|
||||
|
||||
@@ -14,11 +14,11 @@ import {
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
Settings,
|
||||
Calendar,
|
||||
// Calendar,
|
||||
Users,
|
||||
Share2,
|
||||
CheckCircle,
|
||||
XCircle,
|
||||
// CheckCircle,
|
||||
// XCircle,
|
||||
TrendingUp,
|
||||
} from 'lucide-react';
|
||||
import { Card } from '@/components/ui/card';
|
||||
|
||||
Reference in New Issue
Block a user