A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
blob: 0916d8f1d683f5537bda95780b0e11c86a480feb (1624 bytes)[doc][blame][raw]
1
import {$lang, http} from '../utils.js';2
import VIcon from '../element/icon.js';3
import VPlayer from '../component/player.js';4
import VTab from '../component/tab.js';5
import VStation from '../component/station.js';7
export default {8
props: ['state'],9
data() {10
return {11
results: [],12
loading: false13
};14
},15
components: {16
VIcon,17
VTab,18
VPlayer,19
VStation20
},21
methods: {22
$lang,23
async doFetch() {24
this.loading = true;25
const result = await http`get::/api/favorite`();26
this.loading = false;27
this.results = result;28
}29
},30
mounted() {31
this.doFetch();32
},33
template: `34
<v-tab id="favorites" :tab="state.tab">35
<v-player :station="state.station"></v-player>36
<ul class="flex flex-col">37
<li38
:key="station.id"39
v-for="station in results"40
class="border-t sm:border-t-2 first:border-none border-zinc-900 py-5 first:pt-0"41
>42
<v-station :station="station"></v-station>43
</li>44
</ul>45
<div46
v-show="loading"47
class="w-[60px] h-[60px] select-none pointer-events-none mx-auto"48
>49
<v-icon50
id="loader"51
class="bg-gray-400 animate-spin"52
style="animation-duration: 2s;"53
size="80%"54
></v-icon>55
</div>56
</v-tab>57
`58
}