refacto: Merge TopList and TopItems into Tops
This commit is contained in:
parent
ea8567169d
commit
bba6803b5b
@ -7,8 +7,8 @@ OC.L10N.register(
|
||||
"# Features\n- 🔍 Browse and subscribe huge collection of podcasts\n- 🔊 Listen to episodes directly in Nextcloud\n- 🌐 Sync your activity with [AntennaPod](https://antennapod.org/)\n\n# Requirements\nYou need to have [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) installed to use this app!" : "# Fonctionnalités\n- 🔍 Parcourir et s'abonner à une grande collections de podcasts\n- 🔊 Écouter vos épisodes directement sur Nextcloud\n- 🌐 Synchroniser son activité avec [AntennaPod](https://antennapod.org/)\n\n# Pré-requis\nVous devez avoir [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) installé pour utiliser cette application !",
|
||||
"Add a RSS link" : "Ajouter un lien RSS",
|
||||
"Could not fetch search results" : "Impossible de récupérer les resultats de la recherche",
|
||||
"Hot podcasts" : "Tendances",
|
||||
"New podcasts" : "Nouveautés",
|
||||
"hot podcasts" : "tendances",
|
||||
"new podcasts" : "nouveautés",
|
||||
"Could not fetch tops" : "Impossible de récupérer les tops",
|
||||
"Subscribe" : "S'abonner",
|
||||
"Error while adding the feed" : "Erreur lors de l'ajout du flux",
|
||||
|
@ -5,8 +5,8 @@
|
||||
"# Features\n- 🔍 Browse and subscribe huge collection of podcasts\n- 🔊 Listen to episodes directly in Nextcloud\n- 🌐 Sync your activity with [AntennaPod](https://antennapod.org/)\n\n# Requirements\nYou need to have [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) installed to use this app!" : "# Fonctionnalités\n- 🔍 Parcourir et s'abonner à une grande collections de podcasts\n- 🔊 Écouter vos épisodes directement sur Nextcloud\n- 🌐 Synchroniser son activité avec [AntennaPod](https://antennapod.org/)\n\n# Pré-requis\nVous devez avoir [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) installé pour utiliser cette application !",
|
||||
"Add a RSS link" : "Ajouter un lien RSS",
|
||||
"Could not fetch search results" : "Impossible de récupérer les resultats de la recherche",
|
||||
"Hot podcasts" : "Tendances",
|
||||
"New podcasts" : "Nouveautés",
|
||||
"hot podcasts" : "tendances",
|
||||
"new podcasts" : "nouveautés",
|
||||
"Could not fetch tops" : "Impossible de récupérer les tops",
|
||||
"Subscribe" : "S'abonner",
|
||||
"Error while adding the feed" : "Erreur lors de l'ajout du flux",
|
||||
|
@ -1,43 +0,0 @@
|
||||
<template>
|
||||
<router-link :to="hash">
|
||||
<img :src="imageUrl" :title="author">
|
||||
</router-link>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { toUrl } from '../../utils/url.js'
|
||||
|
||||
export default {
|
||||
name: 'TopItem',
|
||||
props: {
|
||||
author: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
imageUrl: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
link: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
hash() {
|
||||
return toUrl(this.link)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
img {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
@ -1,95 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<h2>{{ t('repod', 'Hot podcasts') }}</h2>
|
||||
<Loading v-if="tops.hot.loading" />
|
||||
<ul v-if="!tops.hot.loading">
|
||||
<li v-for="top in tops.hot.items" :key="top.link">
|
||||
<TopItem :author="top.author"
|
||||
:image-url="top.imageUrl"
|
||||
:link="top.link"
|
||||
:title="top.title" />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<h2>{{ t('repod', 'New podcasts') }}</h2>
|
||||
<Loading v-if="tops.new.loading" />
|
||||
<ul v-if="!tops.new.loading">
|
||||
<li v-for="top in tops.new.items" :key="top.link">
|
||||
<TopItem :author="top.author"
|
||||
:image-url="top.imageUrl"
|
||||
:link="top.link"
|
||||
:title="top.title" />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Loading from '../Atoms/Loading.vue'
|
||||
import TopItem from './TopItem.vue'
|
||||
import axios from '@nextcloud/axios'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import { showError } from '@nextcloud/dialogs'
|
||||
|
||||
export default {
|
||||
name: 'TopList',
|
||||
components: {
|
||||
Loading,
|
||||
TopItem,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tops: {
|
||||
hot: {
|
||||
items: [],
|
||||
loading: true,
|
||||
},
|
||||
new: {
|
||||
items: [],
|
||||
loading: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
this.loadList('hot')
|
||||
this.loadList('new')
|
||||
},
|
||||
methods: {
|
||||
async loadList(type) {
|
||||
try {
|
||||
this.tops[type].loading = true
|
||||
const toplist = await axios.get(generateUrl(`/apps/repod/toplist/${type}`))
|
||||
this.tops[type].items = toplist.data
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
showError(t('repod', 'Could not fetch tops'))
|
||||
} finally {
|
||||
this.tops[type].loading = false
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
h2 {
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
li {
|
||||
flex-basis: 10rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
display: flex;
|
||||
gap: 2rem;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
padding: .5rem;
|
||||
}
|
||||
</style>
|
86
src/components/Discover/Tops.vue
Normal file
86
src/components/Discover/Tops.vue
Normal file
@ -0,0 +1,86 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2>{{ t('repod', `${type} podcasts`) }}</h2>
|
||||
<Loading v-if="loading" />
|
||||
<ul v-if="!loading">
|
||||
<li v-for="top in items" :key="top.link">
|
||||
<router-link :to="toUrl(top.link)">
|
||||
<img :src="top.imageUrl" :title="top.author">
|
||||
</router-link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Loading from '../Atoms/Loading.vue'
|
||||
import axios from '@nextcloud/axios'
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import { showError } from '@nextcloud/dialogs'
|
||||
import { toUrl } from '../../utils/url.js'
|
||||
|
||||
export default {
|
||||
name: 'Tops',
|
||||
components: {
|
||||
Loading,
|
||||
},
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
loading: true,
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
this.loadList()
|
||||
},
|
||||
methods: {
|
||||
toUrl,
|
||||
async loadList() {
|
||||
try {
|
||||
this.loading = true
|
||||
const toplist = await axios.get(generateUrl(`/apps/repod/toplist/${this.type}`))
|
||||
this.items = toplist.data
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
showError(t('repod', 'Could not fetch tops'))
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
h2 {
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
h2::first-letter {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
img {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
li {
|
||||
flex-basis: 10rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
display: flex;
|
||||
gap: 2rem;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
padding: .5rem;
|
||||
}
|
||||
</style>
|
@ -4,7 +4,8 @@
|
||||
<Magnify :size="20" />
|
||||
</NcTextField>
|
||||
<Search v-if="search" :value="search" />
|
||||
<TopList v-if="!search" />
|
||||
<Tops v-if="!search" type="hot" />
|
||||
<Tops v-if="!search" type="new" />
|
||||
<AddRss v-if="!search" />
|
||||
</NcAppContent>
|
||||
</template>
|
||||
@ -14,7 +15,7 @@ import { NcAppContent, NcTextField } from '@nextcloud/vue'
|
||||
import AddRss from '../components/Discover/AddRss.vue'
|
||||
import Magnify from 'vue-material-design-icons/Magnify.vue'
|
||||
import Search from '../components/Discover/Search.vue'
|
||||
import TopList from '../components/Discover/TopList.vue'
|
||||
import Tops from '../components/Discover/Tops.vue'
|
||||
|
||||
export default {
|
||||
name: 'Discover',
|
||||
@ -24,7 +25,7 @@ export default {
|
||||
NcAppContent,
|
||||
NcTextField,
|
||||
Search,
|
||||
TopList,
|
||||
Tops,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -50,11 +50,11 @@ msgstr "Ajouter un lien RSS"
|
||||
msgid "Could not fetch search results"
|
||||
msgstr "Impossible de récupérer les resultats de la recherche"
|
||||
|
||||
msgid "Hot podcasts"
|
||||
msgstr "Tendances"
|
||||
msgid "hot podcasts"
|
||||
msgstr "tendances"
|
||||
|
||||
msgid "New podcasts"
|
||||
msgstr "Nouveautés"
|
||||
msgid "new podcasts"
|
||||
msgstr "nouveautés"
|
||||
|
||||
msgid "Could not fetch tops"
|
||||
msgstr "Impossible de récupérer les tops"
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Nextcloud 3.14159\n"
|
||||
"Report-Msgid-Bugs-To: translations\\@example.com\n"
|
||||
"POT-Creation-Date: 2024-01-10 19:15+0000\n"
|
||||
"POT-Creation-Date: 2024-01-14 00:07+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -50,73 +50,69 @@ msgid "Could not fetch search results"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:3
|
||||
msgid "Hot podcasts"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:4
|
||||
msgid "New podcasts"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:5
|
||||
msgid "Could not fetch tops"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:6
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:4
|
||||
msgid "${type} podcasts"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:5
|
||||
msgid "Subscribe"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:7
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:6
|
||||
msgid "Error while adding the feed"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:8
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:7
|
||||
msgid "Play"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:9
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:8
|
||||
msgid "Stop"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:10
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:9
|
||||
msgid "Could not fetch episodes"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:11
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:10
|
||||
msgid "Download"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:12
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:11
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:13
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:12
|
||||
msgid "Are you sure you want to delete this subscription?"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:14
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:13
|
||||
msgid "Error while removing the feed"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:15
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:14
|
||||
msgid "Add a podcast"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:16
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:15
|
||||
msgid "Could not fetch subscriptions"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:17
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:16
|
||||
msgid "Find a podcast"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:18
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:17
|
||||
msgid "Error loading feed"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:19
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:18
|
||||
msgid "Missing required app"
|
||||
msgstr ""
|
||||
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:20
|
||||
#: /app/specialVueFakeDummyForL10nScript.js:19
|
||||
msgid "Install GPodder Sync"
|
||||
msgstr ""
|
||||
|
Loading…
Reference in New Issue
Block a user