A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
blob: 77137058002dd15a05c5551ba9d44c94fd042c3c (2185 bytes)[doc][blame][raw]
1
import {$lang, $route, http, duration} from '../utils.js';2
import VTab from '../component/tab.js';3
import VButton from '../element/button.js';4
import VIcon from '../element/icon.js';6
export default {7
props: ['state'],8
data() {9
return {10
account: null11
};12
},13
components: {14
VTab,15
VButton,16
VIcon17
},18
methods: {19
$lang,20
$route,21
duration,22
async show(id) {23
this.account = await http`get::/api/account/${id}`();24
if(this.account === null) {25
$route('@not-found', { update: false });26
return;27
}28
}29
},30
mounted() {31
const path = window.location.pathname;32
if(/^\/profile$/.test(path)) {33
this.show(this.state.account.id);34
return;35
}36
const match = /^\/profile\/(\d+)$/.exec(path);37
if(match) {38
const id = match[1];39
this.show(id);40
}41
},42
template: `43
<v-tab id="profile" :tab="state.tab">44
<div v-if="account" class="flex flex-col flex-1 gap-[32px] pb-8 sm:pb-[100px] pt-2">45
<p46
class="text-[24px] md:text-[36px] font-[600] text-gray-100 pb-0 overflow-hidden text-ellipsis whitespace-nowrap"47
>48
{{account.name}}49
</p>50
<span class="text-md text-gray-400 overflow-hidden flex flex-wrap gap-x-3 gap-y-1 pt-1">51
<span52
v-if="account.playtime && duration(account.playtime ?? 0).length > 0"53
class="text-gray-400 inline-flex items-center gap-[5px]"54
:title="$lang('detail.playtime')"55
>56
<v-icon57
id="headphones"58
class="w-[18px] h-[18px] !min-w-[18px] inline-flex text-gray-400"59
size="100%"60
></v-icon>61
<p>{{duration(account.playtime ?? 0)}}</p>62
</span>63
</span>64
</div>65
</v-tab>66
`67
}