Skip to content

Commit

Permalink
Merge branch 'main' into hp/drawer-with-active-detour
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahpurcell committed Oct 8, 2024
2 parents 7e603ff + 0f8a42d commit 3c20f21
Show file tree
Hide file tree
Showing 18 changed files with 587 additions and 94 deletions.
54 changes: 33 additions & 21 deletions .github/workflows/deploy-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,24 @@ on:
SLACK_WEBHOOK:
required: true


jobs:
deploy:
name: Deploy
build:
name: Build/push Docker Image
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
environment: ${{ inputs.env }}
env:
ECS_CLUSTER: skate
ECS_SERVICE: skate-${{ inputs.env }}
outputs:
docker-tag-suffix: ${{ steps.build-push.outputs.docker-tag-suffix }}
sentry-release: ${{ steps.version-ids.outputs.sentry-release }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
- uses: actions/checkout@v4
- name: Get version ids
id: version-ids
run: |
echo "sentry-release=${{github.ref}}_${{github.sha}}" | tr / - >> "$GITHUB_OUTPUT"
- uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: ${{ inputs.env }}
version: ${{steps.version-ids.outputs.sentry-release}}
ignore_missing: true
- uses: mbta/actions/build-push-ecr@v2
id: build-push
with:
Expand All @@ -61,13 +48,38 @@ jobs:
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}


deploy_ecs:
name: Deploy (ECS)
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write
environment: ${{ inputs.env }}
env:
ECS_CLUSTER: skate
ECS_SERVICE: skate-${{ inputs.env }}
steps:
- uses: mbta/actions/deploy-ecs@v2
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
ecs-cluster: ${{ env.ECS_CLUSTER }}
ecs-service: ${{ env.ECS_SERVICE }}
docker-tag: ${{ steps.build-push.outputs.docker-tag }}
- uses: mbta/actions/notify-slack-deploy@v1
docker-tag: ${{ secrets.DOCKER_REPO }}:${{ needs.build.outputs.docker-tag-suffix }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: getsentry/action-release@v1
env:
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with:
environment: ${{ inputs.env }}
version: ${{needs.build.outputs.sentry-release}}
ignore_missing: true
- uses: mbta/actions/notify-slack-deploy@v2
if: ${{ !cancelled() }}
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK }}
Expand Down
13 changes: 12 additions & 1 deletion assets/src/components/notificationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
BlockWaiverReason,
NotificationType,
isBlockWaiverNotification,
DetourNotificationStatus,
} from "../realtime"
import { Route } from "../schedule"
import { formattedTime } from "../util/dateTime"
Expand Down Expand Up @@ -99,7 +100,17 @@ export const title = (notification: Notification) => {
}

case NotificationType.Detour: {
return "Detour - Active"
switch (notification.content.status) {
case DetourNotificationStatus.Activated: {
return "Detour - Active"
}
case DetourNotificationStatus.Deactivated: {
return "Detour - Closed"
}
}
// Typescript says this is unreachable,
// but eslint doesn't seem to get the memo
break
}

