Add requested review changes (2)

This commit is contained in:
Raphael Wickihalder 2022-05-04 15:20:34 +02:00 committed by Thomas Zarebczan
parent 7045f4ed45
commit 9ff4578eb1
3 changed files with 11 additions and 29 deletions

View file

@ -72,7 +72,6 @@ type Props = {
activeLivestreamForChannel: any,
defaultQuality: ?string,
doToast: ({ message: string, linkText: string, linkTarget: string }) => void,
selectHistory: Array<string>,
doSetContentHistoryItem: (uri: string) => void,
doClearContentHistoryUri: (uri: string) => void,
};

View file

@ -1,24 +1,12 @@
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import WatchHistoryPage from './view';
import { makeSelectClaimForClaimId, makeSelectChannelForClaimUri } from 'redux/selectors/claims';
import { selectHistory } from 'redux/selectors/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 {
selectHistory: selectHistory(state, uri),
uri,
user: selectUser(state),
channel: uri && makeSelectChannelForClaimUri(uri)(state),
history: selectHistory(state),
};
};

View file

@ -1,5 +1,5 @@
// @flow
import React, { useState } from 'react';
import React from 'react';
import ClaimList from 'component/claimList';
import Page from 'component/page';
import Button from 'component/button';
@ -12,29 +12,24 @@ import Tooltip from 'component/common/tooltip';
export const PAGE_VIEW_QUERY = 'view';
type Props = {
selectHistory: Array<any>,
history: Array<any>,
doClearContentHistoryAll: () => void,
};
export default function WatchHistoryPage(props: Props) {
const { selectHistory, doClearContentHistoryAll } = props;
const [watchHistory, setWatchHistory] = useState([]);
const { history, doClearContentHistoryAll } = props;
const [unavailableUris] = React.useState([]);
const watchHistory = [];
for (let entry of history) {
if (entry.uri.indexOf('@') !== -1) {
watchHistory.push(entry.uri);
}
}
function clearHistory() {
doClearContentHistoryAll();
}
React.useEffect(() => {
let newWatchHistory = [];
for (let entry of selectHistory) {
if (entry.uri.indexOf('@') !== -1) {
newWatchHistory.push(entry.uri);
}
}
setWatchHistory(newWatchHistory);
}, [selectHistory]);
return (
<Page className="historyPage-wrapper">
<div className={classnames('section card-stack')}>