import PropTypes from 'prop-types'
import { useTranslation } from 'react-i18next'
import { Alert, Button, Modal, Row, Col, Grid } from 'react-bootstrap'
import { useIdeContext } from '../../../shared/context/ide-context'
import { useProjectContext } from '../../../shared/context/project-context'
import { useWordCount } from '../hooks/use-word-count'
import Icon from '../../../shared/components/icon'
// NOTE: this component is only mounted when the modal is open
export default function WordCountModalContent({ handleHide }) {
const { _id: projectId } = useProjectContext()
const { clsiServerId } = useIdeContext()
const { t } = useTranslation()
const { data, error, loading } = useWordCount(projectId, clsiServerId)
return (
<>
{t('word_count')}
{loading && !error && (
{t('loading')}…
)}
{error && (
{t('generic_something_went_wrong')}
)}
{data && (
{data.messages && (
{data.messages}
)}
{t('total_words')}:
{data.textWords}
{t('headers')}:
{data.headers}
{t('math_inline')}:
{data.mathInline}
{t('math_display')}:
{data.mathDisplay}
)}
>
)
}
WordCountModalContent.propTypes = {
handleHide: PropTypes.func.isRequired,
}