Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/dashboard-quick-actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"think-app": patch
---

Add "View all" and "New Conversation" quick actions to dashboard

- Added "View all" button to Recent Chats card linking to /chat
- Renamed "Quick Add" to "Quick Actions" with centered button layout
- Added "New Conversation" quick action that starts a fresh chat
- Fixed navigation to ensure new conversations don't auto-load previous chat
12 changes: 12 additions & 0 deletions app/src/pages/ChatPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useState, useEffect, useCallback, useRef, useMemo } from "react";
import { useSearchParams } from "react-router-dom";
import { apiFetch } from "@/lib/api";
import { ChatInput } from "@/components/ChatInput";
import { ChatMessageList } from "@/components/ChatMessageList";
Expand All @@ -19,6 +20,7 @@ export default function ChatPage() {
const [followupSuggestions, setFollowupSuggestions] = useState<string[]>([]);
const isStartingNewChatRef = useRef(false);
const wantsNewChatRef = useRef(false);
const [searchParams, setSearchParams] = useSearchParams();

// Track pending conversation creation to prevent race conditions
const pendingConversationRef = useRef<{
Expand Down Expand Up @@ -257,6 +259,16 @@ export default function ChatPage() {
submitChat(message, currentConversationId);
}, [message, currentConversationId, submitChat]);

// Effect: Handle ?new=true param from navigation (e.g., from HomePage "New Conversation")
useEffect(() => {
if (searchParams.get("new") === "true") {
wantsNewChatRef.current = true;
startNewChat();
searchParams.delete("new");
setSearchParams(searchParams, { replace: true });
}
}, [searchParams, setSearchParams, startNewChat]);

// Effect 1: Handle pending message from navigation (e.g., from HomePage)
useEffect(() => {
if (!pendingMessage || isStartingNewChatRef.current) return;
Expand Down
32 changes: 22 additions & 10 deletions app/src/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,41 +152,53 @@ export default function HomePage({ userName }: HomePageProps) {
{recentChats.length === 0 ? (
<p className="text-sm text-muted-foreground">No chats yet</p>
) : (
<ul className="space-y-2">
<ul className="space-y-1">
{recentChats.map((chat) => (
<li
key={chat.id}
onClick={() => {
selectConversation(chat);
navigate("/chat");
}}
className="text-sm truncate text-muted-foreground hover:text-foreground cursor-pointer transition-colors"
className="text-sm truncate text-muted-foreground hover:text-foreground cursor-pointer transition-colors py-1 -mx-2 px-2 rounded hover:bg-muted"
>
{chat.title || "New conversation"}
</li>
))}
</ul>
)}
<Link to="/chat">
<Button variant="ghost" size="sm" className="mt-2 w-full">
View all
</Button>
</Link>
</CardContent>
</Card>

{/* Quick Add */}
{/* Quick Actions */}
<Card>
<CardHeader className="pb-2">
<CardTitle className="text-sm font-medium flex items-center gap-2">
<Plus className="h-4 w-4" />
Quick Add
Quick Actions
</CardTitle>
</CardHeader>
<CardContent>
<p className="text-sm text-muted-foreground mb-3">
Save a new memory manually
</p>
<Link to="/memories?add=true">
<CardContent className="flex flex-col items-center justify-center space-y-3 py-4">
<Link to="/memories?add=true" className="w-full">
<Button variant="outline" size="sm" className="w-full">
Add Note
New Note
</Button>
</Link>
<Button
variant="outline"
size="sm"
className="w-full"
onClick={() => {
navigate("/chat?new=true");
}}
>
New Conversation
</Button>
</CardContent>
</Card>
</div>
Expand Down
Loading