blob: 8971fcdf645bef2e6360c9eb7134768a9e7069da (
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
<template>
<NcAppContent
:show-details="showDetails"
@update:showDetails="unselectItem()"
>
<template #list>
<NcAppContentList>
<div class="header">
<slot name="header"></slot>
</div>
<FeedItemDisplayList
:items="items"
:fetch-key="fetchKey"
:config="config"
@load-more="emit('load-more')"
/>
</NcAppContentList>
</template>
<NcAppContentDetails class="content-details-container">
<FeedItemDisplay v-if="selectedFeedItem" :item="selectedFeedItem" />
</NcAppContentDetails>
</NcAppContent>
</template>
<script setup lang="ts">
import { PropType, computed, ref, watch } from 'vue';
import itemStore from '../store/item';
import NcAppContent from '@nextcloud/vue/dist/Components/NcAppContent';
import NcAppContentList from '@nextcloud/vue/dist/Components/NcAppContentList';
import NcAppContentDetails from '@nextcloud/vue/dist/Components/NcAppContentDetails';
import {FeedItem} from '../types/FeedItem';
import FeedItemDisplayList from './feed-display/FeedItemDisplayList.vue';
import FeedItemDisplay from './feed-display/FeedItemDisplay.vue';
defineProps({
items: {
type: Array as PropType<Array<FeedItem>>,
required: true
},
fetchKey: {
type: String,
required: true
},
config: {
type: Object
}
})
const emit = defineEmits<{
(event: 'load-more'): void
}>();
const showDetails = ref(false);
const selectedFeedItem = computed(() => {
return itemStore.getters.selected(itemStore.state);
})
watch(selectedFeedItem, (newSelectedFeedItem) => {
if (newSelectedFeedItem) {
showDetails.value = true;
} else {
showDetails.value = false;
}
})
function unselectItem() {
itemStore.mutations.SET_SELECTED_ITEM(
itemStore.state,
{id: undefined}
);
}
</script>
<style scoped>
.header {
padding-left: 50px;
position: absolute;
top: 1em;
font-weight: 700;
}
.content-details-container {
height: 100%
}
</style>
|