RocketChat/Rocket.Chat

View on GitHub
apps/meteor/client/views/room/body/RetentionPolicyWarning.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import type { IRoom } from '@rocket.chat/core-typings';
import { Box, Bubble } from '@rocket.chat/fuselage';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { ReactElement } from 'react';
import React from 'react';

import { withErrorBoundary } from '../../../components/withErrorBoundary';
import { usePruneWarningMessage } from '../../../hooks/usePruneWarningMessage';

const RetentionPolicyWarning = ({ room }: { room: IRoom }): ReactElement => {
    const t = useTranslation();

    const message = usePruneWarningMessage(room);

    return (
        <Box display='flex' justifyContent='center' pi={20} mb={8}>
            <Bubble role='alert' aria-live='polite' aria-label={t('Retention_policy_warning_banner')} small secondary>
                {message}
            </Bubble>
        </Box>
    );
};

export default withErrorBoundary(RetentionPolicyWarning);