"use client"; import { Dropdown, DropdownItem } from "flowbite-react"; import { numberDeclension } from "#/api/utils"; import { useUserPlayerPreferencesStore } from "#/store/player"; interface Voiceover { id: number; name: string; icon: string; episodes_count: number; view_count: number; pinned: boolean; } const DropdownTrigger = ({ icon, name, pinned }: Voiceover) => { return (
{icon && }

{name}

{pinned && ( )}
); }; const DropdownItemInternal = ({ icon, name, pinned, episodes_count, view_count, }: Voiceover) => { return (
{icon && }

{name}

{pinned && ( )}

{episodes_count}{" "} {numberDeclension(episodes_count, "серия", "серии", "серий")}

{view_count}{" "} {numberDeclension(view_count, "просмотр", "просмотра", "просмотров")}

); }; const DropdownTheme = { content: "md:grid md:grid-cols-2 xl:grid-cols-4 gap-2 w-full container", }; export const VoiceoverSelector = (props: { availableVoiceover: Voiceover[]; voiceover: Voiceover; setVoiceover: any; release_id: number; }) => { const playerPreferenceStore = useUserPlayerPreferencesStore(); return ( ( )} > {props.availableVoiceover.map((voiceover: Voiceover) => ( { playerPreferenceStore.setPreferredVoiceover( props.release_id, voiceover.name ); props.setVoiceover({ selected: voiceover, available: props.availableVoiceover, }); }} > ))} ); };