Skip to content

Commit

Permalink
feat: replace dots with commas
Browse files Browse the repository at this point in the history
  • Loading branch information
Osman Minaz committed Oct 16, 2023
1 parent 5b70ec3 commit 19a03f6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
5 changes: 2 additions & 3 deletions src/components/sbb-timetable-row/sbb-timetable-row.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('sbb-timetable-row', () => {
<mock:shadow-root>
<sbb-card size="l">
<sbb-card-action>
Departure: 11:08. Train. IR 37. Direction Basel SBB. Arrival: 12:13. Travel time 1 Hour 15 Minutes.
Departure: 11:08, Train, IR 37, Direction Basel SBB, Arrival: 12:13, Travel time 1 Hour 15 Minutes,
</sbb-card-action>
<div class="sbb-timetable__row" role="row">
<div class="sbb-timetable__row-header" role="gridcell">
Expand Down Expand Up @@ -78,8 +78,7 @@ describe('sbb-timetable-row', () => {
<mock:shadow-root>
<sbb-card size="l">
<sbb-card-action>
Departure: 16:30. from Stand 4. Bus. B 19. Direction Spiegel, Blinzern. Arrival: 17:06. Travel time 41 Minutes. 2 changes. First Class Low to medium occupancy expected. Second Class High occupancy expected.
</sbb-card-action>
Departure: 16:30, from Stand 4, Bus, B 19, Direction Spiegel, Blinzern, Arrival: 17:06, Travel time 41 Minutes, 2 changes, First Class Low to medium occupancy expected. Second Class High occupancy expected. </sbb-card-action>
<div class="sbb-timetable__row" role="row">
<div class="sbb-timetable__row-header" role="gridcell">
<div class="sbb-timetable__row-details">
Expand Down
28 changes: 14 additions & 14 deletions src/components/sbb-timetable-row/sbb-timetable-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,15 @@ export class SbbTimetableRow {
: undefined;

const departureWalkText = departureTimeAttribute
? `${departureTimeAttribute.text} ${departureTimeAttribute.duration}. `
? `${departureTimeAttribute.text} ${departureTimeAttribute.duration}, `
: '';

const arrivalWalkText = arrivalTimeAttribute
? `${arrivalTimeAttribute.text} ${arrivalTimeAttribute.duration}. `
? `${arrivalTimeAttribute.text} ${arrivalTimeAttribute.duration}, `
: '';

const departureTimeText = departureTime
? `${i18nDeparture[this._currentLanguage]}: ${format(departureTime, 'HH:mm')}. `
? `${i18nDeparture[this._currentLanguage]}: ${format(departureTime, 'HH:mm')}, `
: '';

const getDepartureQuayText = (): string => {
Expand All @@ -209,30 +209,30 @@ export class SbbTimetableRow {
// add prefix "new" if quay was changed
const changedQuayPrefix = departure?.quayChanged ? `${i18nNew[this._currentLanguage]} ` : '';
return `${changedQuayPrefix}${this._getQuayTypeStrings()
?.long} ${departure?.quayFormatted}. `;
?.long} ${departure?.quayFormatted}, `;
};

const meansOfTransportText =
product && product.vehicleMode
? i18nMeansOfTransport[product.vehicleMode.toLowerCase()] &&
`${i18nMeansOfTransport[product.vehicleMode.toLowerCase()][this._currentLanguage]}. `
`${i18nMeansOfTransport[product.vehicleMode.toLowerCase()][this._currentLanguage]}, `
: '';

const vehicleSubModeText = product?.vehicleSubModeShortName
? `${product.vehicleSubModeShortName} ${product.line || ''}. `
? `${product.vehicleSubModeShortName} ${product.line || ''}, `
: '';

const directionText = `${i18nDirection[this._currentLanguage]} ${direction}. `;
const directionText = `${i18nDirection[this._currentLanguage]} ${direction}, `;

const himCus = this._handleHimCus(trip);
const cusText = himCus?.cus?.text
? `${i18nRealTimeInfo[this._currentLanguage]}: ${himCus?.cus?.text}. `
? `${i18nRealTimeInfo[this._currentLanguage]}: ${himCus?.cus?.text}, `
: '';
const himText = himCus?.him?.text
? `${i18nRealTimeInfo[this._currentLanguage]}: ${himCus?.him?.text}. `
? `${i18nRealTimeInfo[this._currentLanguage]}: ${himCus?.him?.text}, `
: '';

const boardingText = this.boarding ? `${this.boarding.text}. ` : '';
const boardingText = this.boarding ? `${this.boarding.text}, ` : '';

const priceText = `${this.price?.isDiscount ? i18nSupersaver[this._currentLanguage] : ''} ${
this.price?.text && this.price?.price
Expand All @@ -242,11 +242,11 @@ export class SbbTimetableRow {

const transferProcedures =
legs?.length > 1
? `${legs?.length - 1} ${i18nTransferProcedures[this._currentLanguage]}. `
? `${legs?.length - 1} ${i18nTransferProcedures[this._currentLanguage]}, `
: '';

const arrivalTimeText = arrivalTime
? `${i18nArrival[this._currentLanguage]}: ${format(arrivalTime, 'HH:mm')}. `
? `${i18nArrival[this._currentLanguage]}: ${format(arrivalTime, 'HH:mm')}, `
: '';

const occupancyText =
Expand All @@ -264,7 +264,7 @@ export class SbbTimetableRow {
handleNotices(notices).length &&
handleNotices(notices)
?.map((notice, index) => index < 4 && notice.text?.template)
.join(', ') + '. ';
.join(', ') + ', ';

const attributesText = attributes
? `${i18nTravelhints[this._currentLanguage]}: ${attributes}`
Expand All @@ -274,7 +274,7 @@ export class SbbTimetableRow {
duration > 0
? `${i18nTripDuration[this._currentLanguage]} ${
durationToTime(duration, this._currentLanguage).long
}. `
}, `
: '';

return `${departureWalkText} ${departureTimeText} ${getDepartureQuayText()} ${meansOfTransportText} ${vehicleSubModeText} ${directionText} ${cusText} ${boardingText} ${priceText} ${
Expand Down

0 comments on commit 19a03f6

Please sign in to comment.