Skip to content

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.

feat: improve job details UI

Khuram Niazca3d69f679a1
diff --git a/src/components/CircularScore.tsx b/src/components/CircularScore.tsx
new file mode 100644
index 0000000..03143b4
--- /dev/null
+++ b/src/components/CircularScore.tsx
@@ -0,0 +1,115 @@
+"use client";
+
+import { useEffect, useRef, useState } from "react";
+import { cn } from "@/lib/utils";
+
+interface CircularScoreProps {
+ score: number;
+ size?: "sm" | "md" | "lg";
+ animate?: boolean;
+ className?: string;
+}
+
+const SIZE_CONFIG = {
+ sm: { px: 40, stroke: 4, fontSize: 9, r: 15 },
+ md: { px: 80, stroke: 6, fontSize: 16, r: 30 },
+ lg: { px: 120, stroke: 8, fontSize: 24, r: 46 },
+};
+
+function getColor(score: number) {
+ if (score >= 70) return "hsl(var(--chart-2))";
+ if (score >= 40) return "hsl(var(--chart-4))";
+ return "hsl(var(--destructive))";
+}
+
+function easeOutCubic(t: number) {
+ return 1 - Math.pow(1 - t, 3);
+}
+
+export function CircularScore({ score, size = "md", animate = true, className }: CircularScoreProps) {
+ const { px, stroke, fontSize, r } = SIZE_CONFIG[size];
+ const cx = px / 2;
+ const circumference = 2 * Math.PI * r;
+
+ const [animated, setAnimated] = useState(animate ? 0 : score);
+ const containerRef = useRef<HTMLDivElement>(null);
+ const rafRef = useRef<number>(0);
+ const startedRef = useRef(false);
+
+ useEffect(() => {
+ if (!animate) return;
+ const el = containerRef.current;
+ if (!el) return;
+
+ const observer = new IntersectionObserver(
+ ([entry]) => {
+ if (entry.isIntersecting && !startedRef.current) {
+ startedRef.current = true;
+ let startTime = 0;
+ const duration = 900;
+
+ const tick = (ts: number) => {
+ if (!startTime) startTime = ts;
+ const progress = Math.min((ts - startTime) / duration, 1);
+ setAnimated(easeOutCubic(progress) * score);
+ if (progress < 1) rafRef.current = requestAnimationFrame(tick);
+ };
+
+ rafRef.current = requestAnimationFrame(tick);
+ }
+ },
+ { threshold: 0.3 },
+ );
+
+ observer.observe(el);
+ return () => {
+ observer.disconnect();
+ cancelAnimationFrame(rafRef.current);
+ };
+ }, [score, animate]);
+
+ const dashOffset = circumference * (1 - Math.min(animated, 100) / 100);
+ const color = getColor(score);
+
+ return (
+ <div ref={containerRef} className={cn("inline-flex items-center justify-center", className)}>
+ <svg width={px} height={px} viewBox={`0 0 ${px} ${px}`}>
+ {/* Track */}
+ <circle
+ cx={cx}
+ cy={cx}
+ r={r}
+ fill="none"
+ stroke="hsl(var(--muted))"
+ strokeWidth={stroke}
+ />
+ {/* Progress arc */}
+ <circle
+ cx={cx}
+ cy={cx}
+ r={r}
+ fill="none"
+ stroke={color}
+ strokeWidth={stroke}
+ strokeLinecap="round"
+ strokeDasharray={circumference}
+ strokeDashoffset={dashOffset}
+ transform={`rotate(-90 ${cx} ${cx})`}
+ />
+ {/* Label */}
+ <text
+ x={cx}
+ y={cx}
+ textAnchor="middle"
+ dominantBaseline="central"
+ fontSize={fontSize}
+ fontWeight="600"
+ fill="currentColor"
+ className="fill-foreground"
+ >
+ {Math.round(animated)}%
+ </text>
+ </svg>
+ </div>
+ );
+}
diff --git a/src/components/myjobs/JobDetails.tsx b/src/components/myjobs/JobDetails.tsx
index d1926f5..d28f805 100644
--- a/src/components/myjobs/JobDetails.tsx
+++ b/src/components/myjobs/JobDetails.tsx
@@ -20,6 +20,7 @@ import { useState, useMemo, useCallback } from "react";
import { DownloadFileButton } from "../profile/DownloadFileButton";
import { MatchDetails } from "../automations/MatchDetails";
import type { JobMatchData } from "@/models/ai.schemas";
+import { CircularScore } from "@/components/CircularScore";
function JobDetails({ job }: { job: JobResponse }) {
const [aiSectionOpen, setAiSectionOpen] = useState(false);
@@ -88,7 +89,13 @@ function JobDetails({ job }: { job: JobResponse }) {
{job?.Location?.label} - {getJobType(job?.jobType)}
</CardDescription>
</div>
- <div>
+ <div className="flex flex-col items-end gap-2">
+ {currentMatchScore != null && (
+ <div className="flex flex-col items-center gap-1">
+ <CircularScore score={currentMatchScore} size="md" />
+ <span className="text-xs text-muted-foreground">AI Match</span>
+ </div>
+ )}
{job?.Resume && job?.Resume?.File && job.Resume?.File?.filePath
? DownloadFileButton(
job?.Resume?.File?.filePath,
@@ -152,9 +159,6 @@ function JobDetails({ job }: { job: JobResponse }) {
<h4 className="font-medium mb-2 flex items-center gap-2">
<Sparkles className="h-4 w-4" />
AI Match Analysis
- {currentMatchScore && (
- <Badge variant="default">{currentMatchScore}% Match</Badge>
- )}
</h4>
<MatchDetails matchData={parsedMatchData} />
</div>
diff --git a/src/components/myjobs/MyJobsTable.tsx b/src/components/myjobs/MyJobsTable.tsx
index 2cf6ef7..f22ce5f 100644
--- a/src/components/myjobs/MyJobsTable.tsx
+++ b/src/components/myjobs/MyJobsTable.tsx
@@ -37,6 +37,7 @@ import { JobResponse, JobStatus } from "@/models/job.model";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { DeleteAlertDialog } from "../DeleteAlertDialog";
+import { CircularScore } from "@/components/CircularScore";
type MyJobsTableProps = {
jobs: JobResponse[];
@@ -140,7 +141,11 @@ function MyJobsTable({
)}
</TableCell>
<TableCell className="hidden md:table-cell">
- {job.matchScore != null ? `${job.matchScore}%` : "-"}
+ {job.matchScore != null ? (
+ <CircularScore score={job.matchScore} size="sm" animate={false} />
+ ) : (
+ <span className="text-muted-foreground">-</span>
+ )}
</TableCell>
<TableCell className="hidden md:table-cell">
{job.JobSource?.label}