From a82c7b159aeeb4dc9e668d4916dc98d1875e1154 Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Thu, 22 Oct 2026 20:15:05 +0100 Subject: [PATCH 01/49] add beta badge to workspace agents --- src/pages/workspace/WorkspaceInitialPage.tsx | 2 +- src/pages/workspace/getWorkspaceMenuItems.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/workspace/WorkspaceInitialPage.tsx b/src/pages/workspace/WorkspaceInitialPage.tsx index f7c6489b674d..923024fd1e18 100644 --- a/src/pages/workspace/WorkspaceInitialPage.tsx +++ b/src/pages/workspace/WorkspaceInitialPage.tsx @@ -329,7 +329,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, route}: Workspac highlighted={!!item?.highlighted} focused={getItemScreenNames(item).some((screenName) => activeRoute?.startsWith(screenName))} role={CONST.ROLE.TAB} - badgeText={item.badgeText} + badgeText={item.badgeTranslationKey ? translate(item.badgeTranslationKey) : item.badgeText} shouldIconUseAutoWidthStyle sentryLabel={item.sentryLabel} shouldGreyOutWhenDisabled={hasPolicyCreationError} diff --git a/src/pages/workspace/getWorkspaceMenuItems.ts b/src/pages/workspace/getWorkspaceMenuItems.ts index e22df7e3f2a8..3b094e1eb52d 100644 --- a/src/pages/workspace/getWorkspaceMenuItems.ts +++ b/src/pages/workspace/getWorkspaceMenuItems.ts @@ -85,6 +85,7 @@ type WorkspaceMenuItem = WithSentryLabel & { getRoute: () => Route; brickRoadIndicator?: ValueOf; screenName: WorkspaceTopLevelScreens; + badgeTranslationKey?: TranslationPaths; badgeText?: string; highlighted?: boolean; @@ -265,6 +266,7 @@ function getWorkspaceMenuItems({ getRoute: () => ROUTES.WORKSPACE_AGENTS.getRoute(policyID), screenName: SCREENS.WORKSPACE.AGENTS, sentryLabel: CONST.SENTRY_LABEL.WORKSPACE.INITIAL.AGENTS, + badgeTranslationKey: 'common.beta', }); } From 6ad2a3a365dc8375b0b300b8c5648fb9ad01c897 Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Thu, 22 Oct 2026 21:02:39 +0100 Subject: [PATCH 02/49] move side effects out of useAgents hook --- src/hooks/useAgents.ts | 7 ------- src/pages/settings/Agents/AgentsPage.tsx | 8 ++++++++ src/pages/workspace/WorkspaceAgentsPage.tsx | 8 ++++++++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/hooks/useAgents.ts b/src/hooks/useAgents.ts index ea5fdb91b77a..b2926438644f 100644 --- a/src/hooks/useAgents.ts +++ b/src/hooks/useAgents.ts @@ -19,14 +19,12 @@ import {Str} from 'expensify-common'; import {useEffect, useRef, useState} from 'react'; import useChatWithAgent from './useChatWithAgent'; -import useCleanupSelectedOptions from './useCleanupSelectedOptions'; import useConfirmModal from './useConfirmModal'; import useLocalize from './useLocalize'; import useNetwork from './useNetwork'; import useOnyx from './useOnyx'; import usePrevious from './usePrevious'; import useRuleBotGuardModal from './useRuleBotGuardModal'; -import useSearchBackPress from './useSearchBackPress'; import useSwitchToDelegator from './useSwitchToDelegator'; function handleErrorClose(pendingAction: PendingAction | null | undefined, accountID: number): void { @@ -152,11 +150,6 @@ function useAgents() { }); const clearSelectedAgents = () => setSelectedAgents((prevSelectedAgents) => (prevSelectedAgents.length > 0 ? [] : prevSelectedAgents)); - useCleanupSelectedOptions(clearSelectedAgents); - useSearchBackPress({ - onClearSelection: clearSelectedAgents, - onNavigationCallBack: () => Navigation.goBack(), - }); const removeSelectedAgents = () => { for (const accountIDString of selectedAgentKeys) { diff --git a/src/pages/settings/Agents/AgentsPage.tsx b/src/pages/settings/Agents/AgentsPage.tsx index 5d5302c1cc91..668a81f1ddfb 100644 --- a/src/pages/settings/Agents/AgentsPage.tsx +++ b/src/pages/settings/Agents/AgentsPage.tsx @@ -8,12 +8,14 @@ import ScreenWrapper from '@components/ScreenWrapper'; import AgentsTable from '@components/Tables/AgentsTable'; import useAgents from '@hooks/useAgents'; +import useCleanupSelectedOptions from '@hooks/useCleanupSelectedOptions'; import useDocumentTitle from '@hooks/useDocumentTitle'; import useLayoutSpacing from '@hooks/useLayoutSpacing'; import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; import useLocalize from '@hooks/useLocalize'; import useMobileSelectionMode from '@hooks/useMobileSelectionMode'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; +import useSearchBackPress from '@hooks/useSearchBackPress'; import useShouldDisplayButtonsInSeparateLine from '@hooks/useShouldDisplayButtonsInSeparateLine'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -43,6 +45,12 @@ function AgentsPage() { useDocumentTitle(translate('agentsPage.title')); + useCleanupSelectedOptions(clearSelectedAgents); + useSearchBackPress({ + onClearSelection: clearSelectedAgents, + onNavigationCallBack: () => Navigation.goBack(), + }); + const newAgentButton = hasAgents ? (