({ onReady })
| 253 | ); |
| 254 | |
| 255 | const ChannelsTable = ({ onReady }) => { |
| 256 | // EPG data lookup |
| 257 | const tvgsById = useEPGsStore((s) => s.tvgsById); |
| 258 | const epgs = useEPGsStore((s) => s.epgs); |
| 259 | const tvgsLoaded = useEPGsStore((s) => s.tvgsLoaded); |
| 260 | const hasUnassignedEPGChannels = useChannelsTableStore( |
| 261 | (s) => s.hasUnassignedEPGChannels |
| 262 | ); |
| 263 | |
| 264 | // Get channel logos for logo selection |
| 265 | const { ensureLogosLoaded } = useChannelLogoSelection(); |
| 266 | |
| 267 | const theme = useMantineTheme(); |
| 268 | const channelGroups = useChannelsStore((s) => s.channelGroups); |
| 269 | const hasSignaledReady = useRef(false); |
| 270 | |
| 271 | /** |
| 272 | * STORES |
| 273 | */ |
| 274 | |
| 275 | // store/channelsTable |
| 276 | const data = useChannelsTableStore((s) => s.channels); |
| 277 | const pageCount = useChannelsTableStore((s) => s.pageCount); |
| 278 | |
| 279 | const rowClassMap = useMemo(() => { |
| 280 | const map = {}; |
| 281 | for (const channel of data) { |
| 282 | const hasStreams = channel.streams?.length > 0; |
| 283 | if (!hasStreams) { |
| 284 | map[channel.id] = 'no-streams-row'; |
| 285 | } else if (channel.streams.some((s) => s.is_stale)) { |
| 286 | map[channel.id] = 'has-stale-streams-row'; |
| 287 | } |
| 288 | } |
| 289 | return map; |
| 290 | }, [data]); |
| 291 | const setSelectedChannelIds = useChannelsTableStore( |
| 292 | (s) => s.setSelectedChannelIds |
| 293 | ); |
| 294 | const setExpandedChannelId = useChannelsTableStore( |
| 295 | (s) => s.setExpandedChannelId |
| 296 | ); |
| 297 | const pagination = useChannelsTableStore((s) => s.pagination); |
| 298 | const setPagination = useChannelsTableStore((s) => s.setPagination); |
| 299 | const sorting = useChannelsTableStore((s) => s.sorting); |
| 300 | const setSorting = useChannelsTableStore((s) => s.setSorting); |
| 301 | const totalCount = useChannelsTableStore((s) => s.totalCount); |
| 302 | const allRowIds = useChannelsTableStore((s) => s.allQueryIds); |
| 303 | const setAllRowIds = useChannelsTableStore((s) => s.setAllQueryIds); |
| 304 | |
| 305 | // store/channels |
| 306 | const hasChannels = useChannelsStore((s) => s.channelIds.length > 0); |
| 307 | const profiles = useChannelsStore((s) => s.profiles); |
| 308 | const selectedProfileId = useChannelsStore((s) => s.selectedProfileId); |
| 309 | const [, setTablePrefs] = useLocalStorage('channel-table-prefs', { |
| 310 | pageSize: 50, |
| 311 | }); |
| 312 |
nothing calls this directly
no test coverage detected