feat: zap account directly
This commit is contained in:
parent
20ecc0586c
commit
f1d6d32f92
|
@ -75,6 +75,7 @@ const messages = defineMessages({
|
|||
profileExternal: { id: 'account.profile_external', defaultMessage: 'View profile on {domain}' },
|
||||
header: { id: 'account.header.alt', defaultMessage: 'Profile header' },
|
||||
subscribeFeed: { id: 'account.rss_feed', defaultMessage: 'Subscribe to RSS feed' },
|
||||
zap: { id: 'zap.send_to', defaultMessage: 'Send zaps to {target}' },
|
||||
});
|
||||
|
||||
interface IHeader {
|
||||
|
@ -282,6 +283,10 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
|||
copy(nip19.npubEncode(account.nostr.pubkey!));
|
||||
};
|
||||
|
||||
const handleZapAccount: React.EventHandler<React.MouseEvent> = (e) => {
|
||||
dispatch(openModal('ZAP_PAY_REQUEST', { account }));
|
||||
};
|
||||
|
||||
const makeMenu = () => {
|
||||
const menu: Menu = [];
|
||||
|
||||
|
@ -621,8 +626,22 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
|||
);
|
||||
};
|
||||
|
||||
const renderZapAccount = () => {
|
||||
return (
|
||||
<IconButton
|
||||
src={require('@tabler/icons/outline/bolt.svg')}
|
||||
onClick={handleZapAccount}
|
||||
title={intl.formatMessage(messages.zap, { target: account.display_name })}
|
||||
theme='outlined'
|
||||
className='px-2'
|
||||
iconClassName='h-4 w-4'
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
const info = makeInfo();
|
||||
const menu = makeMenu();
|
||||
const acceptsZaps = account.ditto.accepts_zaps === true;
|
||||
|
||||
return (
|
||||
<div className='-mx-4 -mt-4 sm:-mx-6 sm:-mt-6'>
|
||||
|
@ -664,6 +683,7 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
|||
<SubscriptionButton account={account} />
|
||||
{renderMessageButton()}
|
||||
{renderShareButton()}
|
||||
{acceptsZaps && renderZapAccount()}
|
||||
|
||||
{menu.length > 0 && (
|
||||
<DropdownMenu items={menu} placement='bottom-end'>
|
||||
|
|
Loading…
Reference in New Issue