fix the fonts import ,also fix the infinit scroll

This commit is contained in:
Saeed AB 2025-09-22 15:09:25 +03:30
parent f42a12c25c
commit f1114e71ec
8 changed files with 38 additions and 42 deletions

View File

@ -1,5 +1,5 @@
@import url(/font/fontiran.css);
@import "tailwindcss";
@import url(/font/iranfont.css);
@theme {
/* Teal color scale */

View File

@ -346,10 +346,10 @@ export function DigitalInnovationPage() {
};
const loadMore = useCallback(() => {
if (!loadingMore && hasMore && !loading) {
if (hasMore && !loading) {
setCurrentPage((prev) => prev + 1);
}
}, [loadingMore, hasMore, loading]);
}, [hasMore, loading]);
useEffect(() => {
fetchTable(true);
@ -367,12 +367,12 @@ export function DigitalInnovationPage() {
const scrollContainer = document.querySelector(".overflow-auto");
const handleScroll = () => {
if (!scrollContainer || !hasMore || loadingMore) return;
if (!scrollContainer || !hasMore) return;
const { scrollTop, scrollHeight, clientHeight } = scrollContainer;
const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
if (scrollPercentage >= 0.9) {
if (scrollPercentage == 1) {
loadMore();
}
};

View File

@ -351,10 +351,10 @@ export function GreenInnovationPage() {
};
const loadMore = useCallback(() => {
if (!loadingMore && hasMore && !loading) {
if (hasMore && !loading) {
setCurrentPage((prev) => prev + 1);
}
}, [loadingMore, hasMore, loading]);
}, [hasMore, loading]);
useEffect(() => {
fetchProjects(true);
@ -375,12 +375,12 @@ export function GreenInnovationPage() {
const scrollContainer = document.querySelector(".overflow-auto");
const handleScroll = () => {
if (!scrollContainer || !hasMore || loadingMore) return;
if (!scrollContainer || !hasMore) return;
const { scrollTop, scrollHeight, clientHeight } = scrollContainer;
const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
if (scrollPercentage >= 0.9) {
if (scrollPercentage == 1) {
loadMore();
}
};

View File

@ -411,10 +411,10 @@ export function InnovationBuiltInsidePage() {
};
const loadMore = useCallback(() => {
if (!loadingMore && hasMore && !loading) {
if (hasMore && !loading) {
setCurrentPage((prev) => prev + 1);
}
}, [loadingMore, hasMore, loading]);
}, [hasMore, loading]);
useEffect(() => {
fetchProjects(true);
@ -434,12 +434,12 @@ export function InnovationBuiltInsidePage() {
const scrollContainer = document.querySelector(".overflow-auto");
const handleScroll = () => {
if (!scrollContainer || !hasMore || loadingMore) return;
if (!scrollContainer || !hasMore) return;
const { scrollTop, scrollHeight, clientHeight } = scrollContainer;
const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
if (scrollPercentage >= 0.9) {
if (scrollPercentage == 1) {
loadMore();
}
};

View File

@ -341,10 +341,10 @@ export function ManageIdeasTechPage() {
};
const loadMore = useCallback(() => {
if (!loadingMore && hasMore && !loading) {
if (hasMore && !loading) {
setCurrentPage((prev) => prev + 1);
}
}, [loadingMore, hasMore, loading]);
}, [hasMore, loading]);
useEffect(() => {
fetchProjects(true);
@ -362,13 +362,13 @@ export function ManageIdeasTechPage() {
const scrollContainer = document.querySelector(".overflow-auto");
const handleScroll = () => {
if (!scrollContainer || !hasMore || loadingMore) return;
if (!scrollContainer || !hasMore) return;
const { scrollTop, scrollHeight, clientHeight } = scrollContainer;
const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
// Trigger load more when scrolled to 90% of the container
if (scrollPercentage >= 0.9) {
if (scrollPercentage == 1) {
loadMore();
}
};

View File

@ -321,10 +321,10 @@ export function ProcessInnovationPage() {
};
const loadMore = useCallback(() => {
if (!loadingMore && hasMore && !loading) {
if (hasMore && !loading) {
setCurrentPage((prev) => prev + 1);
}
}, [loadingMore, hasMore, loading]);
}, [hasMore, loading]);
useEffect(() => {
fetchProjects(true);
@ -345,12 +345,12 @@ export function ProcessInnovationPage() {
const scrollContainer = document.querySelector(".overflow-auto");
const handleScroll = () => {
if (!scrollContainer || !hasMore || loadingMore) return;
if (!scrollContainer || !hasMore) return;
const { scrollTop, scrollHeight, clientHeight } = scrollContainer;
const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
if (scrollPercentage >= 0.9) {
if (scrollPercentage == 1) {
loadMore();
}
};

View File

@ -255,7 +255,7 @@ export function ProductInnovationPage() {
const observerRef = useRef<HTMLDivElement>(null);
const fetchingRef = useRef(false);
const handleProjectDetails = async (project: ProductInnovationData) => {
setSelectedProjectDetails(project);
@ -267,7 +267,7 @@ export function ProductInnovationPage() {
const fetchPopupData = async (project: ProductInnovationData) => {
try {
setPopupLoading(true);
// Fetch popup stats
const statsResponse = await apiService.call({
innovation_product_popup_function1: {
@ -296,9 +296,9 @@ export function ProductInnovationPage() {
const chartData = JSON.parse(chartResponse.data);
if (Array.isArray(chartData)) {
// Set all data for line chart
// Filter data for the selected project (bar chart)
const filteredData = chartData.filter(item =>
const filteredData = chartData.filter(item =>
item.product_title === project?.title
);
setAllExportData(chartData);
@ -314,10 +314,10 @@ export function ProductInnovationPage() {
};
const loadMore = useCallback(() => {
if (!loadingMore && hasMore && !loading) {
if (hasMore && !loading) {
setCurrentPage((prev) => prev + 1);
}
}, [loadingMore, hasMore, loading]);
}, [hasMore, loading]);
const fetchProjects = async (reset = false) => {
if (fetchingRef.current) {
@ -497,12 +497,12 @@ export function ProductInnovationPage() {
const scrollContainer = document.querySelector(".overflow-auto");
const handleScroll = () => {
if (!scrollContainer || !hasMore || loadingMore) return;
if (!scrollContainer || !hasMore) return;
const { scrollTop, scrollHeight, clientHeight } = scrollContainer;
const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
if (scrollPercentage >= 0.9) {
if (scrollPercentage == 1) {
loadMore();
}
};
@ -516,7 +516,7 @@ export function ProductInnovationPage() {
scrollContainer.removeEventListener("scroll", handleScroll);
}
};
}, [loadMore, hasMore, loadingMore]);
}, [loadMore, hasMore]);
const handleSort = (field: string) => {
fetchingRef.current = false;
@ -548,7 +548,7 @@ export function ProductInnovationPage() {
return seasons.map(season => {
const seasonData: any = { season };
products.forEach(product => {
const productData = data.find(item =>
const productData = data.find(item =>
item.product_title === product && item.full_season === season
);
seasonData[product] = productData?.export_revenue_sum > 0 && productData ? Math.round(productData?.export_revenue_sum) : 0;
@ -1042,7 +1042,7 @@ export function ProductInnovationPage() {
)}
</div>
</div>
{/* Left Column - Project Description and Charts */}
{popupLoading ? (
<div className="lg:col-span-2 border-r-2 flex flex-col gap-2 pr-4 pb-2 border-r-[#5F6284]/50">
@ -1153,12 +1153,10 @@ export function ProductInnovationPage() {
</div>
)}
</div>
</DialogContent>
</Dialog>
</DashboardLayout>
);
}

View File

@ -264,10 +264,10 @@ export function ProjectManagementPage() {
};
const loadMore = useCallback(() => {
if (!loadingMore && hasMore && !loading) {
if (hasMore && !loading) {
setCurrentPage((prev) => prev + 1);
}
}, [loadingMore, hasMore, loading]);
}, [hasMore, loading]);
useEffect(() => {
fetchProjects(true);
@ -283,18 +283,16 @@ export function ProjectManagementPage() {
// Infinite scroll observer
useEffect(() => {
const scrollContainer = document.querySelector(".overflow-auto");
const handleScroll = () => {
if (!scrollContainer || !hasMore || loadingMore) return;
if (!scrollContainer || !hasMore) return;
const { scrollTop, scrollHeight, clientHeight } = scrollContainer;
const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
// Trigger load more when scrolled to 90% of the container
if (scrollPercentage >= 0.9) {
if (scrollPercentage == 1) {
loadMore();
}
};
if (scrollContainer) {
scrollContainer.addEventListener("scroll", handleScroll);
}
@ -304,7 +302,7 @@ export function ProjectManagementPage() {
scrollContainer.removeEventListener("scroll", handleScroll);
}
};
}, [loadMore, hasMore, loadingMore]);
}, [loadMore, hasMore]);
const handleSort = (field: string) => {
fetchingRef.current = false; // Reset fetching state on sort