Skip to content

Commit

Permalink
Refactor ProductTrainingContext to enhance tooltip rendering and upda…
Browse files Browse the repository at this point in the history
…te workspace chat translation
  • Loading branch information
ishpaul777 committed Dec 9, 2024
1 parent 2600133 commit 0c573ab
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions src/components/ProductTrainingContext/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React, {createContext, useCallback, useContext, useEffect, useMemo, useSt
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import HTMLEngineProvider from '@components/HTMLEngineProvider';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import RenderHTML from '@components/RenderHTML';
import Text from '@components/Text';
import useLocalize from '@hooks/useLocalize';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
Expand Down Expand Up @@ -133,25 +133,24 @@ function ProductTrainingContextProvider({children}: ChildrenProps) {
const renderProductTrainingTooltip = useCallback(
(tooltipName: ProductTrainingTooltipName) => {
const tooltip = PRODUCT_TRAINING_TOOLTIP_DATA[tooltipName];
if (!tooltip) {
return null;
}
const processedContent = () => {
const content = convertToLTR(translate(tooltip.content as TranslationPaths));

return content ? `<comment>${content}</comment>` : '';
};

return (
<View style={[styles.alignItemsCenter, styles.flexRow, styles.justifyContentCenter, styles.flexWrap, styles.textAlignCenter, styles.gap1, styles.p2]}>
<Icon
src={Expensicons.Lightbulb}
fill={theme.tooltipHighlightText}
medium
/>
<Text style={styles.renderHTMLTitle}>
<RenderHTML html={processedContent()} />
{/* {processedContent()} */}
</Text>
<View style={styles.renderHTMLTitle}>
<HTMLEngineProvider>
<RenderHTML html={processedContent()} />
</HTMLEngineProvider>
</View>
</View>
);
},
Expand Down
2 changes: 1 addition & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5444,7 +5444,7 @@ const translations = {
conciergeLHNGBR: 'Get started <strong>here!</strong>',
saveSearchTooltipText: 'You can <strong>rename your saved search</strong> here!',
quickActionButton: '<strong>Quick action!</strong> Just a tap away',
workspaceChatCreate: '<strong>Get started!</strong> Submit your expenses here!',
workspaceChatCreate: 'Submit your <strong>expenses</strong> here!',
},
};

Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5964,7 +5964,7 @@ const translations = {
conciergeLHNGBR: 'Get started <strong>here!</strong>',
saveSearchTooltipText: 'You can <strong>rename your saved search</strong> here!',
quickActionButton: '<strong>Quick action!</strong> Just a tap away',
workspaceChatCreate: '<strong>Get started!</strong> Submit your expenses here!',
workspaceChatCreate: 'Submit your <strong>expenses</strong> here!',
},
};

Expand Down

0 comments on commit 0c573ab

Please sign in to comment.