Skip to content

Commit

Permalink
feat: add first class location (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
opott authored Apr 8, 2024
1 parent ead1dea commit 621ffe3
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/announcement-data/systems/stations/AmeyPhil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { AudioItem, CustomAnnouncementButton, CustomAnnouncementTab } from '../.
import DelayCodeMapping from './DarwinDelayCodes_Male1.json'

export type ChimeType = 'three' | 'four' | 'none'
export type FirstClassLocation = 'none' | 'front' | 'middle' | 'rear'

export interface INextTrainAnnouncementOptions {
chime: ChimeType
Expand All @@ -21,6 +22,7 @@ export interface INextTrainAnnouncementOptions {
terminatingStationCode: string
vias: CallingAtPoint[]
callingAt: CallingAtPoint[]
firstClassLocation: FirstClassLocation
coaches: string | null
}

Expand Down Expand Up @@ -180,6 +182,7 @@ export default class AmeyPhil extends StationAnnouncementSystem {
coaches: '8 coaches',
mindTheGap: true,
thisStationCode: 'LIT',
firstClassLocation: 'none',
},
},
{
Expand Down Expand Up @@ -220,6 +223,7 @@ export default class AmeyPhil extends StationAnnouncementSystem {
coaches: '8 coaches',
mindTheGap: false,
thisStationCode: 'VIC',
firstClassLocation: 'none',
},
},
{
Expand All @@ -240,6 +244,7 @@ export default class AmeyPhil extends StationAnnouncementSystem {
coaches: '8 coaches',
mindTheGap: false,
thisStationCode: 'BTN',
firstClassLocation: 'none',
},
},
{
Expand Down Expand Up @@ -277,6 +282,7 @@ export default class AmeyPhil extends StationAnnouncementSystem {
].map(stationItemCompleter),
coaches: '11 coaches',
mindTheGap: false,
firstClassLocation: 'rear',
},
},
{
Expand All @@ -297,6 +303,7 @@ export default class AmeyPhil extends StationAnnouncementSystem {
coaches: '9 coaches',
mindTheGap: false,
thisStationCode: 'MAN',
firstClassLocation: 'front',
},
},
{
Expand Down Expand Up @@ -357,6 +364,7 @@ export default class AmeyPhil extends StationAnnouncementSystem {
coaches: '5 coaches',
mindTheGap: false,
thisStationCode: 'ABD',
firstClassLocation: 'front',
},
},
{
Expand All @@ -380,6 +388,7 @@ export default class AmeyPhil extends StationAnnouncementSystem {
coaches: '5 coaches',
mindTheGap: false,
thisStationCode: 'MAN',
firstClassLocation: 'front',
},
},
{
Expand All @@ -400,6 +409,7 @@ export default class AmeyPhil extends StationAnnouncementSystem {
coaches: '5 coaches',
mindTheGap: false,
thisStationCode: 'MYB',
firstClassLocation: 'none',
},
},
{
Expand Down Expand Up @@ -434,6 +444,7 @@ export default class AmeyPhil extends StationAnnouncementSystem {
].map(stationItemCompleter),
coaches: '3 coaches',
mindTheGap: false,
firstClassLocation: 'none',
},
},
{
Expand All @@ -454,6 +465,7 @@ export default class AmeyPhil extends StationAnnouncementSystem {
callingAt: ['BDS', 'TCR', 'ZFD', 'LST', 'ZLW', 'CWX', 'CUS', 'WWC'].map(crsToStationItemMapper),
coaches: '9 coaches',
mindTheGap: false,
firstClassLocation: 'none',
},
},
],
Expand Down Expand Up @@ -4537,6 +4549,13 @@ export default class AmeyPhil extends StationAnnouncementSystem {
)),
)

if (options.firstClassLocation !== 'none') {
files.push(
{ id: `m.first class accommodation is situated at the`, opts: { delayStart: 500 } },
`e.${options.firstClassLocation} of the train`,
)
}

if (options.coaches) {
const coaches = options.coaches.split(' ')[0]

Expand Down Expand Up @@ -4645,6 +4664,13 @@ export default class AmeyPhil extends StationAnnouncementSystem {
)),
)

if (options.firstClassLocation !== 'none') {
files.push(
{ id: `m.first class accommodation is situated at the`, opts: { delayStart: 500 } },
`e.${options.firstClassLocation} of the train`,
)
}

await this.playAudioFiles(files, download)
}

Expand Down Expand Up @@ -5289,6 +5315,17 @@ export default class AmeyPhil extends StationAnnouncementSystem {
} as ICallingAtSelectorProps,
default: [],
},
firstClassLocation: {
name: 'First Class Location',
type: 'select',
default: 'none',
options: [
{ title: 'None', value: 'none' },
{ title: 'Front of Train', value: 'front' },
{ title: 'Middle of Train', value: 'middle' },
{ title: 'Rear of Train', value: 'rear' },
],
},
coaches: {
name: 'Coach count',
default: '8 coaches',
Expand Down Expand Up @@ -5518,6 +5555,17 @@ export default class AmeyPhil extends StationAnnouncementSystem {
} as ICallingAtSelectorProps,
default: [],
},
firstClassLocation: {
name: 'First Class Location',
type: 'select',
default: 'none',
options: [
{ title: 'None', value: 'none' },
{ title: 'Front of Train', value: 'front' },
{ title: 'Middle of Train', value: 'middle' },
{ title: 'Rear of Train', value: 'rear' },
],
},
coaches: {
name: 'Coach count',
default: '8 coaches',
Expand Down

0 comments on commit 621ffe3

Please sign in to comment.