A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
blob: 38941294bcd332b238a321e9e3317968379c9020 (2413 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
query: {12
name: '',13
page: 014
},15
results: [],16
loading: false,17
more: true18
};19
},20
components: {21
VIcon,22
VTab,23
VPlayer,24
VStation25
},26
methods: {27
$lang,28
async doSearch() {29
this.loading = true;30
const result = await http`get::/api/search`(this.query);31
this.loading = false;32
this.results = result;33
}34
},35
mounted() {36
this.doSearch();37
},38
template: `39
<v-tab id="search" :tab="state.tab">40
<v-player :station="state.station"></v-player>41
<input42
v-model="query.name"43
@keyup.enter="doSearch"44
type="text"45
:placeholder="$lang('search.input.placeholder')"46
class="w-full h-[56px] px-5 text-lg rounded-lg bg-zinc-900 text-white font-medium placeholder:font-normal placeholder:text-gray-500 focus:placeholder:text-gray-600 outline-none"47
spellcheck="false"48
autocomplete="off"49
>50
<ul class="flex flex-col">51
<li52
:key="station.id"53
v-for="station in results"54
class="border-t sm:border-t-2 first:border-none border-zinc-900 py-5 first:pt-0"55
>56
<v-station :station="station"></v-station>57
</li>58
</ul>59
<div60
v-show="loading"61
class="w-[60px] h-[60px] select-none pointer-events-none mx-auto"62
>63
<v-icon64
id="loader"65
class="bg-gray-400 animate-spin"66
style="animation-duration: 2s;"67
size="80%"68
></v-icon>69
</div>70
<div71
v-if="!more && results.length > 0"72
class="text-zinc-400 text-md mx-auto pb-6"73
>74
{{$lang('search.list.end')}}75
</div>76
</v-tab>77
`78
}