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
feat(questions): filter questions and sidebar tags to one interview round via ?stage, link it from the interviews row, make edit/delete icon-only, update the help page
Khuram Niaz6c129920111c
diff --git a/__tests__/question.actions.spec.ts b/__tests__/question.actions.spec.tsindex 0f7a954..5c4ee8e 100644--- a/__tests__/question.actions.spec.ts+++ b/__tests__/question.actions.spec.ts@@ -103,6 +103,25 @@ describe("Question Actions", () => {);});+ it("should filter to one owned interview round when stageId is provided", async () => {+ (getCurrentUser as any).mockResolvedValue(mockUser);+ (prisma.question.findMany as any).mockResolvedValue([]);+ (prisma.question.count as any).mockResolvedValue(0);++ await getQuestionsList(1, 10, undefined, undefined, "stage-1");++ const where = {+ createdBy: mockUser.id,+ prepLinks: {+ some: { stageId: "stage-1", Stage: { Job: { userId: mockUser.id } } },+ },+ };+ expect(prisma.question.findMany).toHaveBeenCalledWith(+ expect.objectContaining({ where }),+ );+ expect(prisma.question.count).toHaveBeenCalledWith({ where });+ });+it("should search by question and answer content", async () => {(getCurrentUser as any).mockResolvedValue(mockUser);(prisma.question.findMany as any).mockResolvedValue([]);@@ -517,6 +536,28 @@ describe("Question Actions", () => {});});+ it("should count only one owned interview round's questions when stageId is provided", async () => {+ (getCurrentUser as any).mockResolvedValue(mockUser);+ (prisma.tag.findMany as any).mockResolvedValue([]);+ (prisma.question.count as any).mockResolvedValue(0);++ await getTagsWithQuestionCounts("stage-1");++ const prepLinks = {+ some: { stageId: "stage-1", Stage: { Job: { userId: mockUser.id } } },+ };+ expect(prisma.tag.findMany).toHaveBeenCalledWith(+ expect.objectContaining({+ include: {+ _count: { select: { questions: { where: { prepLinks } } } },+ },+ }),+ );+ expect(prisma.question.count).toHaveBeenCalledWith({+ where: { createdBy: mockUser.id, prepLinks },+ });+ });+it("should filter out tags with zero questions", async () => {(getCurrentUser as any).mockResolvedValue(mockUser);const mockTags = [diff --git a/src/actions/question.actions.ts b/src/actions/question.actions.tsindex 5d35f51..3d75ceb 100644--- a/src/actions/question.actions.ts+++ b/src/actions/question.actions.ts@@ -6,11 +6,17 @@ import { requireUser } from "./shared";import { APP_CONSTANTS } from "@/lib/constants";import { z } from "zod";+// Questions on one interview round's prep list, owned through the job+function stagePrepLinks(stageId: string, userId: string) {+ return { some: { stageId, Stage: { Job: { userId } } } };+}+export const getQuestionsList = async (page: number = 1,limit: number = APP_CONSTANTS.RECORDS_PER_PAGE,filter?: string,- search?: string+ search?: string,+ stageId?: string): Promise<any | undefined> => {try {const user = await requireUser();@@ -25,6 +31,10 @@ export const getQuestionsList = async (whereClause.tags = { some: { id: filter } };}+ if (stageId) {+ whereClause.prepLinks = stagePrepLinks(stageId, user.id);+ }+if (search) {whereClause.OR = [{ question: { contains: search } },@@ -51,6 +61,42 @@ export const getQuestionsList = async (}};+export const getPrepStageLabel = async (+ stageId: string+): Promise<any | undefined> => {+ try {+ const user = await requireUser();++ const stage = await prisma.jobStage.findFirst({+ where: { id: stageId, Job: { userId: user.id } },+ select: {+ StageType: { select: { label: true } },+ Job: {+ select: {+ JobTitle: { select: { label: true } },+ Company: { select: { label: true } },+ },+ },+ },+ });++ if (!stage) {+ return { success: false, message: "Interview round not found" };+ }++ return {+ success: true,+ data: {+ round: stage.StageType.label,+ jobTitle: stage.Job.JobTitle.label,+ company: stage.Job.Company.label,+ },+ };+ } catch (error) {+ return handleError(error, "Failed to fetch interview round.");+ }+};+export const getQuestionById = async (questionId: string): Promise<any | undefined> => {@@ -153,17 +199,18 @@ export const deleteQuestion = async (}};-export const getTagsWithQuestionCounts = async (): Promise<- any | undefined-> => {+export const getTagsWithQuestionCounts = async (+ stageId?: string+): Promise<any | undefined> => {try {const user = await requireUser();+ const prepLinks = stageId ? stagePrepLinks(stageId, user.id) : undefined;const tags = await prisma.tag.findMany({where: { createdBy: user.id },include: {_count: {- select: { questions: true },+ select: { questions: prepLinks ? { where: { prepLinks } } : true },},},orderBy: { label: "asc" },@@ -179,7 +226,7 @@ export const getTagsWithQuestionCounts = async (): Promise<}));const totalQuestions = await prisma.question.count({- where: { createdBy: user.id },+ where: { createdBy: user.id, ...(prepLinks && { prepLinks }) },});return { success: true, data, totalQuestions };diff --git a/src/app/dashboard/questions/QuestionsPageClient.tsx b/src/app/dashboard/questions/QuestionsPageClient.tsxindex 1ffa955..7e75918 100644--- a/src/app/dashboard/questions/QuestionsPageClient.tsx+++ b/src/app/dashboard/questions/QuestionsPageClient.tsx@@ -2,7 +2,8 @@import QuestionsContainer from "@/components/questions/QuestionsContainer";import QuestionsSidebar from "@/components/questions/QuestionsSidebar";import { Tag } from "@/models/job.model";-import { useState, useCallback } from "react";+import { useState, useCallback, useEffect, useRef } from "react";+import { useSearchParams } from "next/navigation";import { getTagsWithQuestionCounts } from "@/actions/question.actions";type TagWithCount = {@@ -27,18 +28,27 @@ function QuestionsPageClient({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();+ 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">diff --git a/src/app/dashboard/questions/page.tsx b/src/app/dashboard/questions/page.tsxindex cbaa0e3..f1001e0 100644--- a/src/app/dashboard/questions/page.tsx+++ b/src/app/dashboard/questions/page.tsx@@ -3,10 +3,15 @@ import { getTagsWithQuestionCounts } from "@/actions/question.actions";import { getAllTags } from "@/actions/tag.actions";import React from "react";-async function Questions() {+async function Questions({+ searchParams,+}: {+ searchParams: Promise<{ stage?: string }>;+}) {+ const { stage } = await searchParams;const [allTags, tagsWithCounts] = await Promise.all([getAllTags(),- getTagsWithQuestionCounts(),+ getTagsWithQuestionCounts(stage),]);return (diff --git a/src/components/interviews/InterviewRow.tsx b/src/components/interviews/InterviewRow.tsxindex a1151dc..450d9c5 100644--- a/src/components/interviews/InterviewRow.tsx+++ b/src/components/interviews/InterviewRow.tsx@@ -236,8 +236,18 @@ function InterviewRow({)}</div><div>- <div className="text-xs font-medium uppercase tracking-wide text-muted-foreground">- Prep questions ({prepSummary(interview.prepQuestions)})+ <div className="flex items-baseline gap-3">+ <div className="text-xs font-medium uppercase tracking-wide text-muted-foreground">+ Prep questions ({prepSummary(interview.prepQuestions)})+ </div>+ {interview.prepQuestions.length > 0 && (+ <Link+ href={`/dashboard/questions?stage=${interview.id}`}+ className="whitespace-nowrap text-xs text-primary underline-offset-4 hover:underline"+ >+ View answers+ </Link>+ )}</div>{interview.prepQuestions.length === 0 ? (<p className="mt-1 text-muted-foreground">diff --git a/src/components/questions/QuestionCard.tsx b/src/components/questions/QuestionCard.tsxindex 9e995e9..6e6f5d9 100644--- a/src/components/questions/QuestionCard.tsx+++ b/src/components/questions/QuestionCard.tsx@@ -58,9 +58,9 @@ export function QuestionCard({onEdit(question);}}data-testid="question-edit-btn"+ aria-label="Edit question">- <Pencil className="h-4 w-4 sm:mr-1" />- <span className="hidden sm:inline">Edit</span>+ <Pencil className="h-4 w-4" /></Button><Buttonvariant="ghost"@@ -71,9 +71,9 @@ export function QuestionCard({setShowDeleteDialog(true);}}data-testid="question-delete-btn"+ aria-label="Delete question">- <Trash2 className="h-4 w-4 sm:mr-1" />- <span className="hidden sm:inline">Delete</span>+ <Trash2 className="h-4 w-4" /></Button></div></div>diff --git a/src/components/questions/QuestionsContainer.tsx b/src/components/questions/QuestionsContainer.tsxindex 551fb73..41ec698 100644--- a/src/components/questions/QuestionsContainer.tsx+++ b/src/components/questions/QuestionsContainer.tsx@@ -8,11 +8,12 @@ import {CardTitle,} from "../ui/card";import { Button } from "../ui/button";-import { PlusCircle } from "lucide-react";+import { PlusCircle, X } from "lucide-react";import { SearchInput } from "../SearchInput";import { ResponsiveCardHeader } from "../ResponsiveCardHeader";import {deleteQuestion,+ getPrepStageLabel,getQuestionById,getQuestionsList,} from "@/actions/question.actions";@@ -45,6 +46,8 @@ function QuestionsContainer({const [loading, setLoading] = useState(false);const [dialogOpen, setDialogOpen] = useState(false);const [searchTerm, setSearchTerm] = useState("");+ const [stageLabel, setStageLabel] = useState<string | null>(null);+ const stageId = searchParams.get("stage") ?? undefined;const hasSearched = useRef(false);const autoOpenHandled = useRef(false);@@ -56,6 +59,7 @@ function QuestionsContainer({APP_CONSTANTS.RECORDS_PER_PAGE,filter,search,+ stageId,);if (result?.success && result.data) {setQuestions((prev) =>@@ -68,7 +72,7 @@ function QuestionsContainer({}setLoading(false);},- [],+ [stageId],);const reloadQuestions = useCallback(async () => {@@ -113,6 +117,28 @@ function QuestionsContainer({}}, [router, searchParams]);+ useEffect(() => {+ if (!stageId) {+ setStageLabel(null);+ return;+ }+ getPrepStageLabel(stageId).then((result) => {+ if (result?.success) {+ const { jobTitle, company, round } = result.data;+ setStageLabel(`${jobTitle} · ${company} — ${round}`);+ }+ });+ }, [stageId]);++ const clearStageFilter = () => {+ const params = new URLSearchParams(searchParams.toString());+ params.delete("stage");+ const newPath = params.toString()+ ? `?${params.toString()}`+ : window.location.pathname;+ router.replace(newPath);+ };+useEffect(() => {loadQuestions(1, filterKey, searchTerm || undefined);// eslint-disable-next-line react-hooks/exhaustive-deps@@ -166,6 +192,25 @@ function QuestionsContainer({</div></ResponsiveCardHeader><CardContent>+ {stageId && (+ <div className="mb-4 flex items-center justify-between gap-2 rounded-md border bg-muted/50 px-3 py-2 text-sm">+ <span>+ Prep questions for{" "}+ <span className="font-medium">+ {stageLabel ?? "an interview round"}+ </span>+ </span>+ <Button+ variant="ghost"+ size="icon"+ className="h-6 w-6 shrink-0"+ onClick={clearStageFilter}+ aria-label="Show all questions"+ >+ <X className="h-3.5 w-3.5" />+ </Button>+ </div>+ )}{loading && <Loading />}{!loading && (<>diff --git a/wiki/interviews.md b/wiki/interviews.mdindex 9194c16..ddf9703 100644--- a/wiki/interviews.md+++ b/wiki/interviews.md@@ -29,7 +29,7 @@ To record one, open the **⋮** menu at the end of a row and choose **Set outcom## What is in the expanded row?-Click the arrow at the start of a row to open it. The panel shows the full interviewer list with their titles and email addresses, your notes for the round, and the prep questions with a tick against the ones already asked. One row is open at a time — opening another closes the first.+Click the arrow at the start of a row to open it. The panel shows the full interviewer list with their titles and email addresses, your notes for the round, and the prep questions with a tick against the ones already asked. **View answers**, beside the prep questions heading, opens the Questions page filtered to just that round's prep list so you can read your recorded answers, and narrows the skill tags in its sidebar to that round's questions; the ✕ on the banner there shows all questions again. One row is open at a time — opening another closes the first.Everything in the panel is read-only. Linking an interviewer, building a prep list and ticking a question as asked all happen on the job's [Timeline](./timeline.md) tab, where those tools live.