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 QuestionsContainer from "@/components/questions/QuestionsContainer";
import QuestionsSidebar from "@/components/questions/QuestionsSidebar";
import { Tag } from "@/models/job.model";
import { useState, useCallback, useEffect, useRef } from "react";
import { useSearchParams } from "next/navigation";
import { getTagsWithQuestionCounts } from "@/actions/question.actions";
type TagWithCount = {
id: string;
label: string;
value: string;
questionCount: number;
};
type QuestionsPageClientProps = {
allTags: Tag[];
tagsWithCounts: TagWithCount[];
totalQuestions: number;
};
function QuestionsPageClient({
allTags,
tagsWithCounts,
totalQuestions,
}: QuestionsPageClientProps) {
const [filterKey, setFilterKey] = useState<string | undefined>(undefined);
const [sidebarCounts, setSidebarCounts] =
useState<TagWithCount[]>(tagsWithCounts);
const [sidebarTotal, setSidebarTotal] = useState<number>(totalQuestions);
const stageId = useSearchParams().get("stage") ?? undefined;
const initialStage = useRef(stageId);
const onFilterChange = (filter: string | undefined) => {
setFilterKey(filter);
};
const refreshSidebarCounts = useCallback(async () => {
const result = await getTagsWithQuestionCounts(stageId);
if (result?.success) {
setSidebarCounts(result.data);
setSidebarTotal(result.totalQuestions);
}
}, [stageId]);
// The server rendered the first stage's counts; refetch only on change
useEffect(() => {
if (stageId === initialStage.current) return;
initialStage.current = stageId;
refreshSidebarCounts();
}, [stageId, refreshSidebarCounts]);
return (
<div className="col-span-3 flex h-full">
<QuestionsSidebar
tags={sidebarCounts}
totalQuestions={sidebarTotal}
selectedFilter={filterKey}
onFilterChange={onFilterChange}
/>
<div className="flex-1">
<QuestionsContainer
availableTags={allTags}
filterKey={filterKey}
onQuestionsChanged={refreshSidebarCounts}
/>
</div>
</div>
);
}
export default QuestionsPageClient;