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.

Improve ai match response layout

Khuram Niaz6dadf9a935c5
diff --git a/src/components/profile/AiJobMatchResponseContent.tsx b/src/components/profile/AiJobMatchResponseContent.tsx
index a5a49a8..786b966 100644
--- a/src/components/profile/AiJobMatchResponseContent.tsx
+++ b/src/components/profile/AiJobMatchResponseContent.tsx
@@ -5,67 +5,71 @@ import { parse } from "best-effort-json-parser";
export const AiJobMatchResponseContent = ({ content }: { content: any }) => {
return (
<>
- <div className="pt-2">
- {content.length > 1 && parse(content).matching_score && (
- <RadialChartComponent score={parse(content).matching_score} />
- )}
- </div>
- <div>
- {content.length > 1 && parse(content).detailed_analysis && (
- <>
- <h2 className="font-semibold">Detailed Analysis:</h2>
- {parse(content).detailed_analysis.map(
- (analysis: any, i: number) => (
- <div key={i}>
- <h2 className="text-white font-medium">
- {analysis.toString().length > 1 && analysis.category}
- </h2>
- <SheetDescription>
- {analysis.value &&
- analysis.value.map((v: string, j: number) => {
- return <li key={j}>{v}</li>;
- })}
- </SheetDescription>
- </div>
- )
+ {content.length > 1 && (
+ <>
+ <div className="pt-2">
+ {parse(content).matching_score && (
+ <RadialChartComponent score={parse(content).matching_score} />
)}
- </>
- )}
- </div>
- <div className="pt-2">
- {content.length > 1 && parse(content).suggestions && (
- <>
- <h2 className="font-semibold">Suggestions: </h2>
- {parse(content).suggestions.map((analysis: any, i: number) => (
- <div key={i}>
- <h2 className="text-white font-medium">
- {analysis.toString().length > 1 && analysis.category}
- </h2>
+ </div>
+ <div className="mt-[-50px]">
+ {parse(content).detailed_analysis && (
+ <>
+ <h2 className="font-semibold mb-2">Detailed Analysis:</h2>
+ {parse(content).detailed_analysis.map(
+ (analysis: any, i: number) => (
+ <div key={i}>
+ <h2 className="font-medium my-1">
+ {analysis.toString().length > 1 && analysis.category}
+ </h2>
+ <SheetDescription>
+ {analysis.value &&
+ analysis.value.map((v: string, j: number) => {
+ return <li key={j}>{v}</li>;
+ })}
+ </SheetDescription>
+ </div>
+ )
+ )}
+ </>
+ )}
+ </div>
+ <div className="pt-2">
+ {parse(content).suggestions && (
+ <>
+ <h2 className="font-semibold mb-2">Suggestions: </h2>
+ {parse(content).suggestions.map((analysis: any, i: number) => (
+ <div key={i}>
+ <h2 className="font-medium my-1">
+ {analysis.toString().length > 1 && analysis.category}
+ </h2>
+ <SheetDescription>
+ {analysis.value &&
+ analysis.value.map((v: string, j: number) => {
+ return <li key={j}>{v}</li>;
+ })}
+ </SheetDescription>
+ </div>
+ ))}
+ </>
+ )}
+ </div>
+ <div className="pt-2">
+ {parse(content).additional_comments && (
+ <>
+ <h2 className="font-semibold mb-2">Additional Comments: </h2>
<SheetDescription>
- {analysis.value &&
- analysis.value.map((v: string, j: number) => {
- return <li key={j}>{v}</li>;
- })}
+ {parse(content).additional_comments.map(
+ (c: string, i: number) => {
+ return <li key={i}>{c}</li>;
+ }
+ )}
</SheetDescription>
- </div>
- ))}
- </>
- )}
- </div>
- <div className="pt-2">
- {content.length > 1 && parse(content).additional_comments && (
- <>
- <h2 className="font-semibold">Additional Comments: </h2>
- <SheetDescription>
- {parse(content).additional_comments.map(
- (c: string, i: number) => {
- return <li key={i}>{c}</li>;
- }
- )}
- </SheetDescription>
- </>
- )}
- </div>
+ </>
+ )}
+ </div>
+ </>
+ )}
</>
);
};
diff --git a/src/components/profile/AiJobMatchSection.tsx b/src/components/profile/AiJobMatchSection.tsx
index f056a9c..6a38506 100644
--- a/src/components/profile/AiJobMatchSection.tsx
+++ b/src/components/profile/AiJobMatchSection.tsx
@@ -6,7 +6,6 @@ import {
SheetHeader,
SheetPortal,
SheetTitle,
- SheetTrigger,
} from "../ui/sheet";
import { useEffect, useRef, useState } from "react";
import { Resume } from "@/models/profile.model";
@@ -22,7 +21,6 @@ import {
import Loading from "../Loading";
import { JobMatchResponse } from "@/models/ai.model";
import { AiJobMatchResponseContent } from "./AiJobMatchResponseContent";
-import { RadialChartComponent } from "../RadialChart";
interface AiSectionProps {
aISectionOpen: boolean;
@@ -37,6 +35,7 @@ export const AiJobMatchSection = ({
}: AiSectionProps) => {
const [aIContent, setAIContent] = useState<JobMatchResponse | any>("");
const [loading, setLoading] = useState(false);
+ const [selectedResumeId, setSelectedResumeId] = useState<string>();
const resumesRef = useRef<Resume[]>([]);
const getResumes = async () => {
@@ -70,6 +69,12 @@ export const AiJobMatchSection = ({
try {
setLoading(true);
setAIContent("");
+ // if (
+ // abortControllerRef.current &&
+ // (await readerRef?.current?.closed) === false
+ // ) {
+ // return await abortStream();
+ // }
const abortController = new AbortController();
abortControllerRef.current = abortController;
@@ -116,10 +121,20 @@ export const AiJobMatchSection = ({
});
}
};
+
+ const abortStream = async () => {
+ abortControllerRef.current?.abort();
+ console.log("aborting stream");
+ await readerRef?.current?.cancel();
+ };
+
const onSelectResume = async (resumeId: string) => {
+ setSelectedResumeId(resumeId);
+ // if getting job match response clear first
await getJobMatch(resumeId, jobId);
};
useEffect(() => {
+ console.log("job match rendered");
getResumes();
}, []);
return (
@@ -129,8 +144,8 @@ export const AiJobMatchSection = ({
<SheetHeader>
<SheetTitle>AI Job Match</SheetTitle>
</SheetHeader>
- <div className="mt-6">
- <Select onValueChange={onSelectResume}>
+ <div className="mt-4">
+ <Select value={selectedResumeId} onValueChange={onSelectResume}>
<SelectTrigger className="w-[180px]">
<SelectValue placeholder="Select a resume" />
</SelectTrigger>
@@ -149,7 +164,7 @@ export const AiJobMatchSection = ({
</SelectContent>
</Select>
</div>
- <div className="mt-6">
+ <div className="mt-2">
{loading ? (
<div className="flex items-center flex-col">
<Loading />
diff --git a/src/components/ui/sheet.tsx b/src/components/ui/sheet.tsx
index a37f17b..345ef8f 100644
--- a/src/components/ui/sheet.tsx
+++ b/src/components/ui/sheet.tsx
@@ -1,19 +1,19 @@
-"use client"
+"use client";
-import * as React from "react"
-import * as SheetPrimitive from "@radix-ui/react-dialog"
-import { cva, type VariantProps } from "class-variance-authority"
-import { X } from "lucide-react"
+import * as React from "react";
+import * as SheetPrimitive from "@radix-ui/react-dialog";
+import { cva, type VariantProps } from "class-variance-authority";
+import { X } from "lucide-react";
-import { cn } from "@/lib/utils"
+import { cn } from "@/lib/utils";
-const Sheet = SheetPrimitive.Root
+const Sheet = SheetPrimitive.Root;
-const SheetTrigger = SheetPrimitive.Trigger
+const SheetTrigger = SheetPrimitive.Trigger;
-const SheetClose = SheetPrimitive.Close
+const SheetClose = SheetPrimitive.Close;
-const SheetPortal = SheetPrimitive.Portal
+const SheetPortal = SheetPrimitive.Portal;
const SheetOverlay = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Overlay>,
@@ -21,14 +21,14 @@ const SheetOverlay = React.forwardRef<
>(({ className, ...props }, ref) => (
<SheetPrimitive.Overlay
className={cn(
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
+ "fixed inset-0 z-50 bg-black/60 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className
)}
{...props}
ref={ref}
/>
-))
-SheetOverlay.displayName = SheetPrimitive.Overlay.displayName
+));
+SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
const sheetVariants = cva(
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
@@ -47,7 +47,7 @@ const sheetVariants = cva(
side: "right",
},
}
-)
+);
interface SheetContentProps
extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>,
@@ -71,8 +71,8 @@ const SheetContent = React.forwardRef<
</SheetPrimitive.Close>
</SheetPrimitive.Content>
</SheetPortal>
-))
-SheetContent.displayName = SheetPrimitive.Content.displayName
+));
+SheetContent.displayName = SheetPrimitive.Content.displayName;
const SheetHeader = ({
className,
@@ -85,8 +85,8 @@ const SheetHeader = ({
)}
{...props}
/>
-)
-SheetHeader.displayName = "SheetHeader"
+);
+SheetHeader.displayName = "SheetHeader";
const SheetFooter = ({
className,
@@ -99,8 +99,8 @@ const SheetFooter = ({
)}
{...props}
/>
-)
-SheetFooter.displayName = "SheetFooter"
+);
+SheetFooter.displayName = "SheetFooter";
const SheetTitle = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Title>,
@@ -111,8 +111,8 @@ const SheetTitle = React.forwardRef<
className={cn("text-lg font-semibold text-foreground", className)}
{...props}
/>
-))
-SheetTitle.displayName = SheetPrimitive.Title.displayName
+));
+SheetTitle.displayName = SheetPrimitive.Title.displayName;
const SheetDescription = React.forwardRef<
React.ElementRef<typeof SheetPrimitive.Description>,
@@ -123,8 +123,8 @@ const SheetDescription = React.forwardRef<
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
-))
-SheetDescription.displayName = SheetPrimitive.Description.displayName
+));
+SheetDescription.displayName = SheetPrimitive.Description.displayName;
export {
Sheet,
@@ -137,4 +137,4 @@ export {
SheetFooter,
SheetTitle,
SheetDescription,
-}
+};