diff --git a/.changeset/dashboard-quick-actions.md b/.changeset/dashboard-quick-actions.md new file mode 100644 index 0000000..86222ab --- /dev/null +++ b/.changeset/dashboard-quick-actions.md @@ -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 diff --git a/app/src/pages/ChatPage.tsx b/app/src/pages/ChatPage.tsx index d300c8f..359ee22 100644 --- a/app/src/pages/ChatPage.tsx +++ b/app/src/pages/ChatPage.tsx @@ -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"; @@ -19,6 +20,7 @@ export default function ChatPage() { const [followupSuggestions, setFollowupSuggestions] = useState([]); const isStartingNewChatRef = useRef(false); const wantsNewChatRef = useRef(false); + const [searchParams, setSearchParams] = useSearchParams(); // Track pending conversation creation to prevent race conditions const pendingConversationRef = useRef<{ @@ -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; diff --git a/app/src/pages/HomePage.tsx b/app/src/pages/HomePage.tsx index 17f4db3..76fbb50 100644 --- a/app/src/pages/HomePage.tsx +++ b/app/src/pages/HomePage.tsx @@ -152,7 +152,7 @@ export default function HomePage({ userName }: HomePageProps) { {recentChats.length === 0 ? (

No chats yet

) : ( -