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

Fixed Inconsistency in Source dropdown #1499

Closed
wants to merge 2 commits into from
Closed
Changes from all 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
12 changes: 9 additions & 3 deletions frontend/src/components/SourceDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -63,7 +68,7 @@ function SourceDropdown({
<span className="ml-1 mr-2 flex-1 overflow-hidden text-ellipsis text-left dark:text-bright-gray">
<div className="flex flex-row gap-2">
<p className="max-w-3/4 truncate whitespace-nowrap">
{selectedDocs?.name || 'None'}
{capitalizeFirstLetter(selectedDocs?.name) || 'None'}
</p>
</div>
</span>
Expand All @@ -87,7 +92,7 @@ function SourceDropdown({
onClick={() => {
dispatch(setSelectedDocs(option));
setIsDocsListOpen(false);
handlePostDocumentSelect(option);
handlePostDocumentSelect(capitalizeFirstLetter(option));
}}
>
<span
Expand All @@ -96,7 +101,7 @@ function SourceDropdown({
}}
className="ml-4 flex-1 overflow-hidden overflow-ellipsis whitespace-nowrap py-3"
>
{option.name}
{capitalizeFirstLetter(option.name)}
</span>
{option.location === 'local' && (
<img
Expand All @@ -117,6 +122,7 @@ function SourceDropdown({
) : (
<></>
)}

<div
className="flex cursor-pointer items-center justify-between hover:bg-gray-100 dark:text-bright-gray dark:hover:bg-purple-taupe"
onClick={handleEmptyDocumentSelect}
Expand Down
Loading