refacto: Merge TopList and TopItems into Tops
All checks were successful
repod / xml (push) Successful in 17s
repod / php (push) Successful in 55s
repod / nodejs (push) Successful in 2m22s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-01-14 01:07:55 +01:00
parent ea8567169d
commit bba6803b5b
8 changed files with 118 additions and 173 deletions

View File

@ -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 !", "# 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", "Add a RSS link" : "Ajouter un lien RSS",
"Could not fetch search results" : "Impossible de récupérer les resultats de la recherche", "Could not fetch search results" : "Impossible de récupérer les resultats de la recherche",
"Hot podcasts" : "Tendances", "hot podcasts" : "tendances",
"New podcasts" : "Nouveautés", "new podcasts" : "nouveautés",
"Could not fetch tops" : "Impossible de récupérer les tops", "Could not fetch tops" : "Impossible de récupérer les tops",
"Subscribe" : "S'abonner", "Subscribe" : "S'abonner",
"Error while adding the feed" : "Erreur lors de l'ajout du flux", "Error while adding the feed" : "Erreur lors de l'ajout du flux",

View File

@ -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 !", "# 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", "Add a RSS link" : "Ajouter un lien RSS",
"Could not fetch search results" : "Impossible de récupérer les resultats de la recherche", "Could not fetch search results" : "Impossible de récupérer les resultats de la recherche",
"Hot podcasts" : "Tendances", "hot podcasts" : "tendances",
"New podcasts" : "Nouveautés", "new podcasts" : "nouveautés",
"Could not fetch tops" : "Impossible de récupérer les tops", "Could not fetch tops" : "Impossible de récupérer les tops",
"Subscribe" : "S'abonner", "Subscribe" : "S'abonner",
"Error while adding the feed" : "Erreur lors de l'ajout du flux", "Error while adding the feed" : "Erreur lors de l'ajout du flux",

View File

@ -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>

View File

@ -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>

View 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>

View File

@ -4,7 +4,8 @@
<Magnify :size="20" /> <Magnify :size="20" />
</NcTextField> </NcTextField>
<Search v-if="search" :value="search" /> <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" /> <AddRss v-if="!search" />
</NcAppContent> </NcAppContent>
</template> </template>
@ -14,7 +15,7 @@ import { NcAppContent, NcTextField } from '@nextcloud/vue'
import AddRss from '../components/Discover/AddRss.vue' import AddRss from '../components/Discover/AddRss.vue'
import Magnify from 'vue-material-design-icons/Magnify.vue' import Magnify from 'vue-material-design-icons/Magnify.vue'
import Search from '../components/Discover/Search.vue' import Search from '../components/Discover/Search.vue'
import TopList from '../components/Discover/TopList.vue' import Tops from '../components/Discover/Tops.vue'
export default { export default {
name: 'Discover', name: 'Discover',
@ -24,7 +25,7 @@ export default {
NcAppContent, NcAppContent,
NcTextField, NcTextField,
Search, Search,
TopList, Tops,
}, },
data() { data() {
return { return {

View File

@ -50,11 +50,11 @@ msgstr "Ajouter un lien RSS"
msgid "Could not fetch search results" msgid "Could not fetch search results"
msgstr "Impossible de récupérer les resultats de la recherche" msgstr "Impossible de récupérer les resultats de la recherche"
msgid "Hot podcasts" msgid "hot podcasts"
msgstr "Tendances" msgstr "tendances"
msgid "New podcasts" msgid "new podcasts"
msgstr "Nouveautés" msgstr "nouveautés"
msgid "Could not fetch tops" msgid "Could not fetch tops"
msgstr "Impossible de récupérer les tops" msgstr "Impossible de récupérer les tops"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Nextcloud 3.14159\n" "Project-Id-Version: Nextcloud 3.14159\n"
"Report-Msgid-Bugs-To: translations\\@example.com\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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -50,73 +50,69 @@ msgid "Could not fetch search results"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:3 #: /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" msgid "Could not fetch tops"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:6 #: /app/specialVueFakeDummyForL10nScript.js:4
msgid "${type} podcasts"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:5
msgid "Subscribe" msgid "Subscribe"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:7 #: /app/specialVueFakeDummyForL10nScript.js:6
msgid "Error while adding the feed" msgid "Error while adding the feed"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:8 #: /app/specialVueFakeDummyForL10nScript.js:7
msgid "Play" msgid "Play"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:9 #: /app/specialVueFakeDummyForL10nScript.js:8
msgid "Stop" msgid "Stop"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:10 #: /app/specialVueFakeDummyForL10nScript.js:9
msgid "Could not fetch episodes" msgid "Could not fetch episodes"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:11 #: /app/specialVueFakeDummyForL10nScript.js:10
msgid "Download" msgid "Download"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:12 #: /app/specialVueFakeDummyForL10nScript.js:11
msgid "Delete" msgid "Delete"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:13 #: /app/specialVueFakeDummyForL10nScript.js:12
msgid "Are you sure you want to delete this subscription?" msgid "Are you sure you want to delete this subscription?"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:14 #: /app/specialVueFakeDummyForL10nScript.js:13
msgid "Error while removing the feed" msgid "Error while removing the feed"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:15 #: /app/specialVueFakeDummyForL10nScript.js:14
msgid "Add a podcast" msgid "Add a podcast"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:16 #: /app/specialVueFakeDummyForL10nScript.js:15
msgid "Could not fetch subscriptions" msgid "Could not fetch subscriptions"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:17 #: /app/specialVueFakeDummyForL10nScript.js:16
msgid "Find a podcast" msgid "Find a podcast"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:18 #: /app/specialVueFakeDummyForL10nScript.js:17
msgid "Error loading feed" msgid "Error loading feed"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:19 #: /app/specialVueFakeDummyForL10nScript.js:18
msgid "Missing required app" msgid "Missing required app"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:20 #: /app/specialVueFakeDummyForL10nScript.js:19
msgid "Install GPodder Sync" msgid "Install GPodder Sync"
msgstr "" msgstr ""