diff --git a/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx b/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx index 4a3d0699..c6e988b1 100644 --- a/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx +++ b/apps/masterbots.ai/app/(browse)/[category]/[threadId]/page.tsx @@ -1,10 +1,13 @@ -import { getMessagePairs, getThread } from '@/services/hasura' +import { getCategories, getMessagePairs, getThread } from '@/services/hasura' import type { ChatPageProps } from '@/app/c/[chatbot]/[threadId]/page' import Shortlink from '@/components/routes/browse/shortlink-button' import { ThreadAccordion } from '@/components/shared/thread-accordion' +import { BrowseCategoryTabs } from '@/components/routes/browse/browse-category-tabs' +import { BrowseSearchInput } from '@/components/routes/browse/browse-search-input' export default async function ThreadLandingPage({ params }: ChatPageProps) { + const categories = await getCategories() const thread = await getThread({ threadId: params.threadId }) @@ -12,6 +15,8 @@ export default async function ThreadLandingPage({ params }: ChatPageProps) { return (
+ + +
- +
) } diff --git a/apps/masterbots.ai/app/(browse)/page.tsx b/apps/masterbots.ai/app/(browse)/page.tsx index 8de81e88..3b492380 100644 --- a/apps/masterbots.ai/app/(browse)/page.tsx +++ b/apps/masterbots.ai/app/(browse)/page.tsx @@ -8,12 +8,11 @@ export default async function BrowsePage() { const threads = await getBrowseThreads({ limit: 50 }) - return ( -
+
- +
) } diff --git a/apps/masterbots.ai/app/b/[id]/page.tsx b/apps/masterbots.ai/app/b/[id]/page.tsx index 88ea62e5..99a3c982 100644 --- a/apps/masterbots.ai/app/b/[id]/page.tsx +++ b/apps/masterbots.ai/app/b/[id]/page.tsx @@ -16,9 +16,9 @@ export default async function BotThreadsPage({ threads: true }) if (!chatbot) throw new Error(`Chatbot ${botNames.get(params.id)} not found`) - + const chatbotName = botNames.get(params.id) threads = await getBrowseThreads({ - chatbotName: botNames.get(params.id), + chatbotName, limit: 50 }) @@ -33,7 +33,7 @@ export default async function BotThreadsPage({ threadNum={threads.length} />
- +
) diff --git a/apps/masterbots.ai/app/u/[slug]/page.tsx b/apps/masterbots.ai/app/u/[slug]/page.tsx index ebc5d5b5..f2608f77 100644 --- a/apps/masterbots.ai/app/u/[slug]/page.tsx +++ b/apps/masterbots.ai/app/u/[slug]/page.tsx @@ -23,7 +23,7 @@ export default async function BotThreadsPage({ threadNum={threads.length} //TODO: get total number of thread. not the filter one />
- +
) diff --git a/apps/masterbots.ai/components/shared/thread-list.tsx b/apps/masterbots.ai/components/shared/thread-list.tsx index 8a580002..d5121b58 100644 --- a/apps/masterbots.ai/components/shared/thread-list.tsx +++ b/apps/masterbots.ai/components/shared/thread-list.tsx @@ -7,8 +7,11 @@ import { useBrowse } from '@/hooks/use-browse' import { getBrowseThreads } from '@/services/hasura' import { ThreadDialog } from './thread-dialog' -export default function ThreadList({ initialThreads }: ThreadListProps) { - const { keyword, tab } = useBrowse() +export default function ThreadList({ + initialThreads, + filter +}: ThreadListProps) { + const { keyword } = useBrowse() const [threads, setThreads] = useState(initialThreads) const [filteredThreads, setFilteredThreads] = useState(initialThreads) @@ -22,7 +25,7 @@ export default function ThreadList({ initialThreads }: ThreadListProps) { setLoading(true) const moreThreads = await getBrowseThreads({ - categoryId: tab, + ...filter, offset: filteredThreads.length, limit: 50 }) @@ -79,4 +82,10 @@ export default function ThreadList({ initialThreads }: ThreadListProps) { type ThreadListProps = { initialThreads: Thread[] + filter: { + categoryId?: number + userId?: string + chatbotName?: string + slug?: string + } }