Skip to content

Commit 74b551d

Browse files
authored
[front] - enh(InputBarAttachmentsPicker): styling (#11462)
* [assistant/conversation] - refactor: enhance input bar attachments picker UI and functionality - Redesigned the attachments picker dropdown width for consistency - Integrated a file input for multiple file uploads directly within the dropdown menu - Removed the old upload button and related elements outside of the search area - Provided visual feedback for data sources with the insertion of connector provider logos - Updated the `@dust-tt/sparkle` package to a newer version for potential improvements and fixes * fix: lint/format
1 parent bb9c7a5 commit 74b551d

File tree

3 files changed

+49
-45
lines changed

3 files changed

+49
-45
lines changed

front/components/assistant/conversation/input_bar/InputBarAttachmentsPicker.tsx

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
import { useEffect, useMemo, useRef, useState } from "react";
1717

1818
import type { FileUploaderService } from "@app/hooks/useFileUploaderService";
19+
import { getConnectorProviderLogoWithFallback } from "@app/lib/connector_providers";
1920
import {
2021
getLocationForDataSourceViewContentNode,
2122
getVisualForDataSourceViewContentNode,
@@ -115,23 +116,44 @@ export const InputBarAttachmentsPicker = ({
115116
/>
116117
</DropdownMenuTrigger>
117118
<DropdownMenuContent
118-
className="w-125"
119+
className="w-100"
119120
side="bottom"
120121
onInteractOutside={() => setIsOpen(false)}
121122
>
122-
<div className="items-end pb-2">
123-
<DropdownMenuSearchbar
124-
ref={searchbarRef}
125-
name="search-files"
126-
placeholder="Search knowledge or attach files"
127-
value={search}
128-
onChange={setSearch}
129-
disabled={isLoading}
130-
/>
131-
<DropdownMenuSeparator />
132-
<ScrollArea className="flex max-h-96 flex-col" hideScrollBar>
133-
{showSearchResults ? (
134-
<div className="pt-2">
123+
<Input
124+
type="file"
125+
ref={fileInputRef}
126+
style={{ display: "none" }}
127+
onChange={async (e) => {
128+
setIsOpen(false);
129+
await fileUploaderService.handleFileChange(e);
130+
if (fileInputRef.current) {
131+
fileInputRef.current.value = "";
132+
}
133+
}}
134+
multiple={true}
135+
/>
136+
<DropdownMenuItem
137+
key="upload-item"
138+
label="Upload file"
139+
icon={CloudArrowUpIcon}
140+
onClick={() => fileInputRef.current?.click()}
141+
/>
142+
<DropdownMenuSeparator />
143+
<DropdownMenuSearchbar
144+
ref={searchbarRef}
145+
name="search-files"
146+
placeholder="Search knowledge or attach files"
147+
value={search}
148+
onChange={setSearch}
149+
disabled={isLoading}
150+
/>
151+
152+
{showSearchResults && (
153+
<>
154+
<DropdownMenuSeparator />
155+
<ScrollArea className="flex max-h-96 flex-col" hideScrollBar>
156+
<div className="pt-0">
135157
{unfoldedNodes.length > 0 ? (
136158
unfoldedNodes.map((item, index) => (
137159
<DropdownMenuItem
@@ -142,6 +164,10 @@ export const InputBarAttachmentsPicker = ({
142164
className: "min-w-4",
143165
})
144166
}
167+
extraIcon={getConnectorProviderLogoWithFallback({
168+
provider:
169+
item.dataSourceView.dataSource.connectorProvider,
170+
})}
145171
disabled={
146172
atachedNodeIds.includes(item.internalId) ||
147173
item.type !== "document"
@@ -164,32 +190,10 @@ export const InputBarAttachmentsPicker = ({
164190
</div>
165191
)}
166192
</div>
167-
) : (
168-
<div className="flex flex-col items-end gap-4 pr-1">
169-
<Input
170-
type="file"
171-
ref={fileInputRef}
172-
style={{ display: "none" }}
173-
onChange={async (e) => {
174-
setIsOpen(false);
175-
await fileUploaderService.handleFileChange(e);
176-
if (fileInputRef.current) {
177-
fileInputRef.current.value = "";
178-
}
179-
}}
180-
multiple={true}
181-
/>
182-
<Button
183-
onClick={() => fileInputRef.current?.click()}
184-
disabled={isLoading}
185-
icon={CloudArrowUpIcon}
186-
label="Upload file"
187-
/>
188-
</div>
189-
)}
190-
<ScrollBar className="py-0" />
191-
</ScrollArea>
192-
</div>
193+
<ScrollBar className="py-0" />
194+
</ScrollArea>
195+
</>
196+
)}
193197
</DropdownMenuContent>
194198
</DropdownMenu>
195199
);

front/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"dependencies": {
2222
"@auth0/nextjs-auth0": "^3.5.0",
2323
"@dust-tt/client": "file:../sdks/js",
24-
"@dust-tt/sparkle": "^0.2.441",
24+
"@dust-tt/sparkle": "^0.2.442",
2525
"@google-cloud/bigquery": "^7.9.1",
2626
"@google-cloud/storage-transfer": "^3.6.0",
2727
"@heroicons/react": "^2.0.11",

0 commit comments

Comments
 (0)