"use client"; import { ProjectResult } from "@/app/api/projects"; import React, { useMemo, useState } from "react"; import SearchBox, { Criterion } from "../SearchBox"; import { useTranslation } from "react-i18next"; import SearchResults, { Column } from "../SearchResults"; import { ClientProjectResult } from "@/app/api/clientprojects"; interface Props { projects: ClientProjectResult[]; } type SearchQuery = Partial>; type SearchParamNames = keyof SearchQuery; const ProgressByClientSearch: React.FC = ({ projects }) => { const { t } = useTranslation("projects"); // If project searching is done on the server-side, then no need for this. const [filteredProjects, setFilteredProjects] = useState(projects); const searchCriteria: Criterion[] = useMemo( () => [ { label: "Client Code", paramName: "clientCode", type: "text" }, { label: "Client Name", paramName: "clientName", type: "text" }, ], [t], ); const columns = useMemo[]>( () => [ { name: "clientCode", label: t("Client Code") }, { name: "clientName", label: t("Client Name") }, { name: "SubsidiaryClientCode", label: t("Subsidiary Code") }, { name: "SubsidiaryClientName", label: t("Subisdiary") }, { name: "NoOfProjects", label: t("No. of Projects") }, ], [t], ); return ( <> { console.log(query); }} /> items={filteredProjects} columns={columns} /> ); }; export default ProgressByClientSearch;