import PostList from "@web/src/components/models/course/list/PostList";
import { useAuth } from "@web/src/providers/auth-provider";
import { useMainContext } from "../layout/MainProvider";
import CourseCard from "../courses/components/CourseCard";

export default function MyLearningPage() {
	const { user } = useAuth();
	const { searchCondition } = useMainContext();
	return (
		<>
			<div className="p-4">
				<PostList
					renderItem={(post) => (
						<CourseCard edit={false} course={post}></CourseCard>
					)}
					params={{
						pageSize: 12,
						where: {
							students: {
								some: {
									id: user?.id,
								},
							},
							...searchCondition,
						},
					}}
					cols={4}></PostList>
			</div>
		</>
	);
}
