// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import React from 'react'; import {useIntl} from 'react-intl'; import {Text, View} from 'react-native'; import Button from '@components/button'; import JoinPrivateChannel from '@components/illustrations/join_private_channel'; import JoinPublicChannel from '@components/illustrations/join_public_channel'; import MessageNotViewable from '@components/illustrations/message_not_viewable'; import Markdown from '@components/markdown'; import {Screens} from '@constants'; import {useTheme} from '@context/theme'; import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; import {typography} from '@utils/typography'; type Props = { error: PermalinkErrorType; handleClose: () => void; handleJoin: () => void; } const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => { return { errorContainer: { alignItems: 'center', justifyContent: 'center', marginHorizontal: 36, flex: 1, }, errorTitle: { color: theme.centerChannelColor, textAlign: 'center', ...typography('Heading', 600, 'SemiBold'), marginTop: 8, marginBottom: 16, }, errorText: { textAlign: 'center', color: theme.centerChannelColor, ...typography('Body', 200, 'Regular'), }, errorTextParagraph: { textAlign: 'center', }, errorButtonContainer: { borderTopWidth: 1, borderTopColor: changeOpacity(theme.centerChannelColor, 0.16), padding: 20, gap: 8, }, }; }); function PermalinkError({ error, handleClose, handleJoin, }: Props) { const theme = useTheme(); const style = getStyleSheet(theme); const intl = useIntl(); if (error.notExist || error.unreachable) { const title = intl.formatMessage({id: 'permalink.error.access.title', defaultMessage: 'Message not viewable'}); const text = intl.formatMessage({id: 'permalink.error.access.text', defaultMessage: 'The message you are trying to view is in a channel you don’t have access to or has been deleted.'}); return ( <> {title} {text}