import emojify from '@/utils/emojify' import { Avatar, Button, CustomFlowbiteTheme, Dropdown, Flowbite, Tabs } from 'flowbite-react' import { Entity, MegalodonInterface } from 'megalodon' import { useEffect, useState } from 'react' import { FaEllipsisVertical } from 'react-icons/fa6' import { FormattedMessage, useIntl } from 'react-intl' import Timeline from './profile/Timeline' type Props = { client: MegalodonInterface user_id: string } const customTheme: CustomFlowbiteTheme = { tab: { tablist: { tabitem: { base: 'flex items-center justify-center p-4 rounded-t-lg text-sm font-medium first:ml-0 disabled:cursor-not-allowed disabled:text-gray-400 disabled:dark:text-gray-500' } } } } export default function Profile(props: Props) { const [user, setUser] = useState(null) const [relationship, setRelationship] = useState(null) const { formatMessage } = useIntl() useEffect(() => { const f = async () => { if (props.user_id) { const res = await props.client.getAccount(props.user_id) setUser(res.data) const rel = await props.client.getRelationship(props.user_id) setRelationship(rel.data) } } f() }, [props.user_id, props.client]) const follow = async (id: string) => { const rel = await props.client.followAccount(id) setRelationship(rel.data) } const unfollow = async (id: string) => { const rel = await props.client.unfollowAccount(id) setRelationship(rel.data) } const openOriginal = async (url: string) => { global.ipc.invoke('open-browser', url) } return (
{user && relationship && ( <>
header image
{relationship.following ? ( ) : ( )} ( )} > openOriginal(user.url)}>
{user.display_name}
@{user.acct}
{user.fields.map((data, index) => (
{data.name}
))}
followings followers
)}
) }