Skip to content
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

fixes-37403 Workflows-If the first 2 options are enabled,cannot scroll to see the 3th option #38248

Merged
merged 16 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from 12 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
217 changes: 107 additions & 110 deletions src/pages/workspace/WorkspaceProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import * as Expensicons from '@components/Icon/Expensicons';
import * as Illustrations from '@components/Icon/Illustrations';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import ScrollView from '@components/ScrollView';
import Section from '@components/Section';
import Text from '@components/Text';
import useActiveWorkspace from '@hooks/useActiveWorkspace';
Expand Down Expand Up @@ -118,124 +117,122 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi
icon={Illustrations.House}
>
{(hasVBA?: boolean) => (
<ScrollView>
<View style={[styles.flex1, styles.mt3, isSmallScreenWidth ? styles.workspaceSectionMobile : styles.workspaceSection]}>
<Section
isCentralPane
title=""
>
<Image
style={StyleSheet.flatten([styles.wAuto, styles.h68, imageStyle])}
source={illustrations.WorkspaceProfile}
resizeMode="cover"
/>
<AvatarWithImagePicker
onViewPhotoPress={() => Navigation.navigate(ROUTES.WORKSPACE_AVATAR.getRoute(policy?.id ?? ''))}
source={policy?.avatar ?? ''}
size={CONST.AVATAR_SIZE.XLARGE}
avatarStyle={styles.avatarXLarge}
enablePreview
DefaultAvatar={DefaultAvatar}
type={CONST.ICON_TYPE_WORKSPACE}
fallbackIcon={Expensicons.FallbackWorkspaceAvatar}
style={[
isSmallScreenWidth ? styles.mb1 : styles.mb3,
isSmallScreenWidth ? styles.mtn17 : styles.mtn20,
styles.alignItemsStart,
styles.sectionMenuItemTopDescription,
]}
editIconStyle={styles.smallEditIconWorkspace}
isUsingDefaultAvatar={!policy?.avatar ?? null}
onImageSelected={(file) => Policy.updateWorkspaceAvatar(policy?.id ?? '', file as File)}
onImageRemoved={() => Policy.deleteWorkspaceAvatar(policy?.id ?? '')}
editorMaskImage={Expensicons.ImageCropSquareMask}
pendingAction={policy?.pendingFields?.avatar}
errors={policy?.errorFields?.avatar}
onErrorClose={() => Policy.clearAvatarErrors(policy?.id ?? '')}
previewSource={UserUtils.getFullSizeAvatar(policy?.avatar ?? '')}
headerTitle={translate('workspace.common.workspaceAvatar')}
originalFileName={policy?.originalFileName}
<View style={[styles.flex1, styles.mt3, isSmallScreenWidth ? styles.workspaceSectionMobile : styles.workspaceSection]}>
<Section
isCentralPane
title=""
>
<Image
style={StyleSheet.flatten([styles.wAuto, styles.h68, imageStyle])}
source={illustrations.WorkspaceProfile}
resizeMode="cover"
/>
<AvatarWithImagePicker
onViewPhotoPress={() => Navigation.navigate(ROUTES.WORKSPACE_AVATAR.getRoute(policy?.id ?? ''))}
source={policy?.avatar ?? ''}
size={CONST.AVATAR_SIZE.XLARGE}
avatarStyle={styles.avatarXLarge}
enablePreview
DefaultAvatar={DefaultAvatar}
type={CONST.ICON_TYPE_WORKSPACE}
fallbackIcon={Expensicons.FallbackWorkspaceAvatar}
style={[
isSmallScreenWidth ? styles.mb1 : styles.mb3,
isSmallScreenWidth ? styles.mtn17 : styles.mtn20,
styles.alignItemsStart,
styles.sectionMenuItemTopDescription,
]}
editIconStyle={styles.smallEditIconWorkspace}
isUsingDefaultAvatar={!policy?.avatar ?? null}
onImageSelected={(file) => Policy.updateWorkspaceAvatar(policy?.id ?? '', file as File)}
onImageRemoved={() => Policy.deleteWorkspaceAvatar(policy?.id ?? '')}
editorMaskImage={Expensicons.ImageCropSquareMask}
pendingAction={policy?.pendingFields?.avatar}
errors={policy?.errorFields?.avatar}
onErrorClose={() => Policy.clearAvatarErrors(policy?.id ?? '')}
previewSource={UserUtils.getFullSizeAvatar(policy?.avatar ?? '')}
headerTitle={translate('workspace.common.workspaceAvatar')}
originalFileName={policy?.originalFileName}
disabled={readOnly}
disabledStyle={styles.cursorDefault}
errorRowStyles={undefined}
/>
<OfflineWithFeedback pendingAction={policy?.pendingFields?.generalSettings}>
<MenuItemWithTopDescription
title={policyName}
titleStyle={styles.workspaceTitleStyle}
description={translate('workspace.editor.nameInputLabel')}
shouldShowRightIcon={!readOnly}
disabled={readOnly}
disabledStyle={styles.cursorDefault}
errorRowStyles={undefined}
wrapperStyle={[styles.sectionMenuItemTopDescription, isSmallScreenWidth ? styles.mt3 : {}]}
onPress={onPressName}
shouldGreyOutWhenDisabled={false}
shouldUseDefaultCursorWhenDisabled
/>
<OfflineWithFeedback pendingAction={policy?.pendingFields?.generalSettings}>
</OfflineWithFeedback>
{(!StringUtils.isEmptyString(policy?.description ?? '') || !readOnly) && (
<OfflineWithFeedback pendingAction={policy?.pendingFields?.description}>
<MenuItemWithTopDescription
title={policyName}
titleStyle={styles.workspaceTitleStyle}
description={translate('workspace.editor.nameInputLabel')}
title={policyDescription}
description={translate('workspace.editor.descriptionInputLabel')}
shouldShowRightIcon={!readOnly}
disabled={readOnly}
wrapperStyle={[styles.sectionMenuItemTopDescription, isSmallScreenWidth ? styles.mt3 : {}]}
onPress={onPressName}
wrapperStyle={styles.sectionMenuItemTopDescription}
onPress={onPressDescription}
shouldGreyOutWhenDisabled={false}
shouldUseDefaultCursorWhenDisabled
shouldRenderAsHTML
/>
</OfflineWithFeedback>
{(!StringUtils.isEmptyString(policy?.description ?? '') || !readOnly) && (
<OfflineWithFeedback pendingAction={policy?.pendingFields?.description}>
<MenuItemWithTopDescription
title={policyDescription}
description={translate('workspace.editor.descriptionInputLabel')}
shouldShowRightIcon={!readOnly}
disabled={readOnly}
wrapperStyle={styles.sectionMenuItemTopDescription}
onPress={onPressDescription}
shouldGreyOutWhenDisabled={false}
shouldUseDefaultCursorWhenDisabled
shouldRenderAsHTML
/>
</OfflineWithFeedback>
)}
<OfflineWithFeedback pendingAction={policy?.pendingFields?.generalSettings}>
<View>
<MenuItemWithTopDescription
title={formattedCurrency}
description={translate('workspace.editor.currencyInputLabel')}
shouldShowRightIcon={!readOnly}
disabled={hasVBA ? true : readOnly}
wrapperStyle={styles.sectionMenuItemTopDescription}
onPress={onPressCurrency}
shouldGreyOutWhenDisabled={false}
shouldUseDefaultCursorWhenDisabled
/>
<Text style={[styles.textLabel, styles.colorMuted, styles.mt1, styles.mh5, styles.sectionMenuItemTopDescription]}>
{hasVBA ? translate('workspace.editor.currencyInputDisabledText') : translate('workspace.editor.currencyInputHelpText')}
</Text>
</View>
</OfflineWithFeedback>
{!readOnly && (
<View style={[styles.flexRow, styles.mt6, styles.mnw120]}>
<Button
accessibilityLabel={translate('common.share')}
text={translate('common.share')}
onPress={onPressShare}
medium
icon={Expensicons.QrCode}
/>
<Button
accessibilityLabel={translate('common.delete')}
text={translate('common.delete')}
style={[styles.ml2]}
onPress={() => setIsDeleteModalOpen(true)}
medium
icon={Expensicons.Trashcan}
/>
</View>
)}
</Section>
<ConfirmModal
title={translate('common.delete')}
isVisible={isDeleteModalOpen}
onConfirm={confirmDeleteAndHideModal}
onCancel={() => setIsDeleteModalOpen(false)}
prompt={translate('workspace.common.deleteConfirmation')}
confirmText={translate('common.delete')}
cancelText={translate('common.cancel')}
danger
/>
</View>
</ScrollView>
)}
<OfflineWithFeedback pendingAction={policy?.pendingFields?.generalSettings}>
<View>
<MenuItemWithTopDescription
title={formattedCurrency}
description={translate('workspace.editor.currencyInputLabel')}
shouldShowRightIcon={!readOnly}
disabled={hasVBA ? true : readOnly}
wrapperStyle={styles.sectionMenuItemTopDescription}
onPress={onPressCurrency}
shouldGreyOutWhenDisabled={false}
shouldUseDefaultCursorWhenDisabled
/>
<Text style={[styles.textLabel, styles.colorMuted, styles.mt1, styles.mh5, styles.sectionMenuItemTopDescription]}>
{hasVBA ? translate('workspace.editor.currencyInputDisabledText') : translate('workspace.editor.currencyInputHelpText')}
</Text>
</View>
</OfflineWithFeedback>
{!readOnly && (
<View style={[styles.flexRow, styles.mt6, styles.mnw120]}>
<Button
accessibilityLabel={translate('common.share')}
text={translate('common.share')}
onPress={onPressShare}
medium
icon={Expensicons.QrCode}
/>
<Button
accessibilityLabel={translate('common.delete')}
text={translate('common.delete')}
style={[styles.ml2]}
onPress={() => setIsDeleteModalOpen(true)}
medium
icon={Expensicons.Trashcan}
/>
</View>
)}
</Section>
<ConfirmModal
title={translate('common.delete')}
isVisible={isDeleteModalOpen}
onConfirm={confirmDeleteAndHideModal}
onCancel={() => setIsDeleteModalOpen(false)}
prompt={translate('workspace.common.deleteConfirmation')}
confirmText={translate('common.delete')}
cancelText={translate('common.cancel')}
danger
/>
</View>
)}
</WorkspacePageWithSections>
);
Expand Down
16 changes: 8 additions & 8 deletions src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {StackScreenProps} from '@react-navigation/stack';
import React, {useCallback, useEffect, useMemo} from 'react';
import {FlatList, View} from 'react-native';
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
import * as Illustrations from '@components/Icon/Illustrations';
Expand Down Expand Up @@ -206,8 +206,11 @@ function WorkspaceWorkflowsPage({policy, betas, route, reimbursementAccount, ses
session?.accountID,
]);

