import React from 'react'; import { Check, ChevronDown, RotateCcw } from 'lucide-react'; import type { TFunction } from 'i18next'; import type { ColDef } from '../../utils/useTracklistColumns'; interface Props { /** Every column (required ones are filtered out of the menu). */ allColumns: readonly ColDef[]; pickerRef: React.RefObject; pickerOpen: boolean; setPickerOpen: (updater: (v: boolean) => boolean) => void; colVisible: Set; toggleColumn: (key: string) => void; resetColumns: () => void; t: TFunction; } /** * The column visibility dropdown that sits outside `.tracklist` so the * popover menu can grow without being clipped by the tracklist's overflow * box. Lists every non-required column and offers a reset-to-defaults * button. */ export function TracklistColumnPicker({ allColumns, pickerRef, pickerOpen, setPickerOpen, colVisible, toggleColumn, resetColumns, t, }: Props) { return (
{pickerOpen && (
{t('albumDetail.columns')}
{allColumns.filter(c => !c.required).map(c => { const label = c.i18nKey ? t(`albumDetail.${c.i18nKey as string}`) : c.key; const isOn = colVisible.has(c.key); return ( ); })}
)}
); }