* Add autotranslations * Develop latest changes and missing features * i18n-extract * Fix tests and update api behavior * Fix minor bugs * adjustments to shimmer animation, showtranslation modal style * Update post.tsx * Update show_translation.tsx * adjust sizing and opacity of translate icon * Add channel header translated icon * Disable auto translation item if it is not a supported language * Move channel info to the top * Update edit channel to channel info * Fix align of option items * Fix i18n * Add detox related changes for channel settings changes * Add tests * Address changes around the my channel column change * Address feedback * Fix test * Fix bad import * Fix set my channel autotranslation * Fix test * Address feedback * Add missing files from last commit * Remove unneeded change --------- Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React, {useCallback} from 'react';
|
|
import {defineMessages, useIntl} from 'react-intl';
|
|
|
|
import {BaseOption} from '@components/common_post_options';
|
|
import {Screens} from '@constants';
|
|
import {dismissBottomSheet, goToScreen} from '@screens/navigation';
|
|
|
|
import type {AvailableScreens} from '@typings/screens/navigation';
|
|
|
|
type Props = {
|
|
bottomSheetId: AvailableScreens;
|
|
postId: string;
|
|
}
|
|
|
|
const messages = defineMessages({
|
|
showTranslation: {
|
|
id: 'mobile.post_info.show_translation',
|
|
defaultMessage: 'Show Translation',
|
|
},
|
|
});
|
|
|
|
const ShowTranslationOption = ({bottomSheetId, postId}: Props) => {
|
|
const intl = useIntl();
|
|
const onHandlePress = useCallback(async () => {
|
|
await dismissBottomSheet(bottomSheetId);
|
|
goToScreen(Screens.SHOW_TRANSLATION, intl.formatMessage(messages.showTranslation), {postId});
|
|
}, [bottomSheetId, intl, postId]);
|
|
|
|
return (
|
|
<BaseOption
|
|
message={messages.showTranslation}
|
|
iconName='translate'
|
|
onPress={onHandlePress}
|
|
testID='post_options.show_translation.option'
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default ShowTranslationOption;
|