Skip to content

fix: OfflineIndicator not at the bottom in QuickbooksAutoSyncPage #58514

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

Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import {CONST as COMMON_CONST} from 'expensify-common';
import React from 'react';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import ScreenWrapper from '@components/ScreenWrapper';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import {updateQuickbooksOnlineAutoSync} from '@libs/actions/connections/QuickbooksOnline';
import {getLatestErrorField} from '@libs/ErrorUtils';
import Navigation from '@libs/Navigation/Navigation';
import {settingsPendingAction} from '@libs/PolicyUtils';
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
import type {WithPolicyConnectionsProps} from '@pages/workspace/withPolicyConnections';
import withPolicyConnections from '@pages/workspace/withPolicyConnections';
import ToggleSettingOptionRow from '@pages/workspace/workflows/ToggleSettingsOptionRow';
import {clearQuickbooksOnlineAutoSyncErrorField} from '@userActions/Policy/Policy';

Check failure on line 17 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Module '"@userActions/Policy/Policy"' has no exported member 'clearQuickbooksOnlineAutoSyncErrorField'.
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ROUTES from '@src/ROUTES';

function QuickbooksAutoSyncPage({policy, route}: WithPolicyConnectionsProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const config = policy?.connections?.quickbooksOnline?.config;
const policyID = route.params.policyID;
const accountingMethod = config?.accountingMethod ?? COMMON_CONST.INTEGRATIONS.ACCOUNTING_METHOD.CASH;

Check failure on line 27 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Property 'accountingMethod' does not exist on type '{ realmId: string; companyName: string; autoSync: { jobID: string; enabled: boolean; }; syncPeople: boolean; syncItems: boolean; markChecksToBePrinted: boolean; reimbursableExpensesExportDestination: QBOReimbursableExportAccountType; ... 19 more ...; credentials: QBOCredentials; } & OfflineFeedback<...>'.

Check failure on line 27 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unsafe assignment of an `any` value

Check failure on line 27 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe assignment of an `any` value
const pendingAction =
settingsPendingAction([CONST.QUICKBOOKS_CONFIG.AUTO_SYNC], config?.pendingFields) ?? settingsPendingAction([CONST.QUICKBOOKS_CONFIG.ACCOUNTING_METHOD], config?.pendingFields);

Check failure on line 29 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Property 'ACCOUNTING_METHOD' does not exist on type '{ readonly ENABLE_NEW_CATEGORIES: "enableNewCategories"; readonly SYNC_CLASSES: "syncClasses"; readonly SYNC_CUSTOMERS: "syncCustomers"; readonly SYNC_LOCATIONS: "syncLocations"; ... 17 more ...; readonly COLLECTION_ACCOUNT_ID: "collectionAccountID"; }'.

return (
<AccessOrNotFoundWrapper
policyID={policyID}
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CATEGORIES_ENABLED}
>
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
style={[styles.defaultModalContainer]}
testID={QuickbooksAutoSyncPage.displayName}
offlineIndicatorStyle={styles.mtAuto}
>
<HeaderWithBackButton
title={translate('common.settings')}
onBackButtonPress={() => Navigation.goBack(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_ADVANCED.getRoute(policyID))}
/>
<ToggleSettingOptionRow
title={translate('workspace.accounting.autoSync')}
subtitle={translate('workspace.qbo.autoSyncDescription')}

Check failure on line 49 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Argument of type '"workspace.qbo.autoSyncDescription"' is not assignable to parameter of type 'TranslationPaths'.
isActive={!!config?.autoSync?.enabled}
wrapperStyle={[styles.pv2, styles.mh5]}
switchAccessibilityLabel={translate('workspace.qbo.advancedConfig.autoSyncDescription')}
shouldPlaceSubtitleBelowSwitch
onCloseError={() => clearQuickbooksOnlineAutoSyncErrorField(policyID)}

Check failure on line 54 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unsafe return of an `any` typed value

Check failure on line 54 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unsafe call of an `any` typed value

Check failure on line 54 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe return of an `any` typed value

Check failure on line 54 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe call of an `any` typed value
onToggle={(isEnabled) => updateQuickbooksOnlineAutoSync(policyID, isEnabled)}

Check failure on line 55 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
pendingAction={pendingAction}
errors={getLatestErrorField(config, CONST.QUICKBOOKS_CONFIG.AUTO_SYNC)}
/>
{!!config?.autoSync?.enabled && (
<OfflineWithFeedback pendingAction={pendingAction}>
<MenuItemWithTopDescription
title={
accountingMethod === COMMON_CONST.INTEGRATIONS.ACCOUNTING_METHOD.ACCRUAL
? translate(`workspace.accountingMethods.values.${COMMON_CONST.INTEGRATIONS.ACCOUNTING_METHOD.ACCRUAL}` as TranslationPaths)
: translate(`workspace.accountingMethods.values.${COMMON_CONST.INTEGRATIONS.ACCOUNTING_METHOD.CASH}` as TranslationPaths)
}
description={translate('workspace.accountingMethods.label')}

Check failure on line 67 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Argument of type '"workspace.accountingMethods.label"' is not assignable to parameter of type 'TranslationPaths'.
shouldShowRightIcon
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_ACCOUNTING_METHOD.getRoute(policyID))}

Check failure on line 69 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Property 'WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_ACCOUNTING_METHOD' does not exist on type '{ readonly HOME: "home"; readonly SEARCH_ROOT: { readonly route: "search"; readonly getRoute: ({ query, name }: { query: string; name?: string | undefined; }) => `search?q=${string}${string}`; }; readonly SEARCH_SAVED_SEARCH_RENAME: { ...; }; ... 541 more ...; readonly SAML_SIGN_IN: "sign-in-with-saml"; }'. Did you mean 'WORKSPACE_ACCOUNTING_QUICKBOOKS_ONLINE_ACCOUNT_SELECTOR'?

Check failure on line 69 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unsafe argument of type `any` assigned to a parameter of type `Route`

Check failure on line 69 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unsafe call of an `any` typed value

Check failure on line 69 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Unsafe member access .getRoute on an `error` typed value

Check failure on line 69 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe argument of type `any` assigned to a parameter of type `Route`

Check failure on line 69 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe call of an `any` typed value

Check failure on line 69 in src/pages/workspace/accounting/qbo/advanced/QuickbooksAutoSyncPage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Unsafe member access .getRoute on an `error` typed value
/>
</OfflineWithFeedback>
)}
</ScreenWrapper>
</AccessOrNotFoundWrapper>
);
}

QuickbooksAutoSyncPage.displayName = 'QuickbooksAutoSyncPage';

export default withPolicyConnections(QuickbooksAutoSyncPage);
Loading