Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
"use client";
import { useEffect, useRef } from "react";
import { APP_CONSTANTS } from "@/lib/constants";
// Infinite scroll: auto-load next page when sentinel is visible
export function useJobsInfiniteScroll(
loadedCount: number,
totalJobs: number,
loadingMore: boolean,
onLoadMore: () => void,
) {
const sentinelRef = useRef<HTMLDivElement>(null);
useEffect(() => {
const sentinel = sentinelRef.current;
if (!sentinel) return;
const observer = new IntersectionObserver(
(entries) => {
if (
entries[0].isIntersecting &&
!loadingMore &&
loadedCount < totalJobs
) {
onLoadMore();
}
},
{ threshold: APP_CONSTANTS.INTERSECTION_OBSERVER_THRESHOLD },
);
observer.observe(sentinel);
return () => observer.disconnect();
}, [loadedCount, totalJobs, loadingMore, onLoadMore]);
return sentinelRef;
}