-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Refactored spreadsheet modal code to make it translate free #73493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
carlosmiceli
merged 7 commits into
Expensify:main
from
shubham1206agra:refactored-spreadsheet-modal
Oct 29, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4bd2ca0
Refactored spreadsheet modal code to make it translate free
shubham1206agra 6cbc0e5
Merge branch 'Expensify:main' into refactored-spreadsheet-modal
shubham1206agra e403b92
Addressed comments
shubham1206agra c593690
Addressed comments p2
shubham1206agra 34e923c
Fixed ts
shubham1206agra 1bac81a
Merge branch 'Expensify:main' into refactored-spreadsheet-modal
shubham1206agra 7248a08
Addressed comments p3
shubham1206agra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import React from 'react'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useOnyx from '@hooks/useOnyx'; | ||
| import type {TranslationParameters} from '@src/languages/types'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import ConfirmModal from './ConfirmModal'; | ||
|
|
||
| type ImportSpreadsheetConfirmModalProps = { | ||
| /** Modal visibility */ | ||
| isVisible: boolean; | ||
|
|
||
| /** A function to close both the import page and the modal. */ | ||
| closeImportPageAndModal: () => void; | ||
|
|
||
| /** Callback method fired when the modal is hidden */ | ||
| onModalHide?: () => void; | ||
| }; | ||
|
|
||
| function ImportSpreadsheetConfirmModal({isVisible, closeImportPageAndModal, onModalHide}: ImportSpreadsheetConfirmModalProps) { | ||
| const {translate} = useLocalize(); | ||
| const [spreadsheet] = useOnyx(ONYXKEYS.IMPORTED_SPREADSHEET, {canBeMissing: true}); | ||
|
|
||
| const titleText = spreadsheet?.importFinalModal?.titleKey ? translate(spreadsheet.importFinalModal.titleKey) : ''; | ||
| const promptText = spreadsheet?.importFinalModal?.promptKey | ||
| ? translate(spreadsheet.importFinalModal.promptKey, spreadsheet.importFinalModal.promptKeyParams as TranslationParameters<typeof spreadsheet.importFinalModal.promptKey>[0]) | ||
| : ''; | ||
|
|
||
| return ( | ||
| <ConfirmModal | ||
| isVisible={isVisible} | ||
| title={titleText} | ||
| prompt={promptText} | ||
| onConfirm={closeImportPageAndModal} | ||
| onCancel={closeImportPageAndModal} | ||
| confirmText={translate('common.buttonConfirm')} | ||
| shouldShowCancelButton={false} | ||
| shouldHandleNavigationBack | ||
| onModalHide={onModalHide} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| ImportSpreadsheetConfirmModal.displayName = 'ImportSpreadsheetConfirmModal'; | ||
|
|
||
| export default ImportSpreadsheetConfirmModal; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| import React, {useCallback, useState} from 'react'; | ||
| import ConfirmModal from '@components/ConfirmModal'; | ||
| import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
| import type {ColumnRole} from '@components/ImportColumn'; | ||
| import ImportSpreadsheetColumns from '@components/ImportSpreadsheetColumns'; | ||
| import ImportSpreadsheetConfirmModal from '@components/ImportSpreadsheetConfirmModal'; | ||
| import ScreenWrapper from '@components/ScreenWrapper'; | ||
| import useCloseImportPage from '@hooks/useCloseImportPage'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
|
|
@@ -156,15 +156,9 @@ function ImportedCategoriesPage({route}: ImportedCategoriesPageProps) { | |
| learnMoreLink={CONST.IMPORT_SPREADSHEET.CATEGORIES_ARTICLE_LINK} | ||
| /> | ||
|
|
||
| <ConfirmModal | ||
| <ImportSpreadsheetConfirmModal | ||
| isVisible={spreadsheet?.shouldFinalModalBeOpened} | ||
| title={spreadsheet?.importFinalModal?.title ?? ''} | ||
| prompt={spreadsheet?.importFinalModal?.prompt ?? ''} | ||
| onConfirm={closeImportPageAndModal} | ||
| onCancel={closeImportPageAndModal} | ||
|
Comment on lines
+159
to
-164
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Came from this issue |
||
| confirmText={translate('common.buttonConfirm')} | ||
| shouldShowCancelButton={false} | ||
| shouldHandleNavigationBack | ||
| closeImportPageAndModal={closeImportPageAndModal} | ||
| /> | ||
| </ScreenWrapper> | ||
| ); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.