mock following count increase

This commit is contained in:
Grzegorz Leoniec 2018-10-16 11:18:07 +02:00
parent 98df6ed1f5
commit 4d950ca6be
2 changed files with 24 additions and 10 deletions

View File

@ -2,7 +2,7 @@
<v-popover <v-popover
:open.sync="isPopoverOpen" :open.sync="isPopoverOpen"
:disabled="!hasAuthor || !showAuthorPopover" :disabled="!hasAuthor || !showAuthorPopover"
:open-group="Math.random()" :open-group="Math.random().toString()"
placement="top-start" placement="top-start"
trigger="manual" trigger="manual"
offset="5"> offset="5">
@ -14,7 +14,7 @@
<ds-avatar <ds-avatar
:image="author.avatar" :image="author.avatar"
:name="author.name" :name="author.name"
size="32px" /> <b class="username">{{ author.name }}</b> size="32px" /> <b class="username">{{ author.name | truncate(trunc) }}</b>
</a> </a>
<div <div
slot="popover" slot="popover"
@ -46,18 +46,25 @@
<ds-space margin="small"> <ds-space margin="small">
<ds-text <ds-text
size="x-large" size="x-large"
style="margin-bottom: 0; text-align: center">{{ author.followedByCount }}</ds-text> style="margin-bottom: 0; text-align: center">{{ fanCount }}</ds-text>
<ds-text <ds-text
size="small" size="small"
style="text-align: center">Fans</ds-text> style="text-align: center">Fans</ds-text>
</ds-space> </ds-space>
</ds-flex-item> </ds-flex-item>
</ds-flex> </ds-flex>
<!--<ds-text
color="soft"
size="small">
<ds-icon name="map-marker" /> Hamburg, Deutschland
</ds-text>-->
<ds-flex <ds-flex
gutter="x-small" gutter="x-small"
style="margin-bottom: 0;"> style="margin-bottom: 0;">
<ds-flex-item :width="{base: 3}"> <ds-flex-item :width="{base: 3}">
<hc-follow-button :follow-id="author.id" /> <hc-follow-button
:follow-id="author.id"
@update="voted = true" />
</ds-flex-item> </ds-flex-item>
<ds-flex-item :width="{base: 1}" > <ds-flex-item :width="{base: 1}" >
<ds-button full-width> <ds-button full-width>
@ -83,14 +90,24 @@ export default {
}, },
props: { props: {
post: { type: Object, default: null }, post: { type: Object, default: null },
trunc: { type: Number, default: null },
showAuthorPopover: { type: Boolean, default: true } showAuthorPopover: { type: Boolean, default: true }
}, },
data() { data() {
return { return {
isPopoverOpen: false isPopoverOpen: false,
voted: false
} }
}, },
computed: { computed: {
fanCount() {
let count = Number(this.author.followedByCount) || 0
if (this.voted) {
// NOTE: this is used for presentation
count += 1
}
return count
},
author() { author() {
return this.hasAuthor return this.hasAuthor
? this.post.author.User ? this.post.author.User

View File

@ -1,6 +1,6 @@
<template> <template>
<ds-button <ds-button
:disabled="disabled" :disabled="disabled || !followId"
icon="plus" icon="plus"
primary primary
full-width full-width
@ -14,10 +14,7 @@ export default {
name: 'HcFollowButton', name: 'HcFollowButton',
props: { props: {
followId: { followId: { type: String, default: null }
type: String,
required: true
}
}, },
data() { data() {
return { return {