Skip to content

Commit d8cf418

Browse files
Zhang-Henryclaude
andcommitted
update chat components and git panel
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent dd371dd commit d8cf418

4 files changed

Lines changed: 43 additions & 30 deletions

File tree

src/components/GitPanel.jsx

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,6 @@ function GitPanel({ selectedProject, isMobile, onFileOpen }) {
632632
case 'M': return 'Modified';
633633
case 'A': return 'Added';
634634
case 'D': return 'Deleted';
635-
case 'U': return 'Untracked';
636635
default: return status;
637636
}
638637
};
@@ -733,23 +732,6 @@ function GitPanel({ selectedProject, isMobile, onFileOpen }) {
733732
{isMobile && <span>Discard</span>}
734733
</button>
735734
)}
736-
{status === 'U' && (
737-
<button
738-
onClick={(e) => {
739-
e.stopPropagation();
740-
setConfirmAction({
741-
type: 'delete',
742-
file: filePath,
743-
message: `Delete untracked file "${filePath}"? This action cannot be undone.`
744-
});
745-
}}
746-
className={`${isMobile ? 'px-2 py-1 text-xs' : 'p-1'} hover:bg-destructive/10 rounded text-destructive font-medium flex items-center gap-1`}
747-
title="Delete untracked file"
748-
>
749-
<Trash2 className="w-3 h-3" />
750-
{isMobile && <span>Delete</span>}
751-
</button>
752-
)}
753735
<span
754736
className={`inline-flex items-center justify-center w-5 h-5 rounded text-[10px] font-bold border ${
755737
status === 'M' ? 'bg-yellow-100 text-yellow-700 dark:bg-yellow-900/40 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800/50' :
@@ -1237,7 +1219,7 @@ function GitPanel({ selectedProject, isMobile, onFileOpen }) {
12371219
)}
12381220
</button>
12391221
</div>
1240-
) : !gitStatus || (!gitStatus.modified?.length && !gitStatus.added?.length && !gitStatus.deleted?.length && !gitStatus.untracked?.length) ? (
1222+
) : !gitStatus || (!gitStatus.modified?.length && !gitStatus.added?.length && !gitStatus.deleted?.length) ? (
12411223
<div className="flex flex-col items-center justify-center h-32 text-muted-foreground">
12421224
<GitCommit className="w-10 h-10 mb-2 opacity-40" />
12431225
<p className="text-sm">No changes detected</p>
@@ -1247,7 +1229,6 @@ function GitPanel({ selectedProject, isMobile, onFileOpen }) {
12471229
{gitStatus.modified?.map(file => renderFileItem(file, 'M'))}
12481230
{gitStatus.added?.map(file => renderFileItem(file, 'A'))}
12491231
{gitStatus.deleted?.map(file => renderFileItem(file, 'D'))}
1250-
{gitStatus.untracked?.map(file => renderFileItem(file, 'U'))}
12511232
</div>
12521233
)}
12531234
</div>

src/components/chat/hooks/useChatComposerState.ts

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,11 +834,24 @@ export function useChatComposerState({
834834
setIsTextareaExpanded(false);
835835
}, [resetCommandMenuState]);
836836

837+
const abortTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
838+
839+
useEffect(() => {
840+
return () => {
841+
if (abortTimeoutRef.current) {
842+
clearTimeout(abortTimeoutRef.current);
843+
abortTimeoutRef.current = null;
844+
}
845+
};
846+
}, []);
847+
837848
const handleAbortSession = useCallback(() => {
838849
if (!canAbortSession) {
839850
return;
840851
}
841852

853+
setCanAbortSession(false);
854+
842855
const pendingSessionId =
843856
typeof window !== 'undefined' ? sessionStorage.getItem('pendingSessionId') : null;
844857
const cursorSessionId =
@@ -856,7 +869,16 @@ export function useChatComposerState({
856869
candidateSessionIds.find((sessionId) => Boolean(sessionId) && !isTemporarySessionId(sessionId)) || null;
857870

858871
if (!targetSessionId) {
859-
console.warn('Abort requested but no concrete session ID is available yet.');
872+
setIsLoading(false);
873+
setClaudeStatus(null);
874+
setChatMessages((previous) => [
875+
...previous,
876+
{
877+
type: 'error',
878+
content: 'Could not stop session: no active session found.',
879+
timestamp: new Date(),
880+
},
881+
]);
860882
return;
861883
}
862884

@@ -865,7 +887,17 @@ export function useChatComposerState({
865887
sessionId: targetSessionId,
866888
provider,
867889
});
868-
}, [canAbortSession, currentSessionId, pendingViewSessionRef, provider, selectedSession?.id, sendMessage]);
890+
891+
if (abortTimeoutRef.current) {
892+
clearTimeout(abortTimeoutRef.current);
893+
}
894+
abortTimeoutRef.current = setTimeout(() => {
895+
abortTimeoutRef.current = null;
896+
setIsLoading(false);
897+
setCanAbortSession(false);
898+
setClaudeStatus(null);
899+
}, 5000);
900+
}, [canAbortSession, currentSessionId, pendingViewSessionRef, provider, selectedSession?.id, sendMessage, setCanAbortSession, setChatMessages, setClaudeStatus, setIsLoading]);
869901

870902
const handleTranscript = useCallback((text: string) => {
871903
if (!text.trim()) {

src/components/chat/hooks/useChatRealtimeHandlers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export function useChatRealtimeHandlers({
144144
? (latestMessage.data as Record<string, any>)
145145
: null;
146146

147-
const globalMessageTypes = ['projects_updated', 'taskmaster-project-updated', 'session-created'];
147+
const globalMessageTypes = ['projects_updated', 'taskmaster-project-updated', 'session-created', 'session-aborted'];
148148
const isGlobalMessage = globalMessageTypes.includes(String(latestMessage.type));
149149
const lifecycleMessageTypes = new Set([
150150
'claude-complete',
@@ -960,11 +960,13 @@ export function useChatRealtimeHandlers({
960960
},
961961
]);
962962
} else {
963+
clearLoadingIndicators();
964+
setPendingPermissionRequests([]);
963965
setChatMessages((previous) => [
964966
...previous,
965967
{
966968
type: 'error',
967-
content: 'Stop request failed. The session is still running.',
969+
content: 'Session has already finished.',
968970
timestamp: new Date(),
969971
},
970972
]);

src/components/chat/view/subcomponents/MessageComponent.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { memo, useMemo } from 'react';
2+
import { User } from 'lucide-react';
23
import { useTranslation } from 'react-i18next';
34
import SessionProviderLogo from '../../../SessionProviderLogo';
45
import type {
@@ -102,12 +103,9 @@ const MessageComponent = memo(({ message, index, prevMessage, createDiff, onFile
102103
<div className="flex flex-col items-end w-full mb-4">
103104
<div className="flex items-center space-x-2 mb-1.5">
104105
{!isGrouped && (
105-
<>
106-
<span className="text-xs font-medium text-gray-500 dark:text-gray-400">{t('messageTypes.user', { defaultValue: 'User' })}</span>
107-
<div className="w-6 h-6 bg-blue-600 rounded-full flex items-center justify-center text-white text-[10px] flex-shrink-0">
108-
U
109-
</div>
110-
</>
106+
<div className="w-6 h-6 bg-blue-600 rounded-full flex items-center justify-center text-white flex-shrink-0">
107+
<User className="w-3.5 h-3.5" />
108+
</div>
111109
)}
112110
</div>
113111
<div className="bg-blue-600 text-white rounded-2xl rounded-tr-none px-4 py-2.5 shadow-sm max-w-[90%] sm:max-w-[85%]">

0 commit comments

Comments
 (0)