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 { FormattedMessage, useIntl } from 'react-intl'
|
||||||
import Timeline from './profile/Timeline'
|
import Timeline from './profile/Timeline'
|
||||||
import Followings from './profile/Followings'
|
import Followings from './profile/Followings'
|
||||||
|
import Followers from './profile/Followers'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
client: MegalodonInterface
|
client: MegalodonInterface
|
||||||
|
@ -116,7 +117,7 @@ export default function Profile(props: Props) {
|
||||||
<Followings client={props.client} user_id={props.user_id} />
|
<Followings client={props.client} user_id={props.user_id} />
|
||||||
</Tabs.Item>
|
</Tabs.Item>
|
||||||
<Tabs.Item title={formatMessage({ id: 'profile.followers' })} className="focus:ring-0">
|
<Tabs.Item title={formatMessage({ id: 'profile.followers' })} className="focus:ring-0">
|
||||||
followers
|
<Followers client={props.client} user_id={props.user_id} />
|
||||||
</Tabs.Item>
|
</Tabs.Item>
|
||||||
</Tabs.Group>
|
</Tabs.Group>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -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…
Reference in New Issue