diff --git a/src/i18n/en.js b/src/i18n/en.js index 84bd0229a..3373909e0 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -61,8 +61,10 @@ const translations = { 'area.localAddress.postCode': 'Postal code area: {area}', 'area.geographicalServices.neighborhood': 'Services of the neighbourhood ({length})', 'area.geographicalServices.postcode_area': 'Services of the postal code area ({length})', + 'area.geographicalServices.major_district': 'Services of the major district ({length})', 'area.neighborhood.title': 'Choose neighbourhood', 'area.postcode_area.title': 'Choose postal code', + 'area.major_district.title': 'Choose major district', 'area.noSelection': 'Choose area from the Choice of Area tab', 'area.noUnits': 'There are no service points in your chosen area', 'area.popupLink': 'Show the details for the area (new tab)', @@ -78,6 +80,7 @@ const translations = { 'area.list.neighborhood': 'Neighborhood', 'area.list.postcode': 'Postcode', 'area.list.postcode_area': 'Postcode area', + 'area.list.major_district': 'Major district', 'area.list.rescue_area': 'Civil defence district', 'area.list.rescue_district': 'Civil defence section', 'area.list.rescue_sub_district': 'Civil defence subsection', @@ -93,6 +96,7 @@ const translations = { 'area.list.resident_parking_zone': 'Residential parking areas', 'area.list.neighborhood.plural': 'Neighborhoods', 'area.list.postcode_area.plural': 'Postcode areas', + 'area.list.major_district.plural': 'Major districts', 'area.list.rescue_area.plural': 'Civil defence districts', 'area.list.rescue_district.plural': 'Civil defence sections', 'area.list.rescue_sub_district.plural': 'Civil defence subsections', diff --git a/src/i18n/fi.js b/src/i18n/fi.js index f6054d7af..0f59901b6 100644 --- a/src/i18n/fi.js +++ b/src/i18n/fi.js @@ -61,8 +61,10 @@ const translations = { 'area.localAddress.postCode': 'Postinumero: {area}', 'area.geographicalServices.neighborhood': 'Kaupunginosan palvelut ({length})', 'area.geographicalServices.postcode_area': 'Postinumeroalueen palvelut ({length})', + 'area.geographicalServices.major_district': 'Suurpiirin palvelut ({length})', 'area.neighborhood.title': 'Valitse kaupunginosa', 'area.postcode_area.title': 'Valitse postinumero', + 'area.major_district.title': 'Valitse suurpiiri', 'area.noSelection': 'Valitse alue Alueen Valinta -välilehdeltä', 'area.noUnits': 'Valitsemallasi alueella ei ole toimipisteitä', 'area.popupLink': 'Näytä alueen tiedot (uusi välilehti)', @@ -78,6 +80,7 @@ const translations = { 'area.list.neighborhood': 'Kaupunginosa', 'area.list.postcode': 'Postinumero', 'area.list.postcode_area': 'Postinumeroalue', + 'area.list.major_district': 'Suurpiiri', 'area.list.rescue_area': 'Suojelupiiri', 'area.list.rescue_district': 'Suojelulohko', 'area.list.rescue_sub_district': 'Suojelualalohko', @@ -93,6 +96,7 @@ const translations = { 'area.list.resident_parking_zone': 'Asukaspysäköintialueet', 'area.list.neighborhood.plural': 'Kaupunginosat', 'area.list.postcode_area.plural': 'Postinumeroalueet', + 'area.list.major_district.plural': 'Suurpiirit', 'area.list.rescue_area.plural': 'Suojelupiirit', 'area.list.rescue_district.plural': 'Suojelulohkot', 'area.list.rescue_sub_district.plural': 'Suojelualalohkot', diff --git a/src/i18n/sv.js b/src/i18n/sv.js index c2296ed96..a7568a285 100644 --- a/src/i18n/sv.js +++ b/src/i18n/sv.js @@ -61,8 +61,10 @@ const translations = { 'area.localAddress.postCode': 'Postnummer: {area}', 'area.geographicalServices.neighborhood': 'Tjänster i stadsdelen ({length})', 'area.geographicalServices.postcode_area': 'Tjänster i postnummerområdet ({length})', + 'area.geographicalServices.major_district': 'Tjänster i stordistriktet ({length})', 'area.neighborhood.title': 'Välj stadsdel', 'area.postcode_area.title': 'Välj postnummer', + 'area.major_district.title': 'Välj stordistrikt', 'area.noSelection': 'Väl område under fliken Val av område', 'area.noUnits': 'Det finns inga verksamhetsställen i ditt valda område', 'area.popupLink': 'Visa uppgifterna för området (ny flik)', @@ -78,6 +80,7 @@ const translations = { 'area.list.neighborhood': 'Stadsdel', 'area.list.postcode': 'Postnummer', 'area.list.postcode_area': 'Postnummerområde', + 'area.list.major_district': 'Stordistrikt', 'area.list.rescue_area': 'Skyddsdistrikt', 'area.list.rescue_district': 'Skyddsavsnitt', 'area.list.rescue_sub_district': 'Skyddsunderavsnitt', @@ -93,6 +96,7 @@ const translations = { 'area.list.resident_parking_zone': 'Invånarparkeringsområden', 'area.list.neighborhood.plural': 'Stadsdelar', 'area.list.postcode_area.plural': 'Postnummerområden', + 'area.list.major_district.plural': 'Stordistrikten', 'area.list.rescue_area.plural': 'Skyddsdistrikten', 'area.list.rescue_district.plural': 'Skyddsavsnitten', 'area.list.rescue_sub_district.plural': 'Skyddsunderavsnitten', diff --git a/src/views/AddressView/utils/fetchAdministrativeDistricts.js b/src/views/AddressView/utils/fetchAdministrativeDistricts.js index 5aef8d220..8b6e24375 100644 --- a/src/views/AddressView/utils/fetchAdministrativeDistricts.js +++ b/src/views/AddressView/utils/fetchAdministrativeDistricts.js @@ -3,6 +3,7 @@ import { districtFetch } from '../../../utils/fetch'; const SORTED_DIVISIONS = [ 'postcode_area', 'neighborhood', + 'major_district', 'health_station_district', 'maternity_clinic_district', 'income_support_district', @@ -23,6 +24,7 @@ const fetchAdministrativeDistricts = async (lnglat) => { const districts = [ 'postcode_area', 'neighborhood', + 'major_district', 'health_station_district', 'maternity_clinic_district', 'lower_comprehensive_school_district_fi', diff --git a/src/views/AreaView/components/GeographicalTab/GeographicalTab.js b/src/views/AreaView/components/GeographicalTab/GeographicalTab.js index af1f6e8ec..24ae8691e 100644 --- a/src/views/AreaView/components/GeographicalTab/GeographicalTab.js +++ b/src/views/AreaView/components/GeographicalTab/GeographicalTab.js @@ -17,6 +17,7 @@ import { getFilteredSubdistrictServices } from '../../../../redux/selectors/dist import GeographicalDistrictList from '../GeographicalDistrictList'; import GeographicalUnitList from '../GeographicalUnitList'; import useLocaleText from '../../../../utils/useLocaleText'; +import { geographicalDistricts } from '../../utils/districtDataHelper'; const GeographicalTab = ({ @@ -37,7 +38,7 @@ const GeographicalTab = ({ const getLocaleText = useLocaleText(); const [openCategory, setOpenCategory] = useState( - useSelector(state => state.districts.openItems).find(item => item === 'neighborhood' || item === 'postcode_area') || [], + useSelector(state => state.districts.openItems).find(item => geographicalDistricts.includes(item)) || [], ); @@ -83,7 +84,7 @@ const GeographicalTab = ({ }; useEffect(() => { - if (!selectedDistrictType || (selectedDistrictType !== 'neighborhood' && selectedDistrictType !== 'postcode_area')) { + if (!selectedDistrictType || geographicalDistricts.includes(selectedDistrictType)) { dispatch(setSelectedSubdistricts([])); dispatch(setSelectedDistrictServices([])); setOpenCategory(null); @@ -117,7 +118,7 @@ const GeographicalTab = ({ const render = () => { - const districtItems = districtData.filter(obj => obj.id === 'neighborhood' || obj.id === 'postcode_area'); + const districtItems = districtData.filter(obj => geographicalDistricts.includes(obj.id)); return ( <> {localAddressData?.address && localAddressData.districts?.length && ( diff --git a/src/views/AreaView/utils/districtDataHelper.js b/src/views/AreaView/utils/districtDataHelper.js index 1b05d6103..2425327d2 100644 --- a/src/views/AreaView/utils/districtDataHelper.js +++ b/src/views/AreaView/utils/districtDataHelper.js @@ -52,6 +52,7 @@ export const dataStructure = [ // Categorized district data structure districts: [ 'neighborhood', 'postcode_area', + 'major_district', ], }, {