|
1 | 1 | import { cn } from '@sim/emcn' |
2 | 2 | import { ArrowRight } from '@sim/emcn/icons' |
3 | 3 | import type { CareerPosting } from '@/lib/ashby/jobs' |
4 | | -import { ALL_FILTER_VALUE } from '@/app/(landing)/careers/search-params' |
5 | | - |
6 | | -export interface DepartmentGroup { |
7 | | - department: string |
8 | | - postings: CareerPosting[] |
9 | | -} |
10 | | - |
11 | | -/** |
12 | | - * Narrows postings to a selected Team and Location, treating {@link ALL_FILTER_VALUE} |
13 | | - * as "any". Shared by the server-rendered fallback and the client board so a |
14 | | - * deep-linked filter resolves to the exact same set on both sides. |
15 | | - */ |
16 | | -export function filterPostings( |
17 | | - postings: CareerPosting[], |
18 | | - team: string, |
19 | | - location: string |
20 | | -): CareerPosting[] { |
21 | | - return postings.filter( |
22 | | - (posting) => |
23 | | - (team === ALL_FILTER_VALUE || posting.department === team) && |
24 | | - (location === ALL_FILTER_VALUE || posting.location === location) |
25 | | - ) |
26 | | -} |
27 | | - |
28 | | -/** Whether either the Team or Location filter is narrowing the board. */ |
29 | | -export function hasActiveFilters(team: string, location: string): boolean { |
30 | | - return team !== ALL_FILTER_VALUE || location !== ALL_FILTER_VALUE |
31 | | -} |
| 4 | +import type { DepartmentGroup } from '@/app/(landing)/careers/components/job-board/utils' |
32 | 5 |
|
33 | 6 | /** Empty-state copy: distinguishes a truly empty board from a filtered-to-zero view. */ |
34 | 7 | const NO_OPEN_ROLES_MESSAGE = 'No open roles right now — check back soon.' |
35 | 8 | const NO_MATCHING_ROLES_MESSAGE = |
36 | 9 | 'No roles match these filters right now. Try clearing them, or check back soon.' |
37 | 10 |
|
38 | | -/** |
39 | | - * Buckets postings by department, preserving their incoming order (the fetcher |
40 | | - * pre-sorts by department then title). Shared by the interactive board and its |
41 | | - * static Suspense fallback so the two can never render a different grouping. |
42 | | - */ |
43 | | -export function groupByDepartment(postings: CareerPosting[]): DepartmentGroup[] { |
44 | | - const byDepartment = new Map<string, CareerPosting[]>() |
45 | | - for (const posting of postings) { |
46 | | - const bucket = byDepartment.get(posting.department) |
47 | | - if (bucket) bucket.push(posting) |
48 | | - else byDepartment.set(posting.department, [posting]) |
49 | | - } |
50 | | - return Array.from(byDepartment, ([department, items]) => ({ department, postings: items })) |
51 | | -} |
52 | | - |
53 | 11 | interface JobGroupsProps { |
54 | 12 | groups: DepartmentGroup[] |
55 | 13 | /** |
|
0 commit comments