-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* rka-51: add ashby * rka-51: fix jobs emails layout * rka-51: add applied handling * rka-48, rka-51: fix no results in list view
- Loading branch information
1 parent
4a82362
commit dfe632f
Showing
23 changed files
with
1,218 additions
and
125 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,100 +1,27 @@ | ||
'use client' | ||
|
||
import type { GetJobsFilter } from '@/lib/db/queries' | ||
import { Button, Flex, Reset } from '@radix-ui/themes' | ||
import Link from 'next/link' | ||
import { usePathname, useSearchParams } from 'next/navigation' | ||
import { useCallback } from 'react' | ||
|
||
const FilterButton = ({ | ||
searchParams, | ||
title, | ||
active = false, | ||
}: { searchParams: string; title: string; active?: boolean }) => { | ||
const pathname = usePathname() | ||
|
||
return ( | ||
<Link href={`${pathname}?${searchParams}`}> | ||
<Button variant={active ? 'solid' : 'outline'}>{title}</Button> | ||
</Link> | ||
) | ||
} | ||
import { SegmentedControl } from '@radix-ui/themes' | ||
import { usePathname, useRouter } from 'next/navigation' | ||
|
||
export const FilterPanel = () => { | ||
const searchParams = useSearchParams() | ||
|
||
const createSearchParams = useCallback( | ||
(filter: GetJobsFilter, shouldReset = filter === 'all') => { | ||
const newSearchParams = new URLSearchParams(searchParams) | ||
|
||
const shouldRemove = newSearchParams | ||
.getAll('filter') | ||
.some(existingFilter => existingFilter === filter) | ||
|
||
if (!newSearchParams.has('filter')) { | ||
newSearchParams.set('filter', 'new') | ||
} | ||
|
||
if (shouldRemove) { | ||
newSearchParams.delete('filter', filter) | ||
} else if (shouldReset) { | ||
newSearchParams.set('filter', filter) | ||
} else { | ||
newSearchParams.delete('filter', 'all') | ||
newSearchParams.append('filter', filter) | ||
} | ||
const pathname = usePathname() | ||
const { push } = useRouter() | ||
|
||
newSearchParams.delete('page') | ||
const handleValueChange = (value: string) => { | ||
const searchParams = new URLSearchParams({ filter: value }) | ||
|
||
return newSearchParams.toString() | ||
}, | ||
[searchParams], | ||
) | ||
push(`${pathname}?${searchParams}`) | ||
} | ||
|
||
return ( | ||
<Flex gap="3" asChild> | ||
<Reset> | ||
<ul> | ||
<li> | ||
<FilterButton | ||
title="New / Unseen" | ||
searchParams={createSearchParams('new')} | ||
active={ | ||
searchParams.getAll('filter').includes('new') || | ||
!searchParams.has('filter') | ||
} | ||
/> | ||
</li> | ||
<li> | ||
<FilterButton | ||
title="Top Choice" | ||
searchParams={createSearchParams('topChoice')} | ||
active={searchParams.getAll('filter').includes('topChoice')} | ||
/> | ||
</li> | ||
<li> | ||
<FilterButton | ||
title="Seen" | ||
searchParams={createSearchParams('seen')} | ||
active={searchParams.getAll('filter').includes('seen')} | ||
/> | ||
</li> | ||
<li> | ||
<FilterButton | ||
title="Hidden" | ||
searchParams={createSearchParams('hidden')} | ||
active={searchParams.getAll('filter').includes('hidden')} | ||
/> | ||
</li> | ||
<li> | ||
<FilterButton | ||
title="All" | ||
searchParams={createSearchParams('all')} | ||
active={searchParams.getAll('filter').includes('all')} | ||
/> | ||
</li> | ||
</ul> | ||
</Reset> | ||
</Flex> | ||
<SegmentedControl.Root onValueChange={handleValueChange} defaultValue="new"> | ||
<SegmentedControl.Item value="new">New / Unseen</SegmentedControl.Item> | ||
<SegmentedControl.Item value="topChoice"> | ||
Top Choice | ||
</SegmentedControl.Item> | ||
<SegmentedControl.Item value="seen">Seen</SegmentedControl.Item> | ||
<SegmentedControl.Item value="hidden">Hidden</SegmentedControl.Item> | ||
<SegmentedControl.Item value="applied">Applied</SegmentedControl.Item> | ||
<SegmentedControl.Item value="all">All</SegmentedControl.Item> | ||
</SegmentedControl.Root> | ||
) | ||
} |
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
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 @@ | ||
ALTER TYPE "hiring_platform" ADD VALUE 'ashby'; |
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,25 @@ | ||
DO $$ BEGIN | ||
CREATE TYPE "public"."compensation_type" AS ENUM('salary', 'equity'); | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
--> statement-breakpoint | ||
CREATE TABLE IF NOT EXISTS "compensations" ( | ||
"id" serial PRIMARY KEY NOT NULL, | ||
"created_at" timestamp DEFAULT now() NOT NULL, | ||
"updated_at" timestamp DEFAULT now() NOT NULL, | ||
"job_id" integer NOT NULL, | ||
"type" "compensation_type" NOT NULL, | ||
"currency_code" text, | ||
"min_value" numeric(10, 3) NOT NULL, | ||
"max_value" numeric(10, 3), | ||
"summary" text, | ||
"interval" text | ||
); | ||
--> statement-breakpoint | ||
ALTER TABLE "jobs" ADD COLUMN "is_remote" boolean;--> statement-breakpoint | ||
DO $$ BEGIN | ||
ALTER TABLE "compensations" ADD CONSTRAINT "compensations_job_id_jobs_id_fk" FOREIGN KEY ("job_id") REFERENCES "public"."jobs"("id") ON DELETE cascade ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; |
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,8 @@ | ||
DROP TABLE "compensations";--> statement-breakpoint | ||
ALTER TABLE "jobs" ADD COLUMN "currency_code" text;--> statement-breakpoint | ||
ALTER TABLE "jobs" ADD COLUMN "compensation_interval" text;--> statement-breakpoint | ||
ALTER TABLE "jobs" ADD COLUMN "compensation_summary" text;--> statement-breakpoint | ||
ALTER TABLE "jobs" ADD COLUMN "salary_min" numeric(10, 3);--> statement-breakpoint | ||
ALTER TABLE "jobs" ADD COLUMN "salary_max" numeric(10, 3);--> statement-breakpoint | ||
ALTER TABLE "jobs" ADD COLUMN "equity_min" numeric(10, 3);--> statement-breakpoint | ||
ALTER TABLE "jobs" ADD COLUMN "equity_max" numeric(10, 3); |
Oops, something went wrong.