diff --git a/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx b/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx index 3cf95e88..85df01a7 100644 --- a/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx +++ b/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx @@ -13,7 +13,7 @@ export default async function ThreadPage({ params }: ThreadPageProps) { const initialMessagePairs = await getMessagePairs(thread.threadId) return ( -
+
1 return ( -
+
diff --git a/apps/masterbots.ai/app/(browse)/page.tsx b/apps/masterbots.ai/app/(browse)/page.tsx index 56c319eb..23d51368 100644 --- a/apps/masterbots.ai/app/(browse)/page.tsx +++ b/apps/masterbots.ai/app/(browse)/page.tsx @@ -23,10 +23,10 @@ export default async function HomePage({ searchParams }: HomePageProps) { offset: (page - 1) * limit, query }) - console.log('Thereads', threads.length) + console.log('Threads', threads.length) return ( -
+
{/*
Your query: {query}
diff --git a/apps/masterbots.ai/app/b/[id]/page.tsx b/apps/masterbots.ai/app/b/[id]/page.tsx index 2fc8c4e4..a465e74c 100644 --- a/apps/masterbots.ai/app/b/[id]/page.tsx +++ b/apps/masterbots.ai/app/b/[id]/page.tsx @@ -44,7 +44,7 @@ export default async function BotThreadsPage({ threadNum={threads.length} category={chatbot.categories[0]?.category.name} /> -
+
diff --git a/apps/masterbots.ai/app/c/layout.tsx b/apps/masterbots.ai/app/c/layout.tsx index 13cb705b..bc1d2534 100644 --- a/apps/masterbots.ai/app/c/layout.tsx +++ b/apps/masterbots.ai/app/c/layout.tsx @@ -24,8 +24,8 @@ export default async function ChatLayout({ children }: ChatLayoutProps) { //
} -
- {children} +
+
{children}
diff --git a/apps/masterbots.ai/app/globals.css b/apps/masterbots.ai/app/globals.css index d45651cd..f7ff0249 100644 --- a/apps/masterbots.ai/app/globals.css +++ b/apps/masterbots.ai/app/globals.css @@ -46,11 +46,9 @@ --mirage: 217, 33%, 17%; --iron: 240, 6%, 90%; - --mb-gradient: linear-gradient( - 21deg, - rgba(16, 171, 255, 0.7), - rgba(27, 234, 189, 0.6) - ); + --mb-gradient: linear-gradient(21deg, + rgba(16, 171, 255, 0.7), + rgba(27, 234, 189, 0.6)); } .dark { @@ -100,9 +98,14 @@ * { @apply border-border; } + body { @apply bg-background text-foreground; } + + .fluid-container { + @apply max-w-[1024px] px-4 pb-10 mx-auto w-full; + } } .scrollbar { @@ -113,10 +116,12 @@ width: 4px; height: 4px; } + .scrollbar::-webkit-scrollbar-track, .scrollbar::-webkit-scrollbar-corner { background: var(--scrollbar-track); } + .scrollbar::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 2px; @@ -147,7 +152,7 @@ text-overflow: clip; } -.hide-buttons > button { +.hide-buttons>button { display: none; } @@ -175,13 +180,17 @@ /* Input specific styles */ .gradient-input { - position: relative; /* Set to relative for proper positioning of child elements */ + position: relative; + /* Set to relative for proper positioning of child elements */ background: var(--mb-gradient); - padding: 2px; /* Padding around the input for border effect */ - display: inline-block; /* Default display to inline for inline fields */ - border-radius: 9999em; /* Circular border radius */ - - > input { + padding: 2px; + /* Padding around the input for border effect */ + display: inline-block; + /* Default display to inline for inline fields */ + border-radius: 9999em; + /* Circular border radius */ + + >input { border-radius: inherit; } -} +} \ No newline at end of file diff --git a/apps/masterbots.ai/app/u/[slug]/page.tsx b/apps/masterbots.ai/app/u/[slug]/page.tsx index d5e1696e..7a3ec341 100644 --- a/apps/masterbots.ai/app/u/[slug]/page.tsx +++ b/apps/masterbots.ai/app/u/[slug]/page.tsx @@ -31,7 +31,7 @@ export default async function BotThreadsPage({ threadNum={threads.length} //TODO: get total number of thread. not the filter one username={user.username} /> -
+
)} - {user.username} + + {user.username} + -
name
-
email
+
{user.username}
+
{user.email}
diff --git a/apps/masterbots.ai/components/routes/c/sidebar/index.tsx b/apps/masterbots.ai/components/routes/c/sidebar/index.tsx index 197cb244..0df1bb49 100644 --- a/apps/masterbots.ai/components/routes/c/sidebar/index.tsx +++ b/apps/masterbots.ai/components/routes/c/sidebar/index.tsx @@ -20,9 +20,7 @@ export function Sidebar({ className, children }: SidebarProps) { data-state={isSidebarOpen && !isLoading ? 'open' : 'closed'} ref={ref} > -
- {children} -
+
{children}
) } diff --git a/apps/masterbots.ai/components/routes/c/sidebar/sidebar-responsive.tsx b/apps/masterbots.ai/components/routes/c/sidebar/sidebar-responsive.tsx index d26217d6..4c95a473 100644 --- a/apps/masterbots.ai/components/routes/c/sidebar/sidebar-responsive.tsx +++ b/apps/masterbots.ai/components/routes/c/sidebar/sidebar-responsive.tsx @@ -9,7 +9,8 @@ export async function ResponsiveSidebar() { transition-all -translate-x-full duration-500 ease-in-out data-[state=open]:translate-x-0 data-[state=closed]:lg:translate-x-0 - w-[300px] lg:w-[250px] xl:w-[300px]" + w-[300px] lg:w-[250px] xl:w-[300px] + lg:static absolute" > {/*

Chat history

diff --git a/apps/masterbots.ai/components/shared/account-details.tsx b/apps/masterbots.ai/components/shared/account-details.tsx index 4d077572..ff802fe7 100644 --- a/apps/masterbots.ai/components/shared/account-details.tsx +++ b/apps/masterbots.ai/components/shared/account-details.tsx @@ -20,7 +20,7 @@ export default function AccountDetails({
diff --git a/apps/masterbots.ai/components/shared/search-input.tsx b/apps/masterbots.ai/components/shared/search-input.tsx index da397451..6984ffe9 100644 --- a/apps/masterbots.ai/components/shared/search-input.tsx +++ b/apps/masterbots.ai/components/shared/search-input.tsx @@ -55,18 +55,16 @@ export function SearchInput() {
) : null} -
{ setQuery(e.target.value) }} - placeholder="Search answers on all categories" + placeholder="Search any chat with any Bot" type="text" value={query || ''} /> {/* */} -
{/* */}
diff --git a/apps/masterbots.ai/components/shared/thread-accordion.tsx b/apps/masterbots.ai/components/shared/thread-accordion.tsx index e55d3b7f..148d2913 100644 --- a/apps/masterbots.ai/components/shared/thread-accordion.tsx +++ b/apps/masterbots.ai/components/shared/thread-accordion.tsx @@ -63,8 +63,10 @@ export function ThreadAccordion({ // Cleanup function to remove the query parameter on unmount return () => { const url = new URL(window.location.href) - url.searchParams.delete('threadId') - window.history.pushState({}, '', url.pathname + url.search) + if (url.searchParams.get('threadId') === thread.threadId) { + url.searchParams.delete('threadId') + window.history.pushState({}, '', url.pathname + url.search) + } } }, [thread.threadId, pathname]) diff --git a/apps/masterbots.ai/components/shared/thread-heading.tsx b/apps/masterbots.ai/components/shared/thread-heading.tsx index 780942ac..960fb113 100644 --- a/apps/masterbots.ai/components/shared/thread-heading.tsx +++ b/apps/masterbots.ai/components/shared/thread-heading.tsx @@ -54,7 +54,9 @@ export function ThreadHeading({
{response ? ( -
+
) : null} diff --git a/apps/masterbots.ai/components/shared/thread-list-accordion.tsx b/apps/masterbots.ai/components/shared/thread-list-accordion.tsx index 82d19915..e730907c 100644 --- a/apps/masterbots.ai/components/shared/thread-list-accordion.tsx +++ b/apps/masterbots.ai/components/shared/thread-list-accordion.tsx @@ -3,7 +3,7 @@ import type { Thread } from '@repo/mb-genql' import { DialogProps } from '@radix-ui/react-dialog' import { useSetState } from 'react-use' -import { cn } from '@/lib/utils' +import { cn, sleep } from '@/lib/utils' import { Accordion, AccordionContent, @@ -13,6 +13,8 @@ import { import { ThreadAccordion } from './thread-accordion' import { ThreadHeading } from './thread-heading' import { createMessagePairs } from '@/lib/threads' +import { useSearchParams } from 'next/navigation' +import { useEffect, useRef } from 'react' export function ThreadListAccordion({ thread, @@ -27,13 +29,29 @@ export function ThreadListAccordion({ firstResponse: thread.messages.find(m => m.role === 'assistant')?.content || 'not found' }) + const searchParams = useSearchParams(); + const threadRef = useRef(null) + const handleThreadIdChange = async () => { + if (searchParams.get('threadId') === thread.threadId) { + await sleep(300) // animation time + threadRef.current?.scrollIntoView({ behavior: 'smooth', block: 'start' }) + } else if (state.isOpen && searchParams.get('threadId')) { + setState({ isOpen: false }) + } + } + + useEffect(() => { + handleThreadIdChange() + }, [searchParams ]) return ( { setState({ isOpen: v[0] === 'pair-1' }) }} + value={state.isOpen ? ['pair-1'] : []} type="multiple" > {/* Frist level question and excerpt visible on lists */} diff --git a/apps/masterbots.ai/lib/threads.ts b/apps/masterbots.ai/lib/threads.ts index 9e8e14e0..1b641038 100644 --- a/apps/masterbots.ai/lib/threads.ts +++ b/apps/masterbots.ai/lib/threads.ts @@ -91,5 +91,5 @@ export function getThreadLink({ }) { return chat ? `/c/${toSlug(thread.chatbot.name)}/${thread.threadId}` - : `/${toSlug(thread.chatbot.categories[0]?.category.name)}/${thread.threadId}}` + : `/${toSlug(thread.chatbot.categories[0]?.category.name)}/${thread.threadId}` }