Skip to content

Commit

Permalink
Merge pull request #1037 from City-of-Helsinki/fix/embedder-alphabeti…
Browse files Browse the repository at this point in the history
…c-order

Fix/embedder alphabetic order
  • Loading branch information
vitalis0itu authored Oct 6, 2023
2 parents d0d5ce6 + 11cbea6 commit b60b743
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/components/ListItems/ResultItem/ResultItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const ResultItem = ({
</StyledListItemIcon>
)
}
<StyledItemTextContainer simpleitem={simpleItem || undefined}>
<StyledItemTextContainer simpleitem={+simpleItem}>
<StyledTopRow data-sm="ResultItemTopRow">
{
// SROnly element with full readable text
Expand All @@ -119,7 +119,7 @@ const ResultItem = ({
// Title
}
<StyledTitle
simpleitem={simpleItem || undefined}
simpleitem={+simpleItem}
data-sm="ResultItemTitle"
className={`${typographyClasses.title || ''} ResultItem-title`}
component="p"
Expand Down Expand Up @@ -191,7 +191,7 @@ const ResultItem = ({
{divider && (
<li aria-hidden>
<StyledDivider
simpleitem={simpleItem || undefined}
simpleitem={+simpleItem}
variant={icon ? 'inset' : 'fullWidth'}
/>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ exports[`<ResultItem /> should work 1`] = `
class="MuiTypography-root MuiTypography-body2 ResultItem-title css-1eygwv7-MuiTypography-root"
data-sm="ResultItemTitle"
role="textbox"
simpleitem="0"
>
Title text
</p>
Expand Down Expand Up @@ -77,6 +78,7 @@ exports[`<ResultItem /> should work 1`] = `
>
<hr
class="MuiDivider-root MuiDivider-fullWidth css-3ab9ag-MuiDivider-root"
simpleitem="0"
/>
</li>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ exports[`<UnitItem /> should work 1`] = `
class="MuiTypography-root MuiTypography-body2 css-in3yi3 ResultItem-title css-1eygwv7-MuiTypography-root"
data-sm="ResultItemTitle"
role="textbox"
simpleitem="0"
>
Lippulaivan kirjasto
</p>
Expand All @@ -64,6 +65,7 @@ exports[`<UnitItem /> should work 1`] = `
>
<hr
class="MuiDivider-root MuiDivider-inset css-1tvkns7-MuiDivider-root"
simpleitem="0"
/>
</li>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ exports[`<ResultList /> should work 1`] = `
class="MuiTypography-root MuiTypography-body2 css-in3yi3 ResultItem-title css-1eygwv7-MuiTypography-root"
data-sm="ResultItemTitle"
role="textbox"
simpleitem="0"
>
Lippulaivan kirjasto
</p>
Expand All @@ -102,6 +103,7 @@ exports[`<ResultList /> should work 1`] = `
>
<hr
class="MuiDivider-root MuiDivider-inset css-1tvkns7-MuiDivider-root"
simpleitem="0"
/>
</li>
<li
Expand Down Expand Up @@ -144,6 +146,7 @@ exports[`<ResultList /> should work 1`] = `
class="MuiTypography-root MuiTypography-body2 css-in3yi3 ResultItem-title css-1eygwv7-MuiTypography-root"
data-sm="ResultItemTitle"
role="textbox"
simpleitem="0"
>
Kivistön kirjasto
</p>
Expand All @@ -166,6 +169,7 @@ exports[`<ResultList /> should work 1`] = `
>
<hr
class="MuiDivider-root MuiDivider-inset css-1tvkns7-MuiDivider-root"
simpleitem="0"
/>
</li>
</ul>
Expand Down
10 changes: 7 additions & 3 deletions src/views/MapView/utils/useMapUnits.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { getDistrictPrimaryUnits, getFilteredSubdistrictUnits, getParkingUnits }
import { getOrderedData } from '../../../redux/selectors/results';
import { getSelectedUnit } from '../../../redux/selectors/selectedUnit';
import { getServiceUnits } from '../../../redux/selectors/service';
import orderUnits from '../../../utils/orderUnits';
import { useEmbedStatus } from '../../../utils/path';
import { getServiceFilteredStatisticalDistrictUnits } from '../../../redux/selectors/statisticalDistrict';

Expand Down Expand Up @@ -96,6 +97,7 @@ const useMapUnits = () => {
const statisticalDistrictUnits = useSelector(getServiceFilteredStatisticalDistrictUnits);
const parkingAreaUnits = useSelector(state => getParkingUnits(state));
const highlightedUnit = useSelector(state => getSelectedUnit(state));
const locale = useSelector(state => state.user.locale);

const searchUnitsLoading = useSelector(state => state.searchResults.isFetching);
const serviceUnitsLoading = useSelector(state => state.service.isFetching);
Expand Down Expand Up @@ -135,17 +137,19 @@ const useMapUnits = () => {
if (serviceUnits && !unitsLoading) return serviceUnits;
return [];

case 'area':
return [
case 'area': {
const results = [
...(districtPrimaryUnits.length ? districtPrimaryUnits : []),
...(districtServiceUnits.length ? districtServiceUnits : []),
...(parkingAreaUnits.length ? parkingAreaUnits : []),
...(statisticalDistrictUnits.length && statisticalTabOpen
...((statisticalDistrictUnits.length && statisticalTabOpen)
? statisticalDistrictUnits
: []
),
];

return orderUnits(results, { locale, direction: 'desc', order: 'alphabetical' });
}
default:
return [];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ exports[`<UnitDataList /> should work 1`] = `
class="MuiTypography-root MuiTypography-body2 ResultItem-title css-1eygwv7-MuiTypography-root"
data-sm="ResultItemTitle"
role="textbox"
simpleitem="0"
>
Suomen kielen kielikahvila
</p>
Expand All @@ -77,6 +78,7 @@ exports[`<UnitDataList /> should work 1`] = `
>
<hr
class="MuiDivider-root MuiDivider-inset css-1tvkns7-MuiDivider-root"
simpleitem="0"
/>
</li>
<li
Expand Down Expand Up @@ -125,6 +127,7 @@ exports[`<UnitDataList /> should work 1`] = `
class="MuiTypography-root MuiTypography-body2 ResultItem-title css-1eygwv7-MuiTypography-root"
data-sm="ResultItemTitle"
role="textbox"
simpleitem="0"
>
R&A x Armas: Vanhenemisen estetiikka
</p>
Expand All @@ -136,6 +139,7 @@ exports[`<UnitDataList /> should work 1`] = `
>
<hr
class="MuiDivider-root MuiDivider-inset css-1tvkns7-MuiDivider-root"
simpleitem="0"
/>
</li>
<li
Expand Down Expand Up @@ -184,6 +188,7 @@ exports[`<UnitDataList /> should work 1`] = `
class="MuiTypography-root MuiTypography-body2 ResultItem-title css-1eygwv7-MuiTypography-root"
data-sm="ResultItemTitle"
role="textbox"
simpleitem="0"
>
Digital guidance for seniors
</p>
Expand Down

0 comments on commit b60b743

Please sign in to comment.