add lastViewed prop to <FileCard>
This commit is contained in:
parent
86a40eacbc
commit
9bd0a32b99
2 changed files with 9 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import moment from 'moment';
|
||||||
import { normalizeURI, convertToShareLink } from 'lbry-redux';
|
import { normalizeURI, convertToShareLink } from 'lbry-redux';
|
||||||
import type { Claim, Metadata } from 'types/claim';
|
import type { Claim, Metadata } from 'types/claim';
|
||||||
import CardMedia from 'component/cardMedia';
|
import CardMedia from 'component/cardMedia';
|
||||||
|
@ -24,6 +25,7 @@ type Props = {
|
||||||
showPrice: boolean,
|
showPrice: boolean,
|
||||||
pending?: boolean,
|
pending?: boolean,
|
||||||
position: ?number,
|
position: ?number,
|
||||||
|
lastViewed: ?number,
|
||||||
/* eslint-disable react/no-unused-prop-types */
|
/* eslint-disable react/no-unused-prop-types */
|
||||||
resolveUri: string => void,
|
resolveUri: string => void,
|
||||||
isResolvingUri: boolean,
|
isResolvingUri: boolean,
|
||||||
|
@ -63,6 +65,7 @@ class FileCard extends React.PureComponent<Props> {
|
||||||
showPrice,
|
showPrice,
|
||||||
pending,
|
pending,
|
||||||
position,
|
position,
|
||||||
|
lastViewed,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const shouldHide = !claimIsMine && !pending && obscureNsfw && metadata && metadata.nsfw;
|
const shouldHide = !claimIsMine && !pending && obscureNsfw && metadata && metadata.nsfw;
|
||||||
|
@ -107,6 +110,9 @@ class FileCard extends React.PureComponent<Props> {
|
||||||
{fileInfo && <Icon icon={icons.LOCAL} />}
|
{fileInfo && <Icon icon={icons.LOCAL} />}
|
||||||
{position && <Icon icon={icons.REFRESH} />}
|
{position && <Icon icon={icons.REFRESH} />}
|
||||||
</div>
|
</div>
|
||||||
|
{lastViewed && (
|
||||||
|
<div className="card__subtitle">{moment(lastViewed).from(moment())}</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|
|
@ -47,7 +47,9 @@ class UserHistoryPage extends React.PureComponent<Props> {
|
||||||
<div className="card__list">
|
<div className="card__list">
|
||||||
{history && history.length ? (
|
{history && history.length ? (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{history.map(item => <FileCard key={item.uri} uri={item.uri} />)}
|
{history.map(item => (
|
||||||
|
<FileCard key={item.uri} uri={item.uri} lastViewed={item.lastViewed} />
|
||||||
|
))}
|
||||||
{pageCount > 1 && (
|
{pageCount > 1 && (
|
||||||
<FormRow verticallyCentered centered>
|
<FormRow verticallyCentered centered>
|
||||||
<ReactPaginate
|
<ReactPaginate
|
||||||
|
|
Loading…
Reference in a new issue