2022-06-18 03:28:16 +00:00
|
|
|
import { DonationTxn } from 'common/txn'
|
2022-05-02 15:23:12 +00:00
|
|
|
import { Avatar } from '../avatar'
|
2022-07-14 00:43:20 +00:00
|
|
|
import { useUserById } from 'web/hooks/use-user'
|
2022-05-02 15:23:12 +00:00
|
|
|
import { UserLink } from '../user-page'
|
2022-05-10 18:14:24 +00:00
|
|
|
import { manaToUSD } from '../../../common/util/format'
|
2022-05-05 22:30:30 +00:00
|
|
|
import { RelativeTimestamp } from '../relative-timestamp'
|
2022-05-02 15:23:12 +00:00
|
|
|
|
2022-06-18 03:28:16 +00:00
|
|
|
export function Donation(props: { txn: DonationTxn }) {
|
2022-05-02 15:23:12 +00:00
|
|
|
const { txn } = props
|
|
|
|
const user = useUserById(txn.fromId)
|
|
|
|
|
|
|
|
if (!user) {
|
|
|
|
return <>Loading...</>
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="mb-2 flow-root pr-2 md:pr-0">
|
|
|
|
<div className="relative flex items-center space-x-3">
|
2022-06-01 03:02:50 +00:00
|
|
|
<Avatar username={user.username} avatarUrl={user.avatarUrl} size="sm" />
|
2022-05-02 15:23:12 +00:00
|
|
|
<div className="min-w-0 flex-1">
|
|
|
|
<p className="mt-0.5 text-sm text-gray-500">
|
|
|
|
<UserLink
|
|
|
|
className="text-gray-500"
|
|
|
|
username={user.username}
|
|
|
|
name={user.name}
|
|
|
|
/>{' '}
|
|
|
|
donated {manaToUSD(txn.amount)}
|
|
|
|
<RelativeTimestamp time={txn.createdTime} />
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|