diff --git a/static/app-strings.json b/static/app-strings.json index 357f52efe..712de9a86 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -2327,5 +2327,7 @@ "* Note that as\n peer-to-peer software, your IP address and potentially other system information can be sent to other\n users, though this information is not stored permanently.": "* Note that as\n peer-to-peer software, your IP address and potentially other system information can be sent to other\n users, though this information is not stored permanently.", "Persist watch time": "Persist watch time", "Persist the watch time of the videos you have watched.": "Persist the watch time of the videos you have watched.", + "Clearing...": "Clearing...", + "Cache cleared": "Cache cleared", "--end--": "--end--" } diff --git a/ui/component/fileThumbnail/index.js b/ui/component/fileThumbnail/index.js index f657b7e66..c817b8193 100644 --- a/ui/component/fileThumbnail/index.js +++ b/ui/component/fileThumbnail/index.js @@ -1,12 +1,12 @@ import { connect } from 'react-redux'; import { doResolveUri } from 'redux/actions/claims'; import { makeSelectClaimForUri } from 'redux/selectors/claims'; -import { makeSelectContentPositionForUri } from 'redux/selectors/content'; +import { makeSelectContentWatchedPercentageForUri } from 'redux/selectors/content'; import CardMedia from './view'; const select = (state, props) => { return { - position: makeSelectContentPositionForUri(props.uri)(state), + watchedPercentage: makeSelectContentWatchedPercentageForUri(props.uri)(state), claim: makeSelectClaimForUri(props.uri)(state), }; }; diff --git a/ui/component/fileThumbnail/view.jsx b/ui/component/fileThumbnail/view.jsx index 1e16cadd1..3a9124950 100644 --- a/ui/component/fileThumbnail/view.jsx +++ b/ui/component/fileThumbnail/view.jsx @@ -16,11 +16,20 @@ type Props = { claim: ?StreamClaim, doResolveUri: (string) => void, className?: string, - position: number | null, + watchedPercentage: number, }; function FileThumbnail(props: Props) { - const { claim, uri, doResolveUri, thumbnail: rawThumbnail, children, allowGifs = false, className, position } = props; + const { + claim, + uri, + doResolveUri, + thumbnail: rawThumbnail, + children, + allowGifs = false, + className, + watchedPercentage, + } = props; const passedThumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://'); const thumbnailFromClaim = @@ -30,12 +39,7 @@ function FileThumbnail(props: Props) { const hasResolvedClaim = claim !== undefined; const isGif = thumbnail && thumbnail.endsWith('gif'); - const media = claim && claim.value && (claim.value.video || claim.value.audio); - const duration = media && media.duration; - // When the position is -1, it means the user has watched the entire - // video and he/she is using the persist watch setting. - const watchedPercentage = position === -1 ? 100 : ((position || 0) / (duration || 1)) * 100 || 0; - const viewedBar = position && ( + const viewedBar = watchedPercentage && (