Skip to content

Commit a030b2a

Browse files
committed
Simplify hasFlexColumn and add missing flex columns
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
1 parent 638332b commit a030b2a

2 files changed

Lines changed: 6 additions & 20 deletions

File tree

src/libs/SearchUIUtils.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5766,26 +5766,16 @@ const FLEX_COLUMNS = new Set<string>([
57665766
CONST.SEARCH.TABLE_COLUMNS.CATEGORY,
57675767
CONST.SEARCH.TABLE_COLUMNS.TAG,
57685768
CONST.SEARCH.TABLE_COLUMNS.TAX_RATE,
5769-
]);
5770-
5771-
const TOTAL_COLUMNS = new Set<string>([
5772-
CONST.SEARCH.TABLE_COLUMNS.TOTAL,
5773-
CONST.SEARCH.TABLE_COLUMNS.TOTAL_AMOUNT,
5774-
CONST.SEARCH.TABLE_COLUMNS.TOTAL_PER_ATTENDEE,
5775-
CONST.SEARCH.TABLE_COLUMNS.ORIGINAL_AMOUNT,
5769+
CONST.SEARCH.TABLE_COLUMNS.CARD,
5770+
CONST.SEARCH.TABLE_COLUMNS.EXCHANGE_RATE,
57765771
]);
57775772

57785773
/**
5779-
* Returns true when it's safe to remove flex from total columns — i.e., another flex column
5780-
* exists to fill the space, and the total column is the last visible column.
5774+
* Returns true when another flex column exists that can fill the remaining space,
5775+
* making it safe to remove flex from total columns.
57815776
*/
57825777
function hasFlexColumn(columns?: SearchColumnType[]): boolean {
5783-
if (!columns?.length) {
5784-
return false;
5785-
}
5786-
const lastColumn = columns.at(-1);
5787-
const isTotalLastColumn = !!lastColumn && TOTAL_COLUMNS.has(lastColumn);
5788-
return isTotalLastColumn && columns.some((col) => FLEX_COLUMNS.has(col));
5778+
return !!columns?.some((col) => FLEX_COLUMNS.has(col));
57895779
}
57905780

57915781
export {

src/styles/utils/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,11 +1926,7 @@ const createStyleUtils = (theme: ThemeColors, styles: ThemeStyles) => ({
19261926
case CONST.SEARCH.TABLE_COLUMNS.GROUP_TOTAL:
19271927
case CONST.SEARCH.TABLE_COLUMNS.TOTAL_PER_ATTENDEE:
19281928
case CONST.SEARCH.TABLE_COLUMNS.TOTAL:
1929-
columnWidth = {
1930-
...getWidthStyle(isAmountColumnWide ? variables.w130 : variables.w96),
1931-
...(!shouldRemoveTotalColumnFlex && styles.flex1),
1932-
...styles.alignItemsEnd,
1933-
};
1929+
columnWidth = {...getWidthStyle(isAmountColumnWide ? variables.w130 : variables.w96), ...(!shouldRemoveTotalColumnFlex && styles.flex1), ...styles.alignItemsEnd};
19341930
break;
19351931
case CONST.SEARCH.TABLE_COLUMNS.TYPE:
19361932
columnWidth = {...getWidthStyle(variables.w16), ...styles.alignItemsCenter};

0 commit comments

Comments
 (0)