hide tooltip when it has files

This commit is contained in:
Brent O'Neill 2025-10-06 15:14:39 -06:00
parent b3a11fed39
commit a54ea69869

View file

@ -7,6 +7,11 @@ import { type CloudFile, UnifiedCloudPicker } from "@/components/cloud-picker";
import type { IngestSettings } from "@/components/cloud-picker/types"; import type { IngestSettings } from "@/components/cloud-picker/types";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { useTask } from "@/contexts/task-context"; import { useTask } from "@/contexts/task-context";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
// CloudFile interface is now imported from the unified cloud picker // CloudFile interface is now imported from the unified cloud picker
@ -325,6 +330,8 @@ export default function UploadProviderPage() {
); );
} }
const hasSelectedFiles = selectedFiles.length > 0;
return ( return (
<div className="container mx-auto max-w-3xl px-6"> <div className="container mx-auto max-w-3xl px-6">
<div className="mb-8 flex gap-2 items-center"> <div className="mb-8 flex gap-2 items-center">
@ -355,26 +362,36 @@ export default function UploadProviderPage() {
<div className="flex justify-between gap-3 mb-4"> <div className="flex justify-between gap-3 mb-4">
<Button <Button
variant="ghost" variant="ghost"
className=" border bg-transparent border-border rounded-lg text-secondary-foreground" className="border bg-transparent border-border rounded-lg text-secondary-foreground"
onClick={() => router.back()} onClick={() => router.back()}
> >
Back Back
</Button> </Button>
<Button <Tooltip>
className="bg-foreground text-background hover:bg-foreground/90 font-semibold" <TooltipTrigger>
variant={selectedFiles.length === 0 ? "secondary" : undefined} <Button
onClick={() => handleSync(connector)} className="bg-foreground text-background hover:bg-foreground/90 font-semibold"
disabled={selectedFiles.length === 0 || isIngesting} variant={!hasSelectedFiles ? "secondary" : undefined}
> onClick={() => handleSync(connector)}
{selectedFiles.length === 0 ? ( loading={isIngesting}
<>Ingest files</> disabled={!hasSelectedFiles || isIngesting}
) : ( >
<> {!hasSelectedFiles ? (
Ingest {selectedFiles.length} file <>Ingest files</>
{selectedFiles.length > 1 ? "s" : ""} ) : (
</> <>
)} Ingest {selectedFiles.length} file
</Button> {selectedFiles.length > 1 ? "s" : ""}
</>
)}
</Button>
</TooltipTrigger>
{!hasSelectedFiles ? (
<TooltipContent side="left">
Select at least one file before ingesting
</TooltipContent>
) : null}
</Tooltip>
</div> </div>
</div> </div>
</div> </div>