diff --git a/frontend/src/components/forms/Channel.jsx b/frontend/src/components/forms/Channel.jsx index a3cfe992..e1e33da3 100644 --- a/frontend/src/components/forms/Channel.jsx +++ b/frontend/src/components/forms/Channel.jsx @@ -29,6 +29,7 @@ import { ScrollArea, Tooltip, NumberInput, + Image, } from '@mantine/core'; import { ListOrdered, SquarePlus, SquareX, X } from 'lucide-react'; import useEPGsStore from '../../store/epgs'; @@ -39,6 +40,7 @@ const Channel = ({ channel = null, isOpen, onClose }) => { const theme = useMantineTheme(); const listRef = useRef(null); + const logoListRef = useRef(null); const { channelGroups, logos, fetchLogos } = useChannelsStore(); const streams = useStreamsStore((state) => state.streams); @@ -50,8 +52,11 @@ const Channel = ({ channel = null, isOpen, onClose }) => { const [channelStreams, setChannelStreams] = useState([]); const [channelGroupModelOpen, setChannelGroupModalOpen] = useState(false); const [epgPopoverOpened, setEpgPopoverOpened] = useState(false); + const [logoPopoverOpened, setLogoPopoverOpened] = useState(false); const [selectedEPG, setSelectedEPG] = useState({}); const [tvgFilter, setTvgFilter] = useState(''); + const [logoFilter, setLogoFilter] = useState(''); + const [logoOptions, setLogoOptions] = useState([]); const addStream = (stream) => { const streamSet = new Set(channelStreams); @@ -120,6 +125,7 @@ const Channel = ({ channel = null, isOpen, onClose }) => { setLogoPreview(null); setSubmitting(false); setTvgFilter(''); + setLogoFilter(''); onClose(); }, }); @@ -147,9 +153,14 @@ const Channel = ({ channel = null, isOpen, onClose }) => { } else { formik.resetForm(); setTvgFilter(''); + setLogoFilter(''); } }, [channel, tvgsById]); + useEffect(() => { + setLogoOptions([{ id: '0', name: 'Default' }].concat(Object.values(logos))); + }, [logos]); + const renderLogoOption = ({ option, checked }) => { return (
@@ -298,6 +309,10 @@ const Channel = ({ channel = null, isOpen, onClose }) => { tvg.tvg_id.toLowerCase().includes(tvgFilter.toLowerCase()) ); + const filteredLogos = logoOptions.filter((logo) => + logo.name.toLowerCase().includes(logoFilter.toLowerCase()) + ); + return ( <> { -