Add requested review changes (2)
This commit is contained in:
parent
7045f4ed45
commit
9ff4578eb1
3 changed files with 11 additions and 29 deletions
|
@ -72,7 +72,6 @@ type Props = {
|
||||||
activeLivestreamForChannel: any,
|
activeLivestreamForChannel: any,
|
||||||
defaultQuality: ?string,
|
defaultQuality: ?string,
|
||||||
doToast: ({ message: string, linkText: string, linkTarget: string }) => void,
|
doToast: ({ message: string, linkText: string, linkTarget: string }) => void,
|
||||||
selectHistory: Array<string>,
|
|
||||||
doSetContentHistoryItem: (uri: string) => void,
|
doSetContentHistoryItem: (uri: string) => void,
|
||||||
doClearContentHistoryUri: (uri: string) => void,
|
doClearContentHistoryUri: (uri: string) => void,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,24 +1,12 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { withRouter } from 'react-router-dom';
|
import { withRouter } from 'react-router-dom';
|
||||||
import WatchHistoryPage from './view';
|
import WatchHistoryPage from './view';
|
||||||
import { makeSelectClaimForClaimId, makeSelectChannelForClaimUri } from 'redux/selectors/claims';
|
|
||||||
import { selectHistory } from 'redux/selectors/content';
|
import { selectHistory } from 'redux/selectors/content';
|
||||||
import { doClearContentHistoryAll } from 'redux/actions/content';
|
import { doClearContentHistoryAll } from 'redux/actions/content';
|
||||||
import { selectUser } from 'redux/selectors/user';
|
|
||||||
|
|
||||||
const select = (state, props) => {
|
|
||||||
const { match } = props;
|
|
||||||
const { params } = match;
|
|
||||||
const { collectionId } = params;
|
|
||||||
|
|
||||||
const claim = collectionId && makeSelectClaimForClaimId(collectionId)(state);
|
|
||||||
const uri = (claim && (claim.canonical_url || claim.permanent_url)) || null;
|
|
||||||
|
|
||||||
|
const select = (state) => {
|
||||||
return {
|
return {
|
||||||
selectHistory: selectHistory(state, uri),
|
history: selectHistory(state),
|
||||||
uri,
|
|
||||||
user: selectUser(state),
|
|
||||||
channel: uri && makeSelectChannelForClaimUri(uri)(state),
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React, { useState } from 'react';
|
import React from 'react';
|
||||||
import ClaimList from 'component/claimList';
|
import ClaimList from 'component/claimList';
|
||||||
import Page from 'component/page';
|
import Page from 'component/page';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
|
@ -12,29 +12,24 @@ import Tooltip from 'component/common/tooltip';
|
||||||
export const PAGE_VIEW_QUERY = 'view';
|
export const PAGE_VIEW_QUERY = 'view';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
selectHistory: Array<any>,
|
history: Array<any>,
|
||||||
doClearContentHistoryAll: () => void,
|
doClearContentHistoryAll: () => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function WatchHistoryPage(props: Props) {
|
export default function WatchHistoryPage(props: Props) {
|
||||||
const { selectHistory, doClearContentHistoryAll } = props;
|
const { history, doClearContentHistoryAll } = props;
|
||||||
const [watchHistory, setWatchHistory] = useState([]);
|
|
||||||
const [unavailableUris] = React.useState([]);
|
const [unavailableUris] = React.useState([]);
|
||||||
|
const watchHistory = [];
|
||||||
|
for (let entry of history) {
|
||||||
|
if (entry.uri.indexOf('@') !== -1) {
|
||||||
|
watchHistory.push(entry.uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function clearHistory() {
|
function clearHistory() {
|
||||||
doClearContentHistoryAll();
|
doClearContentHistoryAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
let newWatchHistory = [];
|
|
||||||
for (let entry of selectHistory) {
|
|
||||||
if (entry.uri.indexOf('@') !== -1) {
|
|
||||||
newWatchHistory.push(entry.uri);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setWatchHistory(newWatchHistory);
|
|
||||||
}, [selectHistory]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page className="historyPage-wrapper">
|
<Page className="historyPage-wrapper">
|
||||||
<div className={classnames('section card-stack')}>
|
<div className={classnames('section card-stack')}>
|
||||||
|
|
Loading…
Reference in a new issue