const renderOptionItem = ({item}: {item: ToggleSettingOptionRowProps}) => (
<View style={styles.mt7}>
const renderOptionItem = (item: ToggleSettingOptionRowProps, index: number) => (
<View
style={styles.mt7}
key={`toggleSettingOptionItem-${index}`}
>
<ToggleSettingOptionRow
icon={item.icon}
title={item.title}
Expand Down Expand Up @@ -236,6 +239,7 @@ function WorkspaceWorkflowsPage({policy, betas, route, reimbursementAccount, ses
shouldShowNotFoundPage={!isPaidGroupPolicy || !isPolicyAdmin}
shouldSkipVBBACall
isLoading={isLoading}
shouldUseScrollView
>
<View style={[styles.mt3, styles.textStrong, isSmallScreenWidth ? styles.workspaceSectionMobile : styles.workspaceSection]}>
<Section
Expand All @@ -245,11 +249,7 @@ function WorkspaceWorkflowsPage({policy, betas, route, reimbursementAccount, ses
>
<View>
<Text style={[styles.mt3, styles.textSupporting]}>{translate('workflowsPage.workflowDescription')}</Text>
<FlatList
data={optionItems}
renderItem={renderOptionItem}
keyExtractor={(item: ToggleSettingOptionRowProps) => item.title}
/>
{optionItems.map(renderOptionItem)}
</View>
</Section>
</View>
Expand Down
Loading