feat(frontend): enable deep linking for job filters via url params
This commit is contained in:
parent
640eb10703
commit
1818479499
1 changed files with 20 additions and 0 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
|
import { useSearchParams } from "next/navigation"
|
||||||
|
|
||||||
import { useEffect, useState, useMemo, Suspense } from "react"
|
import { useEffect, useState, useMemo, Suspense } from "react"
|
||||||
import { Navbar } from "@/components/navbar"
|
import { Navbar } from "@/components/navbar"
|
||||||
import { Footer } from "@/components/footer"
|
import { Footer } from "@/components/footer"
|
||||||
|
|
@ -28,6 +30,24 @@ function JobsContent() {
|
||||||
const [sortBy, setSortBy] = useState("recent")
|
const [sortBy, setSortBy] = useState("recent")
|
||||||
const [showFilters, setShowFilters] = useState(false)
|
const [showFilters, setShowFilters] = useState(false)
|
||||||
|
|
||||||
|
const searchParams = useSearchParams()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const tech = searchParams.get("tech")
|
||||||
|
const q = searchParams.get("q")
|
||||||
|
const type = searchParams.get("type")
|
||||||
|
|
||||||
|
if (tech || q) {
|
||||||
|
setSearchTerm(tech || q || "")
|
||||||
|
setShowFilters(true) // Show filters if searching
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === "remoto") {
|
||||||
|
setWorkModeFilter("remote")
|
||||||
|
setShowFilters(true)
|
||||||
|
}
|
||||||
|
}, [searchParams])
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1)
|
const [currentPage, setCurrentPage] = useState(1)
|
||||||
const ITEMS_PER_PAGE = 10
|
const ITEMS_PER_PAGE = 10
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue