From 880628fb6805d5d0c50d4b5c5c2660cad6612df8 Mon Sep 17 00:00:00 2001 From: Luigi <19366824+luigidotmoe@users.noreply.github.com> Date: Mon, 11 Aug 2025 06:09:50 +0200 Subject: [PATCH] New: Select with poster click in series selection --- .../Index/Posters/SeriesIndexPoster.tsx | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/frontend/src/Series/Index/Posters/SeriesIndexPoster.tsx b/frontend/src/Series/Index/Posters/SeriesIndexPoster.tsx index 7bb207163..c93639737 100644 --- a/frontend/src/Series/Index/Posters/SeriesIndexPoster.tsx +++ b/frontend/src/Series/Index/Posters/SeriesIndexPoster.tsx @@ -1,6 +1,7 @@ import classNames from 'classnames'; -import React, { useCallback, useState } from 'react'; +import React, { SyntheticEvent, useCallback, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; +import { useSelect } from 'App/SelectContext'; import { REFRESH_SERIES, SERIES_SEARCH } from 'Commands/commandNames'; import Label from 'Components/Label'; import IconButton from 'Components/Link/IconButton'; @@ -122,8 +123,31 @@ function SeriesIndexPoster(props: SeriesIndexPosterProps) { setIsDeleteSeriesModalOpen(false); }, [setIsDeleteSeriesModalOpen]); + const [selectState, selectDispatch] = useSelect(); + + const onSelectPress = useCallback( + (event: SyntheticEvent) => { + if (event.nativeEvent.ctrlKey || event.nativeEvent.metaKey) { + window.open(`/series/${titleSlug}`, '_blank'); + return; + } + + const shiftKey = event.nativeEvent.shiftKey; + + selectDispatch({ + type: 'toggleSelected', + id: seriesId, + isSelected: !selectState.selectedState[seriesId], + shiftKey, + }); + }, + [seriesId, selectState.selectedState, selectDispatch, titleSlug] + ); + const link = `/series/${titleSlug}`; + const linkProps = isSelectMode ? { onPress: onSelectPress } : { to: link }; + const elementStyle = { width: `${posterWidth}px`, height: `${posterHeight}px`, @@ -175,7 +199,7 @@ function SeriesIndexPoster(props: SeriesIndexPosterProps) { /> ) : null} - +