2022-06-12 07:14:46 -07: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 09:23:36 -08:00
import ReplyIndicator from 'soapbox/features/compose/components/reply-indicator' ;
2022-06-12 07:14:46 -07: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-02-15 13:26:27 -08:00
status : StatusEntity
onReblog : ( status : StatusEntity ) = > void
onClose : ( ) = > void
2022-06-12 07:14:46 -07: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 05:09:28 -08:00
title = { < FormattedMessage id = 'boost_modal.title' defaultMessage = 'Repost?' / > }
2022-06-12 07:14:46 -07:00
confirmationAction = { handleReblog }
confirmationText = { intl . formatMessage ( buttonText ) }
>
< Stack space = { 4 } >
< ReplyIndicator status = { status } hideActions / >
< Text >
2022-07-26 03:30:51 -07: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/repeat.svg' ) } / > < / span > } } / >
2022-06-12 07:14:46 -07:00
< / Text >
< / Stack >
< / Modal >
) ;
} ;
export default BoostModal ;