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 Feb 18, 2024
2 parents 78eeaf5 + 23edb29 commit 1a9b725
Show file tree
Hide file tree
Showing 42 changed files with 485 additions and 159 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@reach/tabs": "^0.18.0",
"@sentry/gatsby": "^7.100.1",
"@sentry/tracing": "^7.100.1",
"@sentry/gatsby": "^7.101.1",
"@sentry/tracing": "^7.101.1",
"clsx": "^2.1.0",
"copy-to-clipboard": "^3.3.3",
"crunker": "^2.4.0",
Expand Down Expand Up @@ -59,10 +59,10 @@
"uuid": "^9.0.1"
},
"devDependencies": {
"@sentry/cli": "^2.28.5",
"@sentry/cli": "^2.28.6",
"@types/gatsbyjs__reach-router": "^2.0.4",
"@types/node": "^20.11.17",
"@types/react": "^18.2.55",
"@types/node": "^20.11.19",
"@types/react": "^18.2.56",
"@types/react-beautiful-dnd": "^13.1.8",
"@types/react-dom": "^18.2.19",
"@types/uuid": "^9.0.8",
Expand Down
26 changes: 25 additions & 1 deletion src/announcement-data/systems/rolling-stock/BombardierXstar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ const announcementPresets: Readonly<Record<string, ICustomAnnouncementPreset[]>>
callingAtCodes: ['HOV', 'PLD', 'SSE', 'LAC', 'WRH', 'WWO', 'DUR', 'GBS', 'ANG'].map(crsToStationItemMapper),
},
},
{
name: 'Dorking to London Victoria',
state: {
thisStationCode: 'DKG',
terminatesAtCode: 'VIC',
callingAtCodes: ['BXW', 'LHD', 'AHD', 'EPS', 'EWE', 'CHE', 'SUO', 'CSH', 'HCB', 'MIJ', 'MTC', 'BAL', 'CLJ'].map(crsToStationItemMapper),
},
},
],
}

Expand All @@ -63,7 +71,7 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
const files: AudioItem[] = []

files.push('bing bong')
files.push('we will shortly be arriving at', `stations.${options.stationCode}`)
files.push('we are now approaching', `stations.${options.stationCode}`)

