-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add CSV import flow to Categories page #47827
Add CSV import flow to Categories page #47827
Conversation
@rushatgabhane Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@rushatgabhane - I think it is mostly ready for review, only on Chrome on Android there is an issue with |
Can we check the spacing of this empty state? The illustration feels a bit close to the headline. And the text below the headline should use our textSupporting color. Please refer to the Figma for this one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working very well overall!
@@ -5496,6 +5499,30 @@ const CONST = { | |||
REMOVE: 'remove', | |||
}, | |||
}, | |||
|
|||
CSV_IMPORT_COLUMNS: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was the idea in the doc to split into constants for each file, should we update to match that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the idea, but it is not needed IMO and in the function findColumnName
we don't know it e.g. field GL Code
is from categories
or tags
, so what should be set there as an attribute? (there is no difference, because they are the same) Example below:
case 'glcode': case 'gl': attribute = CONST.CSV_IMPORT_COLUMNS.CATEGORIES.GL_CODE; break;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@filip-solecki couple small comments and the pending one from @dannymcclain
src/libs/importSpreadsheetUtils.ts
Outdated
function numberToColumn(index: number) { | ||
let column = ''; | ||
let number = index; | ||
while (number >= 0) { | ||
column = String.fromCharCode((number % 26) + 65) + column; | ||
number = Math.floor(number / 26) - 1; | ||
} | ||
return column; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A doc would be handy for this method, what exactly we are doing
Agree that the selection should have a background color. As for the error, I guess it makes sense. I'm generally not a fan of allowing users to put them selves in a situation where validation issues occur as I prefer better defaulted options. But I think in this instance it might be weird to default the users to the first required value and better to let the user choose intentionally. The error message is also useful. Happy to go ahead with it |
Fixed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One NAB
Co-authored-by: Vit Horacek <36083550+mountiny@users.noreply.github.com>
Screen.Recording.2024-09-03.at.15.25.37.movNow background of the selected item always has correct hex |
Nice! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the video looks good
🧪🧪 Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! 🧪🧪 |
I have marked the snyk warnings about the xlms as resolved https://app.snyk.io/org/expensify/project/a75415c0-01a0-4906-abb8-070d86e05d58/pr-check/0bd42126-7fbf-4cea-a9f5-e8870001d371 I do not think we need to worry about those |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.29-0 🚀
|
This PR is failing for Desktop because of issue #48540 |
🚀 Deployed to production by https://github.com/roryabraham in version: 9.0.29-12 🚀
|
@@ -254,6 +259,7 @@ function PopoverMenu({ | |||
iconRight={item.iconRight} | |||
shouldPutLeftPaddingWhenNoIcon={item.shouldPutLeftPaddingWhenNoIcon} | |||
label={item.label} | |||
style={{backgroundColor: item.isSelected ? theme.activeComponentBG : undefined}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this addition led to the following issue:
Since given the new addition and the fact that in SearchTypeMenuNarrow.tsx
we never pass the isSelected
property. The issue was fixed by passing down isSelected
which fixed the issue of the selected item highlight. More details in the issue proposal.
const columnValuesString = column.slice(containsHeader ? 1 : 0).join(', '); | ||
|
||
const colName = findColumnName(column[0]); | ||
const defaultSelectedIndex = columnRoles.findIndex((item) => item.value === colName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming from this issue
In several cases defaultSelectedIndex
will return -1 if the index is not found.
As result dropdown button does not match the selection in the dropdown list
And to fix this
A check was added If the index is not found, the default index will be 0
Details
This PR add possibility to import Categories from spreadsheet. It uses new library called
xlsx
to read the data from files.Fixed Issues
$ #47357
PROPOSAL: N/A
Tests
Import spreadsheet
Choose file
Offline tests
Feature not supported offline - info modal should be shown
QA Steps
Same as Test steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android.mov
Android: mWeb Chrome
iOS: Native
ios_failed.mp4
ios_success.mp4
iOS: mWeb Safari
ios_safari.mp4
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov