Skip to content

Commit c726e63

Browse files
Add logout button to conversation sidebar
## Features - **Logout button**: Added "Log Out" button at bottom of conversation sidebar - **Confirmation dialog**: Prompts user to confirm before logging out - **Conditional display**: Only shows when user is authenticated with a provider - **Proper styling**: Matches sidebar design with subtle gray styling ## Implementation - Integrated with existing InferenceContext for logout functionality - Uses `clearProvider()` to handle complete logout process - Added border separator between conversations and logout button - Positioned at bottom of sidebar with fixed placement ## User Experience - ✅ **Easy access**: Logout button always visible when authenticated - ✅ **Safety confirmation**: Prevents accidental logout with confirm dialog - ✅ **Clean design**: Subtle styling that doesn't distract from conversations - ✅ **Complete logout**: Clears all authentication state and persisted data ## Technical Details - Leverages existing clearProvider() functionality - Automatically clears API keys, OAuth tokens, and selected models - Maintains responsive design and dark mode compatibility - No impact on conversation data (conversations persist locally) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent e5a16a1 commit c726e63

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/components/ConversationSidebar.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Conversation sidebar with conversation list and management
22

33
import { useConversation } from '@/contexts/ConversationContext';
4+
import { useInference } from '@/contexts/InferenceContext';
45

56
export function ConversationSidebar() {
67
const {
@@ -10,11 +11,19 @@ export function ConversationSidebar() {
1011
deleteConversation,
1112
setActiveConversation,
1213
} = useConversation();
14+
15+
const { clearProvider, provider } = useInference();
1316

1417
const handleNewConversation = () => {
1518
createConversation();
1619
};
1720

21+
const handleLogout = () => {
22+
if (confirm('Are you sure you want to log out?')) {
23+
clearProvider();
24+
}
25+
};
26+
1827
const formatDate = (date: Date): string => {
1928
const now = new Date();
2029
const diff = now.getTime() - date.getTime();
@@ -115,6 +124,18 @@ export function ConversationSidebar() {
115124
</div>
116125
)}
117126
</div>
127+
128+
{/* Logout Button */}
129+
{provider && (
130+
<div className="p-4 border-t border-gray-200 dark:border-gray-700">
131+
<button
132+
onClick={handleLogout}
133+
className="w-full px-4 py-2 text-sm bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors"
134+
>
135+
Log Out
136+
</button>
137+
</div>
138+
)}
118139
</div>
119140
);
120141
}

0 commit comments

Comments
 (0)