import { ArrowDownNarrowWide, ArrowDownWideNarrow } from 'lucide-react'
import {
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from 'ui'
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
interface SortDropdownProps {
specificFilterColumn: string
sortColumn: string
sortOrder: string
sortByValue: string
showSortByEmail: boolean
showSortByPhone: boolean
setSortByValue: (value: string) => void
improvedSearchEnabled: boolean
}
/** [Joshen] To refactor to use the SortDropdown component in components/ui */
export const SortDropdown = ({
specificFilterColumn,
sortColumn,
sortOrder,
sortByValue,
showSortByEmail,
showSortByPhone,
setSortByValue,
improvedSearchEnabled = false,
}: SortDropdownProps) => {
if (specificFilterColumn !== 'freeform' && !improvedSearchEnabled) {
return (
}
tooltip={{
content: {
side: 'bottom',
className: 'w-80 text-center',
text: (
<>
Sorting cannot be changed when searching on a specific column. If you'd like to sort
on other columns, change the search to{' '}
unified search from the search dropdown.
>
),
},
}}
>
Sorted by user ID
)
}
return (
: }>
Sorted by {sortColumn === 'id' ? 'user ID' : sortColumn.replaceAll('_', ' ')}
Sort by user ID
Ascending
Descending
Sort by created at
Ascending
Descending
Sort by last sign in at
Ascending
Descending
{showSortByEmail && (
Sort by email
Ascending
Descending
)}
{showSortByPhone && (
Sort by phone
Ascending
Descending
)}
)
}