From b1109ea420baadcee6e91086e31d530795b0cc03 Mon Sep 17 00:00:00 2001
From: psiddharthdesign <107192927+psiddharthdesign@users.noreply.github.com>
Date: Wed, 14 Aug 2024 20:57:18 +0530
Subject: [PATCH] fix / cleanup page
---
.../drifts/DriftedProjectsWithPagination.tsx | 68 +------------------
.../drifts/page.tsx | 9 +++
2 files changed, 12 insertions(+), 65 deletions(-)
diff --git a/src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/org/[organizationId]/(specific-organization-pages)/drifts/DriftedProjectsWithPagination.tsx b/src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/org/[organizationId]/(specific-organization-pages)/drifts/DriftedProjectsWithPagination.tsx
index 39e86ed7..10ac9fdc 100644
--- a/src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/org/[organizationId]/(specific-organization-pages)/drifts/DriftedProjectsWithPagination.tsx
+++ b/src/app/(dynamic-pages)/(authenticated-pages)/(application-pages)/org/[organizationId]/(specific-organization-pages)/drifts/DriftedProjectsWithPagination.tsx
@@ -1,86 +1,24 @@
import { Pagination } from "@/components/Pagination";
import { getLoggedInUserOrganizationRole } from "@/data/user/organizations";
-import { getAllProjectsListInOrganization, getProjectIdsInOrganization, getProjectsCountForUser, getProjectsList, getProjectsTotalCount, getSlimProjectsForUser } from "@/data/user/projects";
+import { getProjectsCountForUser, getProjectsListForUser } from "@/data/user/projects";
import { serverGetLoggedInUser } from "@/utils/server/serverGetLoggedInUser";
import { projectsfilterSchema } from "@/utils/zod-schemas/params";
import { OrganizationProjectsTable } from "../projects/OrganizationProjectsTable";
-import { DriftAlert, generateDummyDriftAlerts } from "./drift-alerts";
-
-
export async function UserDriftedProjectsWithPagination({
organizationId,
searchParams,
}: { organizationId: string; searchParams: unknown }) {
const filters = projectsfilterSchema.parse(searchParams);
-
- const projectIdsForDriftAlerts = await getProjectIdsInOrganization(organizationId, 2);
-
- // Once drift_alerts table is created, we will use that to fetch the alerts and check the count to be greater than 0
- // For now, we are adding dummy alerts from dummyData.ts
-
- // using dummy data to get drifted project ids
- // TODO: once drift_alerts table is created, we will use that to fetch the alerts and check the count to be greater than 0
-
- const driftAlerts: DriftAlert[] = generateDummyDriftAlerts(projectIdsForDriftAlerts);
-
- // get unique project ids from the drift alerts
- const driftedProjectIds = Array.from(new Set(driftAlerts.map(alert => alert.project_id)));
-
const [{ id: userId }, userRole] = await Promise.all([
serverGetLoggedInUser(),
- getLoggedInUserOrganizationRole(organizationId),
+ getLoggedInUserOrganizationRole(organizationId)
]);
-
- // const [projects, totalPages] = await Promise.all([
- // getProjectsListForUser({ ...filters, organizationId, userRole, userId }),
- // getProjectsCountForUser({ ...filters, organizationId, userId }),
- // ]);
-
const [projects, totalPages] = await Promise.all([
- getSlimProjectsForUser({ projectIds: driftedProjectIds, userRole, userId }),
+ getProjectsListForUser({ ...filters, organizationId, userRole, userId }),
getProjectsCountForUser({ ...filters, organizationId, userId }),
]);
-
-
- return (
- <>
-
+ Searching for {filters.query} +
+ )} +