diff --git a/frontend/src/components/SourceDropdown.tsx b/frontend/src/components/SourceDropdown.tsx index f92173a08..ff16b065c 100644 --- a/frontend/src/components/SourceDropdown.tsx +++ b/frontend/src/components/SourceDropdown.tsx @@ -14,6 +14,11 @@ type Props = { handlePostDocumentSelect: any; }; +const capitalizeFirstLetter = (value: any) => + typeof value === 'string' && value.length > 0 + ? value.charAt(0).toUpperCase() + value.slice(1) + : value; + function SourceDropdown({ options, setSelectedDocs, @@ -63,7 +68,7 @@ function SourceDropdown({

- {selectedDocs?.name || 'None'} + {capitalizeFirstLetter(selectedDocs?.name) || 'None'}

@@ -87,7 +92,7 @@ function SourceDropdown({ onClick={() => { dispatch(setSelectedDocs(option)); setIsDocsListOpen(false); - handlePostDocumentSelect(option); + handlePostDocumentSelect(capitalizeFirstLetter(option)); }} > - {option.name} + {capitalizeFirstLetter(option.name)} {option.location === 'local' && ( )} +