- {user && !isTokenExpired(jwt) ? (
-
- ) : (
-
- )}
+
)
diff --git a/apps/masterbots.ai/components/routes/b/bot-details.tsx b/apps/masterbots.ai/components/routes/b/bot-details.tsx
deleted file mode 100644
index 95267e16..00000000
--- a/apps/masterbots.ai/components/routes/b/bot-details.tsx
+++ /dev/null
@@ -1,82 +0,0 @@
-import type { Chatbot } from '@repo/mb-genql'
-import Image from 'next/image'
-import Link from 'next/link'
-import { Separator } from '../../ui/separator'
-
-export default function BrowseChatbotDetails({
- chatbot
-}: {
- chatbot?: Chatbot
-}) {
- return (
-
-
-
-
{chatbot.name}
-
-
- {chatbot.categories[0].category.name}.
-
-
-
- {chatbot.description ?
{chatbot.description}
: ''}
-
-
- Threads:{' '}
-
- {chatbot.threads.length ?? 1}
-
- {/*
- Views: 0
-
*/}
- {/*
- Read time:{' '}
-
- {readingTime(messages)} min
-
-
*/}
-
-
-
-
-
-
- Chat with {chatbot.name} >
-
- {/*
-
- 0
-
- 0
-
-
-
*/}
-
-
-
-
-
-
-
- )
-}
diff --git a/apps/masterbots.ai/components/routes/browse/browse-user-details.tsx b/apps/masterbots.ai/components/routes/browse/browse-user-details.tsx
deleted file mode 100644
index eccfd76a..00000000
--- a/apps/masterbots.ai/components/routes/browse/browse-user-details.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-'use client'
-
-import type { User } from '@repo/mb-genql'
-import Image from 'next/image'
-import { useEffect, useState } from 'react'
-import { getBrowseThreads } from '@/services/hasura'
-import { Separator } from '../../ui/separator'
-
-export default function BrowseChatbotDetails({ user }: { user?: User | null }) {
- const [threadNum, setThreadNum] = useState(0)
- const getThreadByUserName = async () => {
- const threads = await getBrowseThreads({
- slug: user.slug
- })
- setThreadNum(threads.length)
- }
- useEffect(() => {
- getThreadByUserName()
- }, [])
- return (
-
-
-
-
- {user.username.replace('_', ' ')}
-
-
-
-
-
- Threads: {threadNum ?? 1}
-
-
-
-
-
-
-
-
- )
-}
diff --git a/apps/masterbots.ai/components/routes/c/chat-layout-section.tsx b/apps/masterbots.ai/components/routes/c/chat-layout-section.tsx
index 7abb0225..0b062805 100644
--- a/apps/masterbots.ai/components/routes/c/chat-layout-section.tsx
+++ b/apps/masterbots.ai/components/routes/c/chat-layout-section.tsx
@@ -2,7 +2,7 @@
import * as React from 'react'
import { useThread } from '@/hooks/use-thread'
-import { ThreadPopup } from './thread-popup'
+import { ThreadPopup } from './chat-thread-popup'
export function ChatLayoutSection({ children }: { children: React.ReactNode }) {
const { sectionRef, isOpenPopup } = useThread()
diff --git a/apps/masterbots.ai/components/routes/c/thread-list.tsx b/apps/masterbots.ai/components/routes/c/chat-thread-list.tsx
similarity index 100%
rename from apps/masterbots.ai/components/routes/c/thread-list.tsx
rename to apps/masterbots.ai/components/routes/c/chat-thread-list.tsx
diff --git a/apps/masterbots.ai/components/routes/c/thread-popup.tsx b/apps/masterbots.ai/components/routes/c/chat-thread-popup.tsx
similarity index 100%
rename from apps/masterbots.ai/components/routes/c/thread-popup.tsx
rename to apps/masterbots.ai/components/routes/c/chat-thread-popup.tsx
diff --git a/apps/masterbots.ai/components/routes/c/thread-date-range-picker.tsx b/apps/masterbots.ai/components/routes/c/thread-date-range-picker.tsx
deleted file mode 100644
index 26abf56e..00000000
--- a/apps/masterbots.ai/components/routes/c/thread-date-range-picker.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-'use client'
-
-import * as React from 'react'
-import { CalendarIcon } from '@radix-ui/react-icons'
-import { addDays, format } from 'date-fns'
-import type { DateRange } from 'react-day-picker'
-import { cn } from '@/lib/utils'
-import { Button } from '@/components/ui/button'
-import { Calendar } from '@/components/ui/calendar'
-import {
- Popover,
- PopoverContent,
- PopoverTrigger
-} from '@/components/ui/popover'
-
-export function DateRangePicker({
- className
-}: React.HTMLAttributes
) {
- const [date, setDate] = React.useState({
- from: new Date(2023, 0, 20),
- to: addDays(new Date(2023, 0, 20), 20)
- })
-
- return (
-
-
-
-
-
-
-
-
-
-
- )
-}
diff --git a/apps/masterbots.ai/components/routes/c/thread-panel/user-thread-panel.tsx b/apps/masterbots.ai/components/routes/c/thread-panel/user-thread-panel.tsx
index e4ddc093..e6a8e32f 100644
--- a/apps/masterbots.ai/components/routes/c/thread-panel/user-thread-panel.tsx
+++ b/apps/masterbots.ai/components/routes/c/thread-panel/user-thread-panel.tsx
@@ -3,12 +3,13 @@
import type { Thread } from '@repo/mb-genql'
import React, { useEffect, useRef, useState } from 'react'
import { ChatSearchInput } from '@/components/routes/c/chat-search-input'
-import ThreadList from '@/components/routes/c/thread-list'
+
import { useSidebar } from '@/hooks/use-sidebar'
import { useThread } from '@/hooks/use-thread'
import { getThreads } from '@/services/hasura'
import { useGlobalStore } from '@/hooks/use-global-store'
import ChatChatbotDetails from '../chat-chatbot-details'
+import ThreadList from '../chat-thread-list'
const PAGE_SIZE = 20
diff --git a/apps/masterbots.ai/components/shared/mb-avatar.tsx b/apps/masterbots.ai/components/shared/account-avatar.tsx
similarity index 83%
rename from apps/masterbots.ai/components/shared/mb-avatar.tsx
rename to apps/masterbots.ai/components/shared/account-avatar.tsx
index 0072fc95..6378bdda 100644
--- a/apps/masterbots.ai/components/shared/mb-avatar.tsx
+++ b/apps/masterbots.ai/components/shared/account-avatar.tsx
@@ -3,7 +3,7 @@ import Image from 'next/image'
import Link from 'next/link'
import { IconUser } from '../ui/icons'
-export function MbAvatar({ href, alt, src }: MbAvatarProp) {
+export function AccountAvatar({ href, alt, src, size = 32 }: MbAvatarProp) {
return (
) : (
@@ -31,4 +31,5 @@ interface MbAvatarProp {
href: string
alt: string
src?: string
+ size?: number
}
diff --git a/apps/masterbots.ai/components/shared/account-details.tsx b/apps/masterbots.ai/components/shared/account-details.tsx
new file mode 100644
index 00000000..6e3c6b61
--- /dev/null
+++ b/apps/masterbots.ai/components/shared/account-details.tsx
@@ -0,0 +1,72 @@
+import Image from 'next/image'
+import Link from 'next/link'
+import { Separator } from '../ui/separator'
+
+export default function AccountDetails({
+ alt,
+ avatar,
+ username,
+ href,
+ threadNum = 0,
+ chatbotName,
+ description
+}: AccountDetailsProps) {
+ if (!username && !chatbotName)
+ throw new Error('You must pass username or chatbotName')
+
+ return (
+
+
+
+
+
+
+
+
{username || chatbotName}
+
+ {/*
+ {chatbot.categories[0].category.name}.
+
*/}
+
+
+ {description ?
{description}
: ''}
+
+
+
+
+
+ Threads: {threadNum ?? 0}
+
+
+ {chatbotName ? (
+
+ Chat with {chatbotName} >
+
+ ) : null}
+
+
+
+
+
+ )
+}
+
+interface AccountDetailsProps {
+ alt?: string
+ avatar: string
+ username?: string
+ href: string
+ threadNum?: number
+ chatbotName?: string
+ description?: string
+}
diff --git a/apps/masterbots.ai/components/shared/thread-accordion.tsx b/apps/masterbots.ai/components/shared/thread-accordion.tsx
index 9f8b16d2..b3488f37 100644
--- a/apps/masterbots.ai/components/shared/thread-accordion.tsx
+++ b/apps/masterbots.ai/components/shared/thread-accordion.tsx
@@ -23,11 +23,7 @@ export function ThreadAccordion({
clientFetch = false
}: ThreadAccordionProps) {
// initalMessages is coming from server ssr on load. the rest of messages on demand on mount
- const {
- data: pairs,
- isLoading,
- error
- } = useQuery({
+ const { data: pairs, error } = useQuery({
queryKey: [`messages-${thread.threadId}`],
queryFn: () => getMessagePairs(thread.threadId),
initialData: initialMessagePairs,
@@ -50,7 +46,8 @@ export function ThreadAccordion({
if (error) return There was an error loading thread messages
// if no initial message and still loading show loading message
- if (!pairs?.length && isLoading) return Loading thread messages ...
+ // NOTE: its fast and transitions in. testing without this
+ if (!pairs?.length) return null
console.log(pairs.map((_p, key) => `pair-${key}`))
return (
diff --git a/apps/masterbots.ai/components/shared/thread-dialog.tsx b/apps/masterbots.ai/components/shared/thread-dialog.tsx
index f2a414e6..cf0a5f6a 100644
--- a/apps/masterbots.ai/components/shared/thread-dialog.tsx
+++ b/apps/masterbots.ai/components/shared/thread-dialog.tsx
@@ -24,7 +24,7 @@ export function ThreadDialog({ thread }: ThreadDialogProps) {
diff --git a/apps/masterbots.ai/components/shared/thread-heading.tsx b/apps/masterbots.ai/components/shared/thread-heading.tsx
index 5b48fabe..d061ffc9 100644
--- a/apps/masterbots.ai/components/shared/thread-heading.tsx
+++ b/apps/masterbots.ai/components/shared/thread-heading.tsx
@@ -1,6 +1,6 @@
import { Thread } from '@repo/mb-genql'
import { ShortMessage } from './thread-short-message'
-import { MbAvatar } from './mb-avatar'
+import { AccountAvatar } from './account-avatar'
import { cn } from '@/lib/utils'
export function ThreadHeading({
@@ -19,7 +19,7 @@ export function ThreadHeading({
'relative flex items-center font-normal md:text-lg transition-all w-full gap-3 pr-4'
)}
>
- by
-
diff --git a/apps/masterbots.ai/services/hasura/hasura.service.ts b/apps/masterbots.ai/services/hasura/hasura.service.ts
index 35d85245..0c4184a1 100644
--- a/apps/masterbots.ai/services/hasura/hasura.service.ts
+++ b/apps/masterbots.ai/services/hasura/hasura.service.ts
@@ -507,7 +507,6 @@ export async function getUserInfoFromBrowse(slug: string) {
user: {
username: true,
profilePicture: true,
- name: true,
__args: {
where: {
slug: {
diff --git a/bun.lockb b/bun.lockb
index 21507a16..ed82c55c 100755
Binary files a/bun.lockb and b/bun.lockb differ