-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Decoupled components from Nuxt pages. This should make it easier to use those components in future applications. Minor bug fix with query setting of station id.
- Loading branch information
Showing
14 changed files
with
284 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<script setup lang="ts"> | ||
import TrainsResponseEntity from "~/models/trains_response.entity"; | ||
interface MainViewProps { | ||
trainData?: TrainsResponseEntity; | ||
selectedStationName?: string; | ||
hasIncidents: boolean; | ||
isRefreshing: boolean; | ||
} | ||
defineProps<MainViewProps>(); | ||
const emit = defineEmits<{ | ||
onLeftTap: []; | ||
onMiddleTap: []; | ||
onRightTap: []; | ||
onSeeIncidents: []; | ||
}>(); | ||
</script> | ||
|
||
<template> | ||
<AreaAction | ||
:on-left-tap="() => emit('onLeftTap')" | ||
:on-middle-tap="() => emit('onMiddleTap')" | ||
:on-right-tap="() => emit('onRightTap')" | ||
> | ||
<div v-if="trainData" class="flex h-screen flex-col justify-between"> | ||
<TrainArrivalBoard class="trains" :trains="trainData.trains" /> | ||
<div class="mb-2 flex flex-row items-center gap-4"> | ||
<SublineText | ||
class="trains mr-auto w-1/2 truncate text-4xl text-gray-700" | ||
> | ||
{{ selectedStationName }} | ||
</SublineText> | ||
<IncidentNotification | ||
v-if="hasIncidents" | ||
@on-see-incidents="() => emit('onSeeIncidents')" | ||
/> | ||
<LastUpdated | ||
class="trains" | ||
:last-updated="new Date(trainData.lastUpdated)" | ||
/> | ||
</div> | ||
</div> | ||
<LoadingIndicator v-if="isRefreshing" /> | ||
</AreaAction> | ||
</template> | ||
|
||
<style scoped> | ||
.trains { | ||
line-height: 1.7ch; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<script setup lang="ts"> | ||
import AppConstants from "~/constants/app.constants"; | ||
import IncidentEntity from "~/models/incident.entity"; | ||
interface IncidentsViewProps { | ||
incidents: IncidentEntity[]; | ||
} | ||
const props = defineProps<IncidentsViewProps>(); | ||
const emit = defineEmits<{ | ||
onSlideEnd: []; | ||
}>(); | ||
/** | ||
* This will split the incident text into multiple slides if it is too long. | ||
*/ | ||
const incidentDetails = computed(() => { | ||
return props.incidents.reduce( | ||
(acc: string[], { description, linesAffected }) => { | ||
const affected = | ||
linesAffected.length > 0 | ||
? `Affected Lines: ${linesAffected.join(" ")}` | ||
: ""; | ||
if (description.length > AppConstants.maxIncidentTextLength) { | ||
// Split the string into multiple slides but only after a word. | ||
const splitStrings = description.match( | ||
new RegExp( | ||
`[\\s\\S]{1,${AppConstants.maxIncidentTextLength}}(?![\\S])`, | ||
"g" | ||
) | ||
); | ||
if (splitStrings) { | ||
splitStrings[splitStrings.length - 1] = `${ | ||
splitStrings[splitStrings.length - 1] | ||
} ${affected}`; | ||
return [...acc, ...splitStrings]; | ||
} | ||
} else { | ||
return [...acc, `${description} ${affected} `]; | ||
} | ||
return acc; | ||
}, | ||
[] | ||
); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div class="h-screen"> | ||
<div class="flex h-screen flex-col justify-between gap-8"> | ||
<div class="checkered-background"></div> | ||
<h1 class="text-center text-7xl leading-[1.7ch] text-red-600"> | ||
SERVICE ADVISORY | ||
</h1> | ||
<TextCarousel | ||
:slides="incidentDetails" | ||
@slide-end="() => emit('onSlideEnd')" | ||
/> | ||
<div class="checkered-background"></div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.checkered-background { | ||
width: 100%; | ||
height: 50px; | ||
background-image: linear-gradient( | ||
45deg, | ||
#fbbf24 25%, | ||
transparent 25%, | ||
transparent 75%, | ||
#fbbf24 75% | ||
), | ||
linear-gradient( | ||
45deg, | ||
#fbbf24 25%, | ||
transparent 25%, | ||
transparent 75%, | ||
#fbbf24 75% | ||
); | ||
background-size: 50px 50px; | ||
background-position: 25px 50px, 50px 25px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { type client } from "./plugins/client"; | ||
|
||
declare module "#app" { | ||
interface NuxtApp { | ||
$client: client; | ||
} | ||
} | ||
|
||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
90c2a38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
wmata-train-tracking – ./
wmata-train-tracking-ncpleslie.vercel.app
wmata-train-tracking.vercel.app
wmata-train-tracking-git-main-ncpleslie.vercel.app
traintracking.nickleslie.dev