-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DT-4910: New texts for infobox #4875
Changes from 8 commits
9846088
33b3c11
182ba1c
67fc9ae
99f7b31
e807d10
290cf17
7cb8c67
f569001
ed2ca98
3cb02df
6cb1f7f
22ed412
08845a0
acad2d2
ca55d23
81dfc4b
ac037fb
ae21227
28d9113
2487893
9c720c7
14043e3
291099d
798ee74
98260b8
f83a7c3
8934ca8
0954c57
44d211b
c5d341d
dafbba7
f3274b1
1c1b6e1
f575303
8ee65b8
88aad96
84758f0
d8faf24
a5bec27
d94c436
f1c717e
125255c
bc3c5a5
7b77158
b9c7ed1
0285ffa
8b6c417
65567b7
74e5f3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,17 +15,17 @@ import ItineraryLegs from './ItineraryLegs'; | |
import BackButton from './BackButton'; | ||
import MobileTicketPurchaseInformation from './MobileTicketPurchaseInformation'; | ||
import { | ||
getRoutes, | ||
getZones, | ||
compressLegs, | ||
getRoutes, | ||
getTotalBikingDistance, | ||
getTotalBikingDuration, | ||
getTotalDrivingDistance, | ||
getTotalDrivingDuration, | ||
getTotalWalkingDistance, | ||
getTotalWalkingDuration, | ||
legContainsRentalBike, | ||
getTotalDrivingDuration, | ||
getTotalDrivingDistance, | ||
getZones, | ||
isCallAgencyPickupType, | ||
legContainsRentalBike, | ||
} from '../util/legUtils'; | ||
import { BreakpointConsumer } from '../util/withBreakpoint'; | ||
|
||
|
@@ -36,10 +36,10 @@ import { | |
} from '../util/fareUtils'; | ||
import { addAnalyticsEvent } from '../util/analyticsUtils'; | ||
import { | ||
getCurrentMillis, | ||
getFormattedTimeDate, | ||
isToday, | ||
isTomorrow, | ||
getFormattedTimeDate, | ||
getCurrentMillis, | ||
} from '../util/timeUtils'; | ||
import CityBikeDurationInfo from './CityBikeDurationInfo'; | ||
import { getCityBikeNetworkId } from '../util/citybikes'; | ||
|
@@ -86,7 +86,7 @@ class ItineraryTab extends React.Component { | |
|
||
static defaultProps = { | ||
hideTitle: false, | ||
currentLanguage: "fi" | ||
currentLanguage: 'fi', | ||
}; | ||
|
||
static contextTypes = { | ||
|
@@ -216,8 +216,79 @@ class ItineraryTab extends React.Component { | |
const suggestionIndex = this.context.match.params.secondHash | ||
? Number(this.context.match.params.secondHash) + 1 | ||
: Number(this.context.match.params.hash) + 1; | ||
const itineraryContainsCallLegs = itinerary.legs.some(leg => isCallAgencyPickupType(leg)); | ||
|
||
const itineraryContainsCallLegs = itinerary.legs.some(leg => | ||
isCallAgencyPickupType(leg), | ||
); | ||
|
||
const infoBoxText = () => { | ||
if (config.callAgencyInfo && itineraryContainsCallLegs) { | ||
return ( | ||
<div className="description-container"> | ||
<FormattedMessage | ||
id="separate-ticket-required-for-call-agency-disclaimer" | ||
values={{ | ||
callAgencyInfoUrl: get( | ||
config, | ||
`callAgencyInfo.${currentLanguage}.callAgencyInfoLink`, | ||
), | ||
}} | ||
/> | ||
<a href={config.callAgencyInfo[currentLanguage].callAgencyInfoLink}> | ||
<FormattedMessage | ||
id={ | ||
config.callAgencyInfo[currentLanguage].callAgencyInfoLinkText | ||
} | ||
defaultMessage={ | ||
config.callAgencyInfo[currentLanguage].callAgencyInfoLinkText | ||
} | ||
/> | ||
</a> | ||
</div> | ||
); | ||
} | ||
|
||
if (config.showTrainLimitationInfo) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tässä olisi hyvä varmistaa, että ehdotukset sisältävät junaliikennettä (esim. samaan tyyliin kuin yllä kutsuliikenteellä itineraryContainsCallLegs). |
||
return ( | ||
<div className="description-container"> | ||
<FormattedMessage | ||
id="nysse-ticket-limited" | ||
values={{ | ||
agencyName: get(config, 'ticketInformation.primaryAgencyName'), | ||
}} | ||
/> | ||
<a | ||
href={ | ||
config.showTrainLimitationInfo[currentLanguage] | ||
.showTrainLimitationInfoLink | ||
} | ||
> | ||
<FormattedMessage | ||
id={ | ||
config.showTrainLimitationInfo[currentLanguage] | ||
.showTrainLimitationInfoLinkText | ||
} | ||
defaultMessage={ | ||
config.showTrainLimitationInfo[currentLanguage] | ||
.showTrainLimitationInfoLinkText | ||
} | ||
/> | ||
</a> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className="description-container"> | ||
<FormattedMessage | ||
id="separate-ticket-required-disclaimer" | ||
values={{ | ||
agencyName: get(config, 'ticketInformation.primaryAgencyName'), | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
return ( | ||
<div className="itinerary-tab"> | ||
<h2 className="sr-only"> | ||
|
@@ -240,7 +311,11 @@ class ItineraryTab extends React.Component { | |
futureText={extraProps.futureText} | ||
isMultiRow={extraProps.isMultiRow} | ||
isMobile={this.props.isMobile} | ||
hideBottomDivider={shouldShowFarePurchaseInfo(config, breakpoint, fares)} | ||
hideBottomDivider={shouldShowFarePurchaseInfo( | ||
config, | ||
breakpoint, | ||
fares, | ||
)} | ||
/> | ||
) : ( | ||
<> | ||
|
@@ -281,18 +356,19 @@ class ItineraryTab extends React.Component { | |
config={config} | ||
/> | ||
), | ||
shouldShowFareInfo(config) && ( | ||
shouldShowFarePurchaseInfo(config,breakpoint,fares) ? ( | ||
shouldShowFareInfo(config) && | ||
(shouldShowFarePurchaseInfo(config, breakpoint, fares) ? ( | ||
<MobileTicketPurchaseInformation | ||
fares={fares} | ||
zones={getZones(itinerary.legs)} | ||
/>) : | ||
( <TicketInformation | ||
/> | ||
) : ( | ||
<TicketInformation | ||
fares={fares} | ||
zones={getZones(itinerary.legs)} | ||
legs={itinerary.legs} | ||
/>) | ||
), | ||
/> | ||
)), | ||
<div | ||
className={cx('momentum-scroll itinerary-tabs__scroll', { | ||
multirow: extraProps.isMultiRow, | ||
|
@@ -310,37 +386,7 @@ class ItineraryTab extends React.Component { | |
<div className="icon-container"> | ||
<Icon className="info" img="icon-icon_info" /> | ||
</div> | ||
{config.callAgencyInfo && itineraryContainsCallLegs ? | ||
(<div className="description-container"> | ||
<FormattedMessage | ||
id="separate-ticket-required-for-call-agency-disclaimer" | ||
values={{ | ||
callAgencyInfoUrl: get( | ||
config, | ||
`callAgencyInfo.${currentLanguage}.callAgencyInfoLink`, | ||
), | ||
}} | ||
/> | ||
<a href={config.callAgencyInfo[currentLanguage].callAgencyInfoLink}> | ||
<FormattedMessage | ||
id={config.callAgencyInfo[currentLanguage].callAgencyInfoLinkText} | ||
defaultMessage={config.callAgencyInfo[currentLanguage].callAgencyInfoLinkText} | ||
/> | ||
</a> | ||
</div> | ||
) : ( | ||
<div className="description-container"> | ||
<FormattedMessage | ||
id="separate-ticket-required-disclaimer" | ||
values={{ | ||
agencyName: get( | ||
config, | ||
'ticketInformation.primaryAgencyName', | ||
), | ||
}} | ||
/> | ||
</div> | ||
)} | ||
{infoBoxText()} | ||
</div> | ||
)} | ||
<ItineraryLegs | ||
|
@@ -403,7 +449,11 @@ const withRelay = createFragmentContainer( | |
} | ||
legs { | ||
mode | ||
nextLegs(numberOfLegs: 2 originModesWithParentStation: [RAIL] destinationModesWithParentStation: [RAIL]) { | ||
nextLegs( | ||
numberOfLegs: 2 | ||
originModesWithParentStation: [RAIL] | ||
destinationModesWithParentStation: [RAIL] | ||
) { | ||
mode | ||
distance | ||
route { | ||
|
@@ -436,8 +486,8 @@ const withRelay = createFragmentContainer( | |
tripHeadsign | ||
pattern { | ||
code | ||
} | ||
} | ||
|
||
gtfsId | ||
} | ||
realTime | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ import { FormattedMessage, intlShape } from 'react-intl'; | |
import Link from 'found/Link'; | ||
import connectToStores from 'fluxible-addons-react/connectToStores'; | ||
|
||
import ExternalLink from './ExternalLink'; | ||
import LegAgencyInfo from './LegAgencyInfo'; | ||
import Icon from './Icon'; | ||
import IntermediateLeg from './IntermediateLeg'; | ||
|
@@ -16,30 +15,31 @@ import PlatformNumber from './PlatformNumber'; | |
import ServiceAlertIcon from './ServiceAlertIcon'; | ||
import StopCode from './StopCode'; | ||
import { | ||
alertSeverityCompare, | ||
getActiveAlertSeverityLevel, | ||
legHasCancelation, | ||
tripHasCancelationForStop, | ||
getActiveLegAlerts, | ||
getActiveLegAlertSeverityLevel, | ||
alertSeverityCompare, | ||
getMaximumAlertSeverityLevel, | ||
hasEntitiesOfType, | ||
legHasCancelation, | ||
tripHasCancelationForStop, | ||
} from '../util/alertUtils'; | ||
import { PREFIX_ROUTES, PREFIX_STOPS, PREFIX_DISRUPTION } from '../util/path'; | ||
import { PREFIX_DISRUPTION, PREFIX_ROUTES, PREFIX_STOPS } from '../util/path'; | ||
import { durationToString } from '../util/timeUtils'; | ||
import { addAnalyticsEvent } from '../util/analyticsUtils'; | ||
import { | ||
getZoneLabel, | ||
getHeadsignFromRouteLongName, | ||
getStopHeadsignFromStoptimes, | ||
getZoneLabel, | ||
} from '../util/legUtils'; | ||
import { shouldShowFareInfo } from '../util/fareUtils'; | ||
import { AlertSeverityLevelType, AlertEntityType } from '../constants'; | ||
import { AlertEntityType, AlertSeverityLevelType } from '../constants'; | ||
import ZoneIcon from './ZoneIcon'; | ||
import StopInfo from './StopInfo'; | ||
import InterlineInfo from './InterlineInfo'; | ||
import AlternativeLegsInfo from './AlternativeLegsInfo'; | ||
import LegInfo from './LegInfo'; | ||
import ExternalLink from './ExternalLink'; | ||
|
||
class TransitLeg extends React.Component { | ||
constructor(props) { | ||
|
@@ -231,8 +231,8 @@ class TransitLeg extends React.Component { | |
.format('HH:mm')} | ||
</span>, | ||
]; | ||
const LegRouteName = leg.from.name.concat(' - ').concat(leg.to.name); | ||
const modeClassName = mode.toLowerCase(); | ||
const LegRouteName = leg.from.name.concat(' - ').concat(leg.to.name); | ||
|
||
const textVersionBeforeLink = ( | ||
<FormattedMessage | ||
|
@@ -544,35 +544,61 @@ class TransitLeg extends React.Component { | |
/> | ||
)} | ||
</div> | ||
{leg.fare && leg.fare.isUnknown && shouldShowFareInfo(config) && ( | ||
<div className="disclaimer-container unknown-fare-disclaimer__leg"> | ||
<div className="description-container"> | ||
<span className="accent"> | ||
{`${intl.formatMessage({ id: 'pay-attention' })} `} | ||
</span> | ||
{intl.formatMessage({ id: 'separate-ticket-required' })} | ||
{leg.fare && | ||
leg.fare.isUnknown && | ||
shouldShowFareInfo(config) && | ||
(config.showTrainLimitationInfo ? ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tälle parempi sijainti voisi olla RailLeg, samaan tyyliin kuin CallAgencyLeg pitää oman infoboksinsa sisällään. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tarkemmin katsottuja RailLeg ei ole samantyyppinen kuin callAgencyLeg ja pitääkin sisällään TransitLegin ja määrittelee sille junan parametrejä, eli lokaatio on oikea. Tarkistuksen voisi kuitenkin lisätä että kyseessä on junaliikenne, joka onnistunee mode muuttujan avulla. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mode === 'RAIL' on lisätty, mutta tämä on vain lisä turha koodi lisämine sinne. Koska oli testattu kävelly, bussin, polkupyörä, lentokonen matkat ja vain junan kanssa infoteksti tulee sinne jos tarvitaessa. |
||
<div className="disclaimer-container unknown-fare-disclaimer__leg"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Koeta koodata tämä näin: (config.modeDisclaimers[mode] ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suora käytä mode en pysty, koska tämä tulee kun 'RAIL', mutta tarvitseen configille 'rail'. |
||
<div className="description-container"> | ||
<FormattedMessage id="nysse-ticket-limited" /> | ||
<a | ||
href={ | ||
config.showTrainLimitationInfo[lang] | ||
.showTrainLimitationInfoLink | ||
} | ||
> | ||
<FormattedMessage | ||
id={ | ||
config.showTrainLimitationInfo[lang] | ||
.showTrainLimitationInfoLinkText | ||
} | ||
defaultMessage={ | ||
config.showTrainLimitationInfo[lang] | ||
.showTrainLimitationInfoLinkText | ||
} | ||
/> | ||
</a> | ||
</div> | ||
</div> | ||
<div className="ticket-info"> | ||
<div className="accent">{LegRouteName}</div> | ||
{leg.fare.agency && | ||
!config.hideExternalOperator(leg.fare.agency) && ( | ||
<React.Fragment> | ||
<div>{leg.fare.agency.name}</div> | ||
{leg.fare.agency.fareUrl && ( | ||
<ExternalLink | ||
className="agency-link" | ||
href={leg.fare.agency.fareUrl} | ||
> | ||
{intl.formatMessage({ id: 'extra-info' })} | ||
</ExternalLink> | ||
)} | ||
</React.Fragment> | ||
)} | ||
) : ( | ||
<div className="disclaimer-container unknown-fare-disclaimer__leg"> | ||
<div className="description-container"> | ||
<span className="accent"> | ||
{`${intl.formatMessage({ id: 'pay-attention' })} `} | ||
</span> | ||
{intl.formatMessage({ id: 'separate-ticket-required' })} | ||
</div> | ||
<div className="ticket-info"> | ||
<div className="accent">{LegRouteName}</div> | ||
{leg.fare.agency && | ||
!config.hideExternalOperator(leg.fare.agency) && ( | ||
<React.Fragment> | ||
<div>{leg.fare.agency.name}</div> | ||
{leg.fare.agency.fareUrl && ( | ||
<ExternalLink | ||
className="agency-link" | ||
href={leg.fare.agency.fareUrl} | ||
> | ||
{intl.formatMessage({ id: 'extra-info' })} | ||
</ExternalLink> | ||
)} | ||
</React.Fragment> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
)} | ||
))} | ||
</div> | ||
<span className="sr-only">{alertSeverityDescription}</span> | ||
<span className="sr-only">{alertSeverityDescription}</span>; | ||
</div> | ||
); | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,25 @@ export default configMerger(walttiConfig, { | |
}, | ||
}, | ||
|
||
showTrainLimitationInfo: { | ||
fi: { | ||
showTrainLimitationInfoLink: 'https://www.nysse.fi/junat', | ||
showTrainLimitationInfoLinkText: 'nysse.fi/junat', | ||
}, | ||
sv: { | ||
showTrainLimitationInfoLink: | ||
'https://www.nysse.fi/en/ways-to-get-around/train', | ||
showTrainLimitationInfoLinkText: | ||
'Trains in the Nysse area - Nysse, Tampere regional transport', | ||
}, | ||
en: { | ||
showTrainLimitationInfoLink: | ||
'https://www.nysse.fi/en/ways-to-get-around/train', | ||
showTrainLimitationInfoLinkText: | ||
'Trains in the Nysse area - Nysse, Tampere regional transport', | ||
}, | ||
}, | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. modeDisclaimers: { |
||
// mapping fareId from OTP fare identifiers to human readable form | ||
fareMapping: function mapFareId(fareId) { | ||
return fareId && fareId.substring | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seuraava olisi hyvä ratkaisu:
Rakenna taulukko FareDisclaimereja. Taulukoon pusketaan CallAgency yms disclaimerit, ja lisäksi n kpl mode disclaimereja. Eli iteroi kaikki legit ja katso onko käytössä leg.mode disclaimer. Jos on puske taulukkoon.
Tekstit kannattaa siirtää pois translations.txt tiedostosta config .modeDisclaimer objektiin.