import { Menu } from "@base-ui/react/menu"; import { ChevronDown, RefreshCw } from "lucide-react"; import { buttonVariants } from "../../components/ui/button"; import type { CatalogSyncScope } from "../../api/catalog-databases"; export type DatabaseSyncScope = Exclude; export const databaseSyncItemClass = [ "flex cursor-default select-none items-center rounded-md px-3 py-2 text-sm outline-none", "data-[highlighted]:bg-muted data-[disabled]:opacity-45", ].join(" "); export const databaseSyncScopes: ReadonlyArray<{ scope: DatabaseSyncScope; label: string }> = [ { scope: "tables", label: "Synchronize tables" }, { scope: "relationships", label: "Synchronize relationships" }, { scope: "all", label: "Synchronize all" }, ]; interface DatabaseSyncMenuProps { disabled: boolean; disabledReason?: string; onSelect: (scope: DatabaseSyncScope) => void; } export function DatabaseSyncMenu({ disabled, disabledReason, onSelect }: DatabaseSyncMenuProps) { return ( Synchronize {databaseSyncScopes.map(({ scope, label }) => ( onSelect(scope)} > {label} ))} ); }