A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
blob: 9acf19a51115f7902c9d828232e44b090488b1e0 (1807 bytes)[doc][blame][raw]
1
import {http} from './utils.js';2
import VMenu from './component/menu.js';3
import VPlayer from './component/player.js';4
import VSearch from './page/search.js';5
import VFavorites from './page/favorites.js';6
import VAccount from './page/account.js';8
export const state = {9
app: null,10
tab: 'account',11
account: {12
username: '',13
language: 'en'14
},15
station: null16
};18
(async () => {19
state.locale = await http`get::/asset/json/locale.json`();21
new Vue({22
el: '#app',23
data: {24
state25
},26
components: {27
VMenu,28
VSearch,29
VFavorites,30
VAccount,31
VPlayer32
},33
mounted() {34
document.body.style.display = '';35
state.app = this;36
this.init();37
},38
methods: {39
async init() {40
window.app = this;41
state.account = await http`get::/api/account`();42
document.addEventListener('scroll', this.onScroll);43
document.addEventListener('wheel', this.onScroll);44
},45
onScroll() {46
if(window.innerHeight + window.pageYOffset >= document.body.offsetHeight - 200) {47
this.$refs.search.doSearchMore();48
}49
}50
},51
template: `52
<div class="px-4 sm:px-10 pb-8 sm:pb-[100px] max-w-[800px] mx-auto flex flex-col">53
<v-menu :state="state"></v-menu>54
<v-player :station="state.station"></v-player>55
<v-search ref="search" :state="state"></v-search>56
<v-favorites ref="favorites" :state="state"></v-favorites>57
<v-account :state="state"></v-account>58
</div>59
`60
});61
})();