MCPcopy Create free account
hub / github.com/Dispatcharr/Dispatcharr / ChannelForm

Function ChannelForm

frontend/src/components/forms/Channel.jsx:96–1341  ·  view source on GitHub ↗
({ channel: channelProp = null, isOpen, onClose })

Source from the content-addressed store, hash-verified

94};
95
96const ChannelForm = ({ channel: channelProp = null, isOpen, onClose }) => {
97 const theme = useMantineTheme();
98
99 const listRef = useRef(null);
100 const logoListRef = useRef(null);
101 const groupListRef = useRef(null);
102
103 // Local copy so in-modal mutations (clear overrides, etc.) update the
104 // form immediately. Reset on each open from `channelProp`; mutated in
105 // place with API responses.
106 const [channel, setChannel] = useState(channelProp);
107 useEffect(() => {
108 setChannel(channelProp);
109 }, [channelProp]);
110
111 const channelGroups = useChannelsStore((s) => s.channelGroups);
112
113 const {
114 logos: channelLogos,
115 ensureLogosLoaded,
116 isLoading: logosLoading,
117 } = useChannelLogoSelection();
118
119 // Import the full logos store for duplicate checking
120 const allLogos = useLogosStore((s) => s.logos);
121
122 // Ensure logos are loaded when component mounts
123 useEffect(() => {
124 ensureLogosLoaded();
125 }, [ensureLogosLoaded]);
126
127 const streamProfiles = useStreamProfilesStore((s) => s.profiles);
128 const epgs = useEPGsStore((s) => s.epgs);
129 const tvgs = useEPGsStore((s) => s.tvgs);
130 const tvgsById = useEPGsStore((s) => s.tvgsById);
131
132 const [logoModalOpen, setLogoModalOpen] = useState(false);
133 const [channelStreams, setChannelStreams] = useState([]);
134 const [channelGroupModelOpen, setChannelGroupModalOpen] = useState(false);
135 const [epgPopoverOpened, setEpgPopoverOpened] = useState(false);
136 const [logoPopoverOpened, setLogoPopoverOpened] = useState(false);
137 const [selectedEPG, setSelectedEPG] = useState('');
138 const [tvgFilter, setTvgFilter] = useState('');
139 const [logoFilter, setLogoFilter] = useState('');
140
141 const [groupPopoverOpened, setGroupPopoverOpened] = useState(false);
142 const [groupFilter, setGroupFilter] = useState('');
143 const [autoMatchLoading, setAutoMatchLoading] = useState(false);
144 const groupOptions = Object.values(channelGroups);
145
146 const handleLogoSuccess = ({ logo }) => {
147 if (logo && logo.id) {
148 setValue('logo_id', logo.id);
149 ensureLogosLoaded(); // Refresh logos
150 }
151 setLogoModalOpen(false);
152 };
153

Callers

nothing calls this directly

Calls 15

useChannelLogoSelectionFunction · 0.90
showNotificationFunction · 0.90
isFormFieldOverriddenFunction · 0.90
useEpgPreviewFunction · 0.90
getProviderHintFunction · 0.90
getProviderFormValueFunction · 0.90
getFkProviderHintFunction · 0.90
foldTextFunction · 0.85
handleAutoMatchEpgFunction · 0.85
handleSubmitFunction · 0.70
watchFunction · 0.50

Tested by

no test coverage detected