blob: f917ebf362e3ccb6dc1cedd0be37fc348c221783 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<template>
<NcDashboardWidget :items="items">
<template #default="{ item }">
<NcDashboardWidgetItem
:main-text="item.mainText"
:sub-text="item.subText"
:target-url="item.targetURL"
:avatar-is-no-user="true"
:avatar-url="item.favicon">
<NcDashboardWidgetItem>
</template>
</NcDashboardWidget>
</template>
<script>
import NcDashboardWidget from '@nextcloud/vue/dist/Components/NcDashboardWidget.js'
import NcDashboardWidgetItem from '@nextcloud/vue/dist/Components/NcDashboardWidgetItem'
import { loadState } from '@nextcloud/initial-state'
import { generateUrl } from '@nextcloud/router'
const newsItems = loadState('news', 'dashboard-widget-feeds')
console.log(newsItems)
export default {
name: 'NewsFeedWidget',
components: {
NcDashboardWidget,
NcDashboardWidgetItem,
},
props: [],
data() {
return {
newsItems: newsItems
}
},
computed: {
items() {
return this.newsItems.map((g) => {
return {
id: g.id,
mainText: g.title,
subText: `Unread: ${g.unreadCount}`,
targetURL: generateUrl(`/apps/news/#/items/feeds/${g.id}`),
favicon: g.faviconLink,
}
})
}
}
}
</script>
|