import { Check, ChevronsUpDown, ExternalLink } from "lucide-react"; import Link from "next/link"; import { useState } from "react"; import type { FileMetadataWithAdmin } from "~/server/services/storage.service"; import { api } from "~/utils/api"; import { ExtIcon } from "../area-riservata/allegati"; import { Button } from "../ui/button"; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "../ui/command"; import { Label } from "../ui/label"; import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"; export const DocInfo = ({ storageId, children, }: { storageId: string; children: React.ReactNode; }) => { const { data: file_info } = api.storage.getFileInfos.useQuery({ storageId, }); if (!file_info) return null; return (
{children}
); }; export const DocCombo = ({ files, onSelect, current, }: { files: FileMetadataWithAdmin[]; onSelect: (file: FileMetadataWithAdmin) => void; current: string | null; }) => { const [open, setOpen] = useState(false); return ( Nessun file. {files.map((file) => ( { if (currentValue !== current) { // biome-ignore lint/style/noNonNullAssertion: onSelect(files.find((f) => f.id === currentValue)!); } setOpen(false); }} value={file.id} > {file.originalName} {current === file.id && ( )} ))} ); };