Skip to content

Commit

Permalink
Merge pull request #778 from City-of-Helsinki/UHF-8948-fix-and-clean-…
Browse files Browse the repository at this point in the history
…job-search

UHF-8948: Fix and clean job search
  • Loading branch information
Jussiles authored Sep 25, 2023
2 parents bd4ca8c + d02e491 commit c811827
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 41 deletions.
2 changes: 1 addition & 1 deletion dist/js/district-and-project-search.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/job-search.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/news-archive.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ const FormContainer = () => {
icon={<IconLocation />}
label={residentialAreaLabel}
placeholder={Drupal.t('Select area', {}, { context: 'District and project search form label' })}
clearButtonAriaLabel={Drupal.t('Clear @label selection', {'@label': residentialAreaLabel}, { context: 'React search clear selection label' })}
selectedItemRemoveButtonAriaLabel={Drupal.t('Remove item', {}, { context: 'District and project search remove item aria label' })}
toggleButtonAriaLabel={Drupal.t('Open the combobox', {}, { context: 'District and project search open dropdown aria label' })}
clearButtonAriaLabel={Drupal.t('Clear @label selection', { '@label': residentialAreaLabel }, { context: 'React search clear selection label' })}
selectedItemRemoveButtonAriaLabel={Drupal.t('Remove item', {}, { context: 'React search remove item aria label' })}
toggleButtonAriaLabel={Drupal.t('Open the combobox', {}, { context: 'React search open dropdown aria label' })}
theme={{
'--focus-outline-color': 'var(--hdbt-color-black)',
'--multiselect-checkbox-background-selected': 'var(--hdbt-color-black)',
Expand All @@ -106,7 +106,7 @@ const FormContainer = () => {
'--header-line-height': 'var(--lineheight-s)',
}}
>
<div className='district-project-search-form__filters'>
<div className='district-project-search-form__filters'>
<Combobox
multiselect
id={SearchComponents.THEME}
Expand All @@ -116,9 +116,9 @@ const FormContainer = () => {
onChange={setThemeFilter}
label={projectThemeLabel}
placeholder={Drupal.t('All themes', {}, { context: 'District and project search form label' })}
clearButtonAriaLabel={Drupal.t('Clear @label selection', {'@label': projectThemeLabel}, { context: 'React search clear selection label' })}
selectedItemRemoveButtonAriaLabel={Drupal.t('Remove item', {}, { context: 'District and project search remove item aria label' })}
toggleButtonAriaLabel={Drupal.t('Open the combobox', {}, { context: 'District and project search open dropdown aria label' })}
clearButtonAriaLabel={Drupal.t('Clear @label selection', { '@label': projectThemeLabel }, { context: 'React search clear selection label' })}
selectedItemRemoveButtonAriaLabel={Drupal.t('Remove item', {}, { context: 'React search remove item aria label' })}
toggleButtonAriaLabel={Drupal.t('Open the combobox', {}, { context: 'React search open dropdown aria label' })}
theme={{
'--focus-outline-color': 'var(--hdbt-color-black)',
'--multiselect-checkbox-background-selected': 'var(--hdbt-color-black)',
Expand All @@ -134,9 +134,9 @@ const FormContainer = () => {
onChange={setPhaseFilter}
label={projectStageLabel}
placeholder={Drupal.t('All stages', {}, { context: 'District and project search form label' })}
clearButtonAriaLabel={Drupal.t('Clear @label selection', {'@label': projectStageLabel}, { context: 'React search clear selection label' })}
selectedItemRemoveButtonAriaLabel={Drupal.t('Remove item', {}, { context: 'District and project search remove item aria label' })}
toggleButtonAriaLabel={Drupal.t('Open the combobox', {}, { context: 'District and project search open dropdown aria label' })}
clearButtonAriaLabel={Drupal.t('Clear @label selection', { '@label': projectStageLabel }, { context: 'React search clear selection label' })}
selectedItemRemoveButtonAriaLabel={Drupal.t('Remove item', {}, { context: 'React search remove item aria label' })}
toggleButtonAriaLabel={Drupal.t('Open the combobox', {}, { context: 'React search open dropdown aria label' })}
theme={{
'--focus-outline-color': 'var(--hdbt-color-black)',
'--multiselect-checkbox-background-selected': 'var(--hdbt-color-black)',
Expand All @@ -152,9 +152,9 @@ const FormContainer = () => {
onChange={setTypeFilter}
label={projectTypeLabel}
placeholder={Drupal.t('All types', {}, { context: 'District and project search form label' })}
clearButtonAriaLabel={Drupal.t('Clear @label selection', {'@label': projectTypeLabel}, { context: 'React search clear selection label' })}
selectedItemRemoveButtonAriaLabel={Drupal.t('Remove item', {}, { context: 'District and project search remove item aria label' })}
toggleButtonAriaLabel={Drupal.t('Open the combobox', {}, { context: 'District and project search open dropdown aria label' })}
clearButtonAriaLabel={Drupal.t('Clear @label selection', { '@label': projectTypeLabel }, { context: 'React search clear selection label' })}
selectedItemRemoveButtonAriaLabel={Drupal.t('Remove item', {}, { context: 'React search remove item aria label' })}
toggleButtonAriaLabel={Drupal.t('Open the combobox', {}, { context: 'React search open dropdown aria label' })}
theme={{
'--focus-outline-color': 'var(--hdbt-color-black)',
'--multiselect-checkbox-background-selected': 'var(--hdbt-color-black)',
Expand Down
17 changes: 7 additions & 10 deletions src/js/react/apps/job-search/components/results/ResultCard.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { HTMLAttributes } from 'react';
import { useAtomValue } from 'jotai';

import CardItem from '@/react/common/Card';
import Result from '@/types/Result';
import { currentLanguage } from '../../query/queries';

import Job from '../../types/Job';
import Result from '@/types/Result';
import { urlAtom } from '../../store';

const getResultCard = ({
Expand All @@ -29,21 +29,19 @@ const getResultCard = ({
const heading = title[0];
const cardTitle = (
<>
<span {...customAtts}>{heading.charAt(0).toUpperCase() + heading.slice(1)}</span>
{field_jobs?.[0] > 1 && <span>{` (${field_jobs} ${Drupal.t('jobs')})`}</span>}
<span {...customAtts}>{heading}</span>
{field_jobs?.[0] > 1 && <span>{`(${field_jobs} ${Drupal.t('jobs')})`}</span>}
</>
);

const orgName = field_organization_name && field_organization_name.length > 0 && field_organization_name[0] || '';

const getDate = (() => {
let date: undefined|string;
let dateObject: undefined|Date;
const unpublish = unpublish_on?.[0];

if (!unpublish || Number.isNaN(unpublish)) {
return '-';
}
}

try {
dateObject = new Date(unpublish * 1000);
Expand All @@ -62,11 +60,10 @@ const getResultCard = ({
return date;
});

const orgName = field_organization_name && field_organization_name.length > 0 && field_organization_name[0] || '';
const employmentTags = Array.isArray(field_employment) ? field_employment : [];
const typeTags = Array.isArray(field_employment_type) ? field_employment_type : [];
const tags: any = employmentTags.concat(typeTags).map(tag => ({
tag
}));
const tags: any = employmentTags.concat(typeTags).map(tag => ({ tag }));

return (
<CardItem
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useAtomValue } from 'jotai';

import SimpleResultsContainer from './SimpleResultsContainer';
import PromotedResultsContainer from './PromotedResultsContainer';
import { configurationsAtom } from '../store';
Expand Down
5 changes: 3 additions & 2 deletions src/js/react/apps/job-search/hooks/useQueryString.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useAtomValue } from 'jotai';

import CustomIds from '../enum/CustomTermIds';
import Global from '../enum/Global';
import IndexFields from '../enum/IndexFields';
Expand Down Expand Up @@ -40,7 +41,7 @@ const useQueryString = (urlParams: URLParams): string => {
},
{
combined_fields: {
query: urlParams.keyword.toString(),
query: urlParams.keyword.toString().toLowerCase(),
fields: [
`${IndexFields.TITLE}^2`,
`${IndexFields.ORGANIZATION}^1.5`,
Expand All @@ -51,7 +52,7 @@ const useQueryString = (urlParams: URLParams): string => {
},
{
wildcard: {
[`${IndexFields.TITLE}`]: `*${urlParams.keyword.toString()}*`,
[`${IndexFields.TITLE}`]: `*${urlParams.keyword.toString().toLowerCase()}*`,
},
},
],
Expand Down
7 changes: 4 additions & 3 deletions src/js/react/apps/news-archive/components/Filter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Select } from 'hds-react';
import { useAtom } from 'jotai';

import OptionType from '@/types/OptionType';
import { stagedParamsAtom } from '../store';
import URLParams from '../types/URLParams';
Expand Down Expand Up @@ -43,15 +44,15 @@ const Filter = ({label, options, stateKey, ...rest}: FilterProps) => {
<Select
className='news-form__filter'
clearable
clearButtonAriaLabel={Drupal.t('Clear @label selection', {'@label': label}, { context: 'React search clear selection label' })}
clearButtonAriaLabel={Drupal.t('Clear @label selection', { '@label': label }, { context: 'React search clear selection label' })}
label={label}
onChange={onChange}
multiselect
selectedItemRemoveButtonAriaLabel={Drupal.t(
'Remove item',
{},
{ context: 'Job search remove item aria label' }
)}
{ context: 'React search remove item aria label' }
)}
options={options}
value={getValue()}
{...rest}
Expand Down
4 changes: 2 additions & 2 deletions src/js/react/common/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import parse from 'html-react-parser';

import Tags from './Tags';
import Icon from './Icon';
import type MetadataType from '@/types/MetadataType';
import type TagType from '@/types/TagType';
import Tags from './Tags';
import Icon from './Icon';

const Metarow = ({ icon, label, content} : MetadataType) => (
<div className="card__meta">
Expand Down
12 changes: 8 additions & 4 deletions translations/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -654,10 +654,6 @@ msgctxt "News archive clear selections"
msgid "Clear selections"
msgstr "Tyhjennä valinnat"

msgctxt "News archive open dropdown aria label"
msgid "Open the combobox"
msgstr "Avaa alasvetovalikko"

msgctxt "News RSS feed subscribe link"
msgid "Subscribe to all news as RSS feed"
msgstr "Tilaa kaikkien uutisten RSS-syöte"
Expand All @@ -673,6 +669,14 @@ msgctxt "React search clear selection label"
msgid "Clear @label selection"
msgstr "Tyhjennä @label valinnat"

msgctxt "React search remove item aria label"
msgid "Remove item"
msgstr "Poista valinta"

msgctxt "React search open dropdown aria label"
msgid "Open the combobox"
msgstr "Avaa alasvetovalikko"

msgid "Unit homepage"
msgstr "Toimipisteen kotisivut"

Expand Down
12 changes: 8 additions & 4 deletions translations/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -647,10 +647,6 @@ msgctxt "News archive clear selections"
msgid "Clear selections"
msgstr "Töm urvalet"

msgctxt "News archive open dropdown aria label"
msgid "Open the combobox"
msgstr "öppna rullgardinsmenyn"

msgctxt "News RSS feed subscribe link"
msgid "Subscribe to all news as RSS feed"
msgstr "Prenumerera på alla nyheter som RSS-flöde"
Expand All @@ -666,6 +662,14 @@ msgctxt "React search clear selection label"
msgid "Clear @label selection"
msgstr "Rensa alla @label"

msgctxt "React search remove item aria label"
msgid "Remove item"
msgstr "Töm valda"

msgctxt "React search open dropdown aria label"
msgid "Open the combobox"
msgstr "öppna rullgardinsmenyn"

msgid "Unit homepage"
msgstr "Enhetens hemsida"

Expand Down

0 comments on commit c811827

Please sign in to comment.