import { auth } from '@/auth';
import { fetchRecentProjectList } from '@/lib/fetch/clef';
import { redirect } from 'next/navigation';
import { v5 as uuidV5 } from 'uuid';
import ProjectCard from './ProjectCard';

export interface ProjectListSideBarProps {}

const ProjectListSideBar: React.FC<ProjectListSideBarProps> = async () => {
	const recentProjects = await fetchRecentProjectList();
	return (
		<div
			data-state="open"
			className="peer absolute inset-y-0 z-30 hidden border-r bg-muted duration-300 ease-in-out translate-x-0 lg:flex lg:w-[250px] xl:w-[300px] h-full flex-col dark:bg-zinc-950 overflow-auto py-2"
		>
			{recentProjects.map(project => (
				<ProjectCard key={project.id} projectInfo={project} />
			))}
		</div>
	);
};

export default ProjectListSideBar;
