@@ -11,7 +11,7 @@ const useBinaryState = require('stremio/common/useBinaryState');
11
11
const VideoPlaceholder = require ( './VideoPlaceholder' ) ;
12
12
const styles = require ( './styles' ) ;
13
13
14
- const Video = ( { className, id, title, thumbnail, episode, released, upcoming, watched, progress, scheduled, deepLinks, onMarkVideoAsWatched, ...props } ) => {
14
+ const Video = ( { className, id, title, thumbnail, season , episode, released, upcoming, watched, progress, scheduled, seasonWatched , deepLinks, onMarkVideoAsWatched, onMarkSeasonAsWatched , ...props } ) => {
15
15
const routeFocused = useRouteFocused ( ) ;
16
16
const [ menuOpen , , closeMenu , toggleMenu ] = useBinaryState ( false ) ;
17
17
const popupLabelOnMouseUp = React . useCallback ( ( event ) => {
@@ -50,6 +50,12 @@ const Video = ({ className, id, title, thumbnail, episode, released, upcoming, w
50
50
closeMenu ( ) ;
51
51
onMarkVideoAsWatched ( { id, released } , watched ) ;
52
52
} , [ id , released , watched ] ) ;
53
+ const toggleWatchedSeasonOnClick = React . useCallback ( ( event ) => {
54
+ event . preventDefault ( ) ;
55
+ event . stopPropagation ( ) ;
56
+ closeMenu ( ) ;
57
+ onMarkSeasonAsWatched ( season , seasonWatched ) ;
58
+ } , [ season , seasonWatched , onMarkSeasonAsWatched ] ) ;
53
59
const videoButtonOnClick = React . useCallback ( ( ) => {
54
60
if ( deepLinks ) {
55
61
if ( typeof deepLinks . player === 'string' ) {
@@ -142,9 +148,12 @@ const Video = ({ className, id, title, thumbnail, episode, released, upcoming, w
142
148
< Button className = { styles [ 'context-menu-option-container' ] } title = { watched ? 'Mark as non-watched' : 'Mark as watched' } onClick = { toggleWatchedOnClick } >
143
149
< div className = { styles [ 'context-menu-option-label' ] } > { watched ? t ( 'CTX_MARK_NON_WATCHED' ) : t ( 'CTX_MARK_WATCHED' ) } </ div >
144
150
</ Button >
151
+ < Button className = { styles [ 'context-menu-option-container' ] } title = { seasonWatched ? t ( 'CTX_UNMARK_REST' ) : t ( 'CTX_MARK_REST' ) } onClick = { toggleWatchedSeasonOnClick } >
152
+ < div className = { styles [ 'context-menu-option-label' ] } > { seasonWatched ? t ( 'CTX_UNMARK_REST' ) : t ( 'CTX_MARK_REST' ) } </ div >
153
+ </ Button >
145
154
</ div >
146
155
) ;
147
- } , [ watched , toggleWatchedOnClick ] ) ;
156
+ } , [ watched , seasonWatched , toggleWatchedOnClick ] ) ;
148
157
React . useEffect ( ( ) => {
149
158
if ( ! routeFocused ) {
150
159
closeMenu ( ) ;
@@ -182,17 +191,20 @@ Video.propTypes = {
182
191
id : PropTypes . string ,
183
192
title : PropTypes . string ,
184
193
thumbnail : PropTypes . string ,
194
+ season : PropTypes . number ,
185
195
episode : PropTypes . number ,
186
196
released : PropTypes . instanceOf ( Date ) ,
187
197
upcoming : PropTypes . bool ,
188
198
watched : PropTypes . bool ,
189
199
progress : PropTypes . number ,
190
200
scheduled : PropTypes . bool ,
201
+ seasonWatched : PropTypes . bool ,
191
202
deepLinks : PropTypes . shape ( {
192
203
metaDetailsStreams : PropTypes . string ,
193
204
player : PropTypes . string
194
205
} ) ,
195
206
onMarkVideoAsWatched : PropTypes . func ,
207
+ onMarkSeasonAsWatched : PropTypes . func ,
196
208
} ;
197
209
198
210
module . exports = Video ;
0 commit comments