import PostList from "@web/src/components/models/course/list/PostList";
import { useAuth } from "@web/src/providers/auth-provider";
import { useMainContext } from "../../layout/MainProvider";
import { PostType } from "@nice/common";
import PostCard from "@web/src/components/models/post/PostCard";
import CourseCard from "@web/src/components/models/post/SubPost/CourseCard";

export default function MyLearningListContainer() {
	const { user } = useAuth();
	const { searchCondition, termsCondition } = useMainContext();
	return (
		<>
			<PostList
				renderItem={(post) => <CourseCard post={post}></CourseCard>}
				params={{
					pageSize: 12,
					where: {
						type: PostType.COURSE,
						students: {
							some: {
								id: user?.id,
							},
						},
						...termsCondition,
						...searchCondition,
					},
				}}
				cols={4}></PostList>
		</>
	);
}
