Skip to content

Commit

Permalink
Merge branch 'main' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
davwheat committed Jun 15, 2024
2 parents 0f41dad + 54a9d3c commit 7fd281f
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 54 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.32",
"prettier": "^3.3.1",
"typescript": "^5.4.5",
"wrangler": "^3.60.0"
"wrangler": "^3.60.1"
},
"packageManager": "yarn@4.2.2"
}
1 change: 1 addition & 0 deletions src/announcement-data/systems/stations/AmeyCelia.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export default class AmeyCelia extends AmeyPhil {
'Arriva Trains Merseyside',
'Arriva Trains',
'Arriva Transpennine',
'Avanti West Coast',
'c2c Rail',
'Cardiff Railways',
'Channel Tunnel Rail Link',
Expand Down
45 changes: 28 additions & 17 deletions src/announcement-data/systems/stations/AmeyPhil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ export default class AmeyPhil extends StationAnnouncementSystem {
'Yorkshire Pullman',
],
standaloneOnly: [
'Avanti West Coast',
'Channel Tunnel Rail Link',
'Chiltern Railway company',
'Croydon Tramlink',
Expand Down Expand Up @@ -4275,7 +4276,7 @@ export default class AmeyPhil extends StationAnnouncementSystem {

files.push(
...this.pluraliseAudio(
rrbCalls.map(s => `station.m.${s.crsCode}`).concat(restartedTrainCalls.length > 0 ? [] : [`station.m.${terminatingStation}`]),
rrbCalls.map(s => `station.m.${s.crsCode}`).concat(restartAsTrainAfterIndex !== -1 ? [] : [`station.m.${terminatingStation}`]),
{
andId: 'm.and',
firstItemDelay: this.callingPointsOptions.afterCallingAtDelay,
Expand All @@ -4286,16 +4287,18 @@ export default class AmeyPhil extends StationAnnouncementSystem {
),
)

if (restartedTrainCalls.length > 0) {
if (restartAsTrainAfterIndex !== -1) {
files.push(
'm.where the train will restart for-2',
...this.pluraliseAudio(restartedTrainCalls.map(s => `station.m.${s.crsCode}`).concat([`station.e.${terminatingStation}`]), {
andId: 'm.and',
firstItemDelay: this.callingPointsOptions.afterCallingAtDelay,
beforeItemDelay: this.callingPointsOptions.betweenStopsDelay,
beforeAndDelay: this.callingPointsOptions.aroundAndDelay,
afterAndDelay: this.callingPointsOptions.aroundAndDelay,
}),
...(restartedTrainCalls.length > 0
? this.pluraliseAudio(restartedTrainCalls.map(s => `station.m.${s.crsCode}`).concat([`station.e.${terminatingStation}`]), {
andId: 'm.and',
firstItemDelay: this.callingPointsOptions.afterCallingAtDelay,
beforeItemDelay: this.callingPointsOptions.betweenStopsDelay,
beforeAndDelay: this.callingPointsOptions.aroundAndDelay,
afterAndDelay: this.callingPointsOptions.aroundAndDelay,
})
: [`station.m.${terminatingStation}`, 'e.only']),
)
} else {
files.push('e.where the train was originally due to terminate')
Expand Down Expand Up @@ -4728,6 +4731,14 @@ export default class AmeyPhil extends StationAnnouncementSystem {
)),
)

function getNumber(num: number): string {
if (num < 10) {
return `platform.s.${num}`
} else {
return `mins.m.${num}`
}
}

const endInflection = options.disruptionReason ? 'm' : 'e'

switch (options.disruptionType) {
Expand All @@ -4736,13 +4747,13 @@ export default class AmeyPhil extends StationAnnouncementSystem {

const num = parseInt(options.delayTime)

if (num < 10) {
files.push(`platform.s.${num}`)
} else {
files.push(`mins.m.${num}`)
}
const hours = Math.floor(num / 60)
const mins = num % 60

files.push(`${endInflection}.${num !== 1 ? 'minutes' : 'minute'}`)
if (hours > 0) {
files.push(getNumber(hours), hours === 1 ? 'm.hour' : 'm.hours', 'm.and')
}
files.push(getNumber(mins), `${endInflection}.${mins !== 1 ? 'minutes' : 'minute'}`)

if (Array.isArray(options.disruptionReason)) {
files.push('m.due to', ...options.disruptionReason)
Expand Down Expand Up @@ -5730,8 +5741,8 @@ export default class AmeyPhil extends StationAnnouncementSystem {
delayTime: {
name: 'Delay length',
type: 'select',
options: new Array(59).fill(0).map((_, i) => ({ value: (i + 1).toString(), title: `${i + 1} minute${i === 0 ? '' : 's'}` })),
default: '10',
options: new Array(360).fill(0).map((_, i) => ({ value: (i + 1).toString(), title: `${i + 1} minute${i === 0 ? '' : 's'}` })),
default: '65',
onlyShowWhen(activeState) {
return activeState.disruptionType === 'delayedBy'
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/AmeyLiveTrainAnnouncements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ export function LiveTrainAnnouncements<SystemKeys extends string>({
terminatingStationCode: train.destination[0].crs,
vias,
delayTime: delayMins.toString(),
disruptionType: cancelled ? 'cancel' : unknownDelay || delayMins > 59 || delayMins < 0 ? 'delay' : 'delayedBy',
disruptionType: cancelled ? 'cancel' : unknownDelay || delayMins < 0 ? 'delay' : 'delayedBy',
disruptionReason: delayReason ?? '',
}

Expand Down
70 changes: 35 additions & 35 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1635,37 +1635,37 @@ __metadata:
languageName: node
linkType: hard

"@cloudflare/workerd-darwin-64@npm:1.20240605.0":
version: 1.20240605.0
resolution: "@cloudflare/workerd-darwin-64@npm:1.20240605.0"
"@cloudflare/workerd-darwin-64@npm:1.20240610.1":
version: 1.20240610.1
resolution: "@cloudflare/workerd-darwin-64@npm:1.20240610.1"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard

"@cloudflare/workerd-darwin-arm64@npm:1.20240605.0":
version: 1.20240605.0
resolution: "@cloudflare/workerd-darwin-arm64@npm:1.20240605.0"
"@cloudflare/workerd-darwin-arm64@npm:1.20240610.1":
version: 1.20240610.1
resolution: "@cloudflare/workerd-darwin-arm64@npm:1.20240610.1"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard

"@cloudflare/workerd-linux-64@npm:1.20240605.0":
version: 1.20240605.0
resolution: "@cloudflare/workerd-linux-64@npm:1.20240605.0"
"@cloudflare/workerd-linux-64@npm:1.20240610.1":
version: 1.20240610.1
resolution: "@cloudflare/workerd-linux-64@npm:1.20240610.1"
conditions: os=linux & cpu=x64
languageName: node
linkType: hard

"@cloudflare/workerd-linux-arm64@npm:1.20240605.0":
version: 1.20240605.0
resolution: "@cloudflare/workerd-linux-arm64@npm:1.20240605.0"
"@cloudflare/workerd-linux-arm64@npm:1.20240610.1":
version: 1.20240610.1
resolution: "@cloudflare/workerd-linux-arm64@npm:1.20240610.1"
conditions: os=linux & cpu=arm64
languageName: node
linkType: hard

"@cloudflare/workerd-windows-64@npm:1.20240605.0":
version: 1.20240605.0
resolution: "@cloudflare/workerd-windows-64@npm:1.20240605.0"
"@cloudflare/workerd-windows-64@npm:1.20240610.1":
version: 1.20240610.1
resolution: "@cloudflare/workerd-windows-64@npm:1.20240610.1"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard
Expand Down Expand Up @@ -11306,9 +11306,9 @@ __metadata:
languageName: node
linkType: hard

"miniflare@npm:3.20240605.0":
version: 3.20240605.0
resolution: "miniflare@npm:3.20240605.0"
"miniflare@npm:3.20240610.0":
version: 3.20240610.0
resolution: "miniflare@npm:3.20240610.0"
dependencies:
"@cspotcode/source-map-support": "npm:0.8.1"
acorn: "npm:^8.8.0"
Expand All @@ -11318,13 +11318,13 @@ __metadata:
glob-to-regexp: "npm:^0.4.1"
stoppable: "npm:^1.1.0"
undici: "npm:^5.28.2"
workerd: "npm:1.20240605.0"
workerd: "npm:1.20240610.1"
ws: "npm:^8.11.0"
youch: "npm:^3.2.2"
zod: "npm:^3.20.6"
bin:
miniflare: bootstrap.js
checksum: 10/f29cc2f4dc78ed3ec0aa424aa50c4e5d8fd8936b801ef9ebd0566d887ae035c4021d84e0a7a8932bf16425a05154f6471021b70ce225ae29725520cb5a10adc2
checksum: 10/0febb70dbcddd90059d0f57993f357cab5be9dec31a5f61010561b9f625a203cbc0bdfc4eaead26f9e26fcaba77aeef08f39b877e44ee407aaf6114e1368dda9
languageName: node
linkType: hard

Expand Down Expand Up @@ -13189,7 +13189,7 @@ __metadata:
typescript: "npm:^5.4.5"
uk-railway-stations: "npm:^1.6.0"
uuid: "npm:^9.0.1"
wrangler: "npm:^3.60.0"
wrangler: "npm:^3.60.1"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -16033,15 +16033,15 @@ __metadata:
languageName: node
linkType: hard

"workerd@npm:1.20240605.0":
version: 1.20240605.0
resolution: "workerd@npm:1.20240605.0"
"workerd@npm:1.20240610.1":
version: 1.20240610.1
resolution: "workerd@npm:1.20240610.1"
dependencies:
"@cloudflare/workerd-darwin-64": "npm:1.20240605.0"
"@cloudflare/workerd-darwin-arm64": "npm:1.20240605.0"
"@cloudflare/workerd-linux-64": "npm:1.20240605.0"
"@cloudflare/workerd-linux-arm64": "npm:1.20240605.0"
"@cloudflare/workerd-windows-64": "npm:1.20240605.0"
"@cloudflare/workerd-darwin-64": "npm:1.20240610.1"
"@cloudflare/workerd-darwin-arm64": "npm:1.20240610.1"
"@cloudflare/workerd-linux-64": "npm:1.20240610.1"
"@cloudflare/workerd-linux-arm64": "npm:1.20240610.1"
"@cloudflare/workerd-windows-64": "npm:1.20240610.1"
dependenciesMeta:
"@cloudflare/workerd-darwin-64":
optional: true
Expand All @@ -16055,13 +16055,13 @@ __metadata:
optional: true
bin:
workerd: bin/workerd
checksum: 10/3869d9573a078fa41334051241d1de92b80e0781f0ad8c1955585501137759b72f7c9df32c05fae97a8115a896ce3e21d2b3d477a5c8823a9933741f43a69a63
checksum: 10/c37cd30c25fbdc7f97a296cf4b1a8ad2dbb65621a9c4b4bb24cb8fc00d9674c6610c5d2e5dc87c6cda83aa7b3b23a63d84b924ec1d9a3881622a9284590723f6
languageName: node
linkType: hard

"wrangler@npm:^3.60.0":
version: 3.60.0
resolution: "wrangler@npm:3.60.0"
"wrangler@npm:^3.60.1":
version: 3.60.3
resolution: "wrangler@npm:3.60.3"
dependencies:
"@cloudflare/kv-asset-handler": "npm:0.3.2"
"@esbuild-plugins/node-globals-polyfill": "npm:^0.2.3"
Expand All @@ -16070,7 +16070,7 @@ __metadata:
chokidar: "npm:^3.5.3"
esbuild: "npm:0.17.19"
fsevents: "npm:~2.3.2"
miniflare: "npm:3.20240605.0"
miniflare: "npm:3.20240610.0"
nanoid: "npm:^3.3.3"
path-to-regexp: "npm:^6.2.0"
resolve: "npm:^1.22.8"
Expand All @@ -16090,7 +16090,7 @@ __metadata:
bin:
wrangler: bin/wrangler.js
wrangler2: bin/wrangler.js
checksum: 10/c0c49e42b61b741acf29319771d89b230adf3c5eea0d8334b4422ebf69eae0e3c0d501956056460692881473396364cffd2c5d65024c871c0038786710988eb4
checksum: 10/c87e4178a46ede9b0c769f9b0ba701e7ad115e57ee439434fce7f248fa2989c407164964c4d1476e393ecc371f83ece2194d8e889da9f7ff70a0ae5ccec09324
languageName: node
linkType: hard

Expand Down

0 comments on commit 7fd281f

Please sign in to comment.