Skip to content

Commit dc18b40

Browse files
Bran18AndlerRL
andauthored
fix: downgrade react-markdown (#358)
* fix: downgrade react-markdown * fix: downgrade react-markdown * fix: markdown dep version + layout thread list ui * impr: gray-ish overlay bg rm * chore: console log rm --------- Co-authored-by: Roberto Lucas <andler.dev@gmail.com>
1 parent 8a34b83 commit dc18b40

File tree

8 files changed

+63
-50
lines changed

8 files changed

+63
-50
lines changed

apps/masterbots.ai/app/u/[slug]/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default async function ProfilePageLayout({ children }: ProfileLayoutProps
1313
<NextTopLoader color="#1ED761" initialPosition={0.2} />
1414
<Hero />
1515
<ProfileSidebar>
16-
<div className="px-4 md:px-10">
16+
<div className="px-4 md:px-10 h-full">
1717
{children}
1818
</div>
1919
<div className="sticky bottom-0 w-full left-0 z-50 dark:bg-black bg-white">

apps/masterbots.ai/app/u/[slug]/t/page.tsx

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,69 @@
1-
import { authOptions } from '@/auth';
2-
import { UserThreadList } from "@/components/routes/profile/user-thread-list";
3-
import { generateMetadataFromSEO } from '@/lib/metadata';
4-
import { getBrowseThreads, getThreads, getUserBySlug, getUserInfoFromBrowse } from '@/services/hasura';
5-
import { Thread, User } from "mb-genql";
6-
import type { Metadata } from 'next';
7-
import { getServerSession } from "next-auth";
1+
import { authOptions } from '@/auth'
2+
import { UserThreadList } from '@/components/routes/profile/user-thread-list'
3+
import { generateMetadataFromSEO } from '@/lib/metadata'
4+
import {
5+
getBrowseThreads,
6+
getThreads,
7+
getUserBySlug,
8+
getUserInfoFromBrowse,
9+
} from '@/services/hasura'
10+
import type { Thread, User } from 'mb-genql'
11+
import type { Metadata } from 'next'
12+
import { getServerSession } from 'next-auth'
813

914
export default async function ProfilePage({ params }: { params: { slug: string } }) {
10-
1115
let threads: Thread[] = []
1216
const slug = params.slug
1317

1418
const session = await getServerSession(authOptions)
1519
const { user, error } = await getUserBySlug({
1620
slug,
17-
isSameUser: session?.user.slug === slug
18-
});
19-
21+
isSameUser: session?.user.slug === slug,
22+
})
2023

21-
if (error) return <div className="text-center p-4">Error loading profile: <strong>{error}</strong></div>
22-
if (!user) return <div className="text-center p-4">User <strong>{params.slug}</strong> not found</div>
24+
if (error)
25+
return (
26+
<div className="text-center p-4">
27+
Error loading profile: <strong>{error}</strong>
28+
</div>
29+
)
30+
if (!user)
31+
return (
32+
<div className="text-center p-4">
33+
User <strong>{params.slug}</strong> not found
34+
</div>
35+
)
2336

2437
const fetchThreads = async () => {
2538
try {
26-
const isOwnProfile = session?.user?.id === user?.userId;
39+
const isOwnProfile = session?.user?.id === user?.userId
2740
if (!isOwnProfile) {
2841
return await getBrowseThreads({
29-
userId: user.userId
30-
});
42+
userId: user.userId,
43+
})
3144
}
3245

3346
if (!session?.user?.hasuraJwt) {
34-
throw new Error('Authentication required');
47+
throw new Error('Authentication required')
3548
}
3649

3750
return await getThreads({
3851
jwt: session.user.hasuraJwt,
39-
userId: user.userId
40-
});
52+
userId: user.userId,
53+
})
4154
} catch (error) {
42-
console.error('Failed to fetch threads:', error);
43-
return [];
55+
console.error('Failed to fetch threads:', error)
56+
return []
4457
}
45-
};
58+
}
4659

47-
threads = await fetchThreads();
60+
threads = await fetchThreads()
4861

4962
return <UserThreadList user={user as User} threads={threads} />
5063
}
5164

