Skip to content

Commit

Permalink
add view original button
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins committed Feb 7, 2025
1 parent b118d11 commit a1cf9fc
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1775,6 +1775,7 @@ const translations = {
},
translateMessage: 'Nachrichten übersetzen',
viewOriginal: 'Original anzeigen',
showTranslation: 'Übersetzung anzeigen',
},
themePage: {
theme: 'Thema',
Expand Down
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,7 @@ const translations = {
},
translateMessage: 'Translate messages',
viewOriginal: 'View original',
showTranslation: 'Show translation',
},
themePage: {
theme: 'Theme',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1746,6 +1746,7 @@ const translations = {
},
translateMessage: 'Traducir mensajes',
viewOriginal: 'Ver original',
showTranslation: 'Mostrar traducción',
},
themePage: {
theme: 'Tema',
Expand Down
1 change: 1 addition & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1772,6 +1772,7 @@ const translations = {
},
translateMessage: 'Traduire les messages',
viewOriginal: "Voir l'original",
showTranslation: 'Afficher la traduction',
},
themePage: {
theme: 'Th\u00E8me',
Expand Down
1 change: 1 addition & 0 deletions src/languages/ro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,7 @@ const translations = {
},
translateMessage: 'Tradu mesajele',
viewOriginal: 'Vezi originalul',
showTranslation: 'Afișează traducerea',
},
themePage: {
theme: 'Tem\u0103',
Expand Down
10 changes: 7 additions & 3 deletions src/pages/home/report/ReportActionItemSingle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useCallback, useMemo} from 'react';
import React, {useCallback, useMemo, useState} from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
Expand Down Expand Up @@ -101,6 +101,7 @@ function ReportActionItemSingle({
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const [showOriginal, setShowOriginal] = useState(false);
const {translate} = useLocalize();
const personalDetails = usePersonalDetails();
const policy = usePolicy(report?.policyID);
Expand Down Expand Up @@ -281,6 +282,7 @@ function ReportActionItemSingle({
const statusText = status?.text ?? '';
const statusTooltipText = formattedDate ? `${statusText ? `${statusText} ` : ''}(${formattedDate})` : statusText;

console.log('over here', action?.shouldShowTranslation)
return (
<View style={[styles.chatItem, wrapperStyle]}>
<PressableWithoutFeedback
Expand Down Expand Up @@ -333,11 +335,13 @@ function ReportActionItemSingle({
{action?.message?.[0]?.translatedText && (
<PressableWithoutFeedback
style={[styles.ml1]}
onPress={() => console.log('pressed')}
onPress={() => setShowOriginal(!showOriginal)}
accessibilityLabel={actorHint}
role={CONST.ROLE.BUTTON}
>
<Text style={[styles.chatItemMessageHeaderTimestamp, styles.link]}>{translate('languagePage.viewOriginal')}</Text>
<Text style={[styles.chatItemMessageHeaderTimestamp, styles.link]}>
{translate(showOriginal ? 'languagePage.showTranslation' : 'languagePage.viewOriginal')}
</Text>
</PressableWithoutFeedback>
)}
</View>
Expand Down
2 changes: 2 additions & 0 deletions src/types/onyx/ReportAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ type ReportActionBase = OnyxCommon.OnyxValueWithOfflineFeedback<{
* Note: This is sent by the backend but we don't use it locally
*/
timestamp?: number;

shouldShowTranslation?: boolean;
}>;

/**
Expand Down

0 comments on commit a1cf9fc

Please sign in to comment.