#291 - disable empty tabs in user profile panel

This commit is contained in:
dave 2019-02-08 05:31:06 -05:00
parent 62b3b9b8d4
commit b57b4c6e45
3 changed files with 8 additions and 3 deletions

View file

@ -37,7 +37,7 @@ export default Vue.component('tab-switcher', {
return (
<div class={ classesWrapper.join(' ')}>
<button onClick={this.activateTab(index)} class={ classesTab.join(' ') }>{slot.data.attrs.label}</button>
<button disabled={slot.data.attrs.disabled} onClick={this.activateTab(index)} class={ classesTab.join(' ') }>{slot.data.attrs.label}</button>
</div>
)
})

View file

@ -9,19 +9,20 @@
<tab-switcher :renderOnlyFocused="true">
<Timeline
:label="$t('user_card.statuses')"
:diabled="!user.statuses_count"
:embedded="true"
:title="$t('user_profile.timeline_title')"
:timeline="timeline"
:timeline-name="'user'"
:user-id="fetchBy"
/>
<div :label="$t('user_card.followees')" v-if="followsTabVisible">
<div :label="$t('user_card.followees')" v-if="followsTabVisible" :disabled="!user.friends_count">
<FollowList v-if="user.friends_count > 0" :userId="userId" :showFollowers="false" />
<div class="userlist-placeholder" v-else>
<i class="icon-spin3 animate-spin"></i>
</div>
</div>
<div :label="$t('user_card.followers')" v-if="followersTabVisible">
<div :label="$t('user_card.followers')" v-if="followersTabVisible" :disabled="!user.followers_count">
<FollowList v-if="user.followers_count > 0" :userId="userId" :showFollowers="true" />
<div class="userlist-placeholder" v-else>
<i class="icon-spin3 animate-spin"></i>
@ -29,6 +30,7 @@
</div>
<Timeline
:label="$t('user_card.media')"
:disabled="!user.media_count"
:embedded="true" :title="$t('user_card.media')"
timeline-name="media"
:timeline="media"
@ -37,6 +39,7 @@
<Timeline
v-if="isUs"
:label="$t('user_card.favorites')"
:disabled="!user.favourites_count"
:embedded="true"
:title="$t('user_card.favorites')"
timeline-name="favorites"

View file

@ -115,6 +115,8 @@ export const parseUser = (data) => {
output.locked = data.locked
output.followers_count = data.followers_count
output.statuses_count = data.statuses_count
output.favourites_count = data.favourites_count
output.media_count = data.media_count
output.friends = []
output.followers = []