mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-11-20 20:18:15 +00:00
feat(chat-window): remove loading state
This commit is contained in:
@@ -8,7 +8,6 @@ import { Settings } from 'lucide-react';
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import NextError from 'next/error';
|
import NextError from 'next/error';
|
||||||
import { useChat } from '@/lib/hooks/useChat';
|
import { useChat } from '@/lib/hooks/useChat';
|
||||||
import Loader from './ui/Loader';
|
|
||||||
import SettingsButtonMobile from './Settings/SettingsButtonMobile';
|
import SettingsButtonMobile from './Settings/SettingsButtonMobile';
|
||||||
|
|
||||||
export interface BaseMessage {
|
export interface BaseMessage {
|
||||||
@@ -52,7 +51,7 @@ export interface File {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ChatWindow = () => {
|
const ChatWindow = () => {
|
||||||
const { hasError, isReady, notFound, messages } = useChat();
|
const { hasError, notFound, messages } = useChat();
|
||||||
if (hasError) {
|
if (hasError) {
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
@@ -68,24 +67,18 @@ const ChatWindow = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return isReady ? (
|
return notFound ? (
|
||||||
notFound ? (
|
<NextError statusCode={404} />
|
||||||
<NextError statusCode={404} />
|
|
||||||
) : (
|
|
||||||
<div>
|
|
||||||
{messages.length > 0 ? (
|
|
||||||
<>
|
|
||||||
<Navbar />
|
|
||||||
<Chat />
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<EmptyChat />
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
) : (
|
) : (
|
||||||
<div className="flex flex-row items-center justify-center min-h-screen">
|
<div>
|
||||||
<Loader />
|
{messages.length > 0 ? (
|
||||||
|
<>
|
||||||
|
<Navbar />
|
||||||
|
<Chat />
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<EmptyChat />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user