1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-09-06 12:19:08 +01:00
elk/components/account/AccountCard.vue

35 lines
881 B
Vue
Raw Normal View History

<script setup lang="ts">
import type { Account } from 'masto'
2022-11-21 22:59:51 +00:00
const { account, following } = defineProps<{
account: Account
2022-11-21 22:59:51 +00:00
following?: boolean
}>()
2022-11-21 22:59:51 +00:00
const masto = await useMasto()
let isFollowing = $ref<boolean | undefined>(following)
watch($$(following), () => {
isFollowing = following
})
function unfollow() {
masto.accounts.unfollow(account.id)
isFollowing = false
}
function follow() {
masto.accounts.follow(account.id)
isFollowing = true
}
</script>
<template>
<div flex justify-between>
<AccountInfo :account="account" p3 />
<div h-full p5>
2022-11-21 22:59:51 +00:00
<div v-if="isFollowing === true" color-purple hover:color-gray hover:cursor-pointer i-ri:user-unfollow-fill @click="unfollow" />
<div v-else-if="isFollowing === false" color-gray hover:color-purple hover:cursor-pointer i-ri:user-follow-fill @click="follow" />
</div>
</div>
</template>