Skip to content

Commit e6591d0

Browse files
authored
Add CIP action alert banner (#281)
1 parent 7463c6b commit e6591d0

4 files changed

Lines changed: 47 additions & 1 deletion

File tree

src/components/ActionBanner.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const EXPIRY_DATE = new Date('2026-05-01T00:00:00');
2+
3+
export const ActionBanner: React.FC = () => {
4+
if (new Date() >= EXPIRY_DATE) {
5+
return null;
6+
}
7+
8+
return (
9+
<a
10+
className="action-banner"
11+
href="https://secure.everyaction.com/DKcTW8SPr06sCMwjIo44UA2"
12+
target="_blank"
13+
rel="noopener noreferrer"
14+
>
15+
Help Us Make This Year's CIP Better And Bolder!
16+
</a>
17+
);
18+
};

src/components/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useMbtaApi } from '../hooks/useMbtaApi';
77
import { Line } from './Line';
88
import { Header } from './Header';
99
import { Footer } from './Footer';
10+
import { ActionBanner } from './ActionBanner';
1011
import { LineTabPicker } from './LineTabPicker';
1112
import { LineStats } from './LineStats/LineStats';
1213
import { setCssVariable } from './util';
@@ -92,6 +93,7 @@ export const App: React.FC = () => {
9293
return (
9394
<>
9495
<Favicon url={favicon} />
96+
<ActionBanner />
9597
<Header controls={renderControls()} />
9698
{api.isReady ? (
9799
<Line key={selectedLine?.name} line={selectedLine} api={api} age={ageSearchParam} />

src/components/CategoryTabPicker.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import { useCategorySearchParam } from '../hooks/searchParams';
55

66
type TrainCategory = { key: VehicleCategory; label: string };
77

8+
const isDecember = new Date().getMonth() === 11;
9+
810
const trainTypes: TrainCategory[] = [
911
{ key: 'old_vehicles', label: 'Old' },
1012
{ key: 'new_vehicles', label: 'New' },
1113
{ key: 'vehicles', label: 'All' },
1214
{ key: 'pride', label: 'Pride' },
13-
{ key: 'holiday', label: 'Holiday' },
15+
...(isDecember ? [{ key: 'holiday' as VehicleCategory, label: 'Holiday' }] : []),
1416
];
1517

1618
interface CategoryTabPickerProps {

src/main.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,30 @@ a {
4949
flex-direction: column;
5050
}
5151

52+
.action-banner {
53+
display: flex;
54+
align-items: center;
55+
justify-content: center;
56+
gap: 8px;
57+
padding: 8px 16px;
58+
background: #f5c518;
59+
color: #1a1a1a;
60+
font-weight: bold;
61+
font-size: 0.9em;
62+
text-align: center;
63+
text-decoration: none;
64+
z-index: 2;
65+
width: 100%;
66+
box-sizing: border-box;
67+
cursor: pointer;
68+
}
69+
70+
.action-banner:hover {
71+
background: #e6b800;
72+
color: #1a1a1a;
73+
}
74+
75+
5276
.header {
5377
padding: 1rem 0;
5478
z-index: 1;

0 commit comments

Comments
 (0)