From 654daa58ee1b8dec21f540db9a849a9bcd8bc5b0 Mon Sep 17 00:00:00 2001 From: Diana Villalvazo Date: Thu, 17 Jul 2025 18:20:24 -0500 Subject: [PATCH] fix: Change "choose library" phrasing depending on contentType (#2276) * fix: change library dialog phrasing depending on contentType * fix: separate i18n messages * fix: i18n improvements --- .../component-picker/ComponentPicker.test.tsx | 2 +- .../component-picker/ComponentPicker.tsx | 6 ++++- .../component-picker/SelectLibrary.tsx | 8 ++++-- .../component-picker/messages.ts | 26 ++++++++++++++++--- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/library-authoring/component-picker/ComponentPicker.test.tsx b/src/library-authoring/component-picker/ComponentPicker.test.tsx index 9fd3243d7..f7c3558a5 100644 --- a/src/library-authoring/component-picker/ComponentPicker.test.tsx +++ b/src/library-authoring/component-picker/ComponentPicker.test.tsx @@ -271,7 +271,7 @@ describe('', () => { await screen.findByText(/Change Library/i); fireEvent.click(screen.getByText(/Change Library/i)); - await screen.findByText('Select which Library would you like to reference components from.'); + await screen.findByText('Choose a library to browse components.'); }); it('should pick multiple components using the component card button', async () => { diff --git a/src/library-authoring/component-picker/ComponentPicker.tsx b/src/library-authoring/component-picker/ComponentPicker.tsx index 950983286..00cab0630 100644 --- a/src/library-authoring/component-picker/ComponentPicker.tsx +++ b/src/library-authoring/component-picker/ComponentPicker.tsx @@ -114,7 +114,11 @@ export const ComponentPicker: React.FC = ({ activeKey={currentStep} > - + diff --git a/src/library-authoring/component-picker/SelectLibrary.tsx b/src/library-authoring/component-picker/SelectLibrary.tsx index 2181d5c1f..fc914c348 100644 --- a/src/library-authoring/component-picker/SelectLibrary.tsx +++ b/src/library-authoring/component-picker/SelectLibrary.tsx @@ -13,6 +13,7 @@ import Loading from '../../generic/Loading'; import AlertError from '../../generic/alert-error'; import { useContentLibraryV2List } from '../data/apiHooks'; import messages from './messages'; +import { ContentType } from '../routes'; interface EmptyStateProps { hasSearchQuery: boolean; @@ -40,9 +41,10 @@ const EmptyState = ({ hasSearchQuery }: EmptyStateProps) => ( interface SelectLibraryProps { selectedLibrary: string; setSelectedLibrary: (libraryKey: string) => void; + itemType: ContentType; } -const SelectLibrary = ({ selectedLibrary, setSelectedLibrary }: SelectLibraryProps) => { +const SelectLibrary = ({ selectedLibrary, setSelectedLibrary, itemType }: SelectLibraryProps) => { const intl = useIntl(); const [searchQuery, setSearchQuery] = useState(''); @@ -75,7 +77,9 @@ const SelectLibrary = ({ selectedLibrary, setSelectedLibrary }: SelectLibraryPro return ( - {intl.formatMessage(messages.selectLibraryInfo)} +