Skip to content
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

feat: add first class location #180

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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