feat(companies): implement companies page with data table

This commit introduces a new "Companies" page to the dashboard, providing a comprehensive view of company data in a sortable and paginated table.

Key changes include:
- A new page at `/companies` to display the data table.
- A new API route `/api/companies` that serves mock company data.
- A `CompaniesTable` component built with `react-table` featuring sorting, pagination, and search functionality.
- Reusable `TablePagination` and `TableActions` components to support the table.
- The `moment` library has been added as a dependency to format dates within the table.
- A new `CrossIcon` has been added for UI controls.
- The `InputGroup` component is enhanced with an `autoComplete` prop.
- A link to the new "Companies" page has been added to the sidebar navigation.
This commit is contained in:
AmirReza Jamali
2025-09-16 16:01:59 +03:30
parent feac2ddcb9
commit 2fa774b6bd
21 changed files with 350 additions and 24 deletions
@@ -28,20 +28,20 @@ const useTenderListPresenter = () => {
isFetchingNextPage,
} = useTendersInfiniteQuery(params);
const { inView } = useInView({ threshold: 0.5 });
const { ref, inView } = useInView({ threshold: 0.5 });
useEffect(() => {
if (inView && hasNextPage && data && data.pages.length < 5) {
if (inView && hasNextPage && (data?.pages.length ?? 0) < 5) {
fetchNextPage();
}
}, [inView, hasNextPage, data, fetchNextPage]);
}, [inView, hasNextPage, fetchNextPage, data?.pages.length]);
useEffect(() => {
const result = z.string().safeParse(debouncedSearch);
if (result.success) {
setParams((prevParams) => ({
...prevParams,
q: result.data,
search: debouncedSearch,
}));
}
}, [debouncedSearch]);
@@ -57,6 +57,7 @@ const useTenderListPresenter = () => {
const allTenders = data?.pages.flatMap((page) => page.data.tenders) ?? [];
return {
ref,
currentTender,
setCurrentTender,
search,