Reorganize List
All checks were successful
repod / nextcloud (push) Successful in 51s
repod / nodejs (push) Successful in 1m27s

This commit is contained in:
Michel Roux 2023-08-30 09:27:12 +02:00
parent 89f37278aa
commit 7c875219f0
5 changed files with 34 additions and 18 deletions

View File

@ -0,0 +1,16 @@
<template>
<ul :style="{marginBottom: episode ? '6rem' : 'auto'}">
<slot />
</ul>
</template>
<script>
export default {
name: 'List',
computed: {
episode() {
return this.$store.state.player.episode
},
},
}
</script>

View File

@ -1,5 +1,5 @@
<template> <template>
<ul :style="{marginBottom: episode ? '6rem' : 'auto'}"> <List>
<NcListItem v-for="feed in feeds" <NcListItem v-for="feed in feeds"
:key="feed.link" :key="feed.link"
:details="formatTimeAgo(new Date(feed.fetchedAtUnix*1000))" :details="formatTimeAgo(new Date(feed.fetchedAtUnix*1000))"
@ -14,11 +14,12 @@
{{ feed.author }} {{ feed.author }}
</template> </template>
</NcListItem> </NcListItem>
</ul> </List>
</template> </template>
<script> <script>
import { NcAvatar, NcListItem } from '@nextcloud/vue' import { NcAvatar, NcListItem } from '@nextcloud/vue'
import List from '../Atoms/List.vue'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { debounce } from '../../utils/debounce.js' import { debounce } from '../../utils/debounce.js'
import { formatTimeAgo } from '../../utils/time.js' import { formatTimeAgo } from '../../utils/time.js'
@ -28,6 +29,7 @@ import { showError } from '@nextcloud/dialogs'
export default { export default {
name: 'Search', name: 'Search',
components: { components: {
List,
NcAvatar, NcAvatar,
NcListItem, NcListItem,
}, },
@ -42,11 +44,6 @@ export default {
feeds: [], feeds: [],
} }
}, },
computed: {
episode() {
return this.$store.state.player.episode
},
},
watch: { watch: {
value() { value() {
this.search() this.search()

View File

@ -1,12 +1,14 @@
<template> <template>
<div> <div>
<NcLoadingIcon v-if="loading" /> <NcLoadingIcon v-if="loading" />
<ul v-if="!loading" :style="{marginBottom: currentEpisode ? '6rem' : 'auto'}"> <List v-if="!loading">
<NcListItem v-for="episode in episodes" <NcListItem v-for="episode in episodes"
:key="episode.episodeGuid" :key="episode.episodeGuid"
:active="isCurrentEpisode(episode)"
:details="formatTimeAgo(new Date(episode.episodePubDate.date))" :details="formatTimeAgo(new Date(episode.episodePubDate.date))"
:force-display-actions="true" :force-display-actions="true"
:name="episode.episodeName" :name="episode.episodeName"
:style="{opacity: episode.episodeAction && episode.episodeAction.position >= episode.episodeAction.total ? '.5' : 1}"
:title="episode.episodeDescription"> :title="episode.episodeDescription">
<template #icon> <template #icon>
<NcAvatar :display-name="episode.episodeName" <NcAvatar :display-name="episode.episodeName"
@ -31,13 +33,14 @@
</NcActionButton> </NcActionButton>
</template> </template>
</NcListItem> </NcListItem>
</ul> </List>
</div> </div>
</template> </template>
<script> <script>
import { NcActionButton, NcAvatar, NcListItem, NcLoadingIcon } from '@nextcloud/vue' import { NcActionButton, NcAvatar, NcListItem, NcLoadingIcon } from '@nextcloud/vue'
import { formatTimeAgo, formatTimer } from '../../utils/time.js' import { formatTimeAgo, formatTimer } from '../../utils/time.js'
import List from '../Atoms/List.vue'
import PlayButton from 'vue-material-design-icons/Play.vue' import PlayButton from 'vue-material-design-icons/Play.vue'
import StopButton from 'vue-material-design-icons/Stop.vue' import StopButton from 'vue-material-design-icons/Stop.vue'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
@ -45,8 +48,9 @@ import { generateUrl } from '@nextcloud/router'
import { showError } from '@nextcloud/dialogs' import { showError } from '@nextcloud/dialogs'
export default { export default {
name: 'List', name: 'Episodes',
components: { components: {
List,
NcActionButton, NcActionButton,
NcAvatar, NcAvatar,
NcListItem, NcListItem,

View File

@ -9,11 +9,11 @@
</NcAppNavigationNew> </NcAppNavigationNew>
</router-link> </router-link>
<NcLoadingIcon v-if="loading" /> <NcLoadingIcon v-if="loading" />
<ul v-if="!loading" :style="{marginBottom: episode ? '6rem' : 'auto'}"> <List v-if="!loading">
<Item v-for="subscriptionUrl of subscriptions" <Item v-for="subscriptionUrl of subscriptions"
:key="subscriptionUrl" :key="subscriptionUrl"
:url="subscriptionUrl" /> :url="subscriptionUrl" />
</ul> </List>
</NcAppContentList> </NcAppContentList>
</NcAppNavigation> </NcAppNavigation>
</template> </template>
@ -26,6 +26,7 @@ import {
NcLoadingIcon, NcLoadingIcon,
} from '@nextcloud/vue' } from '@nextcloud/vue'
import Item from './Item.vue' import Item from './Item.vue'
import List from '../Atoms/List.vue'
import Plus from 'vue-material-design-icons/Plus.vue' import Plus from 'vue-material-design-icons/Plus.vue'
import { showError } from '@nextcloud/dialogs' import { showError } from '@nextcloud/dialogs'
@ -33,6 +34,7 @@ export default {
name: 'Subscriptions', name: 'Subscriptions',
components: { components: {
Item, Item,
List,
NcAppContentList, NcAppContentList,
NcAppNavigation, NcAppNavigation,
NcAppNavigationNew, NcAppNavigationNew,
@ -45,9 +47,6 @@ export default {
} }
}, },
computed: { computed: {
episode() {
return this.$store.state.player.episode
},
subscriptions() { subscriptions() {
return this.$store.state.subscriptions.subscriptions return this.$store.state.subscriptions.subscriptions
}, },

View File

@ -12,7 +12,7 @@
:image-url="feed.imageUrl" :image-url="feed.imageUrl"
:link="feed.link" :link="feed.link"
:title="feed.title" /> :title="feed.title" />
<List v-if="feed" /> <Episodes v-if="feed" />
</NcAppContent> </NcAppContent>
</template> </template>
@ -20,7 +20,7 @@
import { NcAppContent, NcEmptyContent, NcLoadingIcon } from '@nextcloud/vue' import { NcAppContent, NcEmptyContent, NcLoadingIcon } from '@nextcloud/vue'
import Alert from 'vue-material-design-icons/Alert.vue' import Alert from 'vue-material-design-icons/Alert.vue'
import Banner from '../components/Feed/Banner.vue' import Banner from '../components/Feed/Banner.vue'
import List from '../components/Feed/List.vue' import Episodes from '../components/Feed/Episodes.vue'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router' import { generateUrl } from '@nextcloud/router'
@ -29,10 +29,10 @@ export default {
components: { components: {
Alert, Alert,
Banner, Banner,
Episodes,
NcAppContent, NcAppContent,
NcEmptyContent, NcEmptyContent,
NcLoadingIcon, NcLoadingIcon,
List,
}, },
data() { data() {
return { return {