Watch-progress indicator
This commit is contained in:
parent
1706ceed81
commit
84b9bd617a
5 changed files with 56 additions and 3 deletions
|
@ -11,6 +11,7 @@ import { isChannelClaim } from 'util/claim';
|
||||||
import { formatLbryUrlForWeb } from 'util/url';
|
import { formatLbryUrlForWeb } from 'util/url';
|
||||||
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
import { formatClaimPreviewTitle } from 'util/formatAriaLabel';
|
||||||
import { toCompactNotation } from 'util/string';
|
import { toCompactNotation } from 'util/string';
|
||||||
|
import ClaimPreviewProgress from 'component/claimPreviewProgress';
|
||||||
import Tooltip from 'component/common/tooltip';
|
import Tooltip from 'component/common/tooltip';
|
||||||
import FileThumbnail from 'component/fileThumbnail';
|
import FileThumbnail from 'component/fileThumbnail';
|
||||||
import UriIndicator from 'component/uriIndicator';
|
import UriIndicator from 'component/uriIndicator';
|
||||||
|
@ -368,7 +369,12 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
|
|
||||||
{isChannelUri && claim ? (
|
{isChannelUri && claim ? (
|
||||||
<UriIndicator focusable={false} uri={uri} link>
|
<UriIndicator focusable={false} uri={uri} link>
|
||||||
<ChannelThumbnail uri={uri} small={type === 'inline'} showMemberBadge={showMemberBadge} checkMembership={false} />
|
<ChannelThumbnail
|
||||||
|
uri={uri}
|
||||||
|
small={type === 'inline'}
|
||||||
|
showMemberBadge={showMemberBadge}
|
||||||
|
checkMembership={false}
|
||||||
|
/>
|
||||||
</UriIndicator>
|
</UriIndicator>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
@ -390,6 +396,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
<PreviewOverlayProperties uri={uri} small={type === 'small'} properties={liveProperty} />
|
<PreviewOverlayProperties uri={uri} small={type === 'small'} properties={liveProperty} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
<ClaimPreviewProgress uri={uri} />
|
||||||
</FileThumbnail>
|
</FileThumbnail>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
) : (
|
) : (
|
||||||
|
@ -413,7 +420,12 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||||
{!isChannelUri && signingChannel && (
|
{!isChannelUri && signingChannel && (
|
||||||
<div className="claim-preview__channel-staked">
|
<div className="claim-preview__channel-staked">
|
||||||
<UriIndicator focusable={false} uri={uri} link hideAnonymous>
|
<UriIndicator focusable={false} uri={uri} link hideAnonymous>
|
||||||
<ChannelThumbnail uri={signingChannel.permanent_url} xsmall showMemberBadge={showMemberBadge} checkMembership={false} />
|
<ChannelThumbnail
|
||||||
|
uri={signingChannel.permanent_url}
|
||||||
|
xsmall
|
||||||
|
showMemberBadge={showMemberBadge}
|
||||||
|
checkMembership={false}
|
||||||
|
/>
|
||||||
</UriIndicator>
|
</UriIndicator>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
14
ui/component/claimPreviewProgress/index.js
Normal file
14
ui/component/claimPreviewProgress/index.js
Normal file
|
@ -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);
|
18
ui/component/claimPreviewProgress/view.jsx
Normal file
18
ui/component/claimPreviewProgress/view.jsx
Normal file
|
@ -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 <div className="claim-preview__progress" style={{ width: `${(position / duration) * 100}%` }} />;
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { NavLink, withRouter } from 'react-router-dom';
|
import { NavLink, withRouter } from 'react-router-dom';
|
||||||
|
import ClaimPreviewProgress from 'component/claimPreviewProgress';
|
||||||
import FileThumbnail from 'component/fileThumbnail';
|
import FileThumbnail from 'component/fileThumbnail';
|
||||||
import UriIndicator from 'component/uriIndicator';
|
import UriIndicator from 'component/uriIndicator';
|
||||||
import TruncatedText from 'component/common/truncated-text';
|
import TruncatedText from 'component/common/truncated-text';
|
||||||
|
@ -216,10 +217,10 @@ function ClaimPreviewTile(props: Props) {
|
||||||
{isStream && <FileDownloadLink focusable={false} uri={canonicalUrl} hideOpenButton />}
|
{isStream && <FileDownloadLink focusable={false} uri={canonicalUrl} hideOpenButton />}
|
||||||
</div>
|
</div>
|
||||||
{/* @endif */}
|
{/* @endif */}
|
||||||
|
|
||||||
<div className="claim-preview__file-property-overlay">
|
<div className="claim-preview__file-property-overlay">
|
||||||
<PreviewOverlayProperties uri={uri} properties={liveProperty || properties} />
|
<PreviewOverlayProperties uri={uri} properties={liveProperty || properties} />
|
||||||
</div>
|
</div>
|
||||||
|
<ClaimPreviewProgress uri={uri} />
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)}
|
)}
|
||||||
{isCollection && (
|
{isCollection && (
|
||||||
|
|
|
@ -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 {
|
.claim-preview__claim-property-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: var(--spacing-xxs);
|
bottom: var(--spacing-xxs);
|
||||||
|
|
Loading…
Reference in a new issue