so://phie

verbal

A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal

blob: 316ae6af63fecd69786aac67f8267467027c6ff2 (2461 bytes)[doc][blame][raw]

1import {$lang, http} from '../utils.js';

2import VIcon from '../element/icon.js';

3import VPlayer from '../component/player.js';

4import VTab from '../component/tab.js';

5import VStation from '../component/station.js';

6

7export default {

8 props: ['state'],

9 data() {

10 return {

11 query: {

12 name: '',

13 page: 0

14 },

15 results: [],

16 loading: false,

17 more: true

18 };

19 },

20 components: {

21 VIcon,

22 VTab,

23 VPlayer,

24 VStation

25 },

26 methods: {

27 $lang,

28 async doSearch() {

29 this.results = [];

30 this.loading = true;

31 const result = await http`get::/api/search`(this.query);

32 this.loading = false;

33 this.results = result;

34 }

35 },

36 mounted() {

37 this.doSearch();

38 },

39 template: `

40 <v-tab id="search" :tab="state.tab" @show="doSearch">

41 <v-player :station="state.station"></v-player>

42 <input

43 v-model="query.name"

44 @keyup.enter="doSearch"

45 type="text"

46 :placeholder="$lang('search.input.placeholder')"

47 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"

48 spellcheck="false"

49 autocomplete="off"

50 >

51 <ul class="flex flex-col">

52 <li

53 :key="station.id"

54 v-for="station in results"

55 class="border-t sm:border-t-2 first:border-none border-zinc-900 py-5 first:pt-0"

56 >

57 <v-station :station="station"></v-station>

58 </li>

59 </ul>

60 <div

61 v-show="loading"

62 class="w-[60px] h-[60px] select-none pointer-events-none mx-auto"

63 >

64 <v-icon

65 id="loader"

66 class="bg-gray-400 animate-spin"

67 style="animation-duration: 2s;"

68 size="80%"

69 ></v-icon>

70 </div>

71 <div

72 v-if="!more && results.length > 0"

73 class="text-zinc-400 text-md mx-auto pb-6"

74 >

75 {{$lang('search.list.end')}}

76 </div>

77 </v-tab>

78 `

79}