diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 61db5d83..fb90e385 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -45,7 +45,7 @@ jobs: deploy-til-dev: name: Deploy til dev-gcp needs: bygg-og-push-docker-image - if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/openai-evaluering' + if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/finn-kandidater-stilling' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git "a/src/kandidatsok/hooks/useS\303\270kekriterierFraStilling.ts" "b/src/kandidatsok/hooks/useS\303\270kekriterierFraStilling.ts" index c3132a73..20743e0d 100644 --- "a/src/kandidatsok/hooks/useS\303\270kekriterierFraStilling.ts" +++ "b/src/kandidatsok/hooks/useS\303\270kekriterierFraStilling.ts" @@ -1,9 +1,3 @@ -import { useEffect, useState } from 'react'; -import { useSearchParams } from 'react-router-dom'; -import { FilterParam } from './useQuery'; -import useSøkekriterier, { LISTEPARAMETER_SEPARATOR } from './useSøkekriterier'; -import { KandidatsokQueryParam } from 'felles/lenker'; -import { HentFylkerDTO, useHentFylker } from '../../api/stillings-api/hentFylker'; import { formaterStedsnavn, lagKandidatsøkstreng, @@ -11,13 +5,16 @@ import { stedmappingFraGammeltNummer, } from 'felles/MappingSted'; import { Rekrutteringsbistandstilling } from 'felles/domene/stilling/Stilling'; +import { useEffect, useState } from 'react'; +import { HentFylkerDTO, useHentFylker } from '../../api/stillings-api/hentFylker'; +import { FilterParam } from './useQuery'; +import useSøkekriterier, { LISTEPARAMETER_SEPARATOR } from './useSøkekriterier'; const useSøkekriterierFraStilling = ( rekrutteringsbistandstilling: Rekrutteringsbistandstilling | undefined, brukKriterierFraStillingen: boolean ) => { const { setSearchParam } = useSøkekriterier(); - const [searchParams] = useSearchParams(); const [harLagtTilKriterier, setHarLagtTilKriterier] = useState(false); const { data: fylker, isLoading: fylkerIsLoading } = useHentFylker(); @@ -40,7 +37,6 @@ const useSøkekriterierFraStilling = ( if ( rekrutteringsbistandstilling && brukKriterierFraStillingen && - søkeKriterierIkkeLagtTil(searchParams) && !fylkerIsLoading && !harLagtTilKriterier ) { @@ -92,9 +88,4 @@ const hentØnsketStedFraStilling = ( } }; -const søkeKriterierIkkeLagtTil = (searchParams: URLSearchParams) => - Array.from(searchParams.keys()).every( - (param) => param === KandidatsokQueryParam.Kandidatliste - ) || Array.from(searchParams.keys()).every((param) => param === KandidatsokQueryParam.Stilling); - export default useSøkekriterierFraStilling; diff --git a/src/kandidatsok/kandidatlistebanner/Kandidatlistebanner.tsx b/src/kandidatsok/kandidatlistebanner/Kandidatlistebanner.tsx index 3781e179..3eaf64cb 100644 --- a/src/kandidatsok/kandidatlistebanner/Kandidatlistebanner.tsx +++ b/src/kandidatsok/kandidatlistebanner/Kandidatlistebanner.tsx @@ -7,15 +7,33 @@ import { FunctionComponent } from 'react'; import { Link } from 'react-router-dom'; import useHentStilling, { useHentStillingTittel } from '../../felles/hooks/useStilling'; import { lenkeTilStilling } from '../../felles/lenker'; +import useNavigeringsstate from '../hooks/useNavigeringsstate'; import useSøkekriterierFraStilling from '../hooks/useSøkekriterierFraStilling'; import css from './Kandidatlistebanner.module.css'; -import useNavigeringsstate from '../hooks/useNavigeringsstate'; type Props = { stillingId?: string; }; const Kandidatlistebanner: FunctionComponent = ({ stillingId }) => { + if (stillingId) { + return ; + } + + return ; +}; + +const KandidatlistebannerVisningStilling = ({ stillingId }: { stillingId: string }) => { + const { stilling, isLoading } = useHentStilling(stillingId); + useSøkekriterierFraStilling(stilling, true); + if (isLoading) { + return ; + } + + return ; +}; + +const KandidatlistebannerVisning: FunctionComponent = ({ stillingId }) => { const navigeringsstate = useNavigeringsstate(); const { stilling: rekrutteringsbistandstilling,