From 0bef6caa6f162e7f30ad033f222f3d33a68982ee Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Sun, 28 Apr 2024 05:15:23 +0530 Subject: [PATCH 1/6] fix: Workspace switcher search bar is in the wrong place. Signed-off-by: Krishna Gupta --- .../WorkspacesSectionHeader.tsx | 2 +- src/pages/WorkspaceSwitcherPage/index.tsx | 54 ++++++++++++------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/pages/WorkspaceSwitcherPage/WorkspacesSectionHeader.tsx b/src/pages/WorkspaceSwitcherPage/WorkspacesSectionHeader.tsx index 85e13ba4c0a5..044ded08e35d 100644 --- a/src/pages/WorkspaceSwitcherPage/WorkspacesSectionHeader.tsx +++ b/src/pages/WorkspaceSwitcherPage/WorkspacesSectionHeader.tsx @@ -19,7 +19,7 @@ function WorkspacesSectionHeader() { const {translate} = useLocalize(); return ( - + ; function WorkspaceSwitcherPage() { + const styles = useThemeStyles(); + const theme = useTheme(); const {isOffline} = useNetwork(); const [searchTerm, debouncedSearchTerm, setSearchTerm] = useDebouncedState(''); const {translate} = useLocalize(); @@ -138,33 +144,26 @@ function WorkspaceSwitcherPage() { const sections = useMemo(() => { const options: Array> = [ { - title: translate('workspace.switcher.everythingSection'), + data: filteredAndSortedUserWorkspaces, shouldShow: true, - indexOffset: 0, - data: [ - { - text: CONST.WORKSPACE_SWITCHER.NAME, - policyID: '', - icons: [{source: Expensicons.ExpensifyAppIcon, name: CONST.WORKSPACE_SWITCHER.NAME, type: CONST.ICON_TYPE_AVATAR}], - brickRoadIndicator: getIndicatorTypeForPolicy(undefined), - isSelected: activeWorkspaceID === undefined, - keyForList: CONST.WORKSPACE_SWITCHER.NAME, - }, - ], + indexOffset: 1, }, ]; - options.push({ - CustomSectionHeader: WorkspacesSectionHeader, - data: filteredAndSortedUserWorkspaces, - shouldShow: true, - indexOffset: 1, - }); return options; - }, [activeWorkspaceID, filteredAndSortedUserWorkspaces, getIndicatorTypeForPolicy, translate]); + }, [filteredAndSortedUserWorkspaces]); const headerMessage = filteredAndSortedUserWorkspaces.length === 0 && usersWorkspaces.length ? translate('common.noResultsFound') : ''; const shouldShowCreateWorkspace = usersWorkspaces.length === 0; + const defaultPolicy = { + text: CONST.WORKSPACE_SWITCHER.NAME, + policyID: '', + icons: [{source: Expensicons.ExpensifyAppIcon, name: CONST.WORKSPACE_SWITCHER.NAME, type: CONST.ICON_TYPE_AVATAR}], + brickRoadIndicator: getIndicatorTypeForPolicy(undefined), + keyForList: CONST.WORKSPACE_SWITCHER.NAME, + isSelected: activeWorkspaceID === undefined, + }; + return ( + + + {translate('workspace.switcher.everythingSection')} + + + + selectPolicy(defaultPolicy)} + /> + + ListItem={UserListItem} sections={sections} From 7c396dcca34f72f8409e0c5e37c0a77436a18f8f Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Mon, 29 Apr 2024 03:49:57 +0530 Subject: [PATCH 2/6] minor fix. Signed-off-by: Krishna Gupta --- src/components/SelectionList/UserListItem.tsx | 2 ++ src/pages/WorkspaceSwitcherPage/index.tsx | 15 +++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/SelectionList/UserListItem.tsx b/src/components/SelectionList/UserListItem.tsx index 68349293e134..daf24d0bb3ca 100644 --- a/src/components/SelectionList/UserListItem.tsx +++ b/src/components/SelectionList/UserListItem.tsx @@ -29,6 +29,7 @@ function UserListItem({ rightHandSideComponent, onFocus, shouldSyncFocus, + pressableStyle, }: UserListItemProps) { const styles = useThemeStyles(); const theme = useTheme(); @@ -61,6 +62,7 @@ function UserListItem({ rightHandSideComponent={rightHandSideComponent} errors={item.errors} pendingAction={item.pendingAction} + pressableStyle={pressableStyle} FooterComponent={ item.invitedSecondaryLogin ? ( diff --git a/src/pages/WorkspaceSwitcherPage/index.tsx b/src/pages/WorkspaceSwitcherPage/index.tsx index f01e6a997258..1be8b38a56d8 100644 --- a/src/pages/WorkspaceSwitcherPage/index.tsx +++ b/src/pages/WorkspaceSwitcherPage/index.tsx @@ -181,14 +181,13 @@ function WorkspaceSwitcherPage() { {translate('workspace.switcher.everythingSection')} - - selectPolicy(defaultPolicy)} - /> - + selectPolicy(defaultPolicy)} + pressableStyle={styles.flexRow} + /> ListItem={UserListItem} From 3a3dde8386617b517f8734dc143bea698cb4c806 Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Wed, 15 May 2024 13:01:41 +0530 Subject: [PATCH 3/6] fix: input gets blurred when all chats are selected. Signed-off-by: Krishna Gupta --- src/pages/WorkspaceSwitcherPage/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/WorkspaceSwitcherPage/index.tsx b/src/pages/WorkspaceSwitcherPage/index.tsx index d84ed7b4add4..be9518962dde 100644 --- a/src/pages/WorkspaceSwitcherPage/index.tsx +++ b/src/pages/WorkspaceSwitcherPage/index.tsx @@ -188,6 +188,7 @@ function WorkspaceSwitcherPage() { showTooltip={false} onSelectRow={() => selectPolicy(defaultPolicy)} pressableStyle={styles.flexRow} + shouldSyncFocus={false} /> From 5495b7a3f5101230d2bd744b196f005a981d2112 Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Mon, 20 May 2024 13:36:21 +0530 Subject: [PATCH 4/6] update padding horizontal of workspace section header. Signed-off-by: Krishna Gupta --- src/pages/WorkspaceSwitcherPage/WorkspacesSectionHeader.tsx | 2 +- src/pages/WorkspaceSwitcherPage/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/WorkspaceSwitcherPage/WorkspacesSectionHeader.tsx b/src/pages/WorkspaceSwitcherPage/WorkspacesSectionHeader.tsx index 044ded08e35d..36e24036d365 100644 --- a/src/pages/WorkspaceSwitcherPage/WorkspacesSectionHeader.tsx +++ b/src/pages/WorkspaceSwitcherPage/WorkspacesSectionHeader.tsx @@ -19,7 +19,7 @@ function WorkspacesSectionHeader() { const {translate} = useLocalize(); return ( - + - + Date: Sat, 25 May 2024 03:35:32 +0530 Subject: [PATCH 5/6] hide loading placeholder when searching. Signed-off-by: Krishna Gupta --- src/pages/WorkspaceSwitcherPage/index.tsx | 72 ++++++++++++----------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/src/pages/WorkspaceSwitcherPage/index.tsx b/src/pages/WorkspaceSwitcherPage/index.tsx index 2ef23a936d57..1b9e6fc0974d 100644 --- a/src/pages/WorkspaceSwitcherPage/index.tsx +++ b/src/pages/WorkspaceSwitcherPage/index.tsx @@ -54,7 +54,7 @@ function WorkspaceSwitcherPage() { const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT); const [reportActions] = useOnyx(ONYXKEYS.COLLECTION.REPORT_ACTIONS); - const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY); + const [policies, fetchStatus] = useOnyx(ONYXKEYS.COLLECTION.POLICY); const brickRoadsForPolicies = useMemo(() => getWorkspacesBrickRoads(reports, policies, reportActions), [reports, policies, reportActions]); const unreadStatusesForPolicies = useMemo(() => getWorkspacesUnreadStatuses(reports), [reports]); @@ -169,39 +169,43 @@ function WorkspaceSwitcherPage() { testID={WorkspaceSwitcherPage.displayName} includeSafeAreaPaddingBottom={false} > - - - - {translate('workspace.switcher.everythingSection')} - - - selectPolicy(defaultPolicy)} - pressableStyle={styles.flexRow} - shouldSyncFocus={false} - /> - - - ListItem={UserListItem} - sections={sections} - onSelectRow={selectPolicy} - textInputLabel={usersWorkspaces.length >= CONST.WORKSPACE_SWITCHER.MINIMUM_WORKSPACES_TO_SHOW_SEARCH ? translate('common.search') : undefined} - textInputValue={searchTerm} - onChangeText={setSearchTerm} - headerMessage={headerMessage} - listFooterContent={shouldShowCreateWorkspace ? WorkspaceCardCreateAWorkspaceInstance : null} - initiallyFocusedOptionKey={activeWorkspaceID ?? CONST.WORKSPACE_SWITCHER.NAME} - showLoadingPlaceholder - /> + {({didScreenTransitionEnd}) => ( + <> + + + + {translate('workspace.switcher.everythingSection')} + + + selectPolicy(defaultPolicy)} + pressableStyle={styles.flexRow} + shouldSyncFocus={false} + /> + + + ListItem={UserListItem} + sections={sections} + onSelectRow={selectPolicy} + textInputLabel={usersWorkspaces.length >= CONST.WORKSPACE_SWITCHER.MINIMUM_WORKSPACES_TO_SHOW_SEARCH ? translate('common.search') : undefined} + textInputValue={searchTerm} + onChangeText={setSearchTerm} + headerMessage={headerMessage} + listFooterContent={shouldShowCreateWorkspace ? WorkspaceCardCreateAWorkspaceInstance : null} + initiallyFocusedOptionKey={activeWorkspaceID ?? CONST.WORKSPACE_SWITCHER.NAME} + showLoadingPlaceholder={fetchStatus.status === 'loading' || !didScreenTransitionEnd} + />{' '} + + )} ); } From 6d772b56d1fe233b7bf2df7af1a9ebe459c17feb Mon Sep 17 00:00:00 2001 From: Krishna Gupta Date: Mon, 3 Jun 2024 00:03:09 +0530 Subject: [PATCH 6/6] remove {' '}. Signed-off-by: Krishna Gupta --- src/pages/WorkspaceSwitcherPage/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/WorkspaceSwitcherPage/index.tsx b/src/pages/WorkspaceSwitcherPage/index.tsx index fcaebe1ba310..e48b560bdfbe 100644 --- a/src/pages/WorkspaceSwitcherPage/index.tsx +++ b/src/pages/WorkspaceSwitcherPage/index.tsx @@ -194,7 +194,7 @@ function WorkspaceSwitcherPage() { listFooterContent={shouldShowCreateWorkspace ? WorkspaceCardCreateAWorkspaceInstance : null} initiallyFocusedOptionKey={activeWorkspaceID ?? CONST.WORKSPACE_SWITCHER.NAME} showLoadingPlaceholder={fetchStatus.status === 'loading' || !didScreenTransitionEnd} - />{' '} + /> )}