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

@ -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;
@ -1160,5 +1160,3 @@ export function ProductInnovationPage() {
</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