Skip to content

Commit

Permalink
Add positionLocation input to jobCategories query (#917)
Browse files Browse the repository at this point in the history
* Update job categories input

* Fix components and pass inputs

* Format

* Add changeset

* patch
  • Loading branch information
IreneLee0905 authored Apr 19, 2023
1 parent 4974d26 commit 6e95f2a
Show file tree
Hide file tree
Showing 9 changed files with 7,605 additions and 7,582 deletions.
5 changes: 5 additions & 0 deletions .changeset/silver-laws-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'wingman-fe': patch
---

Add positionProfile input into jobCategories query
18 changes: 13 additions & 5 deletions fe/lib/components/JobCategorySelect/JobCategorySelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import {
import React, { ComponentPropsWithRef, forwardRef, useState } from 'react';

import type {
JobCategoriesPositionProfileInput,
JobCategoriesQuery,
JobCategoriesQueryVariables,
JobCategoryAttributesFragment,
} from '../../types/seekApi.graphql';

Expand All @@ -28,6 +30,7 @@ export interface JobCategorySelectProps
type: JobCategoryType,
) => void;
schemeId: string;
positionProfile?: JobCategoriesPositionProfileInput;
initialValue?: string;
hideLabel?: boolean;
}
Expand All @@ -41,6 +44,7 @@ export const JobCategorySelect = forwardRef<
client,
onSelect,
schemeId,
positionProfile,
initialValue,

message,
Expand All @@ -55,12 +59,16 @@ export const JobCategorySelect = forwardRef<
data: categoriesData,
loading: categoriesLoading,
error: categoriesError,
} = useQuery<JobCategoriesQuery>(JOB_CATEGORIES, {
...(client && { client }),
variables: {
schemeId,
} = useQuery<JobCategoriesQuery, JobCategoriesQueryVariables>(
JOB_CATEGORIES,
{
...(client && { client }),
variables: {
schemeId,
positionProfile,
},
},
});
);

const [selectedJobCategoryId, setSelectedJobCategoryId] = useState('');

Expand Down
7 changes: 5 additions & 2 deletions fe/lib/components/JobCategorySelect/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ const JOB_CATEGORY_ATTRIBUTES = gql`
}
`;
export const JOB_CATEGORIES = gql`
query JobCategories($schemeId: String!) {
jobCategories(schemeId: $schemeId) {
query JobCategories(
$schemeId: String!
$positionProfile: JobCategories_PositionProfileInput
) {
jobCategories(schemeId: $schemeId, positionProfile: $positionProfile) {
...jobCategoryAttributes
children {
...jobCategoryAttributes
Expand Down
5 changes: 4 additions & 1 deletion fe/lib/components/JobCategorySuggest/JobCategorySuggest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export const JobCategorySuggest = React.memo(
positionProfile,
debounceDelay,
);

const {
data: suggestData,
error: suggestError,
Expand Down Expand Up @@ -96,6 +95,10 @@ export const JobCategorySuggest = React.memo(
tone={tone}
client={client}
schemeId={schemeId}
positionProfile={{
positionLocation:
debounceJobCategorySuggestInput.positionLocation,
}}
/>
)
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import React, { ComponentProps, forwardRef, useState } from 'react';

import type {
JobCategoriesPositionProfileInput,
JobCategory,
JobCategorySuggestionChoiceAttributesFragment,
} from '../../types/seekApi.graphql';
Expand All @@ -17,6 +18,7 @@ import { JobCategorySelect } from '../JobCategorySelect/JobCategorySelect';

interface Props {
schemeId: string;
positionProfile: JobCategoriesPositionProfileInput;
choices: JobCategorySuggestionChoiceAttributesFragment[];
onSelect: (
jobCategorySuggestionChoice: JobCategorySuggestionChoiceAttributesFragment,
Expand Down Expand Up @@ -46,6 +48,7 @@ const JobCategorySuggestChoices = forwardRef<HTMLInputElement, Props>(
label = 'Category',
showConfidence = false,
initialValue,
positionProfile,
...restProps
},
forwardedRef,
Expand Down Expand Up @@ -126,6 +129,7 @@ const JobCategorySuggestChoices = forwardRef<HTMLInputElement, Props>(
}
}}
schemeId={schemeId}
positionProfile={positionProfile}
hideLabel
/>
)}
Expand Down
Loading

0 comments on commit 6e95f2a

Please sign in to comment.