Files
supabase/apps/database-new/components/Header/CurrentThreadName.tsx
T
Terry SuttonandJoshen Lim 4c20bb0d52 Chore/db visualizer 3 (#19177)
* Midway doing something

* Small refactor

* Some mobile responsiveness

* bit fix

* Update name

* One more name

* One more name, again

* Footer and faqs

* Fix

* Style fixes

* Style fixes

* Add titles

* Add CTAs to copy, download or load SQL in supabase

* Styling

* mobile

* Add suggestions

* Add delete action

* Cleanup

* Add delete thread and edit thread modals

* Restore server action

* Fix build error

* Import common theme switcher

* Add file

* Restore thread list

* force revalidating profile path

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2023-11-24 13:48:14 +08:00

28 lines
870 B
TypeScript

'use client'
import { useParams } from 'next/navigation'
import { useMessagesQuery } from '@/data/messages-query'
import { UserMessage } from '@/lib/types'
const CurrentThreadName = () => {
const { threadId, runId, messageId }: { threadId: string; runId: string; messageId: string } =
useParams()
const isConversation = threadId !== undefined && runId !== undefined
const { data } = useMessagesQuery({ threadId, runId, enabled: isConversation })
const selectedMessage = data?.messages.find((m) => m.id === messageId) as UserMessage
return (
<div className="hidden xl:block flex items-center gap-x-4">
{selectedMessage !== undefined && (
<p title={selectedMessage.text} className="truncate max-w-[700px] border-l text-sm px-4">
{selectedMessage.text}
</p>
)}
</div>
)
}
export default CurrentThreadName