-
Notifications
You must be signed in to change notification settings - Fork 8
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
Showing
15 changed files
with
10,338 additions
and
5,371 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
} | ||
|
||
.remoteToggleContainer { | ||
grid-column: 1 / 4; | ||
grid-column: 1 / 2; | ||
grid-row: 2 / 3; | ||
} | ||
|
||
|
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
30 changes: 30 additions & 0 deletions
30
site/src/components/pages/OpenPositions/Filter/TextFilter.tsx
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,30 @@ | ||
import type { ReactElement } from 'react' | ||
import { useState, useRef } from 'react' | ||
import debounce from 'lodash.debounce' | ||
import { INPUT_SIZE, Input, SearchIcon } from '@nilfoundation/ui-kit' | ||
|
||
type TextFilterProps = { | ||
setFilterValue: (value: string) => void | ||
} | ||
|
||
export const TextFilter = ({ setFilterValue }: TextFilterProps): ReactElement => { | ||
const [value, setValue] = useState('') | ||
const debouncedSearch = useRef( | ||
debounce((value) => { | ||
setFilterValue(value ?? '') | ||
}, 200), | ||
).current | ||
|
||
return ( | ||
<Input | ||
placeholder="Search by title" | ||
value={value} | ||
onChange={(e) => { | ||
setValue(e.target.value) | ||
debouncedSearch(e.target.value) | ||
}} | ||
startEnhancer={<SearchIcon />} | ||
size={INPUT_SIZE.small} | ||
/> | ||
) | ||
} |
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
19 changes: 13 additions & 6 deletions
19
site/src/components/pages/OpenPositions/Position/Position.tsx
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
14 changes: 8 additions & 6 deletions
14
site/src/components/pages/OpenPositions/useFilterPositions.ts
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
21 changes: 16 additions & 5 deletions
21
site/src/components/pages/OpenPositions/useGroupPositionsByDepartments.ts
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,18 +1,29 @@ | ||
import { useMemo } from 'react' | ||
import { Position } from 'src/freshteam/types' | ||
import { UIPosition } from 'src/freshteam/types' | ||
|
||
export const useGroupPositionsByDepartments = (positions: Position[]) => { | ||
export const useGroupPositionsByDepartments = (positions: UIPosition[], order?: Array<UIPosition['department']>) => { | ||
return useMemo(() => { | ||
const departments = positions.reduce((acc, position) => { | ||
const department = position.department.name | ||
const department = position.department | ||
const departmentPositions = acc[department] || [] | ||
|
||
return { | ||
...acc, | ||
[department]: [...departmentPositions, position], | ||
} | ||
}, {} as Record<string, Position[]>) | ||
}, {} as Record<string, UIPosition[]>) | ||
|
||
if (order) { | ||
return order | ||
.filter((x) => Object.keys(departments).includes(x)) | ||
.reduce((acc, department) => { | ||
return { | ||
...acc, | ||
[department]: departments[department], | ||
} | ||
}, {} as Record<string, UIPosition[]>) | ||
} | ||
|
||
return departments | ||
}, [positions]) | ||
}, [positions, order]) | ||
} |
12 changes: 12 additions & 0 deletions
12
site/src/components/pages/OpenPositions/utils/mapTypeToDisplayType.ts
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,12 @@ | ||
import { Position } from 'src/freshteam/types' | ||
|
||
export const mapTypeToDisplayType = (type: Position['type']): string => { | ||
switch (type) { | ||
case 'full_time': | ||
return 'Full Time' | ||
case 'part_time': | ||
return 'Part Time' | ||
default: | ||
return '' | ||
} | ||
} |
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,20 +1,21 @@ | ||
import { client } from './client' | ||
import { Position, PositionStatus } from './types' | ||
import { mapPositionToUIPosition } from './mappers' | ||
import { PositionStatus, UIPosition } from './types' | ||
|
||
interface Api { | ||
getJobPostings(s: PositionStatus): Promise<Position[]> | ||
getJobPostings(s: PositionStatus): Promise<UIPosition[]> | ||
} | ||
|
||
export const api = { | ||
getJobPostings: async (status?: PositionStatus): Promise<Position[]> => { | ||
getJobPostings: async (status?: PositionStatus): Promise<UIPosition[]> => { | ||
let url = 'job_postings' | ||
|
||
if (status) { | ||
url += `?status=${status}` | ||
} | ||
|
||
const result = await client.get(url).then((res) => res) | ||
console.log(Array.isArray(result), Object.keys(result)) | ||
return result.data | ||
|
||
return result.data.map(mapPositionToUIPosition) | ||
}, | ||
} satisfies Api |
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,15 @@ | ||
import { Position, UIPosition } from './types' | ||
import { convert } from 'html-to-text' | ||
|
||
export const mapPositionToUIPosition = (position: Position): UIPosition => { | ||
return { | ||
id: position.id, | ||
title: position.title, | ||
description: position.description, | ||
plainTextDescription: convert(position.description, { wordwrap: false, limits: { maxBaseElements: 200 } }), | ||
remote: position.remote, | ||
type: position.type, | ||
branch: position.branch, | ||
department: position.department.name, | ||
} | ||
} |
Oops, something went wrong.