import { fetchProjectCategories, fetchProjects } from "@/app/api/projects";
import React from "react";
import ProjectSearch from "./ProjectSearch";
import ProjectSearchLoading from "./ProjectSearchLoading";
import { fetchUserAbilities } from "@/app/utils/fetchUtil";

interface SubComponents {
  Loading: typeof ProjectSearchLoading;
}

const ProjectSearchWrapper: React.FC & SubComponents = async () => {
  const projectCategories = await fetchProjectCategories();
  const projects = await fetchProjects();

  const abilities = await fetchUserAbilities()

  return <ProjectSearch projects={projects} projectCategories={projectCategories} abilities={abilities}/>;
};

ProjectSearchWrapper.Loading = ProjectSearchLoading;

export default ProjectSearchWrapper;
