From de5212cc036ca70b773f8125052cf4b48e86d28e Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 29 Aug 2023 08:28:55 +1000 Subject: [PATCH 1/4] =?UTF-8?q?Change=20=E2=80=9Cproven=20skills=E2=80=9D?= =?UTF-8?q?=20look=20and=20feel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://topcoder.atlassian.net/browse/TAL-65 --- .../src/routes/search-results-page/SearchResultsPage.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx b/src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx index a23d9edfc..0b8c23b05 100644 --- a/src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx +++ b/src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx @@ -34,9 +34,11 @@ const SearchResultsPage: FC = () => { const skillsModalTriggerBtn = (
-
) From f3bd72d5f80da94bad581297e36300344742a430 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Wed, 30 Aug 2023 15:23:45 +1000 Subject: [PATCH 2/4] Change how we show the Sprig survey on talent search https://topcoder.atlassian.net/browse/TAL-79 --- .../src/lib/services/sprig-survey.ts | 8 ++++++-- .../src/routes/search-page/SearchPage.tsx | 20 ++++++++++++++++++- .../search-results-page/SearchResultsPage.tsx | 13 +----------- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/apps/talent-search/src/lib/services/sprig-survey.ts b/src/apps/talent-search/src/lib/services/sprig-survey.ts index c7bdf9032..622b6b54e 100644 --- a/src/apps/talent-search/src/lib/services/sprig-survey.ts +++ b/src/apps/talent-search/src/lib/services/sprig-survey.ts @@ -3,6 +3,10 @@ import { UserProfile } from '~/libs/core' import { SPRIG_CES_SURVEY_ID } from '../../config' -export function triggerSprigSurvey({ userId }: UserProfile): void { - sprigTriggerForUser(SPRIG_CES_SURVEY_ID, userId) +export function triggerSprigSurvey(profile?: UserProfile): void { + if (profile?.userId) { + sprigTriggerForUser(SPRIG_CES_SURVEY_ID, profile?.userId) + } else { + sprigTriggerForUser(SPRIG_CES_SURVEY_ID) + } } diff --git a/src/apps/talent-search/src/routes/search-page/SearchPage.tsx b/src/apps/talent-search/src/routes/search-page/SearchPage.tsx index 8c455f3e3..1ed1ad8da 100644 --- a/src/apps/talent-search/src/routes/search-page/SearchPage.tsx +++ b/src/apps/talent-search/src/routes/search-page/SearchPage.tsx @@ -1,6 +1,7 @@ -import { FC, useRef, useState } from 'react' +import { FC, useContext, useEffect, useRef, useState } from 'react' import { useNavigate, useSearchParams } from 'react-router-dom' +import { profileContext, ProfileContextData } from '~/libs/core' import { ContentLayout, IconOutline } from '~/libs/ui' import { Skill } from '~/libs/shared' @@ -8,10 +9,13 @@ import { SearchInput } from '../../components/search-input' import { PopularSkills } from '../../components/popular-skills' import { TALENT_SEARCH_PATHS } from '../../talent-search.routes' import { encodeUrlQuerySearch } from '../../lib/utils/search-query' +import { triggerSprigSurvey } from '../../lib/services' import styles from './SearchPage.module.scss' export const SearchPage: FC = () => { + const sprigFlag = useRef(false) + const [params] = useSearchParams() const isMissingProfileRoute = params.get('memberNotFound') !== null @@ -19,6 +23,8 @@ export const SearchPage: FC = () => { const navigate = useNavigate() const [skillsFilter, setSkillsFilter] = useState([]) + const { profile }: ProfileContextData = useContext(profileContext) + function navigateToResults(): void { const searchParams = encodeUrlQuerySearch(skillsFilter) navigate(`${TALENT_SEARCH_PATHS.results}?${searchParams}`) @@ -29,6 +35,18 @@ export const SearchPage: FC = () => { searchInputRef.current?.focus() } + useEffect(() => { + if (!sprigFlag.current) { + if (profile?.userId) { + triggerSprigSurvey(profile) + } else { + triggerSprigSurvey() + } + + sprigFlag.current = true + } + }, [profile, skillsFilter]) + function renderHeader(): JSX.Element { return isMissingProfileRoute ? ( <> diff --git a/src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx b/src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx index 0b8c23b05..54fb96303 100644 --- a/src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx +++ b/src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx @@ -1,7 +1,6 @@ -import { FC, useCallback, useContext, useEffect, useRef, useState } from 'react' +import { FC, useCallback, useState } from 'react' import classNames from 'classnames' -import { profileContext, ProfileContextData } from '~/libs/core' import { Button, ContentLayout, LinkButton, LoadingCircles } from '~/libs/ui' import { EmsiSkillSources, HowSkillsWorkModal, SkillPill } from '~/libs/shared' @@ -10,16 +9,13 @@ import { SearchInput } from '../../components/search-input' import { useUrlQuerySearchParms } from '../../lib/utils/search-query' import { InfiniteTalentMatchesResposne, - triggerSprigSurvey, useInfiniteTalentMatches, } from '../../lib/services' import styles from './SearchResultsPage.module.scss' const SearchResultsPage: FC = () => { - const sprigFlag = useRef(false) const [showSkillsModal, setShowSkillsModal] = useState(false) - const { profile }: ProfileContextData = useContext(profileContext) const [skills, setSkills] = useUrlQuerySearchParms('q') const { @@ -43,13 +39,6 @@ const SearchResultsPage: FC = () => { ) - useEffect(() => { - if (profile?.userId && matches?.length && !sprigFlag.current) { - sprigFlag.current = true - triggerSprigSurvey(profile) - } - }, [profile, matches]) - return ( <>
From 72ace30b6d6e19710b422d2ad5bc62c632d5b0b0 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 29 Aug 2023 08:28:55 +1000 Subject: [PATCH 3/4] =?UTF-8?q?Change=20=E2=80=9Cproven=20skills=E2=80=9D?= =?UTF-8?q?=20look=20and=20feel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://topcoder.atlassian.net/browse/TAL-65 From ce2911220c9ed2bd44be2f6fab51fc339137cc36 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Tue, 29 Aug 2023 08:36:29 +1000 Subject: [PATCH 4/4] Lint fix --- .../src/routes/search-results-page/SearchResultsPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx b/src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx index 54fb96303..dd7a315e6 100644 --- a/src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx +++ b/src/apps/talent-search/src/routes/search-results-page/SearchResultsPage.tsx @@ -2,7 +2,7 @@ import { FC, useCallback, useState } from 'react' import classNames from 'classnames' import { Button, ContentLayout, LinkButton, LoadingCircles } from '~/libs/ui' -import { EmsiSkillSources, HowSkillsWorkModal, SkillPill } from '~/libs/shared' +import { HowSkillsWorkModal } from '~/libs/shared' import { TalentCard } from '../../components/talent-card' import { SearchInput } from '../../components/search-input'