diff --git a/ui/component/claimPreview/view.jsx b/ui/component/claimPreview/view.jsx index d5a9ccffd..834eb04b9 100644 --- a/ui/component/claimPreview/view.jsx +++ b/ui/component/claimPreview/view.jsx @@ -11,6 +11,7 @@ import { isChannelClaim } from 'util/claim'; import { formatLbryUrlForWeb } from 'util/url'; import { formatClaimPreviewTitle } from 'util/formatAriaLabel'; import { toCompactNotation } from 'util/string'; +import ClaimPreviewProgress from 'component/claimPreviewProgress'; import Tooltip from 'component/common/tooltip'; import FileThumbnail from 'component/fileThumbnail'; import UriIndicator from 'component/uriIndicator'; @@ -368,7 +369,12 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { {isChannelUri && claim ? ( - + ) : ( <> @@ -390,6 +396,7 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { )} + ) : ( @@ -413,7 +420,12 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { {!isChannelUri && signingChannel && (
- +
)} diff --git a/ui/component/claimPreviewProgress/index.js b/ui/component/claimPreviewProgress/index.js new file mode 100644 index 000000000..99e4b1159 --- /dev/null +++ b/ui/component/claimPreviewProgress/index.js @@ -0,0 +1,14 @@ +import { connect } from 'react-redux'; +import { selectClaimForUri } from 'redux/selectors/claims'; +import { selectContentPositionForUri } from 'redux/selectors/content'; +import ClaimPreviewProgress from './view'; + +const select = (state, props) => { + const claim = selectClaimForUri(state, props.uri); + return { + position: selectContentPositionForUri(state, props.uri), + duration: claim?.value?.video?.duration || claim?.value?.audio?.duration, + }; +}; + +export default connect(select)(ClaimPreviewProgress); diff --git a/ui/component/claimPreviewProgress/view.jsx b/ui/component/claimPreviewProgress/view.jsx new file mode 100644 index 000000000..ed046cdc2 --- /dev/null +++ b/ui/component/claimPreviewProgress/view.jsx @@ -0,0 +1,18 @@ +// @flow +import React from 'react'; + +type Props = { + uri: string, + position: ?number, + duration: ?number, +}; + +export default function ClaimPreviewProgress(props: Props) { + const { position, duration } = props; + + if (!position || !duration) { + return null; + } + + return
; +} diff --git a/ui/component/claimPreviewTile/view.jsx b/ui/component/claimPreviewTile/view.jsx index 774b25615..f998b065d 100644 --- a/ui/component/claimPreviewTile/view.jsx +++ b/ui/component/claimPreviewTile/view.jsx @@ -2,6 +2,7 @@ import React from 'react'; import classnames from 'classnames'; import { NavLink, withRouter } from 'react-router-dom'; +import ClaimPreviewProgress from 'component/claimPreviewProgress'; import FileThumbnail from 'component/fileThumbnail'; import UriIndicator from 'component/uriIndicator'; import TruncatedText from 'component/common/truncated-text'; @@ -216,10 +217,10 @@ function ClaimPreviewTile(props: Props) { {isStream && }
{/* @endif */} -
+ )} {isCollection && ( diff --git a/ui/scss/component/_claim-list.scss b/ui/scss/component/_claim-list.scss index 2ca6f2101..a507dd5b7 100644 --- a/ui/scss/component/_claim-list.scss +++ b/ui/scss/component/_claim-list.scss @@ -1115,6 +1115,14 @@ } } +.claim-preview__progress { + position: absolute; + bottom: 0; + height: 4px; + width: 100%; + background-color: var(--color-primary); +} + .claim-preview__claim-property-overlay { position: absolute; bottom: var(--spacing-xxs);