Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 8 additions & 27 deletions src/components/GameReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ const GameReport = ({
sourceImage,
onClickTranslate,
}) => {
const [translating, setTranslating] = useState(false);
const [translation, setTranslation] = useState(null);

if (!isVisible) return null;

return (
Expand All @@ -41,30 +38,14 @@ const GameReport = ({
: null
}

{translation && <View style={style.translationResultView}>
{/* <Text style={style.translationResultTitle}>Tradução</Text> */}
<Text style={style.translationResultText}>{translation.translation.translation}</Text>
</View>}

{showTranslate && !translation && <View style={style.imageView}>
<TouchableOpacity
onPress={() => {
setTranslating(true);
getTranslation(verb.baseForm)
.then((tr) => {
setTranslation(tr);
setTranslating(false);
onClickTranslate();
}).catch(() => {
setTranslating(false);
});
}}
style={style.translateButtonWrapper}>
<Text style={style.textTranslate}>Translate</Text>
{translating && <ActivityIndicator size='small' color='#ffffff' />}
</TouchableOpacity>
</View>}

{showTranslate && <TouchableOpacity
onPress={() => {
onClickTranslate();
}}
style={style.translateButtonWrapper}>
<Text style={style.textTranslate}>Translate</Text>
{/* {translating && <ActivityIndicator size='small' color='#ffffff' />} */}
</TouchableOpacity>}

<View style={style.imageView} onTouchEnd={onClickImage}>
<Image source={sourceImage || Constants.ICON_PLAY_SRC} style={style.image}></Image>
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion src/styles/GameReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const style = StyleSheet.create({
backgroundColor: Colors.HARD_COLOR,
width: 120,
height: 40,

marginTop: 23,
borderRadius: 50,
display: 'flex',
flexDirection: 'row',
Expand Down