5265
export async function generateMetadata({
53-
params
66+
params,
5467
}: {
5568
params: { slug: string }
5669
}): Promise<Metadata> {
@@ -61,7 +74,7 @@ export async function generateMetadata({
6174
description: user?.username || '',
6275
ogType: 'website',
6376
ogImageUrl: user?.profilePicture || '',
64-
twitterCard: 'summary_large_image'
77+
twitterCard: 'summary_large_image',
6578
}
6679

6780
return generateMetadataFromSEO(seoData)

apps/masterbots.ai/components/layout/profile/profile-page-sidebar.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ export const ProfileSidebar = ({ children }: any) => {
3939
}
4040

4141
return (
42-
<div className="relative w-full flex">
42+
<div className={cn(
43+
'transition-all relative w-full flex',
44+
)}>
4345
{/* Overlay for mobile */}
4446
{isSidebarOpen && (
4547
<div
46-
className="fixed inset-0 bg-black/20 z-30 lg:hidden"
48+
className="fixed inset-0 z-30 lg:hidden"
4749
onClick={() => toggleSidebar()}
4850
role="button"
4951
tabIndex={0}
@@ -57,12 +59,12 @@ export const ProfileSidebar = ({ children }: any) => {
5759
{/* Sidebar */}
5860
<aside
5961
className={cn(
60-
"fixed lg:relative z-40 top-10 md:top-0 transition-transform duration-300 ease-in-out",
62+
"lg:relative z-40 top-10 md:top-0 transition-transform duration-300 ease-in-out",
6163
"w-64 bg-gray-50 dark:bg-black border-r",
6264
"lg:transform-none lg:transition-none",
6365
isSidebarOpen
64-
? "translate-x-0"
65-
: "-translate-x-full lg:translate-x-0"
66+
? 'translate-x-0 w-[300px]'
67+
: '-translate-x-[300px] lg:translate-x-0 w-0'
6668
)}
6769
>
6870
<nav className="flex-1 scrollbar">

apps/masterbots.ai/components/routes/browse/browse-chat-message.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { cleanPrompt } from '@/lib/helpers/ai-helpers'
2929
import { cn } from '@/lib/utils'
3030
import type { Message } from 'ai'
3131
import type { Chatbot } from 'mb-genql'
32-
import type { ExtraProps } from 'react-markdown'
32+
import type ExtraProps from 'react-markdown'
3333
import remarkGfm from 'remark-gfm'
3434
import remarkMath from 'remark-math'
3535

@@ -49,13 +49,13 @@ export function BrowseChatMessage({ message, chatbot, ...props }: ChatMessagePro
4949
remarkPlugins={[remarkGfm, remarkMath]}
5050
components={{
5151
p({ children }) {
52-
return <p className="mb-2 last:mb-0 whitespace-pre-line">{children}</p>
52+
return <p className="mb-2 whitespace-pre-line last:mb-0">{children}</p>
5353
},
5454
ol({ children }) {
55-
return <ol className="list-decimal list-inside text-left">{children}</ol>
55+
return <ol className="text-left list-decimal list-inside">{children}</ol>
5656
},
5757
ul({ children }) {
58-
return <ul className="list-disc list-inside text-left">{children}</ul>
58+
return <ul className="text-left list-disc list-inside">{children}</ul>
5959
},
6060
// @ts-ignore
6161
code({ node, inline = false, className, children, ...props }: React.HTMLAttributes<HTMLElement> & ExtraProps & { node: unknown, inline?: boolean }) {

apps/masterbots.ai/components/routes/chat/onboarding-chatbot-details.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function OnboardingChatbotDetails({
2828
const threadCount = activeChatbot?.threads?.length || 0
2929

3030
return (
31-
<div className="hidden md:flex items-center justify-center -translate-y-8 relative">
31+
<div className="hidden md:flex items-center justify-center relative">
3232
<Card className="w-[600px] bg-white dark:bg-[#09090B] relative z-10">
3333
<CardHeader className="space-y-6">
3434
<h1 className="px-4 pt-4 text-2xl font-bold text-zinc-950 dark:text-gray-300">

apps/masterbots.ai/components/routes/thread/user-thread-panel.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export default function UserThreadPanel({
243243

244244
return (
245245
<>
246-
{(!isContinuousThread || page !== 'profile') && (
246+
{(page !== 'profile' || (page !== 'profile' && !isContinuousThread)) && (
247247
<div className="flex justify-between px-4 md:px-10 py-5 lg:max-w-full">
248248
<ChatSearchInput setThreads={setState} onSearch={setSearchTerm} />
249249
</div>
@@ -259,7 +259,7 @@ export default function UserThreadPanel({
259259
) : (
260260
<>
261261
{page === 'profile' ? (
262-
<div className="flex flex-col py-5 ">
262+
<div className="flex flex-col py-5">
263263
{threads.map((thread: Thread) => (
264264
<BrowseListItem
265265
thread={thread}
@@ -274,15 +274,13 @@ export default function UserThreadPanel({
274274
{loading && <ThreadItemSkeleton />}
275275
</div>
276276
) : (
277-
<div className="flex px-4 py-5 md:px-10">
278-
<ThreadList
279-
threads={threads}
280-
loading={loading}
281-
count={count}
282-
pageSize={PAGE_SIZE}
283-
loadMore={loadMore}
284-
/>
285-
</div>
277+
<ThreadList
278+
threads={threads}
279+
loading={loading}
280+
count={count}
281+
pageSize={PAGE_SIZE}
282+
loadMore={loadMore}
283+
/>
286284
)}
287285
</>
288286
)}

apps/masterbots.ai/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@
6767
"react-day-picker": "^8.10.1",
6868
"react-dom": "^18.3.1",
6969
"react-intersection-observer": "^9.13.1",
70-
"react-markdown": "^9.0.3",
70+
"react-markdown": "^8.0.7",
7171
"react-syntax-highlighter": "^15.6.1",
7272
"react-textarea-autosize": "^8.5.4",
7373
"react-use": "^17.5.1",
74-
"remark-gfm": "^4.0.0",
75-
"remark-math": "^6.0.0",
74+
"remark-gfm": "^3.0.1",
75+
"remark-math": "^5.1.1",
7676
"resend": "^3.5.0",
7777
"sonner": "^1.7.1",
7878
"stripe": "^15.12.0",

bun.lockb

-6.96 KB
Binary file not shown.

0 commit comments

Comments
 (0)