blob: db3b45cfd462fca3867be664c9131affd2e9075d (
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
<script setup>
import { useLogger } from '@/logger.js'
import { LastUpdate, ProgressTime } from '@/components'
const props = defineProps({
sub: {
type: Object,
default: undefined
}
});
defineEmits(['unsubscribe']);
const { copiedPodcast, copiedPodcastError } = useLogger();
// share or copy the url of the podcast to clipboard
async function sharePodcast() {
const shareData = {
title: props.sub.title,
url: props.sub.url
};
// share API
try {
await navigator.share(shareData);
return;
} catch (err) {
console.error(err);
}
// clipboard API
try {
await navigator.clipboard.writeText(shareData.url)
copiedPodcast();
return;
} catch (err) {
console.error(err);
}
copiedPodcastError();
}
</script>
<template>
<div class="card">
<!-- title and timestamp -->
<div
class="card-header d-flex gap-3 py-3"
data-bs-toggle="collapse"
:data-bs-target="'#e' + $.uid"
>
<!-- Podcast Icon -->
<i
class="fa fa-podcast rounded-circle flex-shring-0"
style="font-size: 32px"
/>
<div class="d-flex gap-2 w-100 justify-content-between">
<!-- Title -->
<div>
<h6 class="mb-0">
{{ sub.title || sub.url }}
</h6>
</div>
<div class="text-nowrap">
<!-- Timestamp -->
<small class="opacity-50">
<LastUpdate :unix="sub.timestamp * 1" />
</small>
<!-- Trash Button to unscubscribe from podcast -->
<!-- opens modal and emits unsubscribe event -->
<button
class="btn mx-2 btn-danger"
data-bs-toggle="modal"
data-bs-target="#delete-subs"
@click="$emit('unsubscribe', props.sub)"
>
<i class="fa fa-trash-can" />
</button>
<!-- Share Button (@click.stop should stops card to open but doesn't) -->
<button
class="btn ml-2 btn-secondary"
@click="sharePodcast"
>
<i class="fa fa-share" />
</button>
</div>
</div>
</div>
<!-- episode list -->
<div
:id="'e' + $.uid"
class="collapse"
data-bs-parent="#episodes-accordion"
>
<div class="card-body">
<ol>
<li
v-for="(episode, index) in sub.episodes"
:key="index"
>
{{ episode.title }}
<span class="opacity-50 float-end">
<ProgressTime :unix="episode.position" />/
<ProgressTime :unix="episode.total" />
</span>
</li>
</ol>
</div>
</div>
</div>
</template>
<style scoped>
</style>
|