From c488665486db9105bc7393afb057f65109d78bca Mon Sep 17 00:00:00 2001 From: Alisson Silva Date: Tue, 12 May 2020 22:52:24 -0300 Subject: [PATCH] rollback: google translator with external link --- src/components/GameReport.js | 35 ++++++++--------------------------- src/pages/Game.js | 2 ++ src/styles/GameReport.js | 2 +- 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/src/components/GameReport.js b/src/components/GameReport.js index 5c510af..bd03376 100644 --- a/src/components/GameReport.js +++ b/src/components/GameReport.js @@ -25,9 +25,6 @@ const GameReport = ({ sourceImage, onClickTranslate, }) => { - const [translating, setTranslating] = useState(false); - const [translation, setTranslation] = useState(null); - if (!isVisible) return null; return ( @@ -41,30 +38,14 @@ const GameReport = ({ : null } - {translation && - {/* Tradução */} - {translation.translation.translation} - } - - {showTranslate && !translation && - { - setTranslating(true); - getTranslation(verb.baseForm) - .then((tr) => { - setTranslation(tr); - setTranslating(false); - onClickTranslate(); - }).catch(() => { - setTranslating(false); - }); - }} - style={style.translateButtonWrapper}> - Translate - {translating && } - - } - + {showTranslate && { + onClickTranslate(); + }} + style={style.translateButtonWrapper}> + Translate + {/* {translating && } */} + } diff --git a/src/pages/Game.js b/src/pages/Game.js index 4eaf242..16f7c77 100644 --- a/src/pages/Game.js +++ b/src/pages/Game.js @@ -102,6 +102,8 @@ const Game = () => { const translate = () => { Analytics.logEvent(ConstantsAnalytics.TRANSLATE, { verb_id: currentVerb.id, verb_base_form: currentVerb.baseForm, coins: coins }); + Linking.openURL(`https://translate.google.com/#auto/pt/${currentVerb.baseForm}`) + .catch(err => console.log("Couldn't load page.", err)); }; return ( diff --git a/src/styles/GameReport.js b/src/styles/GameReport.js index b25f1a3..e8bd7f8 100644 --- a/src/styles/GameReport.js +++ b/src/styles/GameReport.js @@ -36,7 +36,7 @@ const style = StyleSheet.create({ backgroundColor: Colors.HARD_COLOR, width: 120, height: 40, - + marginTop: 23, borderRadius: 50, display: 'flex', flexDirection: 'row',