From 541ee4ca01a8664021eac5c5ec01b675b143e02b Mon Sep 17 00:00:00 2001 From: nuno-aac <naac.1999@gmail.com> Date: Fri, 20 Oct 2023 09:44:24 +0100 Subject: [PATCH 1/2] Update jobs card --- workspaces/website/src/pages/jobs/JobsCard.tsx | 3 ++- workspaces/website/src/pages/jobs/JobsPage.tsx | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/workspaces/website/src/pages/jobs/JobsCard.tsx b/workspaces/website/src/pages/jobs/JobsCard.tsx index 85def9a99c..1289730272 100644 --- a/workspaces/website/src/pages/jobs/JobsCard.tsx +++ b/workspaces/website/src/pages/jobs/JobsCard.tsx @@ -1,5 +1,6 @@ import { ListCard } from "@ui/Card/ListCard"; import { JobsHit } from "./JobsPage"; +import moment from "moment"; export default function JobsCard({ hit }: { hit: JobsHit }) { let tags: string[] = []; @@ -10,7 +11,7 @@ export default function JobsCard({ hit }: { hit: JobsHit }) { return ( <ListCard variant="job" - startDateTime={hit.contact?.name} + startDateTime={`${hit.contact?.name} - ${moment(hit.published_at).format('DD MMM, YYYY')}`} image={hit.contact?.logo} title={hit.job?.title} description={hit.job?.description} diff --git a/workspaces/website/src/pages/jobs/JobsPage.tsx b/workspaces/website/src/pages/jobs/JobsPage.tsx index 623f3698c6..1b69ac9ce2 100644 --- a/workspaces/website/src/pages/jobs/JobsPage.tsx +++ b/workspaces/website/src/pages/jobs/JobsPage.tsx @@ -15,7 +15,7 @@ import algoliasearch from "algoliasearch/lite"; import { InstantSearch, Configure, - useInfiniteHits, + useInfiniteHits } from "react-instantsearch-hooks-web"; import { useRefinementList } from "react-instantsearch-hooks"; import { PageLayout } from "@ui/Layout/PageLayout"; @@ -55,8 +55,11 @@ export function JobsPage({ params, env, seo }: Props): JSX.Element | null { indexName={`web_jobs_${env.ALGOLIA_INDEX}`} > <Configure - hitsPerPage={40} - facetsRefinements={{ locale: [params.locale], status: ['active'] }} + hitsPerPage={5} + facetsRefinements={{ + locale: [params.locale], + status: ['active'] + }} /> <JobsPageLayout params={params} seo={seo} /> </InstantSearch> From 9729f1e78440b562b26c01d7801f0316bf86b379 Mon Sep 17 00:00:00 2001 From: nuno-aac <naac.1999@gmail.com> Date: Fri, 20 Oct 2023 09:58:36 +0100 Subject: [PATCH 2/2] Update jobs sorting --- workspaces/cms-scripts/src/algolia.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/workspaces/cms-scripts/src/algolia.ts b/workspaces/cms-scripts/src/algolia.ts index 234144fc48..bc7e350627 100644 --- a/workspaces/cms-scripts/src/algolia.ts +++ b/workspaces/cms-scripts/src/algolia.ts @@ -81,6 +81,12 @@ try { }) .wait(); } + + if (resourceName === "jobs") { + await index.setSettings({ + customRanking: ["desc(published_at_ts)"], + }); + } } } catch (err) { console.error(err);