🎨 Sort widget components alphabetically

This commit is contained in:
Alicia Sykes 2021-12-16 23:32:00 +00:00
parent a23d56591c
commit 599a5cc8d2

View File

@ -25,34 +25,6 @@
@error="handleError" @error="handleError"
:ref="widgetRef" :ref="widgetRef"
/> />
<Weather
v-else-if="widgetType === 'weather'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"
:ref="widgetRef"
/>
<WeatherForecast
v-else-if="widgetType === 'weather-forecast'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"
:ref="widgetRef"
/>
<RssFeed
v-else-if="widgetType === 'rss-feed'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"
:ref="widgetRef"
/>
<TflStatus
v-else-if="widgetType === 'tfl-status'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"
:ref="widgetRef"
/>
<CryptoPriceChart <CryptoPriceChart
v-else-if="widgetType === 'crypto-price-chart'" v-else-if="widgetType === 'crypto-price-chart'"
:options="widgetOptions" :options="widgetOptions"
@ -67,8 +39,8 @@
@error="handleError" @error="handleError"
:ref="widgetRef" :ref="widgetRef"
/> />
<XkcdComic <EmbedWidget
v-else-if="widgetType === 'xkcd-comic'" v-else-if="widgetType === 'embed'"
:options="widgetOptions" :options="widgetOptions"
@loading="setLoaderState" @loading="setLoaderState"
@error="handleError" @error="handleError"
@ -81,20 +53,6 @@
@error="handleError" @error="handleError"
:ref="widgetRef" :ref="widgetRef"
/> />
<StockPriceChart
v-else-if="widgetType === 'stock-price-chart'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"
:ref="widgetRef"
/>
<Jokes
v-else-if="widgetType === 'joke'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"
:ref="widgetRef"
/>
<Flights <Flights
v-else-if="widgetType === 'flight-data'" v-else-if="widgetType === 'flight-data'"
:options="widgetOptions" :options="widgetOptions"
@ -102,8 +60,15 @@
@error="handleError" @error="handleError"
:ref="widgetRef" :ref="widgetRef"
/> />
<SystemInfo <IframeWidget
v-else-if="widgetType === 'system-info'" v-else-if="widgetType === 'iframe'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"
:ref="widgetRef"
/>
<Jokes
v-else-if="widgetType === 'joke'"
:options="widgetOptions" :options="widgetOptions"
@loading="setLoaderState" @loading="setLoaderState"
@error="handleError" @error="handleError"
@ -130,15 +95,50 @@
@error="handleError" @error="handleError"
:ref="widgetRef" :ref="widgetRef"
/> />
<IframeWidget <RssFeed
v-else-if="widgetType === 'iframe'" v-else-if="widgetType === 'rss-feed'"
:options="widgetOptions" :options="widgetOptions"
@loading="setLoaderState" @loading="setLoaderState"
@error="handleError" @error="handleError"
:ref="widgetRef" :ref="widgetRef"
/> />
<EmbedWidget <StockPriceChart
v-else-if="widgetType === 'embed'" v-else-if="widgetType === 'stock-price-chart'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"
:ref="widgetRef"
/>
<SystemInfo
v-else-if="widgetType === 'system-info'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"
:ref="widgetRef"
/>
<TflStatus
v-else-if="widgetType === 'tfl-status'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"
:ref="widgetRef"
/>
<XkcdComic
v-else-if="widgetType === 'xkcd-comic'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"
:ref="widgetRef"
/>
<Weather
v-else-if="widgetType === 'weather'"
:options="widgetOptions"
@loading="setLoaderState"
@error="handleError"
:ref="widgetRef"
/>
<WeatherForecast
v-else-if="widgetType === 'weather-forecast'"
:options="widgetOptions" :options="widgetOptions"
@loading="setLoaderState" @loading="setLoaderState"
@error="handleError" @error="handleError"
@ -158,51 +158,53 @@ import UpdateIcon from '@/assets/interface-icons/widget-update.svg';
import OpenIcon from '@/assets/interface-icons/open-new-tab.svg'; import OpenIcon from '@/assets/interface-icons/open-new-tab.svg';
import LoadingAnimation from '@/assets/interface-icons/loader.svg'; import LoadingAnimation from '@/assets/interface-icons/loader.svg';
// Import available widgets // Import available widgets (add new widgets alphabetically)
import Clock from '@/components/Widgets/Clock.vue'; import Clock from '@/components/Widgets/Clock.vue';
import Weather from '@/components/Widgets/Weather.vue';
import WeatherForecast from '@/components/Widgets/WeatherForecast.vue';
import RssFeed from '@/components/Widgets/RssFeed.vue';
import TflStatus from '@/components/Widgets/TflStatus.vue';
import CryptoPriceChart from '@/components/Widgets/CryptoPriceChart.vue'; import CryptoPriceChart from '@/components/Widgets/CryptoPriceChart.vue';
import CryptoWatchList from '@/components/Widgets/CryptoWatchList.vue'; import CryptoWatchList from '@/components/Widgets/CryptoWatchList.vue';
import XkcdComic from '@/components/Widgets/XkcdComic.vue'; import EmbedWidget from '@/components/Widgets/EmbedWidget.vue';
import ExchangeRates from '@/components/Widgets/ExchangeRates.vue'; import ExchangeRates from '@/components/Widgets/ExchangeRates.vue';
import StockPriceChart from '@/components/Widgets/StockPriceChart.vue';
import Jokes from '@/components/Widgets/Jokes.vue';
import Flights from '@/components/Widgets/Flights.vue'; import Flights from '@/components/Widgets/Flights.vue';
import SystemInfo from '@/components/Widgets/SystemInfo.vue'; import IframeWidget from '@/components/Widgets/IframeWidget.vue';
import Jokes from '@/components/Widgets/Jokes.vue';
import NdCpuHistory from '@/components/Widgets/NdCpuHistory.vue'; import NdCpuHistory from '@/components/Widgets/NdCpuHistory.vue';
import NdLoadHistory from '@/components/Widgets/NdLoadHistory.vue'; import NdLoadHistory from '@/components/Widgets/NdLoadHistory.vue';
import NdRamHistory from '@/components/Widgets/NdRamHistory.vue'; import NdRamHistory from '@/components/Widgets/NdRamHistory.vue';
import IframeWidget from '@/components/Widgets/IframeWidget.vue'; import RssFeed from '@/components/Widgets/RssFeed.vue';
import EmbedWidget from '@/components/Widgets/EmbedWidget.vue'; import StockPriceChart from '@/components/Widgets/StockPriceChart.vue';
import SystemInfo from '@/components/Widgets/SystemInfo.vue';
import TflStatus from '@/components/Widgets/TflStatus.vue';
import Weather from '@/components/Widgets/Weather.vue';
import WeatherForecast from '@/components/Widgets/WeatherForecast.vue';
import XkcdComic from '@/components/Widgets/XkcdComic.vue';
export default { export default {
name: 'Widget', name: 'Widget',
components: { components: {
// Register form elements
Button, Button,
UpdateIcon, UpdateIcon,
OpenIcon, OpenIcon,
LoadingAnimation, LoadingAnimation,
// Register widget components
Clock, Clock,
Weather,
WeatherForecast,
RssFeed,
TflStatus,
CryptoPriceChart, CryptoPriceChart,
CryptoWatchList, CryptoWatchList,
XkcdComic, EmbedWidget,
ExchangeRates, ExchangeRates,
StockPriceChart,
Jokes,
Flights, Flights,
SystemInfo, IframeWidget,
Jokes,
NdCpuHistory, NdCpuHistory,
NdLoadHistory, NdLoadHistory,
NdRamHistory, NdRamHistory,
IframeWidget, RssFeed,
EmbedWidget, StockPriceChart,
SystemInfo,
TflStatus,
Weather,
WeatherForecast,
XkcdComic,
}, },
props: { props: {
widget: Object, widget: Object,