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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3554,6 +3554,8 @@ const CONST = {
COMPANY_CARDS: {
BROKEN_CONNECTION_IGNORED_STATUSES: brokenConnectionScrapeStatuses,
CONNECTION_ERROR: 'connectionError',
WORKSPACE_FEEDS_LOAD_ERROR: 'workspaceFeedsLoadError',
FEED_LOAD_ERROR: 'feedLoadError',
STEP: {
SELECT_BANK: 'SelectBank',
SELECT_FEED_TYPE: 'SelectFeedType',
Expand Down
2 changes: 1 addition & 1 deletion src/components/BlockingViews/BlockingView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function BlockingView({
/>
)}
<View>
<Text style={[titleStyles, styles.notFoundTextHeader]}>{title}</Text>
<Text style={[styles.notFoundTextHeader, titleStyles]}>{title}</Text>

{CustomSubtitle}
{!CustomSubtitle && (
Expand Down
9 changes: 6 additions & 3 deletions src/components/BlockingViews/FullPageErrorView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import {View} from 'react-native';
import type {StyleProp, TextStyle} from 'react-native';
import type {StyleProp, TextStyle, ViewStyle} from 'react-native';
import {useMemoizedLazyIllustrations} from '@hooks/useLazyAsset';
import useThemeStyles from '@hooks/useThemeStyles';
import variables from '@styles/variables';
Expand Down Expand Up @@ -28,18 +28,20 @@ type FullPageErrorViewProps = {

/** The style of the subtitle message */
subtitleStyle?: StyleProp<TextStyle>;

containerStyle?: StyleProp<ViewStyle>;
};

// eslint-disable-next-line rulesdir/no-negated-variables
function FullPageErrorView({testID, children = null, shouldShow = false, title = '', subtitle = '', shouldForceFullScreen = false, subtitleStyle}: FullPageErrorViewProps) {
function FullPageErrorView({testID, children = null, shouldShow = false, title = '', subtitle = '', shouldForceFullScreen = false, subtitleStyle, containerStyle}: FullPageErrorViewProps) {
const styles = useThemeStyles();
const illustrations = useMemoizedLazyIllustrations(['BrokenMagnifyingGlass']);

if (shouldShow) {
return (
<ForceFullScreenView shouldForceFullScreen={shouldForceFullScreen}>
<View
style={[styles.flex1, styles.blockingErrorViewContainer]}
style={[styles.flex1, styles.searchBlockingErrorViewContainer]}
testID={testID}
>
<BlockingView
Expand All @@ -49,6 +51,7 @@ function FullPageErrorView({testID, children = null, shouldShow = false, title =
title={title}
subtitle={subtitle}
subtitleStyle={subtitleStyle}
containerStyle={containerStyle}
/>
</View>
</ForceFullScreenView>
Expand Down
1 change: 1 addition & 0 deletions src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,7 @@ function Search({
<View style={[shouldUseNarrowLayout ? styles.searchListContentContainerStyles : styles.mt3, styles.flex1]}>
<FullPageErrorView
shouldShow
containerStyle={styles.searchBlockingErrorViewContainer}
subtitleStyle={styles.textSupporting}
title={translate('errorPage.title', {isBreakLine: shouldUseNarrowLayout})}
subtitle={translate(isInvalidQuery ? 'errorPage.wrongTypeSubtitle' : 'errorPage.subtitle')}
Expand Down
4 changes: 3 additions & 1 deletion src/hooks/useAssignCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import useCardFeeds from './useCardFeeds';
import type {CombinedCardFeed} from './useCardFeeds';
import useCurrencyList from './useCurrencyList';
import useIsAllowedToIssueCompanyCard from './useIsAllowedToIssueCompanyCard';
import useLocalize from './useLocalize';
import useNetwork from './useNetwork';
import useOnyx from './useOnyx';
import usePolicy from './usePolicy';
Expand All @@ -44,6 +45,7 @@ function useAssignCard({feedName, policyID, setShouldShowOfflineModal}: UseAssig
const [cardFeeds] = useCardFeeds(policyID);
const companyFeeds = getCompanyFeeds(cardFeeds);
const currentFeedData = feedName ? companyFeeds?.[feedName] : ({} as CombinedCardFeed);
const {translate} = useLocalize();

const policy = usePolicy(policyID);
const workspaceAccountID = policy?.workspaceAccountID ?? CONST.DEFAULT_NUMBER_ID;
Expand All @@ -53,7 +55,7 @@ function useAssignCard({feedName, policyID, setShouldShowOfflineModal}: UseAssig
const domainOrWorkspaceAccountID = getDomainOrWorkspaceAccountID(workspaceAccountID, selectedFeedData);

const fetchCompanyCards = () => {
openPolicyCompanyCardsPage(policyID, domainOrWorkspaceAccountID);
openPolicyCompanyCardsPage(policyID, domainOrWorkspaceAccountID, translate);
};

const {isOffline} = useNetwork({onReconnect: fetchCompanyCards});
Expand Down
10 changes: 6 additions & 4 deletions src/hooks/useCardFeeds.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {OnyxCollection, ResultMetadata} from 'react-native-onyx';
import {getCombinedCardFeedsFromAllFeeds} from '@libs/CardFeedUtils';
import {getCombinedCardFeedsFromAllFeeds, getWorkspaceCardFeedsStatus} from '@libs/CardFeedUtils';
import ONYXKEYS from '@src/ONYXKEYS';
import type {CardFeeds, CombinedCardFeed, CombinedCardFeeds, CompanyCardFeedWithDomainID} from '@src/types/onyx';
import type {CardFeeds, CardFeedsStatusByDomainID, CombinedCardFeed, CombinedCardFeeds, CompanyCardFeedWithDomainID} from '@src/types/onyx';
import useOnyx from './useOnyx';
import useWorkspaceAccountID from './useWorkspaceAccountID';

Expand All @@ -19,7 +19,7 @@ import useWorkspaceAccountID from './useWorkspaceAccountID';
* 2. The result metadata from the Onyx collection fetch.
* 3. Card feeds specific to the given policyID (or `undefined` if unavailable).
*/
const useCardFeeds = (policyID: string | undefined): [CombinedCardFeeds | undefined, ResultMetadata<OnyxCollection<CardFeeds>>, CardFeeds | undefined] => {
const useCardFeeds = (policyID: string | undefined): [CombinedCardFeeds | undefined, ResultMetadata<OnyxCollection<CardFeeds>>, CardFeeds | undefined, CardFeedsStatusByDomainID] => {
const workspaceAccountID = useWorkspaceAccountID(policyID);
const [allFeeds, allFeedsResult] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER, {canBeMissing: true});
const defaultFeed = allFeeds?.[`${ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER}${workspaceAccountID}`];
Expand All @@ -31,7 +31,9 @@ const useCardFeeds = (policyID: string | undefined): [CombinedCardFeeds | undefi
workspaceFeeds = getCombinedCardFeedsFromAllFeeds(allFeeds, shouldIncludeFeedPredicate);
}

return [workspaceFeeds, allFeedsResult, defaultFeed];
const workspaceCardFeedsStatus = getWorkspaceCardFeedsStatus(allFeeds);

return [workspaceFeeds, allFeedsResult, defaultFeed, workspaceCardFeedsStatus];
};

export default useCardFeeds;
Expand Down
6 changes: 4 additions & 2 deletions src/hooks/useCompanyCards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {CardFeeds, CardList} from '@src/types/onyx';
import type {AssignableCardsList, WorkspaceCardsList} from '@src/types/onyx/Card';
import type {CombinedCardFeeds, CompanyCardFeed, CompanyCardFeedWithDomainID, CompanyFeeds} from '@src/types/onyx/CardFeeds';
import type {CardFeedsStatusByDomainID, CombinedCardFeeds, CompanyCardFeed, CompanyCardFeedWithDomainID, CompanyFeeds} from '@src/types/onyx/CardFeeds';
import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue';
import useCardFeeds from './useCardFeeds';
import type {CombinedCardFeed} from './useCardFeeds';
Expand All @@ -25,6 +25,7 @@ type UseCompanyCardsResult = Partial<{
feedName: CompanyCardFeedWithDomainID;
cardList: AssignableCardsList;
assignedCards: CardList;
workspaceCardFeedsStatus: CardFeedsStatusByDomainID;
cardNames: string[];
allCardFeeds: CombinedCardFeeds;
companyCardFeeds: CompanyFeeds;
Expand All @@ -48,7 +49,7 @@ function useCompanyCards({policyID, feedName: feedNameProp}: UseCompanyCardsProp
const policyIDKey = policyID || CONST.DEFAULT_MISSING_ID;

const [lastSelectedFeed, lastSelectedFeedMetadata] = useOnyx(`${ONYXKEYS.COLLECTION.LAST_SELECTED_FEED}${policyIDKey}`, {canBeMissing: true});
const [allCardFeeds, allCardFeedsMetadata] = useCardFeeds(policyID);
const [allCardFeeds, allCardFeedsMetadata, , workspaceCardFeedsStatus] = useCardFeeds(policyID);

const feedName = feedNameProp ?? getSelectedFeed(lastSelectedFeed, allCardFeeds);
const bankName = feedName ? getCompanyCardFeed(feedName) : undefined;
Expand Down Expand Up @@ -90,6 +91,7 @@ function useCompanyCards({policyID, feedName: feedNameProp}: UseCompanyCardsProp
companyCardFeeds,
cardList,
assignedCards,
workspaceCardFeedsStatus,
cardNames,
selectedFeed,
bankName,
Expand Down
10 changes: 9 additions & 1 deletion src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ const translations: TranslationDeepObject<typeof en> = {
expiredCodeDescription: 'Gehe zurück zum ursprünglichen Gerät und fordere einen neuen Code an',
successfulNewCodeRequest: 'Code angefordert. Bitte überprüfe dein Gerät.',
tfaRequiredTitle: dedent(`
Zwei-Faktor-Authentifizierung
Zwei-Faktor-Authentifizierung
erforderlich
`),
tfaRequiredDescription: dedent(`
Expand Down Expand Up @@ -4896,6 +4896,14 @@ _Für ausführlichere Anweisungen [besuchen Sie unsere Hilfeseite](${CONST.NETSU
assignCardFailedError: 'Kartenzuweisung fehlgeschlagen.',
cardAlreadyAssignedError: 'This card is already assigned to a user in another workspace.',
unassignCardFailedError: 'Aufhebung der Kartenzuweisung fehlgeschlagen.',
error: {
workspaceFeedsCouldNotBeLoadedTitle: 'Kartenfeeds konnten nicht geladen werden',
workspaceFeedsCouldNotBeLoadedMessage:
'Beim Laden der Workspace-Kartenfeeds ist ein Fehler aufgetreten. Bitte versuche es erneut oder wende dich an deine Administratorin bzw. deinen Administrator.',
feedCouldNotBeLoadedTitle: 'Dieser Feed konnte nicht geladen werden',
feedCouldNotBeLoadedMessage: 'Beim Laden dieses Feeds ist ein Fehler aufgetreten. Bitte versuche es erneut oder kontaktiere deine Administratorin/deinen Administrator.',
tryAgain: 'Erneut versuchen',
},
},
expensifyCard: {
issueAndManageCards: 'Expensify Cards ausstellen und verwalten',
Expand Down
7 changes: 7 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4706,6 +4706,13 @@ const translations = {
companyCards: {
addCards: 'Add cards',
selectCards: 'Select cards',
error: {
workspaceFeedsCouldNotBeLoadedTitle: "Couldn't load card feeds",
workspaceFeedsCouldNotBeLoadedMessage: 'An error occurred while loading workspace card feeds. Please try again or contact your administrator.',
feedCouldNotBeLoadedTitle: "Couldn't load this feed",
feedCouldNotBeLoadedMessage: 'An error occurred while loading this feed. Please try again or contact your administrator.',
tryAgain: 'Try again',
},
addNewCard: {
other: 'Other',
cardProviders: {
Expand Down
Loading
Loading