Skip to content

Commit

Permalink
feat(chat-window): show settings during error on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
ItzCrazyKns committed Jan 11, 2025
1 parent 0f6b3c2 commit 2dc60d0
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions ui/components/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { toast } from 'sonner';
import { useSearchParams } from 'next/navigation';
import { getSuggestions } from '@/lib/actions';
import Error from 'next/error';
import { Settings } from 'lucide-react';
import SettingsDialog from './SettingsDialog';

export type Message = {
messageId: string;
Expand Down Expand Up @@ -344,6 +346,8 @@ const ChatWindow = ({ id }: { id?: string }) => {

const [notFound, setNotFound] = useState(false);

const [isSettingsOpen, setIsSettingsOpen] = useState(false);

useEffect(() => {
if (
chatId &&
Expand Down Expand Up @@ -548,10 +552,19 @@ const ChatWindow = ({ id }: { id?: string }) => {

if (hasError) {
return (
<div className="flex flex-col items-center justify-center min-h-screen">
<p className="dark:text-white/70 text-black/70 text-sm">
Failed to connect to the server. Please try again later.
</p>
<div className="relative">
<div className="absolute w-full flex flex-row items-center justify-end mr-5 mt-5">
<Settings
className="cursor-pointer lg:hidden"
onClick={() => setIsSettingsOpen(true)}
/>
</div>
<div className="flex flex-col items-center justify-center min-h-screen">
<p className="dark:text-white/70 text-black/70 text-sm">
Failed to connect to the server. Please try again later.
</p>
</div>
<SettingsDialog isOpen={isSettingsOpen} setIsOpen={setIsSettingsOpen} />
</div>
);
}
Expand Down

0 comments on commit 2dc60d0

Please sign in to comment.