User history #1846

Merged
daovist merged 17 commits from user-history into master 2018-09-07 07:21:38 +02:00
2 changed files with 9 additions and 1 deletions
Showing only changes of commit 9bd0a32b99 - Show all commits

View file

@ -1,5 +1,6 @@
// @flow
import * as React from 'react';
import moment from 'moment';
import { normalizeURI, convertToShareLink } from 'lbry-redux';
import type { Claim, Metadata } from 'types/claim';
import CardMedia from 'component/cardMedia';
@ -24,6 +25,7 @@ type Props = {
showPrice: boolean,
pending?: boolean,
position: ?number,
lastViewed: ?number,
/* eslint-disable react/no-unused-prop-types */
resolveUri: string => void,
isResolvingUri: boolean,
@ -63,6 +65,7 @@ class FileCard extends React.PureComponent<Props> {
showPrice,
pending,
position,
lastViewed,
} = this.props;
const shouldHide = !claimIsMine && !pending && obscureNsfw && metadata && metadata.nsfw;
@ -107,6 +110,9 @@ class FileCard extends React.PureComponent<Props> {
{fileInfo && <Icon icon={icons.LOCAL} />}
{position && <Icon icon={icons.REFRESH} />}
</div>
{lastViewed && (
<div className="card__subtitle">{moment(lastViewed).from(moment())}</div>
)}
</div>
</section>
);

View file

@ -47,7 +47,9 @@ class UserHistoryPage extends React.PureComponent<Props> {
<div className="card__list">
{history && history.length ? (
<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 && (
<FormRow verticallyCentered centered>
<ReactPaginate