diff --git a/docs/widgets.md b/docs/widgets.md index 6e4f0486..83accd78 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -86,6 +86,33 @@ Displays the weather (temperature and conditions) for the next few days for a gi units: imperial ``` +### TFL Status + +Shows real-time tube status of the London Underground. All options are optional. + +##### Options + +**Field** | **Type** | **Required** | **Description** +--- | --- | --- | --- +**`showAll`** | `boolean` | _Optional_ | By default, details for lines with a Good Service are not visible, but you can click More Details to see all. Setting this option to `true` will show all lines on initial page load +**`sortAlphabetically`** | `boolean` | _Optional_ | By default lines are sorted by current status, set this option to `true` to instead sort them alphabetically +**`linesToShow`** | `array` | _Optional_ | By default all lines are shown. If you're only interested in the status of a few lines, then pass in an array of lines to show, specified by name + +##### Example + +```yaml + - name: TFL Status + icon: '🚋' + type: tfl-status + options: + showAll: true + sortAlphabetically: true + linesToShow: + - District + - Jubilee + - Central +``` + --- ## Dynamic Widgets diff --git a/src/assets/locales/en.json b/src/assets/locales/en.json index 817b3088..5399cf18 100644 --- a/src/assets/locales/en.json +++ b/src/assets/locales/en.json @@ -1,7 +1,8 @@ { "home": { "no-results": "No Search Results", - "no-data": "No Data Configured" + "no-data": "No Data Configured", + "no-items-section": "No Items to Show Yet" }, "search": { "search-label": "Search", @@ -243,5 +244,19 @@ "download-file-tooltip": "Download all app config to your device, in a YAML file", "view-title": "View Config" } + }, + "widgets": { + "general": { + "loading": "Loading...", + "show-more": "Expand Details", + "show-less": "Show Less" + }, + "clock": {}, + "weather": {}, + "weather-forecast": {}, + "tfl-status": { + "good-service-all": "Good Service on all Lines", + "good-service-rest": "Good Service on all other Lines" + } } } \ No newline at end of file diff --git a/src/components/Widgets/TflStatus.vue b/src/components/Widgets/TflStatus.vue new file mode 100644 index 00000000..ea92b4e4 --- /dev/null +++ b/src/components/Widgets/TflStatus.vue @@ -0,0 +1,170 @@ + + + + + diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index 3a0f5233..f466ffc0 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -1,19 +1,20 @@ @@ -21,6 +22,7 @@ import Clock from '@/components/Widgets/Clock.vue'; import Weather from '@/components/Widgets/Weather.vue'; import WeatherForecast from '@/components/Widgets/WeatherForecast.vue'; +import TflStatus from '@/components/Widgets/TflStatus.vue'; import Collapsable from '@/components/LinkItems/Collapsable.vue'; export default { @@ -30,6 +32,7 @@ export default { Clock, Weather, WeatherForecast, + TflStatus, }, props: { widget: Object, diff --git a/src/utils/defaults.js b/src/utils/defaults.js index c29aaf19..467e45cc 100644 --- a/src/utils/defaults.js +++ b/src/utils/defaults.js @@ -207,6 +207,7 @@ module.exports = { widgetApiEndpoints: { weather: 'https://api.openweathermap.org/data/2.5/weather', weatherForecast: 'https://api.openweathermap.org/data/2.5/forecast/daily', + tflStatus: 'https://api.tfl.gov.uk/line/mode/tube/status', }, /* URLs for web search engines */ searchEngineUrls: {