case NotificationType.BridgeMovement: {
Expand Down
6 changes: 6 additions & 0 deletions assets/src/models/notificationData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import {
BlockWaiverNotification,
BridgeNotification,
DetourNotificationStatus,
Notification,
NotificationContentTypes,
NotificationType,
Expand Down Expand Up @@ -68,6 +69,10 @@ export const BridgeNotificationData = union([

export const DetourNotificationData = type({
__struct__: literal(NotificationType.Detour),
status: enums([
DetourNotificationStatus.Activated,
DetourNotificationStatus.Deactivated,
]),
detour_id: detourId,
headsign: string(),
route: string(),
Expand Down Expand Up @@ -136,6 +141,7 @@ export const notificationFromData = (
case NotificationType.Detour: {
content = {
$type: NotificationType.Detour,
status: notificationData.content.status,
detourId: notificationData.content.detour_id,
direction: notificationData.content.direction,
headsign: notificationData.content.headsign,
Expand Down
6 changes: 6 additions & 0 deletions assets/src/realtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,14 @@ export type BlockWaiverNotification = {
endTime: Date | null
}

export enum DetourNotificationStatus {
Activated = "activated",
Deactivated = "deactivated",
}

export type DetourNotification = {
$type: NotificationType.Detour
status: DetourNotificationStatus
detourId: DetourId
headsign: string
route: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`NotificationBellIcon activated detour notification renders when there are new detour notifications and user is not part of DetoursList 1`] = `
<body>
<div>
<span
class="c-notification-bell-icon c-notification-bell-icon--closed c-notification-bell-icon--read"
>
<svg />
</span>
</div>
</body>
`;

exports[`NotificationBellIcon activated detour notification renders when there are new detour notifications and user is part of DetoursList group 1`] = `
<body>
<div>
<span
class="c-notification-bell-icon c-notification-bell-icon--closed c-notification-bell-icon--unread"
>
<svg />
</span>
</div>
</body>
`;

exports[`NotificationBellIcon deactivated detour notification renders when there are new detour notifications and user is not part of DetoursList 1`] = `
<body>
<div>
<span
class="c-notification-bell-icon c-notification-bell-icon--closed c-notification-bell-icon--read"
>
<svg />
</span>
</div>
</body>
`;

exports[`NotificationBellIcon deactivated detour notification renders when there are new detour notifications and user is part of DetoursList group 1`] = `
<body>
<div>
<span
class="c-notification-bell-icon c-notification-bell-icon--closed c-notification-bell-icon--unread"
>
<svg />
</span>
</div>
</body>
`;

exports[`NotificationBellIcon renders when the drawer is closed and there are new notifications 1`] = `
<span
className="c-notification-bell-icon c-notification-bell-icon--closed c-notification-bell-icon--unread"
Expand Down Expand Up @@ -43,27 +91,3 @@ exports[`NotificationBellIcon renders when the drawer is open and there are not
}
/>
`;

exports[`NotificationBellIcon renders when there are new detour notifications and user is not part of DetoursList 1`] = `
<body>
<div>
<span
class="c-notification-bell-icon c-notification-bell-icon--closed c-notification-bell-icon--read"
>
<svg />
</span>
</div>
</body>
`;

exports[`NotificationBellIcon renders when there are new detour notifications and user is part of DetoursList group 1`] = `
<body>
<div>
<span
class="c-notification-bell-icon c-notification-bell-icon--closed c-notification-bell-icon--unread"
>
<svg />
</span>
</div>
</body>
`;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`NotificationCard renders detour notification if user is in DetoursList group 1`] = `
exports[`NotificationCard renders activated detour notification if user is in DetoursList group 1`] = `
<body>
<div>
<div
Expand Down Expand Up @@ -43,19 +43,92 @@ exports[`NotificationCard renders detour notification if user is in DetoursList
<div
class="c-route-pill c-route-pill--bus"
>
2
4
</div>
<div>
<div
class="fw-semibold"
>
Headsign 2
Headsign 4
</div>
<div
class="fw-normal text-body-secondary"
>
From
Origin station 2
Origin station 4
</div>
<div
class="fw-normal"
>
Outbound
</div>
</div>
</div>
</div>
</div>
</div>
</button>
</div>
</div>
</body>
`;

exports[`NotificationCard renders detour deactivated notification if user is in DetoursList group 1`] = `
<body>
<div>
<div
aria-labelledby="card-label-:ri:"
class="c-card c-card--kiwi"
>
<button
class="c-card__left"
>
<div
class="c-card__left-content"
>
<div
class="c-card__top-row"
>
<div
class="c-card__title"
id="card-label-:ri:"
>
<span>
<svg />
</span>
Detour - Closed
</div>
<div
class="c-card__time"
>
0 min
</div>
</div>
<div
class="c-card__contents"
>
<div
class="c-card__body"
>
<div
class="d-flex flex-row gap-2"
>
<div
class="c-route-pill c-route-pill--bus"
>
1
</div>
<div>
<div
class="fw-semibold"
>
Headsign 1
</div>
<div
class="fw-normal text-body-secondary"
>
From
Origin station 1
</div>
<div
class="fw-normal"
Expand Down
Loading

0 comments on commit 3c20f21

Please sign in to comment.