'use client';

import { nanoid } from '@/lib/utils';
import { Chat } from '@/components/chat';
import { ThemeToggle } from '../../components/ThemeToggle';
import { useAtomValue } from 'jotai';
import { datasetAtom } from '../../state';
import { EmptyScreen } from '../../components/chat/EmptyScreen';

export default function Page() {
	const id = nanoid();
	const dataset = useAtomValue(datasetAtom);

	if (!dataset.length)
		return (
			<div className="pb-[150px] pt-4 md:pt-10 h-full">
				<EmptyScreen />
			</div>
		);

	return (
		<>
			<Chat id={id} />
			<ThemeToggle />
		</>
	);
}
