mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-02-03 18:57:43 +01:00
Add followers in profile
This commit is contained in:
parent
482034fe86
commit
555fb288d1
@ -6,6 +6,7 @@ import { FaEllipsisVertical } from 'react-icons/fa6'
|
||||
import { FormattedMessage, useIntl } from 'react-intl'
|
||||
import Timeline from './profile/Timeline'
|
||||
import Followings from './profile/Followings'
|
||||
import Followers from './profile/Followers'
|
||||
|
||||
type Props = {
|
||||
client: MegalodonInterface
|
||||
@ -116,7 +117,7 @@ export default function Profile(props: Props) {
|
||||
<Followings client={props.client} user_id={props.user_id} />
|
||||
</Tabs.Item>
|
||||
<Tabs.Item title={formatMessage({ id: 'profile.followers' })} className="focus:ring-0">
|
||||
followers
|
||||
<Followers client={props.client} user_id={props.user_id} />
|
||||
</Tabs.Item>
|
||||
</Tabs.Group>
|
||||
</div>
|
||||
|
30
renderer/components/detail/profile/Followers.tsx
Normal file
30
renderer/components/detail/profile/Followers.tsx
Normal file
@ -0,0 +1,30 @@
|
||||
import { Entity, MegalodonInterface } from 'megalodon'
|
||||
import { useEffect, useState } from 'react'
|
||||
import User from './User'
|
||||
|
||||
type Props = {
|
||||
client: MegalodonInterface
|
||||
user_id: string
|
||||
}
|
||||
|
||||
export default function Followers(props: Props) {
|
||||
const [users, setUsers] = useState<Array<Entity.Account>>([])
|
||||
|
||||
useEffect(() => {
|
||||
if (props.user_id) {
|
||||
const f = async () => {
|
||||
const res = await props.client.getAccountFollowers(props.user_id)
|
||||
setUsers(res.data)
|
||||
}
|
||||
f()
|
||||
}
|
||||
}, [props.client, props.user_id])
|
||||
|
||||
return (
|
||||
<>
|
||||
{users.map((user, index) => (
|
||||
<User user={user} key={index} />
|
||||
))}
|
||||
</>
|
||||
)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user