bookmarks/src/components/Dashboard.vue

45 lines
1.2 KiB
Vue
Raw Normal View History

2020-10-11 11:50:16 +00:00
<!--
- Copyright (c) 2020. The Nextcloud Bookmarks contributors.
-
- This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
-->
<template>
<DashboardWidget :items="items"
:loading="loading"
:show-more-text="t('bookmarks', 'Bookmarks')"
:show-more-url="moreUrl"
:empty-content-message="t('bookmarks', 'No bookmarks found')" />
2020-10-11 11:50:16 +00:00
</template>
<script>
import { DashboardWidget } from '@nextcloud/vue-dashboard'
import { generateUrl } from '@nextcloud/router'
import { actions } from '../store'
export default {
name: 'Dashboard',
components: { DashboardWidget },
computed: {
loading() {
return Boolean(this.$store.state.loading.bookmarks)
2020-10-11 11:50:16 +00:00
},
items() {
return this.$store.state.bookmarks.map(bookmark => ({
id: bookmark.id,
targetUrl: bookmark.url,
avatarUrl: generateUrl(`/apps/bookmarks/bookmark/${bookmark.id}/favicon`),
mainText: bookmark.title,
subText: bookmark.url,
}))
},
moreUrl() {
return generateUrl('/apps/bookmarks/')
},
2020-10-11 11:50:16 +00:00
},
async mounted() {
await this.$store.dispatch(actions.FILTER_BY_RECENT)
await this.$store.dispatch(actions.FETCH_PAGE)
},
}
</script>