-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
…-fork into Guccio163/47927-ExportCSV
- Loading branch information
Showing
39 changed files
with
2,021 additions
and
182 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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,84 @@ | ||
diff --git a/node_modules/date-fns-tz/_lib/tzTokenizeDate/index.js b/node_modules/date-fns-tz/_lib/tzTokenizeDate/index.js | ||
index 9222a61..8540224 100644 | ||
--- a/node_modules/date-fns-tz/_lib/tzTokenizeDate/index.js | ||
+++ b/node_modules/date-fns-tz/_lib/tzTokenizeDate/index.js | ||
@@ -59,20 +59,23 @@ function hackyOffset(dtf, date) { | ||
|
||
var dtfCache = {}; | ||
|
||
+// New browsers use `hourCycle`, IE and Chrome <73 does not support it and uses `hour12` | ||
+const testDateFormatted = new Intl.DateTimeFormat('en-US', { | ||
+ hourCycle: 'h23', | ||
+ timeZone: 'America/New_York', | ||
+ year: 'numeric', | ||
+ month: '2-digit', | ||
+ day: '2-digit', | ||
+ hour: '2-digit', | ||
+ minute: '2-digit', | ||
+ second: '2-digit', | ||
+}).format(new Date('2014-06-25T04:00:00.123Z')) | ||
+const hourCycleSupported = | ||
+ testDateFormatted === '06/25/2014, 00:00:00' || | ||
+ testDateFormatted === '06/25/2014 00:00:00' | ||
+ | ||
function getDateTimeFormat(timeZone) { | ||
if (!dtfCache[timeZone]) { | ||
- // New browsers use `hourCycle`, IE and Chrome <73 does not support it and uses `hour12` | ||
- var testDateFormatted = new Intl.DateTimeFormat('en-US', { | ||
- hour12: false, | ||
- timeZone: 'America/New_York', | ||
- year: 'numeric', | ||
- month: 'numeric', | ||
- day: '2-digit', | ||
- hour: '2-digit', | ||
- minute: '2-digit', | ||
- second: '2-digit' | ||
- }).format(new Date('2014-06-25T04:00:00.123Z')); | ||
- var hourCycleSupported = testDateFormatted === '06/25/2014, 00:00:00' || testDateFormatted === '06/25/2014 00:00:00'; | ||
dtfCache[timeZone] = hourCycleSupported ? new Intl.DateTimeFormat('en-US', { | ||
hour12: false, | ||
timeZone: timeZone, | ||
diff --git a/node_modules/date-fns-tz/esm/_lib/tzTokenizeDate/index.js b/node_modules/date-fns-tz/esm/_lib/tzTokenizeDate/index.js | ||
index cc1d143..17333cc 100644 | ||
--- a/node_modules/date-fns-tz/esm/_lib/tzTokenizeDate/index.js | ||
+++ b/node_modules/date-fns-tz/esm/_lib/tzTokenizeDate/index.js | ||
@@ -48,23 +48,24 @@ function hackyOffset(dtf, date) { | ||
// to get deterministic local date/time output according to the `en-US` locale which | ||
// can be used to extract local time parts as necessary. | ||
var dtfCache = {} | ||
+ | ||
+// New browsers use `hourCycle`, IE and Chrome <73 does not support it and uses `hour12` | ||
+const testDateFormatted = new Intl.DateTimeFormat('en-US', { | ||
+ hourCycle: 'h23', | ||
+ timeZone: 'America/New_York', | ||
+ year: 'numeric', | ||
+ month: '2-digit', | ||
+ day: '2-digit', | ||
+ hour: '2-digit', | ||
+ minute: '2-digit', | ||
+ second: '2-digit', | ||
+}).format(new Date('2014-06-25T04:00:00.123Z')) | ||
+const hourCycleSupported = | ||
+ testDateFormatted === '06/25/2014, 00:00:00' || | ||
+ testDateFormatted === '06/25/2014 00:00:00' | ||
+ | ||
function getDateTimeFormat(timeZone) { | ||
if (!dtfCache[timeZone]) { | ||
- // New browsers use `hourCycle`, IE and Chrome <73 does not support it and uses `hour12` | ||
- var testDateFormatted = new Intl.DateTimeFormat('en-US', { | ||
- hour12: false, | ||
- timeZone: 'America/New_York', | ||
- year: 'numeric', | ||
- month: 'numeric', | ||
- day: '2-digit', | ||
- hour: '2-digit', | ||
- minute: '2-digit', | ||
- second: '2-digit', | ||
- }).format(new Date('2014-06-25T04:00:00.123Z')) | ||
- var hourCycleSupported = | ||
- testDateFormatted === '06/25/2014, 00:00:00' || | ||
- testDateFormatted === '06/25/2014 00:00:00' | ||
- | ||
dtfCache[timeZone] = hourCycleSupported | ||
? new Intl.DateTimeFormat('en-US', { | ||
hour12: false, |
This file contains 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 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 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 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 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,115 @@ | ||
import React, {useMemo} from 'react'; | ||
import type {SectionListData} from 'react-native'; | ||
import useDebouncedState from '@hooks/useDebouncedState'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import usePolicy from '@hooks/usePolicy'; | ||
import useScreenWrapperTranstionStatus from '@hooks/useScreenWrapperTransitionStatus'; | ||
import * as DeviceCapabilities from '@libs/DeviceCapabilities'; | ||
import * as OptionsListUtils from '@libs/OptionsListUtils'; | ||
import * as PolicyUtils from '@libs/PolicyUtils'; | ||
import CONST from '@src/CONST'; | ||
import type {Icon} from '@src/types/onyx/OnyxCommon'; | ||
import Badge from './Badge'; | ||
import {FallbackAvatar} from './Icon/Expensicons'; | ||
import {usePersonalDetails} from './OnyxProvider'; | ||
import SelectionList from './SelectionList'; | ||
import InviteMemberListItem from './SelectionList/InviteMemberListItem'; | ||
import type {Section} from './SelectionList/types'; | ||
|
||
type SelectionListApprover = { | ||
text: string; | ||
alternateText: string; | ||
keyForList: string; | ||
isSelected: boolean; | ||
login: string; | ||
rightElement?: React.ReactNode; | ||
icons: Icon[]; | ||
}; | ||
type ApproverSection = SectionListData<SelectionListApprover, Section<SelectionListApprover>>; | ||
|
||
type WorkspaceMembersSelectionListProps = { | ||
policyID: string; | ||
selectedApprover: string; | ||
setApprover: (email: string) => void; | ||
}; | ||
|
||
function WorkspaceMembersSelectionList({policyID, selectedApprover, setApprover}: WorkspaceMembersSelectionListProps) { | ||
const {translate} = useLocalize(); | ||
const {didScreenTransitionEnd} = useScreenWrapperTranstionStatus(); | ||
const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState(''); | ||
const personalDetails = usePersonalDetails(); | ||
const policy = usePolicy(policyID); | ||
|
||
const sections: ApproverSection[] = useMemo(() => { | ||
const approvers: SelectionListApprover[] = []; | ||
|
||
if (policy?.employeeList) { | ||
const availableApprovers = Object.values(policy.employeeList) | ||
.map((employee): SelectionListApprover | null => { | ||
const isAdmin = employee?.role === CONST.REPORT.ROLE.ADMIN; | ||
const email = employee.email; | ||
|
||
if (!email) { | ||
return null; | ||
} | ||
|
||
const policyMemberEmailsToAccountIDs = PolicyUtils.getMemberAccountIDsForWorkspace(policy?.employeeList); | ||
const accountID = Number(policyMemberEmailsToAccountIDs[email] ?? ''); | ||
const {avatar, displayName = email} = personalDetails?.[accountID] ?? {}; | ||
|
||
return { | ||
text: displayName, | ||
alternateText: email, | ||
keyForList: email, | ||
isSelected: selectedApprover === email, | ||
login: email, | ||
icons: [{source: avatar ?? FallbackAvatar, type: CONST.ICON_TYPE_AVATAR, name: displayName, id: accountID}], | ||
rightElement: isAdmin ? <Badge text={translate('common.admin')} /> : undefined, | ||
}; | ||
}) | ||
.filter((approver): approver is SelectionListApprover => !!approver); | ||
|
||
approvers.push(...availableApprovers); | ||
} | ||
|
||
const filteredApprovers = | ||
debouncedSearchTerm !== '' | ||
? approvers.filter((option) => { | ||
const searchValue = OptionsListUtils.getSearchValueForPhoneOrEmail(debouncedSearchTerm); | ||
const isPartOfSearchTerm = !!option.text?.toLowerCase().includes(searchValue) || !!option.login?.toLowerCase().includes(searchValue); | ||
return isPartOfSearchTerm; | ||
}) | ||
: approvers; | ||
|
||
return [ | ||
{ | ||
title: undefined, | ||
data: OptionsListUtils.sortAlphabetically(filteredApprovers, 'text'), | ||
shouldShow: true, | ||
}, | ||
]; | ||
}, [debouncedSearchTerm, personalDetails, policy?.employeeList, selectedApprover, translate]); | ||
|
||
const handleOnSelectRow = (approver: SelectionListApprover) => { | ||
setApprover(approver.login); | ||
}; | ||
|
||
const headerMessage = useMemo(() => (searchTerm && !sections[0].data.length ? translate('common.noResultsFound') : ''), [searchTerm, sections, translate]); | ||
|
||
return ( | ||
<SelectionList | ||
sections={sections} | ||
ListItem={InviteMemberListItem} | ||
textInputLabel={translate('selectionList.nameEmailOrPhoneNumber')} | ||
textInputValue={searchTerm} | ||
onChangeText={setSearchTerm} | ||
headerMessage={headerMessage} | ||
onSelectRow={handleOnSelectRow} | ||
showScrollIndicator | ||
showLoadingPlaceholder={!didScreenTransitionEnd} | ||
shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} | ||
/> | ||
); | ||
} | ||
|
||
export default WorkspaceMembersSelectionList; |
This file contains 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 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
6 changes: 6 additions & 0 deletions
6
src/libs/API/parameters/RemovePolicyCategoryReceiptsRequiredParams.ts
This file contains 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,6 @@ | ||
type RemovePolicyCategoryReceiptsRequiredParams = { | ||
policyID: string; | ||
categoryName: string; | ||
}; | ||
|
||
export default RemovePolicyCategoryReceiptsRequiredParams; |
This file contains 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,7 @@ | ||
type SetPolicyCategoryApproverParams = { | ||
policyID: string; | ||
categoryName: string; | ||
approver: string; | ||
}; | ||
|
||
export default SetPolicyCategoryApproverParams; |
7 changes: 7 additions & 0 deletions
7
src/libs/API/parameters/SetPolicyCategoryDescriptionRequiredParams.ts
This file contains 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,7 @@ | ||
type SetPolicyCategoryDescriptionRequiredParams = { | ||
policyID: string; | ||
categoryName: string; | ||
areCommentsRequired: boolean; | ||
}; | ||
|
||
export default SetPolicyCategoryDescriptionRequiredParams; |
10 changes: 10 additions & 0 deletions
10
src/libs/API/parameters/SetPolicyCategoryMaxAmountParams.ts
This file contains 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,10 @@ | ||
import type {PolicyCategoryExpenseLimitType} from '@src/types/onyx/PolicyCategory'; | ||
|
||
type SetPolicyCategoryMaxAmountParams = { | ||
policyID: string; | ||
categoryName: string; | ||
maxExpenseAmount: number | null; | ||
expenseLimitType: PolicyCategoryExpenseLimitType; | ||
}; | ||
|
||
export default SetPolicyCategoryMaxAmountParams; |
7 changes: 7 additions & 0 deletions
7
src/libs/API/parameters/SetPolicyCategoryReceiptsRequiredParams.ts
This file contains 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,7 @@ | ||
type SetPolicyCategoryReceiptsRequiredParams = { | ||
policyID: string; | ||
categoryName: string; | ||
maxExpenseAmountNoReceipt: number; | ||
}; | ||
|
||
export default SetPolicyCategoryReceiptsRequiredParams; |
This file contains 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,7 @@ | ||
type SetPolicyCategoryTaxParams = { | ||
policyID: string; | ||
categoryName: string; | ||
taxID: string; | ||
}; | ||
|
||
export default SetPolicyCategoryTaxParams; |
Oops, something went wrong.