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

{name}

); }; const DropdownItem = ({ name, episodes_count }: Source) => { return (

{name}

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

); }; export const SourceSelector = (props: { availableSource: Source[]; source: Source; setSource: any; release_id: any; }) => { const playerPreferenceStore = useUserPlayerPreferencesStore(); return ( ( )} > {props.availableSource.map((source: Source) => ( { playerPreferenceStore.setPreferredPlayer( props.release_id, source.name ); props.setSource({ selected: source, available: props.availableSource, }); }} > ))} ); };