diff options
Diffstat (limited to 'src/view/com/post-thread/PostThreadItem.tsx')
-rw-r--r-- | src/view/com/post-thread/PostThreadItem.tsx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index 4e14a84b7..8eda0962a 100644 --- a/src/view/com/post-thread/PostThreadItem.tsx +++ b/src/view/com/post-thread/PostThreadItem.tsx @@ -1,6 +1,6 @@ import React from 'react' import {observer} from 'mobx-react-lite' -import {StyleSheet, View} from 'react-native' +import {Linking, StyleSheet, View} from 'react-native' import Clipboard from '@react-native-clipboard/clipboard' import {AtUri} from '../../../third-party/uri' import { @@ -89,6 +89,11 @@ export const PostThreadItem = observer(function PostThreadItem({ Clipboard.setString(record?.text || '') Toast.show('Copied to clipboard') }, [record]) + const onOpenTranslate = React.useCallback(() => { + Linking.openURL( + encodeURI(`https://translate.google.com/#auto|en|${record?.text || ''}`), + ) + }, [record]) const onDeletePost = React.useCallback(() => { item.delete().then( () => { @@ -167,6 +172,7 @@ export const PostThreadItem = observer(function PostThreadItem({ itemTitle={itemTitle} isAuthor={item.post.author.did === store.me.did} onCopyPostText={onCopyPostText} + onOpenTranslate={onOpenTranslate} onDeletePost={onDeletePost}> <FontAwesomeIcon icon="ellipsis-h" @@ -259,6 +265,7 @@ export const PostThreadItem = observer(function PostThreadItem({ onPressToggleRepost={onPressToggleRepost} onPressToggleUpvote={onPressToggleUpvote} onCopyPostText={onCopyPostText} + onOpenTranslate={onOpenTranslate} onDeletePost={onDeletePost} /> </View> @@ -353,6 +360,7 @@ export const PostThreadItem = observer(function PostThreadItem({ onPressToggleRepost={onPressToggleRepost} onPressToggleUpvote={onPressToggleUpvote} onCopyPostText={onCopyPostText} + onOpenTranslate={onOpenTranslate} onDeletePost={onDeletePost} /> </View> |