Browse Source

fix(weather_status): Always show all favorite locations

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/38664/head
Ferdinand Thiessen 2 years ago
parent
commit
bab7cc9853
  1. 40
      apps/weather_status/src/App.vue
  2. 4
      dist/weather_status-weather-status.js
  3. 2
      dist/weather_status-weather-status.js.map

40
apps/weather_status/src/App.vue

@ -64,21 +64,18 @@
@submit="onAddressSubmit">
{{ t('weather_status', 'Set custom address') }}
</NcActionInput>
<NcActionButton v-show="favorites.length > 0"
:icon="toggleFavoritesIcon"
:aria-hidden="true"
@click="showFavorites = !showFavorites">
{{ t('weather_status', 'Favorites') }}
</NcActionButton>
<NcActionButton v-for="favorite in displayedFavorites"
:key="favorite"
:aria-hidden="true"
@click="onFavoriteClick($event, favorite)">
<template #icon>
<IconStar :size="20" :class="{'favorite-color': address === favorite}" />
</template>
{{ favorite }}
</NcActionButton>
<template v-if="favorites.length > 0">
<NcActionCaption :title="t('weather_status', 'Favorites')" />
<NcActionButton v-for="favorite in favorites"
:key="favorite"
:aria-hidden="true"
@click="onFavoriteClick($event, favorite)">
<template #icon>
<IconStar :size="20" :class="{'favorite-color': address === favorite}" />
</template>
{{ favorite }}
</NcActionButton>
</template>
</NcActions>
</div>
</li>
@ -92,6 +89,7 @@ import IconStar from 'vue-material-design-icons/Star.vue'
import IconStarOutline from 'vue-material-design-icons/StarOutline.vue'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import NcActionCaption from '@nextcloud/vue/dist/Components/NcActionCaption.js'
import NcActionInput from '@nextcloud/vue/dist/Components/NcActionInput.js'
import NcActionLink from '@nextcloud/vue/dist/Components/NcActionLink.js'
import NcActionSeparator from '@nextcloud/vue/dist/Components/NcActionSeparator.js'
@ -211,6 +209,7 @@ export default {
IconStar,
NcActions,
NcActionButton,
NcActionCaption,
NcActionInput,
NcActionLink,
NcActionSeparator,
@ -236,7 +235,6 @@ export default {
forecasts: [],
loop: null,
favorites: [],
showFavorites: false,
}
},
computed: {
@ -309,16 +307,6 @@ export default {
return f === this.address
})
},
toggleFavoritesIcon() {
return this.showFavorites
? 'icon-triangle-s'
: 'icon-triangle-e'
},
displayedFavorites() {
return this.showFavorites
? this.favorites
: []
},
},
mounted() {
this.initWeatherStatus()

4
dist/weather_status-weather-status.js
File diff suppressed because it is too large
View File

2
dist/weather_status-weather-status.js.map
File diff suppressed because it is too large
View File

Loading…
Cancel
Save