2022-06-12 14:14:46 +00:00
import React from 'react' ;
import { defineMessages , FormattedMessage , useIntl } from 'react-intl' ;
import Icon from 'soapbox/components/icon' ;
import { Modal , Stack , Text } from 'soapbox/components/ui' ;
2022-11-15 17:23:36 +00:00
import ReplyIndicator from 'soapbox/features/compose/components/reply-indicator' ;
2022-06-12 14:14:46 +00:00
import type { Status as StatusEntity } from 'soapbox/types/entities' ;
const messages = defineMessages ( {
cancel_reblog : { id : 'status.cancel_reblog_private' , defaultMessage : 'Un-repost' } ,
reblog : { id : 'status.reblog' , defaultMessage : 'Repost' } ,
} ) ;
interface IBoostModal {
2023-10-02 18:54:02 +00:00
status : StatusEntity ;
onReblog : ( status : StatusEntity ) = > void ;
onClose : ( ) = > void ;
2022-06-12 14:14:46 +00:00
}
const BoostModal : React.FC < IBoostModal > = ( { status , onReblog , onClose } ) = > {
const intl = useIntl ( ) ;
const handleReblog = ( ) = > {
onReblog ( status ) ;
onClose ( ) ;
} ;
const buttonText = status . reblogged ? messages.cancel_reblog : messages.reblog ;
return (
< Modal
2022-11-26 13:09:28 +00:00
title = { < FormattedMessage id = 'boost_modal.title' defaultMessage = 'Repost?' / > }
2022-06-12 14:14:46 +00:00
confirmationAction = { handleReblog }
confirmationText = { intl . formatMessage ( buttonText ) }
>
< Stack space = { 4 } >
< ReplyIndicator status = { status } hideActions / >
< Text >
2024-10-22 19:48:35 +00:00
{ /* eslint-disable-next-line formatjs/no-literal-string-in-jsx */ }
2024-04-03 11:28:30 +00:00
< FormattedMessage id = 'boost_modal.combo' defaultMessage = 'You can press {combo} to skip this next time' values = { { combo : < span > Shift + < Icon className = 'inline-block align-middle' src = { require ( '@tabler/icons/outline/repeat.svg' ) } / > < / span > } } / >
2022-06-12 14:14:46 +00:00
< / Text >
< / Stack >
< / Modal >
) ;
} ;
export default BoostModal ;