Render recent statuses on Status show page

This commit is contained in:
Angelina Filippova 2020-05-02 16:59:14 +03:00
parent 5fe5b38c13
commit 7cf2878eb8

View file

@ -29,6 +29,18 @@
<div class="status-container"> <div class="status-container">
<status :status="status" :account="user" :show-checkbox="false" :godmode="showPrivate"/> <status :status="status" :account="user" :show-checkbox="false" :godmode="showPrivate"/>
</div> </div>
<div class="recent-statuses-container">
<h2 class="recent-statuses">{{ $t('userProfile.recentStatuses') }} by {{ user.display_name }}</h2>
<el-checkbox v-model="showPrivate" class="show-private-statuses" @change="onTogglePrivate">
{{ $t('statuses.showPrivateStatuses') }}
</el-checkbox>
<el-timeline v-if="!statusesLoading" class="statuses">
<el-timeline-item v-for="status in statuses" :key="status.id">
<status :status="status" :account="status.account" :show-checkbox="false" :user-id="user.id" :godmode="showPrivate"/>
</el-timeline-item>
<p v-if="statuses.length === 0" class="no-statuses">{{ $t('userProfile.noStatuses') }}</p>
</el-timeline>
</div>
</div> </div>
</template> </template>
@ -42,7 +54,7 @@ export default {
components: { ModerationDropdown, RebootButton, Status }, components: { ModerationDropdown, RebootButton, Status },
data() { data() {
return { return {
showPrivate: true, showPrivate: false,
resetPasswordDialogOpen: false resetPasswordDialogOpen: false
} }
}, },
@ -62,6 +74,12 @@ export default {
status() { status() {
return this.$store.state.status.fetchedStatus return this.$store.state.status.fetchedStatus
}, },
statuses() {
return this.$store.state.userProfile.statuses
},
statusesLoading() {
return this.$store.state.userProfile.statusesLoading
},
user() { user() {
return this.$store.state.status.fetchedStatus.account return this.$store.state.status.fetchedStatus.account
} }
@ -70,11 +88,15 @@ export default {
this.$store.dispatch('NeedReboot') this.$store.dispatch('NeedReboot')
this.$store.dispatch('GetNodeInfo') this.$store.dispatch('GetNodeInfo')
this.$store.dispatch('FetchStatus', this.$route.params.id) this.$store.dispatch('FetchStatus', this.$route.params.id)
this.$store.dispatch('FetchUserStatuses', { userId: this.user.id, godmode: this.showPrivate })
}, },
methods: { methods: {
accountExists(account, key) { accountExists(account, key) {
return account[key] return account[key]
}, },
onTogglePrivate() {
this.$store.dispatch('FetchUserStatuses', { userId: this.user.id, godmode: this.showPrivate })
},
openResetPasswordDialog() { openResetPasswordDialog() {
this.resetPasswordDialogOpen = true this.resetPasswordDialogOpen = true
} }
@ -87,13 +109,31 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.no-statuses {
margin-left: 28px;
color: #606266;
}
.reboot-button { .reboot-button {
padding: 10px; padding: 10px;
margin-left: 6px; margin-left: 6px;
} }
.recent-statuses {
margin-left: 28px;
}
.recent-statuses-container {
display: flex;
flex-direction: column;
}
.show-private-statuses {
margin-left: 28px;
margin-bottom: 20px;
}
.status-container { .status-container {
margin: 0 15px 0 20px; margin: 0 15px 0 20px;
} }
.statuses {
padding: 0 20px 0 0;
}
.user-page-header { .user-page-header {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@ -113,6 +153,16 @@ export default {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.recent-statuses {
margin: 20px 10px 15px 10px;
}
.recent-statuses-container {
width: 100%;
margin: 0 10px;
}
.show-private-statuses {
margin: 0 10px 20px 10px;
}
.user-page-header { .user-page-header {
padding: 0; padding: 0;
margin: 7px 15px 15px 10px; margin: 7px 15px 15px 10px;
@ -125,6 +175,16 @@ export default {
} }
} }
@media only screen and (max-width:801px) and (min-width: 481px) { @media only screen and (max-width:801px) and (min-width: 481px) {
.recent-statuses {
margin: 20px 10px 15px 0;
}
.recent-statuses-container {
width: 97%;
margin: 0 20px;
}
.show-private-statuses {
margin: 0 10px 20px 0;
}
.user-page-header { .user-page-header {
padding: 0; padding: 0;
margin: 7px 15px 20px 20px; margin: 7px 15px 20px 20px;