-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aee51e6
commit fabfeda
Showing
12 changed files
with
424 additions
and
72 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
prisma/migrations/20241015192257_added_cascading_job/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- CreateTable | ||
CREATE TABLE "Bookmark" ( | ||
"id" TEXT NOT NULL, | ||
"jobId" TEXT NOT NULL, | ||
"userId" TEXT NOT NULL, | ||
|
||
CONSTRAINT "Bookmark_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Bookmark" ADD CONSTRAINT "Bookmark_jobId_fkey" FOREIGN KEY ("jobId") REFERENCES "Job"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Bookmark" ADD CONSTRAINT "Bookmark_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -402,3 +402,7 @@ html { | |
html { | ||
scroll-behavior: smooth; | ||
} | ||
|
||
.no-scrollbar::-webkit-scrollbar { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
'use client'; | ||
|
||
import { GetBookmarkByUserId } from '@/actions/job.action'; | ||
import BookmarkCardSkeleton from '@/components/BookmarkCardSkeletion'; | ||
import JobCard from '@/components/Jobcard'; | ||
|
||
import { JobType } from '@/types/jobs.types'; | ||
import { useEffect, useState } from 'react'; | ||
|
||
export default function BookmarkPage() { | ||
const [loading, setLoading] = useState(true); | ||
const [errorNoPost, setErrorNoPost] = useState(false); | ||
const [bookmarkedJobs, setBookmarkedJobs] = useState< | ||
{ | ||
job: JobType; | ||
}[] | ||
>(); | ||
|
||
useEffect(() => { | ||
const getBookmark = async () => { | ||
setLoading(true); | ||
try { | ||
const response = await GetBookmarkByUserId(); | ||
if (response.status !== 200 || !response.data) { | ||
return setErrorNoPost(true); | ||
} | ||
setBookmarkedJobs(response.data); | ||
} finally { | ||
setLoading(false); | ||
} | ||
}; | ||
getBookmark(); | ||
}, []); | ||
|
||
return ( | ||
<div className="md:container flex flex-col w-full"> | ||
<div className="flex justify-between items-center"> | ||
<span>Bookmarks</span> | ||
</div> | ||
|
||
{loading ? ( | ||
<div className="space-y-4 w-full"> | ||
{[1, 2, 3, 4, 5].map((e: number) => ( | ||
<BookmarkCardSkeleton key={e} /> | ||
))} | ||
</div> | ||
) : ( | ||
<> | ||
{errorNoPost ? ( | ||
<div className="w-full h-screen flex items-center justify-center text-white"> | ||
<p>No Bookmarks found</p> | ||
</div> | ||
) : ( | ||
<div className="h-full overflow-y-scroll no-scrollbar flex flex-col gap-8 my-3"> | ||
{bookmarkedJobs?.map(({ job }, index) => { | ||
return <JobCard job={job} key={index} className="w-full" />; | ||
})} | ||
</div> | ||
)} | ||
</> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Card, CardContent } from '@/components/ui/card'; | ||
import { Skeleton } from '@/components/ui/skeleton'; | ||
|
||
export default function BookmarkCardSkeleton() { | ||
return ( | ||
<Card className=" border shadow-sm "> | ||
<CardContent className="p-6"> | ||
<div className="flex flex-col sm:flex-row items-start gap-4"> | ||
<Skeleton className="w-12 h-12 rounded-full " /> | ||
<div className="flex-1 space-y-2"> | ||
<Skeleton className="w-48 h-6 " /> | ||
<Skeleton className="w-32 h-4 " /> | ||
<div className="flex flex-wrap gap-4"> | ||
<Skeleton className="w-20 h-6 " /> | ||
<Skeleton className="w-20 h-6 " /> | ||
<Skeleton className="w-32 h-6 " /> | ||
</div> | ||
<div className="flex flex-wrap gap-2"> | ||
{[1, 2, 3, 4, 5, 6].map((skill) => ( | ||
<Skeleton key={skill} className="w-16 h-4 " /> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
</CardContent> | ||
</Card> | ||
); | ||
} |
Oops, something went wrong.