th: quotes: Show cancel button in quote mode

Like replies

Cherry-picked-from: 6b59d3674c
main
VT Social 2024-07-10 09:50:59 +00:00 committed by kouhai
parent 99aec9e9e5
commit 71b3c711ca
2 changed files with 4 additions and 2 deletions

View File

@ -22,6 +22,7 @@ export const NavigationBar = () => {
const intl = useIntl(); const intl = useIntl();
const account = useSelector(state => state.getIn(['accounts', me])); const account = useSelector(state => state.getIn(['accounts', me]));
const isReplying = useSelector(state => !!state.getIn(['compose', 'in_reply_to'])); const isReplying = useSelector(state => !!state.getIn(['compose', 'in_reply_to']));
const isQuoting = useSelector(state => !!state.getIn(['compose', 'quote_id']));
const handleCancelClick = useCallback(() => { const handleCancelClick = useCallback(() => {
dispatch(cancelReplyCompose()); dispatch(cancelReplyCompose());
@ -30,7 +31,7 @@ export const NavigationBar = () => {
return ( return (
<div className='navigation-bar'> <div className='navigation-bar'>
<Account account={account} minimal /> <Account account={account} minimal />
{isReplying ? <IconButton title={intl.formatMessage(messages.cancel)} iconComponent={CloseIcon} onClick={handleCancelClick} /> : <ActionBar />} {(isReplying || isQuoting) ? <IconButton title={intl.formatMessage(messages.cancel)} iconComponent={CloseIcon} onClick={handleCancelClick} /> : <ActionBar />}
</div> </div>
); );
}; };

View File

@ -22,6 +22,7 @@ export const NavigationBar = () => {
const intl = useIntl(); const intl = useIntl();
const account = useSelector(state => state.getIn(['accounts', me])); const account = useSelector(state => state.getIn(['accounts', me]));
const isReplying = useSelector(state => !!state.getIn(['compose', 'in_reply_to'])); const isReplying = useSelector(state => !!state.getIn(['compose', 'in_reply_to']));
const isQuoting = useSelector(state => !!state.getIn(['compose', 'quote_id']));
const handleCancelClick = useCallback(() => { const handleCancelClick = useCallback(() => {
dispatch(cancelReplyCompose()); dispatch(cancelReplyCompose());
@ -30,7 +31,7 @@ export const NavigationBar = () => {
return ( return (
<div className='navigation-bar'> <div className='navigation-bar'>
<Account account={account} minimal /> <Account account={account} minimal />
{isReplying ? <IconButton title={intl.formatMessage(messages.cancel)} iconComponent={CloseIcon} onClick={handleCancelClick} /> : <ActionBar />} {(isReplying || isQuoting) ? <IconButton title={intl.formatMessage(messages.cancel)} iconComponent={CloseIcon} onClick={handleCancelClick} /> : <ActionBar />}
</div> </div>
); );
}; };