feat(dashboard): integrate new dashboard queries and refactor closing soon component
- Replaced TTenderDetails with TDashboardClosingSoonItem in the ClosingSoonCard component for better type accuracy. - Removed the fake-data.ts file as it is no longer needed with the new dashboard queries. - Introduced new hooks for fetching dashboard data, including summary, trend, countries, notice types, and closing soon items. - Updated useDashboardData to utilize the new dashboard queries, enhancing data retrieval and management. - Enhanced the API service layer with new endpoints for dashboard functionalities, improving overall architecture.
This commit is contained in:
@@ -16,6 +16,7 @@ import { TenderDetailsError } from "./components/tender-details-error";
|
||||
import { TenderDetailsHeader } from "./components/tender-details-header";
|
||||
import { useTenderSectionScrollSpy } from "./hooks/use-tender-section-scroll-spy";
|
||||
import { getTenderNavItems } from "./tender-nav-utils";
|
||||
import { shouldShowAiSummarySection } from "./tender-display-utils";
|
||||
|
||||
interface IProps {
|
||||
params: Promise<{
|
||||
@@ -43,11 +44,14 @@ const TenderDetails = ({ params }: IProps) => {
|
||||
];
|
||||
|
||||
const tenderForNav = data?.data;
|
||||
const hasValidAiSummary = tenderForNav
|
||||
? shouldShowAiSummarySection(tenderForNav)
|
||||
: false;
|
||||
const { data: documentsResponse, isPending: isDocumentsLoading } =
|
||||
useGetTenderDocumentsQuery(details);
|
||||
useGetTenderDocumentsQuery(details, { enabled: hasValidAiSummary });
|
||||
const documents = documentsResponse?.data ?? [];
|
||||
const showDocumentsSection =
|
||||
isDocumentsLoading || documents.length > 0;
|
||||
hasValidAiSummary && (isDocumentsLoading || documents.length > 0);
|
||||
|
||||
const tenderNavItems = useMemo(
|
||||
() =>
|
||||
|
||||
Reference in New Issue
Block a user