if (options.mindTheGap) {
files.push('please mind the gap between the train and the platform')
Expand Down Expand Up @@ -131,12 +139,14 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
'ABW',
'ADM',
'AFK',
'AHD',
'ANG',
'ANZ',
'APD',
'AYH',
'AYL',
'AYP',
'BAL',
'BAN',
'BAT',
'BBL',
Expand Down Expand Up @@ -168,6 +178,7 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
'BUG',
'BVD',
'BXH',
'BXW',
'BXY',
'CAT',
'CBE',
Expand All @@ -176,6 +187,7 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
'CDS',
'CFB',
'CFT',
'CHE',
'CHG',
'CHX',
'CIL',
Expand All @@ -190,6 +202,7 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
'CRT',
'CRW',
'CRY',
'CSH',
'CST',
'CSW',
'CTF',
Expand All @@ -201,6 +214,7 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
'DEA',
'DEP',
'DFD',
'DKG',
'DMK',
'DMP',
'DNG',
Expand All @@ -215,9 +229,11 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
'ELW',
'EML',
'EPH',
'EPS',
'ERH',
'ESD',
'ETC',
'EWE',
'EYN',
'FAV',
'FCN',
Expand All @@ -241,6 +257,7 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
'GTW',
'HAI',
'HBN',
'HCB',
'HCN',
'HDM',
'HGM',
Expand All @@ -249,6 +266,7 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
'HHE',
'HIB',
'HLB',
'HLM',
'HMD',
'HMT',
'HNB',
Expand Down Expand Up @@ -276,6 +294,7 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
'LEW',
'LGF',
'LGJ',
'LHD',
'LIH',
'LIT',
'LMS',
Expand All @@ -290,8 +309,10 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
'MDW',
'MEP',
'MHM',
'MIJ',
'MRN',
'MSR',
'MTC',
'MTG',
'MTM',
'MYB',
Expand All @@ -309,6 +330,7 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
'NVN',
'NWD',
'NWX',
'OLY',
'ORE',
'ORP',
'OTF',
Expand Down Expand Up @@ -360,12 +382,14 @@ export default class BombardierXstar extends TrainAnnouncementSystem {
'SOL',
'SOO',
'SOR',
'SOU',
'SPH',
'SPU',
'SRT',
'SSE',
'SSS',
'STU',
'SUO',
'SUP',
'SVO',
'SWL',
Expand Down
51 changes: 30 additions & 21 deletions src/components/AnnouncementPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ import { deletePersonalPreset, getPersonalPresets, initPersonalPresetsDb, savePe

import * as Sentry from '@sentry/gatsby'

function AnnouncementPanel() {
const AnnouncementSystem = getActiveSystem()
import type TrainAnnouncementSystem from '@announcement-data/TrainAnnouncementSystem'
import type StationAnnouncementSystem from '@announcement-data/StationAnnouncementSystem'
import type AnnouncementSystem from '@announcement-data/AnnouncementSystem'

interface IProps {
system: new () => TrainAnnouncementSystem | StationAnnouncementSystem | AnnouncementSystem
}

function AnnouncementPanel({ system }: IProps) {
const AnnouncementSystem = system

const [isPresetsDbReady, setIsPresetsDbReady] = useState<boolean>(false)

Expand Down Expand Up @@ -105,37 +113,38 @@ function AnnouncementPanel() {
if (!AnnouncementSystem) return null

return (
<div
css={{
padding: 16,
backgroundColor: '#eee',
marginTop: 24,
}}
>
<div>
<h2
css={{
marginBottom: 16,
marginTop: 32,
marginBottom: 32,
}}
>
{AnnouncementSystemInstance?.NAME}
</h2>

<div
css={{
marginBottom: 16,
marginTop: 24,
}}
>
{AnnouncementSystemInstance?.headerComponent()}
<div
css={{
marginBottom: 16,
}}
>
{AnnouncementSystemInstance?.headerComponent()}
</div>

<Tabs
key={AnnouncementSystemInstance?.ID}
selectedTabIndex={getSelectedTab()}
onTabChange={setSelectedTab}
tabNames={Object.values(customTabs).map(tab => tab.name)}
tabItems={TabPanels ?? []}
customKeyPrefix={AnnouncementSystemInstance?.ID}
/>
</div>

<Tabs
key={AnnouncementSystemInstance?.ID}
selectedTabIndex={getSelectedTab()}
onTabChange={setSelectedTab}
tabNames={Object.values(customTabs).map(tab => tab.name)}
tabItems={TabPanels ?? []}
customKeyPrefix={AnnouncementSystemInstance?.ID}
/>
</div>
)
}
Expand Down
103 changes: 103 additions & 0 deletions src/components/CardLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import React from 'react'

import { Link } from 'gatsby'

interface ICardLinkProps {
title: React.ReactNode
description?: React.ReactNode
to: string
className?: string
}

const CARD_PADDING = 16 as const

function CardLink({ title, description, to, className }: ICardLinkProps) {
return (
<Link
className={className}
to={to}
css={{
textDecoration: 'none !important',
display: 'flex',
border: '2px solid black',
outline: '0px solid black',
background: 'white',

'&:hover, &:focus, &:active': {
outlineWidth: 2,
'& $arrow': {
'&::after': {
transform: 'translateX(3px) scaleY(0.92) scaleX(1.05) rotate(45deg)',
},
},
},
}}
>
<article
css={{
display: 'flex',
flexDirection: 'column',
padding: CARD_PADDING,
position: 'relative',
flexGrow: 1,
}}
>
<header
css={{
display: 'flex',
gap: 8,
}}
>
<h3
css={[
{
flexGrow: 1,
},
!description && {
marginBottom: 0,
},
]}
>
{title}
</h3>
</header>

{description && (
<>
<div
aria-hidden
css={{
flexGrow: 1,
}}
/>
<p>{description}</p>
</>
)}
</article>

<div
role="presentation"
aria-hidden="true"
css={{
display: 'inline-flex',
alignItems: 'center',
padding: '10px 18px',
paddingRight: 20,
gap: 8,
transformOrigin: 'center',
'&::after': {
content: '""',
display: 'inline-block',
width: '0.75em',
height: '0.75em',
borderTop: '2px solid currentColor',
borderRight: '2px solid currentColor',
transform: 'rotate(45deg)',
},
}}
/>
</Link>
)
}

export default CardLink
2 changes: 1 addition & 1 deletion src/components/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function NavBar() {
},
}}
>
<Link to="/">Generator</Link>
<Link to="/">Home</Link>
<Link to="/amey-live-train-announcements">Live announcements</Link>
<Link to="/about">About</Link>
<Link to="/changelog">Latest changes</Link>
Expand Down
4 changes: 2 additions & 2 deletions src/components/PanelPanes/CustomAnnouncementPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ function CustomAnnouncementPane({
return (
<div
css={{
padding: 16,
padding: 24,
backgroundColor: '#eee',
}}
>
Expand All @@ -279,7 +279,7 @@ function CustomAnnouncementPane({
return (
<div
css={{
padding: 16,
padding: 24,
backgroundColor: '#eee',
}}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/PanelPanes/CustomButtonPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function CustomButtonPane({ buttons, buttonSections }: ICustomButtonPaneProps) {
return (
<div
css={{
padding: 16,
padding: 24,
backgroundColor: '#eee',
}}
>
Expand Down
Loading

0 comments on commit 1a9b725

Please sign in to comment.