2023-07-02 22:12:40 +00:00
|
|
|
<template>
|
|
|
|
<fragment>
|
2023-07-28 00:37:57 +00:00
|
|
|
<p>
|
2023-07-03 15:30:09 +00:00
|
|
|
<span>{{ t('Discover') }}</span>
|
2023-07-03 06:42:00 +00:00
|
|
|
</p>
|
2023-07-02 22:12:40 +00:00
|
|
|
<p>
|
|
|
|
<NcLoadingIcon v-if="loading" />
|
|
|
|
<ul v-if="!loading" class="tops">
|
2023-07-25 19:44:25 +00:00
|
|
|
<li v-for="top in tops" :key="top.id">
|
2023-07-29 15:53:51 +00:00
|
|
|
<TopItem :author="top.author"
|
|
|
|
:img-url="top.imgURL"
|
|
|
|
:xml-url="top.xmlURL" />
|
2023-07-02 22:12:40 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
2023-07-25 19:44:25 +00:00
|
|
|
<span class="caption">{{ t('Suggests by fyyd') }}</span>
|
2023-07-02 22:12:40 +00:00
|
|
|
</p>
|
|
|
|
</fragment>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-07-28 00:37:57 +00:00
|
|
|
import { NcLoadingIcon } from '@nextcloud/vue'
|
2023-07-25 20:07:35 +00:00
|
|
|
import TopItem from './TopItem.vue'
|
2023-07-02 22:12:40 +00:00
|
|
|
import axios from '@nextcloud/axios'
|
|
|
|
import { generateUrl } from '@nextcloud/router'
|
|
|
|
import { showError } from '@nextcloud/dialogs'
|
|
|
|
|
|
|
|
export default {
|
2023-07-25 20:07:35 +00:00
|
|
|
name: 'TopList',
|
2023-07-02 22:12:40 +00:00
|
|
|
components: {
|
|
|
|
NcLoadingIcon,
|
2023-07-25 20:07:35 +00:00
|
|
|
TopItem,
|
2023-07-02 22:12:40 +00:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
tops: [],
|
|
|
|
loading: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
async mounted() {
|
2023-07-28 00:37:57 +00:00
|
|
|
try {
|
|
|
|
this.loading = true
|
|
|
|
const top = await axios.get(generateUrl('/apps/repod/top'))
|
|
|
|
this.tops = top.data.data
|
|
|
|
} catch (e) {
|
|
|
|
console.error(e)
|
|
|
|
showError(t('Could not fetch tops'))
|
|
|
|
} finally {
|
|
|
|
this.loading = false
|
|
|
|
}
|
2023-07-02 22:12:40 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.tops {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
gap: 2rem 5%;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tops li {
|
|
|
|
flex-basis: 15%;
|
|
|
|
}
|
|
|
|
|
2023-07-03 06:42:00 +00:00
|
|
|
.caption {
|
|
|
|
float: right;
|
|
|
|
font-size: small;
|
|
|
|
margin: .5rem;
|
|
|
|
}
|
2023-07-02 22:12:40 +00:00
|
|
|
</style>
|