Remove Running Sessions components from CC Agents
- Deleted RunningSessionsView.tsx file - Removed import and usage in CCAgents.tsx - Removed 'Running Sessions' tab from navigation - Removed activeTab state management - Simplified UI to show only agents list
This commit is contained in:
@@ -38,7 +38,6 @@ import { Toast, ToastContainer } from "@/components/ui/toast";
|
||||
import { CreateAgent } from "./CreateAgent";
|
||||
import { AgentExecution } from "./AgentExecution";
|
||||
import { AgentRunsList } from "./AgentRunsList";
|
||||
import { RunningSessionsView } from "./RunningSessionsView";
|
||||
import { GitHubAgentBrowser } from "./GitHubAgentBrowser";
|
||||
import { ICON_MAP } from "./IconPicker";
|
||||
|
||||
@@ -73,7 +72,6 @@ export const CCAgents: React.FC<CCAgentsProps> = ({ onBack, className }) => {
|
||||
const [toast, setToast] = useState<{ message: string; type: "success" | "error" } | null>(null);
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [view, setView] = useState<"list" | "create" | "edit" | "execute">("list");
|
||||
const [activeTab, setActiveTab] = useState<"agents" | "running">("agents");
|
||||
const [selectedAgent, setSelectedAgent] = useState<Agent | null>(null);
|
||||
// const [selectedRunId, setSelectedRunId] = useState<number | null>(null);
|
||||
const [showGitHubBrowser, setShowGitHubBrowser] = useState(false);
|
||||
@@ -363,203 +361,154 @@ export const CCAgents: React.FC<CCAgentsProps> = ({ onBack, className }) => {
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
{/* Tab Navigation */}
|
||||
<div className="border-b border-border">
|
||||
<nav className="flex space-x-8">
|
||||
<button
|
||||
onClick={() => setActiveTab("agents")}
|
||||
className={cn(
|
||||
"py-2 px-1 border-b-2 font-medium text-sm transition-colors",
|
||||
activeTab === "agents"
|
||||
? "border-primary text-primary"
|
||||
: "border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"
|
||||
)}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<Bot className="h-4 w-4" />
|
||||
Agents
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setActiveTab("running")}
|
||||
className={cn(
|
||||
"py-2 px-1 border-b-2 font-medium text-sm transition-colors",
|
||||
activeTab === "running"
|
||||
? "border-primary text-primary"
|
||||
: "border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground"
|
||||
)}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<Play className="h-4 w-4" />
|
||||
Running Sessions
|
||||
</div>
|
||||
</button>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
{/* Tab Content */}
|
||||
{/* Main Content */}
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
<AnimatePresence mode="wait">
|
||||
{activeTab === "agents" && (
|
||||
<motion.div
|
||||
key="agents"
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
exit={{ opacity: 0, y: -20 }}
|
||||
transition={{ duration: 0.2 }}
|
||||
className="pt-6 space-y-8"
|
||||
>
|
||||
{/* Agents Grid */}
|
||||
<div>
|
||||
{loading ? (
|
||||
<div className="flex items-center justify-center h-64">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
|
||||
<motion.div
|
||||
key="agents"
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
exit={{ opacity: 0, y: -20 }}
|
||||
transition={{ duration: 0.2 }}
|
||||
className="pt-6 space-y-8"
|
||||
>
|
||||
{/* Agents Grid */}
|
||||
<div>
|
||||
{loading ? (
|
||||
<div className="flex items-center justify-center h-64">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
|
||||
</div>
|
||||
) : agents.length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center h-64 text-center">
|
||||
<Bot className="h-16 w-16 text-muted-foreground mb-4" />
|
||||
<h3 className="text-lg font-medium mb-2">No agents yet</h3>
|
||||
<p className="text-sm text-muted-foreground mb-4">
|
||||
Create your first CC Agent to get started
|
||||
</p>
|
||||
<Button onClick={() => setView("create")} size="default">
|
||||
<Plus className="h-4 w-4 mr-2" />
|
||||
Create CC Agent
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<AnimatePresence mode="popLayout">
|
||||
{paginatedAgents.map((agent, index) => (
|
||||
<motion.div
|
||||
key={agent.id}
|
||||
initial={{ opacity: 0, scale: 0.9 }}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
exit={{ opacity: 0, scale: 0.9 }}
|
||||
transition={{ duration: 0.2, delay: index * 0.05 }}
|
||||
>
|
||||
<Card className="h-full hover:shadow-lg transition-shadow">
|
||||
<CardContent className="p-6 flex flex-col items-center text-center">
|
||||
<div className="mb-4 p-4 rounded-full bg-primary/10 text-primary">
|
||||
{renderIcon(agent.icon)}
|
||||
</div>
|
||||
<h3 className="text-lg font-semibold mb-2">
|
||||
{agent.name}
|
||||
</h3>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Created: {new Date(agent.created_at).toLocaleDateString()}
|
||||
</p>
|
||||
</CardContent>
|
||||
<CardFooter className="p-4 pt-0 flex justify-center gap-1 flex-wrap">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => handleExecuteAgent(agent)}
|
||||
className="flex items-center gap-1"
|
||||
title="Execute agent"
|
||||
>
|
||||
<Play className="h-3 w-3" />
|
||||
Execute
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => handleEditAgent(agent)}
|
||||
className="flex items-center gap-1"
|
||||
title="Edit agent"
|
||||
>
|
||||
<Edit className="h-3 w-3" />
|
||||
Edit
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => handleExportAgent(agent)}
|
||||
className="flex items-center gap-1"
|
||||
title="Export agent to .claudia.json"
|
||||
>
|
||||
<Upload className="h-3 w-3" />
|
||||
Export
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => handleDeleteAgent(agent)}
|
||||
className="flex items-center gap-1 text-destructive hover:text-destructive"
|
||||
title="Delete agent"
|
||||
>
|
||||
<Trash2 className="h-3 w-3" />
|
||||
Delete
|
||||
</Button>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</motion.div>
|
||||
))}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
) : agents.length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center h-64 text-center">
|
||||
<Bot className="h-16 w-16 text-muted-foreground mb-4" />
|
||||
<h3 className="text-lg font-medium mb-2">No agents yet</h3>
|
||||
<p className="text-sm text-muted-foreground mb-4">
|
||||
Create your first CC Agent to get started
|
||||
</p>
|
||||
<Button onClick={() => setView("create")} size="default">
|
||||
<Plus className="h-4 w-4 mr-2" />
|
||||
Create CC Agent
|
||||
</Button>
|
||||
|
||||
{/* Pagination */}
|
||||
{totalPages > 1 && (
|
||||
<div className="mt-6 flex justify-center gap-2">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => setCurrentPage(p => Math.max(1, p - 1))}
|
||||
disabled={currentPage === 1}
|
||||
>
|
||||
Previous
|
||||
</Button>
|
||||
<span className="flex items-center px-3 text-sm">
|
||||
Page {currentPage} of {totalPages}
|
||||
</span>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => setCurrentPage(p => Math.min(totalPages, p + 1))}
|
||||
disabled={currentPage === totalPages}
|
||||
>
|
||||
Next
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Execution History */}
|
||||
{!loading && agents.length > 0 && (
|
||||
<div className="overflow-hidden">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<History className="h-5 w-5 text-muted-foreground" />
|
||||
<h2 className="text-lg font-semibold">Recent Executions</h2>
|
||||
</div>
|
||||
{runsLoading ? (
|
||||
<div className="flex items-center justify-center h-32">
|
||||
<div className="animate-spin rounded-full h-6 w-6 border-b-2 border-primary"></div>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
<AnimatePresence mode="popLayout">
|
||||
{paginatedAgents.map((agent, index) => (
|
||||
<motion.div
|
||||
key={agent.id}
|
||||
initial={{ opacity: 0, scale: 0.9 }}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
exit={{ opacity: 0, scale: 0.9 }}
|
||||
transition={{ duration: 0.2, delay: index * 0.05 }}
|
||||
>
|
||||
<Card className="h-full hover:shadow-lg transition-shadow">
|
||||
<CardContent className="p-6 flex flex-col items-center text-center">
|
||||
<div className="mb-4 p-4 rounded-full bg-primary/10 text-primary">
|
||||
{renderIcon(agent.icon)}
|
||||
</div>
|
||||
<h3 className="text-lg font-semibold mb-2">
|
||||
{agent.name}
|
||||
</h3>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Created: {new Date(agent.created_at).toLocaleDateString()}
|
||||
</p>
|
||||
</CardContent>
|
||||
<CardFooter className="p-4 pt-0 flex justify-center gap-1 flex-wrap">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => handleExecuteAgent(agent)}
|
||||
className="flex items-center gap-1"
|
||||
title="Execute agent"
|
||||
>
|
||||
<Play className="h-3 w-3" />
|
||||
Execute
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => handleEditAgent(agent)}
|
||||
className="flex items-center gap-1"
|
||||
title="Edit agent"
|
||||
>
|
||||
<Edit className="h-3 w-3" />
|
||||
Edit
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => handleExportAgent(agent)}
|
||||
className="flex items-center gap-1"
|
||||
title="Export agent to .claudia.json"
|
||||
>
|
||||
<Upload className="h-3 w-3" />
|
||||
Export
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => handleDeleteAgent(agent)}
|
||||
className="flex items-center gap-1 text-destructive hover:text-destructive"
|
||||
title="Delete agent"
|
||||
>
|
||||
<Trash2 className="h-3 w-3" />
|
||||
Delete
|
||||
</Button>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</motion.div>
|
||||
))}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
|
||||
{/* Pagination */}
|
||||
{totalPages > 1 && (
|
||||
<div className="mt-6 flex justify-center gap-2">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => setCurrentPage(p => Math.max(1, p - 1))}
|
||||
disabled={currentPage === 1}
|
||||
>
|
||||
Previous
|
||||
</Button>
|
||||
<span className="flex items-center px-3 text-sm">
|
||||
Page {currentPage} of {totalPages}
|
||||
</span>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
onClick={() => setCurrentPage(p => Math.min(totalPages, p + 1))}
|
||||
disabled={currentPage === totalPages}
|
||||
>
|
||||
Next
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
<AgentRunsList
|
||||
runs={runs}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Execution History */}
|
||||
{!loading && agents.length > 0 && (
|
||||
<div className="overflow-hidden">
|
||||
<div className="flex items-center gap-2 mb-4">
|
||||
<History className="h-5 w-5 text-muted-foreground" />
|
||||
<h2 className="text-lg font-semibold">Recent Executions</h2>
|
||||
</div>
|
||||
{runsLoading ? (
|
||||
<div className="flex items-center justify-center h-32">
|
||||
<div className="animate-spin rounded-full h-6 w-6 border-b-2 border-primary"></div>
|
||||
</div>
|
||||
) : (
|
||||
<AgentRunsList
|
||||
runs={runs}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
{activeTab === "running" && (
|
||||
<motion.div
|
||||
key="running"
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
exit={{ opacity: 0, y: -20 }}
|
||||
transition={{ duration: 0.2 }}
|
||||
className="pt-6"
|
||||
>
|
||||
<RunningSessionsView />
|
||||
</motion.div>
|
||||
)}
|
||||
)}
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user