import type { MouseEventHandler, ReactNode, Ref } from "react"; import { useTranslation } from "react-i18next"; import { ChevronDown, FolderInput, History, ListRestart, Square, X } from "lucide-react"; import { Button } from "../../components/ui/Button"; /** The playlist's second toolbar row while rows are selected: how many, and what can be done to them. * `count` is the rows shown, what an action covers; `hidden` the selected ones a filter hides, which * it leaves alone. With only hidden ones the actions stay in place, off, and the way out stays on. * Below `xl` the buttons are glyphs named in their tooltips: in words the row wraps there, and the * first tick would push the list from under the second tap. On a phone the count is its number and * the undo pair stays out, for the same one row. The page says the count out loud: this band goes * when the selection does, and a live region that leaves with its news announces nothing. */ export function SelectionBand({ ref, count, hidden, recentName, onMoveRecent, moveMenuProps, moveMenuOpen, onRemove, onClear, onClearView, trailing, }: { ref: Ref; count: number; hidden: number; /** The list the last move went to: one click away, absent when there is none to repeat. */ recentName: string | null; onMoveRecent: () => void; moveMenuProps: Record; moveMenuOpen: boolean; onRemove: () => void; onClear: () => void; /** The view's reset, which the row this one replaces offers. */ onClearView?: MouseEventHandler; trailing: ReactNode; }) { const { t } = useTranslation(); const none = count === 0; return (
{t("playlists.selectedCount", { count })} {hidden > 0 && ( {t("playlists.selectedHidden", { count: hidden })} )} {recentName != null && ( )} {onClearView && ( )}
{trailing}
); }