"use client";
import * as Popover from "@radix-ui/react-popover";
import * as Select from "@radix-ui/react-select";
import { ArrowDown, ArrowDownAZ, ArrowUpAZ, Plus, X } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator";
import type { ViewSort } from "@/lib/hooks/use-view-data";
import { useViewStore } from "@/lib/stores/view-store";
import { cn } from "@/lib/utils";
const SORT_FIELDS = [
{ value: "title", label: "Title" },
{ value: "status", label: "Status" },
{ value: "sortOrder", label: "Order" },
{ value: "createdAt", label: "Created" },
{ value: "updatedAt", label: "Updated" },
] as const;
const selectTriggerClass = cn(
"flex h-8 min-w-[5.5rem] shrink-0 items-center justify-between gap-1 rounded-md border border-input bg-background px-2 text-xs",
"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background",
);
const selectContentClass = cn(
"z-[60] max-h-[min(60vh,20rem)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
);
const selectItemClass =
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-xs outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
function SortSelect({
value,
options,
onChange,
placeholder,
className,
}: {
value: string;
options: { value: string; label: string }[];
onChange: (v: string) => void;
placeholder?: string;
className?: string;
}) {
return (
Sort by