Skip to content

Commit daf0d1a

Browse files
committed
fix:chat mobile layout
1 parent 67eb340 commit daf0d1a

File tree

3 files changed

+42
-23
lines changed

3 files changed

+42
-23
lines changed

apps/masterbots.ai/components/routes/chat/chat-layout-section.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ export function ChatLayoutSection({ children }: { children: React.ReactNode }) {
1515
<section
1616
ref={sectionRef as React.Ref<HTMLDivElement>}
1717
className={cn(
18-
'flex h-[calc(100vh-4rem)] group w-full overflow-auto animate-in duration-300 ease-in-out relative lg:w-[calc(100%-250px)] xl:w-[calc(100%-300px)] lg:ml-[250px] xl:ml-[300px] scrollbar',
18+
'flex h-[calc(100vh-4rem)] group w-full overflow-auto animate-in duration-300 ease-in-out relative',
19+
'lg:w-[calc(100%-250px)] xl:w-[calc(100%-300px)] lg:ml-[250px] xl:ml-[300px]',
20+
'scrollbar'
1921
)}
2022
>
21-
<div className="flex flex-col w-full max-w-screen-lg gap-10 pt-5 mx-auto px-4 md:px-10">
22-
{children} {/* Renders children within the centered layout */}
23+
<div className="flex flex-col w-full max-w-screen-lg gap-10 px-4 pt-5 mx-auto md:px-10">
24+
{children}
2325
</div>
2426

25-
{isOpenPopup ? <ThreadPopup /> : ''}
27+
<ThreadPopup className={isOpenPopup ? '' : 'hidden'} />
2628
</section>
2729
)
2830
}

apps/masterbots.ai/components/routes/chat/prompt-form.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
import { useEnterSubmit } from '@/lib/hooks/use-enter-submit'
3535
import { useSidebar } from '@/lib/hooks/use-sidebar'
3636
import { useThread } from '@/lib/hooks/use-thread'
37+
import { cn } from '@/lib/utils'
3738
import type { UseChatHelpers } from 'ai/react'
3839
import * as React from 'react'
3940
import Textarea from 'react-textarea-autosize'
@@ -86,9 +87,12 @@ export function PromptForm({
8687
}}
8788
ref={formRef}
8889
>
89-
<div
90-
className={`relative flex flex-col w-full px-8 overflow-hidden max-h-60 grow bg-background sm:rounded-md sm:border sm:px-12
91-
${isOpenPopup && isFocused ? ' dark:border-mirage border-iron' : ''}`}
90+
<div
91+
className={cn(
92+
"relative flex flex-col w-full px-8 overflow-hidden grow bg-background sm:rounded-md sm:border sm:px-12",
93+
"max-h-[120px] md:max-h-60", // Limit height on mobile
94+
isOpenPopup && isFocused ? 'dark:border-mirage border-iron' : ''
95+
)}
9296
>
9397
<ChatCombobox />
9498
<Textarea
@@ -103,8 +107,12 @@ export function PromptForm({
103107
placeholder={placeholder}
104108
spellCheck={false}
105109
disabled={disabled}
106-
className="min-h-[60px] w-full resize-none bg-transparent px-4 py-[1.3rem] focus-within:outline-none sm:text-sm"
107-
/>
110+
className={cn(
111+
"w-full resize-none bg-transparent px-4 focus-within:outline-none sm:text-sm",
112+
"min-h-[40px] md:min-h-[60px]", //? Smaller height on mobile
113+
"py-2 md:py-[1.3rem]" //? Adjusted padding for mobile
114+
)}
115+
/>
108116
<div className="absolute right-0 top-4 sm:right-4">
109117
<Tooltip>
110118
<TooltipTrigger asChild>

apps/masterbots.ai/components/routes/thread/thread-popup.tsx

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,25 @@ export function ThreadPopup({ className }: { className?: string }) {
9191
const threadTitleSubHeading = threadTitleChunks?.slice(32).join(' ')
9292

9393
return (
94-
<div
95-
className={cn(
96-
'size-full dark:bg-[#27272A80] lg:max-w-[calc(100%-250px)] xl:max-w-[calc(100%-300px)] flex justify-center items-center fixed top-16 h-[calc(100vh-4rem)] bg-[#F4F4F580] backdrop-blur-sm ease-in-out duration-500 z-[9] transition-all',
97-
isOpenPopup ? 'animate-fade-in' : 'hidden animate-fade-out'
98-
)}
99-
>
10094
<div
10195
className={cn(
102-
className,
103-
`flex flex-col z-10 rounded-lg duration-500 ease-in-out fixed h-full max-h-[90%]
104-
max-w-[1032px] w-[95%] dark:border-mirage border-iron border
105-
transition-opacity ${isOpenPopup ? 'animate-fade-in' : 'animate-fade-out'}`
96+
'size-full bg-background/80 dark:bg-background/80',
97+
'lg:max-w-[calc(100%-250px)] xl:max-w-[calc(100%-300px)]',
98+
'flex justify-center items-center fixed top-16',
99+
'h-[calc(100vh-4rem)] backdrop-blur-sm ease-in-out duration-500 z-[9]',
100+
'transition-all',
101+
isOpenPopup ? 'animate-fade-in' : 'animate-fade-out',
102+
className
106103
)}
107104
>
105+
<div
106+
className={cn(
107+
'flex flex-col z-10 rounded-lg duration-500 ease-in-out fixed',
108+
'h-full max-h-[90%] max-w-[1032px] w-[95%]',
109+
'dark:border-mirage border-iron border bg-background dark:bg-background',
110+
'transition-opacity'
111+
)}
112+
>
108113
<div className="relative rounded-t-[8px] px-[32px] py-[20px] dark:bg-[#1E293B] bg-[#E4E4E7]">
109114
<div className="flex items-center justify-between gap-6">
110115
<div className="items-center block overflow-y-auto whitespace-pre-line max-h-28 scrollbar small-thumb">
@@ -132,10 +137,14 @@ export function ThreadPopup({ className }: { className?: string }) {
132137
</div>
133138

134139
<div
135-
className="flex flex-col dark:bg-[#18181B] bg-[white] grow rounded-b-[8px] scrollbar h-full
136-
pb-[180px] md:pb-[180px] max-h-[calc(100vh-280px)] md:max-h-[calc(100vh-220px)]"
137-
ref={popupContentRef as React.Ref<HTMLDivElement>}
138-
>
140+
className={cn(
141+
"flex flex-col dark:bg-[#18181B] bg-white grow rounded-b-[8px] scrollbar h-full",
142+
"pb-[120px] md:pb-[180px]", //? Reduced padding on mobile
143+
"max-h-[calc(100vh-240px)] md:max-h-[calc(100vh-220px)]", //? Adjusted height for mobile
144+
className
145+
)}
146+
ref={popupContentRef as React.Ref<HTMLDivElement>}
147+
>
139148
<ChatList
140149
className="max-w-full !px-[32px] !mx-0"
141150
isThread={false}

0 commit comments

Comments
 (0)