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.

Format url utility function

Khuram Niazaeb174a397bd
diff --git a/src/components/AddJob.tsx b/src/components/AddJob.tsx
index 6fdbbbf..8c1c6ae 100644
--- a/src/components/AddJob.tsx
+++ b/src/components/AddJob.tsx
@@ -112,6 +112,7 @@ export function AddJob({
reloadJobs();
});
toast({
+ variant: "success",
description: `Job has been ${
editJob ? "updated" : "created"
} successfully`,
diff --git a/src/components/JobDetails.tsx b/src/components/JobDetails.tsx
index b9c01b4..b0db16e 100644
--- a/src/components/JobDetails.tsx
+++ b/src/components/JobDetails.tsx
@@ -13,7 +13,7 @@ import { format } from "date-fns";
import { EditorContent, useEditor } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import { Badge } from "./ui/badge";
-import { cn } from "@/lib/utils";
+import { cn, formatUrl } from "@/lib/utils";
import Link from "next/link";
import { JobResponse } from "@/models/job.model";
@@ -65,7 +65,11 @@ function JobDetails({ jobId }: { jobId: string }) {
{job.jobUrl ? (
<div className="my-3">
<span className="font-semibold mr-2">Job URL:</span>
- <a href={job.jobUrl} target="_blank">
+ <a
+ href={formatUrl(job.jobUrl)}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
{job.jobUrl}
</a>
</div>
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 365058c..2afd3d6 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -4,3 +4,10 @@ import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
+
+export function formatUrl(url: string) {
+ if (!url.startsWith("http://") && !url.startsWith("https://")) {
+ return `https://${url}`;
+ }
+ return url;
+}