Skip to content

[front] - enh(InputBarAttachmentsPicker): styling #11462

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

Merged
merged 2 commits into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import { useEffect, useMemo, useRef, useState } from "react";

import type { FileUploaderService } from "@app/hooks/useFileUploaderService";
import { getConnectorProviderLogoWithFallback } from "@app/lib/connector_providers";
import {
getLocationForDataSourceViewContentNode,
getVisualForDataSourceViewContentNode,
Expand Down Expand Up @@ -115,23 +116,44 @@ export const InputBarAttachmentsPicker = ({
/>
</DropdownMenuTrigger>
<DropdownMenuContent
className="w-125"
className="w-100"
side="bottom"
onInteractOutside={() => setIsOpen(false)}
>
<div className="items-end pb-2">
<DropdownMenuSearchbar
ref={searchbarRef}
name="search-files"
placeholder="Search knowledge or attach files"
value={search}
onChange={setSearch}
disabled={isLoading}
/>
<DropdownMenuSeparator />
<ScrollArea className="flex max-h-96 flex-col" hideScrollBar>
{showSearchResults ? (
<div className="pt-2">
<Input
type="file"
ref={fileInputRef}
style={{ display: "none" }}
onChange={async (e) => {
setIsOpen(false);
await fileUploaderService.handleFileChange(e);
if (fileInputRef.current) {
fileInputRef.current.value = "";
}
}}
multiple={true}
/>
<DropdownMenuItem
key="upload-item"
label="Upload file"
icon={CloudArrowUpIcon}
onClick={() => fileInputRef.current?.click()}
/>
<DropdownMenuSeparator />
<DropdownMenuSearchbar
ref={searchbarRef}
name="search-files"
placeholder="Search knowledge or attach files"
value={search}
onChange={setSearch}
disabled={isLoading}
/>

{showSearchResults && (
<>
<DropdownMenuSeparator />
<ScrollArea className="flex max-h-96 flex-col" hideScrollBar>
<div className="pt-0">
{unfoldedNodes.length > 0 ? (
unfoldedNodes.map((item, index) => (
<DropdownMenuItem
Expand All @@ -142,6 +164,10 @@ export const InputBarAttachmentsPicker = ({
className: "min-w-4",
})
}
extraIcon={getConnectorProviderLogoWithFallback({
provider:
item.dataSourceView.dataSource.connectorProvider,
})}
disabled={
atachedNodeIds.includes(item.internalId) ||
item.type !== "document"
Expand All @@ -164,32 +190,10 @@ export const InputBarAttachmentsPicker = ({
</div>
)}
</div>
) : (
<div className="flex flex-col items-end gap-4 pr-1">
<Input
type="file"
ref={fileInputRef}
style={{ display: "none" }}
onChange={async (e) => {
setIsOpen(false);
await fileUploaderService.handleFileChange(e);
if (fileInputRef.current) {
fileInputRef.current.value = "";
}
}}
multiple={true}
/>
<Button
onClick={() => fileInputRef.current?.click()}
disabled={isLoading}
icon={CloudArrowUpIcon}
label="Upload file"
/>
</div>
)}
<ScrollBar className="py-0" />
</ScrollArea>
</div>
<ScrollBar className="py-0" />
</ScrollArea>
</>
)}
</DropdownMenuContent>
</DropdownMenu>
);
Expand Down
8 changes: 4 additions & 4 deletions front/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"dependencies": {
"@auth0/nextjs-auth0": "^3.5.0",
"@dust-tt/client": "file:../sdks/js",
"@dust-tt/sparkle": "^0.2.441",
"@dust-tt/sparkle": "^0.2.442",
"@google-cloud/bigquery": "^7.9.1",
"@google-cloud/storage-transfer": "^3.6.0",
"@heroicons/react": "^2.0.11",
Expand Down