Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ function App({url, hybridAppSettings}: AppProps) {
ThemeStylesProvider,
ThemeIllustrationsProvider,
SafeAreaProvider,
HTMLEngineProvider,
PortalProvider,
SafeArea,
LocaleContextProvider,
HTMLEngineProvider,
Comment on lines +91 to -94
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this change was not done by prettier , please revert this, else LGTM!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required to run RenderHTML in iOS on tooltips.

PopoverContextProvider,
CurrentReportIDContextProvider,
ScrollOffsetContextProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ function BaseHTMLEngineProvider({textSelectable = false, children, enableExperim
},
contentModel: HTMLContentModel.block,
}),
tooltip: HTMLElementModel.fromCustomModel({
tagName: 'tooltip',
mixedUAStyles: {whiteSpace: 'pre', ...styles.productTrainingTooltipText},
contentModel: HTMLContentModel.block,
}),
strong: HTMLElementModel.fromCustomModel({
tagName: 'strong',
getMixedUAStyles: (tnode) => (isChildOfTaskTitle(tnode as TNode) ? {} : styles.strong),
Expand Down Expand Up @@ -144,6 +149,7 @@ function BaseHTMLEngineProvider({textSelectable = false, children, enableExperim
styles.mb0,
styles.colorMuted,
styles.mutedNormalTextLabel,
styles.productTrainingTooltipText,
styles.textLabelSupporting,
styles.lh16,
styles.textSupporting,
Expand Down
77 changes: 14 additions & 63 deletions src/components/ProductTrainingContext/TOOLTIPS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type ShouldShowConditionProps = {
};

type TooltipData = {
content: Array<{text: TranslationPaths; isBold: boolean}>;
content: TranslationPaths;
onHideTooltip: (isDismissedUsingCloseButton?: boolean) => void;
name: ProductTrainingTooltipName;
priority: number;
Expand All @@ -41,10 +41,7 @@ type TooltipData = {

const TOOLTIPS: Record<ProductTrainingTooltipName, TooltipData> = {
[CONCIERGE_LHN_GBR]: {
content: [
{text: 'productTrainingTooltip.conciergeLHNGBR.part1', isBold: false},
{text: 'productTrainingTooltip.conciergeLHNGBR.part2', isBold: true},
],
content: 'productTrainingTooltip.conciergeLHNGBR',
onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(CONCIERGE_LHN_GBR, isDismissedUsingCloseButton),
name: CONCIERGE_LHN_GBR,
priority: 1300,
Expand All @@ -53,132 +50,86 @@ const TOOLTIPS: Record<ProductTrainingTooltipName, TooltipData> = {
shouldShow: () => false,
},
[RENAME_SAVED_SEARCH]: {
content: [
{text: 'productTrainingTooltip.saveSearchTooltip.part1', isBold: true},
{text: 'productTrainingTooltip.saveSearchTooltip.part2', isBold: false},
],
content: 'productTrainingTooltip.saveSearchTooltip',
onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(RENAME_SAVED_SEARCH, isDismissedUsingCloseButton),
name: RENAME_SAVED_SEARCH,
priority: 1250,
shouldShow: ({shouldUseNarrowLayout}) => !shouldUseNarrowLayout,
},
[GLOBAL_CREATE_TOOLTIP]: {
content: [
{text: 'productTrainingTooltip.globalCreateTooltip.part1', isBold: true},
{text: 'productTrainingTooltip.globalCreateTooltip.part2', isBold: false},
{text: 'productTrainingTooltip.globalCreateTooltip.part3', isBold: false},
{text: 'productTrainingTooltip.globalCreateTooltip.part4', isBold: false},
],
content: 'productTrainingTooltip.globalCreateTooltip',
onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(GLOBAL_CREATE_TOOLTIP, isDismissedUsingCloseButton),
name: GLOBAL_CREATE_TOOLTIP,
priority: 1950,
shouldShow: ({isUserPolicyEmployee}) => isUserPolicyEmployee,
},
[BOTTOM_NAV_INBOX_TOOLTIP]: {
content: [
{text: 'productTrainingTooltip.bottomNavInboxTooltip.part1', isBold: false},
{text: 'productTrainingTooltip.bottomNavInboxTooltip.part2', isBold: true},
{text: 'productTrainingTooltip.bottomNavInboxTooltip.part3', isBold: false},
{text: 'productTrainingTooltip.bottomNavInboxTooltip.part4', isBold: true},
],
content: 'productTrainingTooltip.bottomNavInboxTooltip',
onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(BOTTOM_NAV_INBOX_TOOLTIP, isDismissedUsingCloseButton),
name: BOTTOM_NAV_INBOX_TOOLTIP,
priority: 1700,
shouldShow: ({hasBeenAddedToNudgeMigration}) => hasBeenAddedToNudgeMigration,
},
[LHN_WORKSPACE_CHAT_TOOLTIP]: {
content: [
{text: 'productTrainingTooltip.workspaceChatTooltip.part1', isBold: false},
{text: 'productTrainingTooltip.workspaceChatTooltip.part2', isBold: true},
],
content: 'productTrainingTooltip.workspaceChatTooltip',
onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(LHN_WORKSPACE_CHAT_TOOLTIP, isDismissedUsingCloseButton),
name: LHN_WORKSPACE_CHAT_TOOLTIP,
priority: 1800,
shouldShow: ({isUserPolicyEmployee}) => isUserPolicyEmployee,
},
[GBR_RBR_CHAT]: {
content: [
{text: 'productTrainingTooltip.GBRRBRChat.part1', isBold: false},
{text: 'productTrainingTooltip.GBRRBRChat.part2', isBold: true},
{text: 'productTrainingTooltip.GBRRBRChat.part3', isBold: false},
{text: 'productTrainingTooltip.GBRRBRChat.part4', isBold: true},
],
content: 'productTrainingTooltip.GBRRBRChat',
onHideTooltip: () => dismissProductTraining(GBR_RBR_CHAT),
name: GBR_RBR_CHAT,
priority: 1900,
shouldShow: () => true,
},
[ACCOUNT_SWITCHER]: {
content: [
{text: 'productTrainingTooltip.accountSwitcher.part1', isBold: false},
{text: 'productTrainingTooltip.accountSwitcher.part2', isBold: true},
{text: 'productTrainingTooltip.accountSwitcher.part3', isBold: false},
],
content: 'productTrainingTooltip.accountSwitcher',
onHideTooltip: () => dismissProductTraining(ACCOUNT_SWITCHER),
name: ACCOUNT_SWITCHER,
priority: 1600,
shouldShow: () => true,
},
[EXPENSE_REPORTS_FILTER]: {
content: [
{text: 'productTrainingTooltip.expenseReportsFilter.part1', isBold: false},
{text: 'productTrainingTooltip.expenseReportsFilter.part2', isBold: true},
{text: 'productTrainingTooltip.expenseReportsFilter.part3', isBold: false},
],
content: 'productTrainingTooltip.expenseReportsFilter',
onHideTooltip: () => dismissProductTraining(EXPENSE_REPORTS_FILTER),
name: EXPENSE_REPORTS_FILTER,
priority: 2000,
shouldShow: ({shouldUseNarrowLayout, isUserPolicyAdmin, hasBeenAddedToNudgeMigration}: ShouldShowConditionProps) =>
!shouldUseNarrowLayout && isUserPolicyAdmin && hasBeenAddedToNudgeMigration,
},
[SCAN_TEST_TOOLTIP]: {
content: [
{text: 'productTrainingTooltip.scanTestTooltip.part1', isBold: true},
{text: 'productTrainingTooltip.scanTestTooltip.part2', isBold: false},
],
content: 'productTrainingTooltip.scanTestTooltip.main',
onHideTooltip: () => dismissProductTraining(SCAN_TEST_TOOLTIP),
name: SCAN_TEST_TOOLTIP,
priority: 900,
shouldShow: ({isUserInPaidPolicy, hasBeenAddedToNudgeMigration}) => !isUserInPaidPolicy && !hasBeenAddedToNudgeMigration,
shouldRenderActionButtons: true,
},
[SCAN_TEST_TOOLTIP_MANAGER]: {
content: [
{text: 'productTrainingTooltip.scanTestTooltip.part3', isBold: false},
{text: 'productTrainingTooltip.scanTestTooltip.part4', isBold: true},
{text: 'productTrainingTooltip.scanTestTooltip.part5', isBold: false},
],
content: 'productTrainingTooltip.scanTestTooltip.manager',
onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(SCAN_TEST_TOOLTIP_MANAGER, isDismissedUsingCloseButton),
name: SCAN_TEST_TOOLTIP_MANAGER,
priority: 1000,
shouldShow: ({hasBeenAddedToNudgeMigration}) => !hasBeenAddedToNudgeMigration,
},
[SCAN_TEST_CONFIRMATION]: {
content: [
{text: 'productTrainingTooltip.scanTestTooltip.part6', isBold: false},
{text: 'productTrainingTooltip.scanTestTooltip.part7', isBold: true},
{text: 'productTrainingTooltip.scanTestTooltip.part8', isBold: false},
],
content: 'productTrainingTooltip.scanTestTooltip.confirmation',
onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(SCAN_TEST_CONFIRMATION, isDismissedUsingCloseButton),
name: SCAN_TEST_CONFIRMATION,
priority: 1100,
shouldShow: ({hasBeenAddedToNudgeMigration}) => !hasBeenAddedToNudgeMigration,
},
[OUTSTANDING_FILTER]: {
content: [
{text: 'productTrainingTooltip.outstandingFilter.part1', isBold: false},
{text: 'productTrainingTooltip.outstandingFilter.part2', isBold: true},
],
content: 'productTrainingTooltip.outstandingFilter',
onHideTooltip: () => dismissProductTraining(OUTSTANDING_FILTER),
name: OUTSTANDING_FILTER,
priority: 1925,
shouldShow: ({isUserPolicyAdmin}) => isUserPolicyAdmin,
},
[SCAN_TEST_DRIVE_CONFIRMATION]: {
content: [
{text: 'productTrainingTooltip.scanTestDriveTooltip.part1', isBold: false},
{text: 'productTrainingTooltip.scanTestDriveTooltip.part2', isBold: true},
],
content: 'productTrainingTooltip.scanTestDriveTooltip',
onHideTooltip: (isDismissedUsingCloseButton = false) => dismissProductTraining(SCAN_TEST_DRIVE_CONFIRMATION, isDismissedUsingCloseButton),
name: SCAN_TEST_DRIVE_CONFIRMATION,
priority: 1200,
Expand Down
25 changes: 7 additions & 18 deletions src/components/ProductTrainingContext/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Button from '@components/Button';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import Text from '@components/Text';
import RenderHTML from '@components/RenderHTML';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
Expand Down Expand Up @@ -294,19 +294,9 @@ const useProductTrainingContext = (tooltipName: ProductTrainingTooltipName, shou
fill={theme.tooltipHighlightText}
medium
/>
<Text style={[styles.productTrainingTooltipText, styles.textWrap, styles.mw100]}>
{tooltip.content.map(({text, isBold}) => {
const translatedText = translate(text);
return (
<Text
key={text}
style={[styles.productTrainingTooltipText, isBold && styles.textBold]}
>
{translatedText}
</Text>
);
})}
</Text>
<View style={[styles.renderHTML, styles.dFlex, styles.flexShrink1]}>
<RenderHTML html={translate(tooltip.content)} />
</View>
{!tooltip?.shouldRenderActionButtons && (
<PressableWithoutFeedback
shouldUseAutoHitSlop
Expand Down Expand Up @@ -352,14 +342,13 @@ const useProductTrainingContext = (tooltipName: ProductTrainingTooltipName, shou
styles.textAlignCenter,
styles.gap3,
styles.pv2,
styles.productTrainingTooltipText,
styles.textWrap,
styles.mw100,
styles.flex1,
styles.justifyContentBetween,
styles.ph2,
styles.gap2,
styles.textBold,
styles.renderHTML,
styles.dFlex,
styles.flexShrink1,
theme.tooltipHighlightText,
theme.icon,
translate,
Expand Down
69 changes: 13 additions & 56 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6954,66 +6954,23 @@ const translations = {
productTrainingTooltip: {
// TODO: CONCIERGE_LHN_GBR tooltip will be replaced by a tooltip in the #admins room
// https://github.com/Expensify/App/issues/57045#issuecomment-2701455668
conciergeLHNGBR: {
part1: 'Loslegen',
part2: 'hier!',
},
saveSearchTooltip: {
part1: 'Benennen Sie Ihre gespeicherten Suchen um',
part2: 'hier!',
},
bottomNavInboxTooltip: {
part1: 'Überprüfen Sie was',
part2: 'benötigt Ihre Aufmerksamkeit',
part3: 'und',
part4: 'über Ausgaben chatten.',
},
workspaceChatTooltip: {
part1: 'Chatten mit',
part2: 'Genehmiger',
},
globalCreateTooltip: {
part1: 'Ausgaben erstellen',
part2: ', beginnen Sie zu chatten,',
part3: 'und mehr.',
part4: 'Probieren Sie es aus!',
},
GBRRBRChat: {
part1: 'Du wirst 🟢 auf sehen',
part2: 'Maßnahmen ergreifen',
part3: ',\nund 🔴 auf',
part4: 'Elemente zur Überprüfung.',
},
accountSwitcher: {
part1: 'Zugriff auf Ihre',
part2: 'Copilot-Konten',
part3: 'hier',
},
expenseReportsFilter: {
part1: 'Willkommen! Finden Sie alle Ihre',
part2: 'Berichte des Unternehmens',
part3: 'here.',
},
conciergeLHNGBR: '<tooltip>Loslegen <strong>hier!</strong></tooltip>',
saveSearchTooltip: '<tooltip><strong>Benennen Sie Ihre gespeicherten Suchen um</strong> hier!</tooltip>',
globalCreateTooltip: '<tooltip><strong>Ausgaben erstellen</strong>, beginnen Sie zu chatten, und mehr. Probieren Sie es aus!</tooltip>',
bottomNavInboxTooltip: '<tooltip>Überprüfen Sie was <strong>benötigt Ihre Aufmerksamkeit</strong> und <strong>über Ausgaben chatten.</strong></tooltip>',
workspaceChatTooltip: '<tooltip>Chatten mit <strong>Genehmigern</strong></tooltip>',
GBRRBRChat: '<tooltip>Du wirst 🟢 auf sehen <strong>Maßnahmen ergreifen</strong>, und 🔴 auf <strong>Elemente zur Überprüfung.</strong></tooltip>',
accountSwitcher: '<tooltip>Zugriff auf Ihre <strong>Copilot-Konten</strong> hier</tooltip>',
expenseReportsFilter: '<tooltip>Willkommen! Finden Sie alle Ihre <strong>Berichte des Unternehmens</strong> hier.</tooltip>',
scanTestTooltip: {
part1: 'Möchten Sie sehen, wie Scan funktioniert?',
part2: 'Probieren Sie einen Testbeleg aus!',
part3: 'Wählen Sie unsere',
part4: 'Testmanager',
part5: 'um es auszuprobieren!',
part6: 'Jetzt,',
part7: 'Reichen Sie Ihre Ausgaben ein',
part8: 'und sieh zu, wie die Magie geschieht!',
main: '<tooltip><strong>Möchten Sie sehen, wie Scan funktioniert?</strong> Probieren Sie einen Testbeleg aus!</tooltip>',
manager: '<tooltip>Wählen Sie unsere <strong>Testmanager</strong>, um es auszuprobieren!</tooltip>',
confirmation: '<tooltip>Jetzt, <strong>Reichen Sie Ihre Ausgaben ein</strong> und sieh zu, wie die Magie geschieht!</tooltip>',
tryItOut: 'Probieren Sie es aus',
noThanks: 'Nein danke',
},
outstandingFilter: {
part1: 'Filter für Ausgaben, die',
part2: 'Genehmigung erforderlich',
},
scanTestDriveTooltip: {
part1: 'Diesen Beleg senden an',
part2: 'Beenden Sie die Probefahrt!',
},
outstandingFilter: '<tooltip>Filter für Ausgaben, die <strong>Genehmigung erforderlich</strong></tooltip>',
scanTestDriveTooltip: '<tooltip>Diesen Beleg senden an <strong>Beenden Sie die Probefahrt!</strong></tooltip>',
},
discardChangesConfirmation: {
title: 'Änderungen verwerfen?',
Expand Down
Loading
Loading