Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Hau Vo
pleroma-fe
Commits
9ca805a9
Commit
9ca805a9
authored
Feb 25, 2019
by
Tae Hoon
Browse files
Add new FollowCard component
parent
1337e42b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/components/follow_card/follow_card.js
0 → 100644
View file @
9ca805a9
import
BasicUserCard
from
'
../basic_user_card/basic_user_card.vue
'
import
{
requestFollow
,
requestUnfollow
}
from
'
../../services/follow_manipulate/follow_manipulate
'
const
FollowCard
=
{
props
:
[
'
user
'
,
'
noFollowsYou
'
],
data
()
{
return
{
progress
:
false
,
requestSent
:
false
,
updated
:
false
}
},
components
:
{
BasicUserCard
},
computed
:
{
isMe
()
{
return
this
.
$store
.
state
.
users
.
currentUser
.
id
===
this
.
user
.
id
},
following
()
{
return
this
.
updated
?
this
.
updated
.
following
:
this
.
user
.
following
},
showFollow
()
{
return
!
this
.
following
||
this
.
updated
&&
!
this
.
updated
.
following
}
},
methods
:
{
followUser
()
{
this
.
progress
=
true
requestFollow
(
this
.
user
,
this
.
$store
).
then
(({
sent
,
updated
})
=>
{
this
.
progress
=
false
this
.
requestSent
=
sent
this
.
updated
=
updated
})
},
unfollowUser
()
{
this
.
progress
=
true
requestUnfollow
(
this
.
user
,
this
.
$store
).
then
(({
updated
})
=>
{
this
.
progress
=
false
this
.
updated
=
updated
})
}
}
}
export
default
FollowCard
src/components/follow_card/follow_card.vue
0 → 100644
View file @
9ca805a9
<
template
>
<basic-user-card
:user=
"user"
>
<template
slot=
"secondary-area"
>
<div
class=
"follow-box"
>
<button
v-if=
"showFollow"
class=
"btn btn-default"
@
click=
"followUser"
:disabled=
"progress"
:title=
"requestSent ? $t('user_card.follow_again') : ''"
>
<template
v-if=
"progress"
>
{{
$t
(
'
user_card.follow_progress
'
)
}}
</
template
>
<
template
v-else-if=
"requestSent"
>
{{
$t
(
'
user_card.follow_sent
'
)
}}
</
template
>
<
template
v-else
>
{{
$t
(
'
user_card.follow
'
)
}}
</
template
>
</button>
<button
v-if=
"following"
class=
"btn btn-default pressed"
@
click=
"unfollowUser"
:disabled=
"progress"
>
<
template
v-if=
"progress"
>
{{
$t
(
'
user_card.follow_progress
'
)
}}
</
template
>
<
template
v-else
>
{{
$t
(
'
user_card.follow_unfollow
'
)
}}
</
template
>
</button>
</div>
</template>
<
template
slot=
"third-area"
>
<span
class=
"faint"
v-if=
"!noFollowsYou && user.follows_you"
>
{{
isMe
?
$t
(
'
user_card.its_you
'
)
:
$t
(
'
user_card.follows_you
'
)
}}
</span>
</
template
>
</basic-user-card>
</template>
<
script
src=
"./follow_card.js"
></
script
>
src/components/user_profile/user_profile.js
View file @
9ca805a9
import
{
compose
}
from
'
vue-compose
'
import
get
from
'
lodash/get
'
import
UserCardContent
from
'
../user_card_content/user_card_content.vue
'
import
User
Card
from
'
../
user_card/user
_card.vue
'
import
Follow
Card
from
'
../
follow_card/follow
_card.vue
'
import
Timeline
from
'
../timeline/timeline.vue
'
import
withLoadMore
from
'
../../hocs/with_load_more/with_load_more
'
import
withList
from
'
../../hocs/with_list/with_list
'
...
...
@@ -15,7 +15,7 @@ const FollowerList = compose(
additionalPropNames
:
[
'
userId
'
]
}),
withList
({
getEntryProps
:
user
=>
({
user
})
})
)(
User
Card
)
)(
Follow
Card
)
const
FriendList
=
compose
(
withLoadMore
({
...
...
@@ -26,7 +26,7 @@ const FriendList = compose(
additionalPropNames
:
[
'
userId
'
]
}),
withList
({
getEntryProps
:
user
=>
({
user
})
})
)(
User
Card
)
)(
Follow
Card
)
const
UserProfile
=
{
data
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment