add animation for following someone
This commit is contained in:
parent
80c92ac33d
commit
15133c276b
|
@ -30,6 +30,7 @@
|
||||||
pressed="{{following}}"
|
pressed="{{following}}"
|
||||||
big="true"
|
big="true"
|
||||||
on:click="onFollowButtonClick()"
|
on:click="onFollowButtonClick()"
|
||||||
|
animation="{{animateFollowButton && followButtonAnimation}}"
|
||||||
/>
|
/>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -189,8 +190,25 @@
|
||||||
import { store } from '../_store/store'
|
import { store } from '../_store/store'
|
||||||
import { setAccountFollowed } from '../_actions/follow'
|
import { setAccountFollowed } from '../_actions/follow'
|
||||||
import { database } from '../_database/database'
|
import { database } from '../_database/database'
|
||||||
|
import { FOLLOW_BUTTON_ANIMATION } from '../_static/animations'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
methods: {
|
||||||
|
async onFollowButtonClick() {
|
||||||
|
let accountId = this.get('profile').id
|
||||||
|
let instanceName = this.store.get('currentInstance')
|
||||||
|
let following = this.get('following')
|
||||||
|
let followRequested = this.get('followRequested')
|
||||||
|
this.set({animateFollowButton: true})
|
||||||
|
await setAccountFollowed(accountId, !(following || followRequested))
|
||||||
|
let relationship = await database.getRelationship(instanceName, accountId)
|
||||||
|
this.set({relationship})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
store: () => store,
|
||||||
|
data: () => ({
|
||||||
|
followButtonAnimation: FOLLOW_BUTTON_ANIMATION
|
||||||
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
headerIsMissing: (profile) => profile.header.endsWith('missing.png'),
|
headerIsMissing: (profile) => profile.header.endsWith('missing.png'),
|
||||||
note: (profile) => profile.note,
|
note: (profile) => profile.note,
|
||||||
|
@ -222,17 +240,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
async onFollowButtonClick() {
|
|
||||||
let accountId = this.get('profile').id
|
|
||||||
let instanceName = this.store.get('currentInstance')
|
|
||||||
let following = this.get('following')
|
|
||||||
let followRequested = this.get('followRequested')
|
|
||||||
await setAccountFollowed(accountId, !(following || followRequested))
|
|
||||||
this.set({relationship: await database.getRelationship(instanceName, accountId)})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
store: () => store,
|
|
||||||
components: {
|
components: {
|
||||||
IconButton,
|
IconButton,
|
||||||
ExternalLink,
|
ExternalLink,
|
||||||
|
|
|
@ -23,3 +23,17 @@ export const FAVORITE_ANIMATION = [
|
||||||
]
|
]
|
||||||
|
|
||||||
export const REBLOG_ANIMATION = FAVORITE_ANIMATION
|
export const REBLOG_ANIMATION = FAVORITE_ANIMATION
|
||||||
|
|
||||||
|
export const FOLLOW_BUTTON_ANIMATION = [
|
||||||
|
{
|
||||||
|
properties: [
|
||||||
|
{transform: 'scale(1)'},
|
||||||
|
{transform: 'scale(2)'},
|
||||||
|
{transform: 'scale(1)'}
|
||||||
|
],
|
||||||
|
options: {
|
||||||
|
duration: 400,
|
||||||
|
easing: 'ease-in-out'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
Loading…
Reference in a new issue