diff --git a/app/component/CardHeader.js b/app/component/CardHeader.js index 3f8538c9b6..229634b1f9 100644 --- a/app/component/CardHeader.js +++ b/app/component/CardHeader.js @@ -1,12 +1,10 @@ import PropTypes from 'prop-types'; import React from 'react'; import cx from 'classnames'; -import { FormattedMessage } from 'react-intl'; import ComponentUsageExample from './ComponentUsageExample'; import Icon from './Icon'; import SplitBars from './SplitBars'; import Favourite from './Favourite'; -import { getCityBikeNetworkName } from '../util/citybikes'; const CardHeader = ({ className, @@ -19,7 +17,6 @@ const CardHeader = ({ icon, icons, unlinked, - network, }) => (
{children} @@ -44,14 +41,6 @@ const CardHeader = ({ {unlinked ? null : }
- {network && ( -

- -

- )} {code != null ?

{code}

: null} {description != null && description !== 'null' ? (

{description}

@@ -99,7 +88,6 @@ CardHeader.propTypes = { icons: PropTypes.arrayOf(PropTypes.node), children: PropTypes.node, unlinked: PropTypes.bool, - network: PropTypes.string, }; CardHeader.defaultProps = { diff --git a/app/component/CityBikeCard.js b/app/component/CityBikeCard.js index f69608ef7f..55472cfd87 100644 --- a/app/component/CityBikeCard.js +++ b/app/component/CityBikeCard.js @@ -5,10 +5,7 @@ import CardHeader from './CardHeader'; import { station as exampleStation } from './ExampleData'; import ComponentUsageExample from './ComponentUsageExample'; import Card from './Card'; -import { - getCityBikeNetworkIcon, - getCityBikeNetworkName, -} from '../util/citybikes'; +import { getCityBikeNetworkIcon } from '../util/citybikes'; const CityBikeCard = ({ station, children, className }, { config }) => { if (!station || !children || children.length === 0) { @@ -18,10 +15,9 @@ const CityBikeCard = ({ station, children, className }, { config }) => { return ( {children} diff --git a/app/translations.js b/app/translations.js index 88ab8c2858..2a4f33bdf3 100644 --- a/app/translations.js +++ b/app/translations.js @@ -833,10 +833,7 @@ const translations = { navigate: 'Navigate', 'near-you': 'Near you', nearest: 'Nearest', - 'network-citybike': 'Helsinki and Espoo', - 'network-citybike-vantaa': 'Vantaa', 'network-error': 'Network error', - 'network-scooter': 'Vuosaari', next: 'Next', 'no-bike-allowed-popup': 'Bicycles are not allowed on buses or trams. If you are using these vehicles on your route, leave the bicycle at the stop or at a Park-and-Ride. ', @@ -1535,10 +1532,7 @@ const translations = { navigate: 'Navigoi', 'near-you': 'Lähelläsi', nearest: 'Lähimmät', - 'network-citybike': 'Helsinki ja Espoo', - 'network-citybike-vantaa': 'Vantaa', 'network-error': 'Verkkovirhe', - 'network-scooter': 'Vuosaari', next: 'Seuraava', 'no-bike-allowed-popup': 'Pyörää ei voi ottaa bussiin tai raitiovaunuun. Jos käytät reitilläsi näitä kulkuvälineitä, jätä pyörä pysäkille tai liityntäpysäköintiin.', @@ -2546,10 +2540,7 @@ const translations = { navigate: 'Navigera', 'near-you': 'Nära dig', nearest: 'Närmaste', - 'network-citybike': 'Helsingfors och Esbo', - 'network-citybike-vantaa': 'Vanda', 'network-error': 'Nätverksfel', - 'network-scooter': 'Nordsjö', next: 'Nästa', 'no-bike-allowed-popup': 'Cyklar är inte tillåtna i bussar eller spårvagnar. Om du använder dessa fordon på din färd, lämna cykeln vid hållplatsen eller vid infartsparkeringen.', diff --git a/app/util/citybikes.js b/app/util/citybikes.js index 151a10a8cd..b292579f13 100644 --- a/app/util/citybikes.js +++ b/app/util/citybikes.js @@ -6,22 +6,20 @@ export const BIKESTATION_CLOSED = 'Station closed'; const scooterNetwork = 'Samocat'; const vantaaNetwork = 'vantaa'; -export const getCityBikeNetworkName = networks => { - const defaultName = 'citybike'; +export const getCityBikeNetworkIcon = networks => { + const iconTemplate = iconName => `icon-icon_${iconName}`; + const defaultIcon = iconTemplate('citybike'); if (!Array.isArray(networks) || networks.length === 0) { - return defaultName; + return defaultIcon; } switch (networks[0]) { case scooterNetwork: - return 'scooter'; + return iconTemplate('scooter'); case vantaaNetwork: - return 'citybike-vantaa'; + return iconTemplate('citybike-vantaa'); default: - return defaultName; + return defaultIcon; } }; - -export const getCityBikeNetworkIcon = networks => - `icon-icon_${getCityBikeNetworkName(networks)}`; diff --git a/sass/base/_elements.scss b/sass/base/_elements.scss index eb99b8fde7..a908ebb973 100644 --- a/sass/base/_elements.scss +++ b/sass/base/_elements.scss @@ -20,13 +20,6 @@ $border-radius-rounded: 30px; .card-header-wrapper { flex-grow: 1; - .network-header{ - font-family: $font-family; - font-weight: $font-weight-book; - font-size: $font-size-small; - margin-right: 5px; - color: $gray; - } } } diff --git a/test/unit/component/CardHeader.test.js b/test/unit/component/CardHeader.test.js index 6edde0caaf..247a5cbfc2 100644 --- a/test/unit/component/CardHeader.test.js +++ b/test/unit/component/CardHeader.test.js @@ -13,25 +13,4 @@ describe('', () => { const wrapper = shallowWithIntl(); expect(wrapper.find('.header-icon')).to.have.lengthOf(1); }); - it('should render the text for the network', () => { - const props = { - description: 'Ratapihantie', - headerIcon:
, - name: 'Pasilan asema', - network: 'citybike', - }; - const wrapper = shallowWithIntl(); - expect(wrapper.find('.network-header').text()); - }); - it('should render the station code', () => { - const props = { - description: 'Ratapihantie', - headerIcon:
, - name: 'Pasilan asema', - code: '7528', - network: 'citybike', - }; - const wrapper = shallowWithIntl(); - expect(wrapper.find('.card-code').text()).to.equal('7528'); - }); }); diff --git a/test/unit/component/CityBikeCard.test.js b/test/unit/component/CityBikeCard.test.js index 17a70b2fa5..0f99bc62b6 100644 --- a/test/unit/component/CityBikeCard.test.js +++ b/test/unit/component/CityBikeCard.test.js @@ -19,20 +19,6 @@ describe('', () => { expect(wrapper.find(CardHeader).props().icon).to.equal('icon-icon_scooter'); }); - it("should have the citybike network's name", () => { - const props = { - children:
, - station: { - name: 'Valimon asema', - networks: ['Samocat'], - }, - }; - const wrapper = shallowWithIntl(, { - context: { config: { cityBike: {} } }, - }); - expect(wrapper.find(CardHeader).props().network).to.equal('scooter'); - }); - it("should include the citybike station's id in the description", () => { const props = { children:
, diff --git a/test/unit/util/citybikes.test.js b/test/unit/util/citybikes.test.js index 53604c4f5c..9eb171f9b4 100644 --- a/test/unit/util/citybikes.test.js +++ b/test/unit/util/citybikes.test.js @@ -1,7 +1,4 @@ -import { - getCityBikeNetworkIcon, - getCityBikeNetworkName, -} from '../../../app/util/citybikes'; +import { getCityBikeNetworkIcon } from '../../../app/util/citybikes'; describe('citybikes', () => { describe('getCityBikeNetworkIcon', () => { @@ -21,22 +18,4 @@ describe('citybikes', () => { expect(result).to.equal('icon-icon_scooter'); }); }); - - describe('getCityBikeNetworkName', () => { - it('should default to "citybike" if the networks are falsy', () => { - const result = getCityBikeNetworkName(undefined); - expect(result).to.equal('citybike'); - }); - - it('should default to "citybike" if no matching network is found', () => { - const result = getCityBikeNetworkName(['foobar']); - expect(result).to.equal('citybike'); - }); - - it('should pick the first network', () => { - const networks = ['Samocat', 'Smoove']; - const result = getCityBikeNetworkName(networks); - expect(result).to.equal('scooter'); - }); - }); });