mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 20:23:36 +00:00
feat(agent): Unselect session when archiving currently selected session
When a session is archived and it was the currently selected session, it is now automatically deselected and the empty state placeholder is shown in the right panel. - Updated SessionManagerProps to allow null for onSelectSession callback - Added logic to deselect session on archive if it was selected - Added data-testid attributes for testing
This commit is contained in:
@@ -47,7 +47,7 @@ function generateRandomSessionName(): string {
|
||||
|
||||
interface SessionManagerProps {
|
||||
currentSessionId: string | null;
|
||||
onSelectSession: (sessionId: string) => void;
|
||||
onSelectSession: (sessionId: string | null) => void;
|
||||
projectPath: string;
|
||||
isCurrentSessionThinking?: boolean;
|
||||
}
|
||||
@@ -141,6 +141,10 @@ export function SessionManager({
|
||||
|
||||
const result = await window.electronAPI.sessions.archive(sessionId);
|
||||
if (result.success) {
|
||||
// If the archived session was currently selected, deselect it
|
||||
if (currentSessionId === sessionId) {
|
||||
onSelectSession(null);
|
||||
}
|
||||
await loadSessions();
|
||||
}
|
||||
};
|
||||
@@ -357,6 +361,7 @@ export function SessionManager({
|
||||
variant="ghost"
|
||||
onClick={() => handleArchiveSession(session.id)}
|
||||
className="h-7 w-7 p-0"
|
||||
data-testid={`archive-session-${session.id}`}
|
||||
>
|
||||
<Archive className="w-3 h-3" />
|
||||
</Button>
|
||||
|
||||
@@ -471,7 +471,7 @@ export function AgentView() {
|
||||
|
||||
{/* Messages */}
|
||||
{!currentSessionId ? (
|
||||
<div className="flex-1 flex items-center justify-center">
|
||||
<div className="flex-1 flex items-center justify-center" data-testid="no-session-placeholder">
|
||||
<div className="text-center">
|
||||
<Bot className="w-12 h-12 text-muted-foreground mx-auto mb-4 opacity-50" />
|
||||
<h2 className="text-lg font-semibold mb-2">
|
||||
|
||||
Reference in New Issue
Block a user