From 65dbc5498da3f14758c590f1b029a4e52b457edc Mon Sep 17 00:00:00 2001 From: Nick Sandstrom <32273437+nick4810@users.noreply.github.com> Date: Mon, 15 Dec 2025 08:21:00 -0800 Subject: [PATCH] Fixed handler arrow functions --- frontend/src/pages/DVR.jsx | 82 ++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/frontend/src/pages/DVR.jsx b/frontend/src/pages/DVR.jsx index 81ef300a..bca5e246 100644 --- a/frontend/src/pages/DVR.jsx +++ b/frontend/src/pages/DVR.jsx @@ -103,50 +103,46 @@ const DVRPage = () => { )); } - const getOnWatchLive = () => { - return () => { - const rec = detailsRecording; - const now = userNow(); - const s = toUserTime(rec.start_time); - const e = toUserTime(rec.end_time); - if (now.isAfter(s) && now.isBefore(e)) { - // call into child RecordingCard behavior by constructing a URL like there - const channel = channels[rec.channel]; - if (!channel) return; - let url = `/proxy/ts/stream/${channel.uuid}`; - if (useSettingsStore.getState().environment.env_mode === 'dev') { - url = `${window.location.protocol}//${window.location.hostname}:5656${url}`; - } - useVideoStore.getState().showVideo(url, 'live'); + const handleOnWatchLive = () => { + const rec = detailsRecording; + const now = userNow(); + const s = toUserTime(rec.start_time); + const e = toUserTime(rec.end_time); + if (now.isAfter(s) && now.isBefore(e)) { + // call into child RecordingCard behavior by constructing a URL like there + const channel = channels[rec.channel]; + if (!channel) return; + let url = `/proxy/ts/stream/${channel.uuid}`; + if (useSettingsStore.getState().environment.env_mode === 'dev') { + url = `${window.location.protocol}//${window.location.hostname}:5656${url}`; } - }; + useVideoStore.getState().showVideo(url, 'live'); + } } - const getOnWatchRecording = () => { - return () => { - let fileUrl = - detailsRecording.custom_properties?.file_url || - detailsRecording.custom_properties?.output_file_url; - if (!fileUrl) return; - if ( - useSettingsStore.getState().environment.env_mode === 'dev' && - fileUrl.startsWith('/') - ) { - fileUrl = `${window.location.protocol}//${window.location.hostname}:5656${fileUrl}`; - } - useVideoStore.getState().showVideo(fileUrl, 'vod', { - name: - detailsRecording.custom_properties?.program?.title || - 'Recording', - logo: { - url: - (detailsRecording.custom_properties?.poster_logo_id - ? `/api/channels/logos/${detailsRecording.custom_properties.poster_logo_id}/cache/` - : channels[detailsRecording.channel]?.logo?.cache_url) || - '/logo.png', - }, - }); - }; + const handleOnWatchRecording = () => { + let fileUrl = + detailsRecording.custom_properties?.file_url || + detailsRecording.custom_properties?.output_file_url; + if (!fileUrl) return; + if ( + useSettingsStore.getState().environment.env_mode === 'dev' && + fileUrl.startsWith('/') + ) { + fileUrl = `${window.location.protocol}//${window.location.hostname}:5656${fileUrl}`; + } + useVideoStore.getState().showVideo(fileUrl, 'vod', { + name: + detailsRecording.custom_properties?.program?.title || + 'Recording', + logo: { + url: + (detailsRecording.custom_properties?.poster_logo_id + ? `/api/channels/logos/${detailsRecording.custom_properties.poster_logo_id}/cache/` + : channels[detailsRecording.channel]?.logo?.cache_url) || + '/logo.png', + }, + }); } return ( @@ -269,8 +265,8 @@ const DVRPage = () => { '/logo.png' } env_mode={useSettingsStore.getState().environment.env_mode} - onWatchLive={getOnWatchLive()} - onWatchRecording={getOnWatchRecording()} + onWatchLive={handleOnWatchLive} + onWatchRecording={handleOnWatchRecording} onEdit={(rec) => { setEditRecording(rec); closeDetails();