feat(tv): add long-press mark as watched action using alert dialog

This commit is contained in:
Fredrik Burmester
2026-01-28 20:36:57 +01:00
parent 8dcd4c40f9
commit 2ff9625903
21 changed files with 212 additions and 13 deletions

View File

@@ -26,6 +26,7 @@ interface TVEpisodeCardProps {
/** Shows a "Now Playing" badge on the card */
isCurrent?: boolean;
onPress: () => void;
onLongPress?: () => void;
onFocus?: () => void;
onBlur?: () => void;
/** Setter function for the ref (for focus guide destinations) */
@@ -39,6 +40,7 @@ export const TVEpisodeCard: React.FC<TVEpisodeCardProps> = ({
focusableWhenDisabled = false,
isCurrent = false,
onPress,
onLongPress,
onFocus,
onBlur,
refSetter,
@@ -123,6 +125,7 @@ export const TVEpisodeCard: React.FC<TVEpisodeCardProps> = ({
>
<TVFocusablePoster
onPress={onPress}
onLongPress={onLongPress}
hasTVPreferredFocus={hasTVPreferredFocus}
disabled={disabled}
focusableWhenDisabled={focusableWhenDisabled}

View File

@@ -16,6 +16,8 @@ interface TVEpisodeListProps {
disabled?: boolean;
/** Handler when an episode is pressed */
onEpisodePress: (episode: BaseItemDto) => void;
/** Called when any episode is long-pressed */
onEpisodeLongPress?: (episode: BaseItemDto) => void;
/** Called when any episode gains focus */
onFocus?: () => void;
/** Called when any episode loses focus */
@@ -35,6 +37,7 @@ export const TVEpisodeList: React.FC<TVEpisodeListProps> = ({
currentEpisodeId,
disabled = false,
onEpisodePress,
onEpisodeLongPress,
onFocus,
onBlur,
scrollViewRef,
@@ -79,6 +82,9 @@ export const TVEpisodeList: React.FC<TVEpisodeListProps> = ({
key={episode.Id}
episode={episode}
onPress={() => onEpisodePress(episode)}
onLongPress={
onEpisodeLongPress ? () => onEpisodeLongPress(episode) : undefined
}
onFocus={onFocus}
onBlur={onBlur}
disabled={isCurrent || disabled}

View File

@@ -32,6 +32,7 @@ import { TVSeriesHeader } from "@/components/series/TVSeriesHeader";
import { TVFavoriteButton } from "@/components/tv/TVFavoriteButton";
import { useScaledTVTypography } from "@/constants/TVTypography";
import useRouter from "@/hooks/useAppRouter";
import { useTVItemActionModal } from "@/hooks/useTVItemActionModal";
import { useTVSeriesSeasonModal } from "@/hooks/useTVSeriesSeasonModal";
import { useDownload } from "@/providers/DownloadProvider";
import { apiAtom, userAtom } from "@/providers/JellyfinProvider";
@@ -225,6 +226,7 @@ export const TVSeriesPage: React.FC<TVSeriesPageProps> = ({
const [user] = useAtom(userAtom);
const { getDownloadedItems, downloadedItems } = useDownload();
const { showSeasonModal } = useTVSeriesSeasonModal();
const { showItemActions } = useTVItemActionModal();
const seasonModalState = useAtomValue(tvSeriesSeasonModalAtom);
const isSeasonModalVisible = seasonModalState !== null;
@@ -625,6 +627,7 @@ export const TVSeriesPage: React.FC<TVSeriesPageProps> = ({
episodes={episodesForSeason}
disabled={isSeasonModalVisible}
onEpisodePress={handleEpisodePress}
onEpisodeLongPress={showItemActions}
onFocus={handleEpisodeFocus}
onBlur={handleEpisodeBlur}
scrollViewRef={episodeListRef}