adds sortBy default prop to subscriptions and channel pages #2058

Merged
jessopb merged 1 commit from fixChannel into master 2018-10-26 17:48:14 +02:00
4 changed files with 7 additions and 15 deletions

View file

@ -49,7 +49,7 @@
"formik": "^0.10.4", "formik": "^0.10.4",
"hast-util-sanitize": "^1.1.2", "hast-util-sanitize": "^1.1.2",
"keytar": "^4.2.1", "keytar": "^4.2.1",
"lbry-redux": "lbryio/lbry-redux#03aea43da5f12bc01546a92bdf460ebd08681013", "lbry-redux": "lbryio/lbry-redux#ecd1ab156fb755c8bff4d890679399d66f41ad17",
"lbryinc": "lbryio/lbryinc#3f34af546ee73ff2ee7d8ad05e540b3b0aa658fb", "lbryinc": "lbryio/lbryinc#3f34af546ee73ff2ee7d8ad05e540b3b0aa658fb",
"localforage": "^1.7.1", "localforage": "^1.7.1",
"mammoth": "^1.4.6", "mammoth": "^1.4.6",

View file

@ -12,13 +12,14 @@ type Props = {
fileInfos: Array<FileInfo>, fileInfos: Array<FileInfo>,
checkPending?: boolean, checkPending?: boolean,
sortBy: string, sortBy: string,
page: string, page?: string,
setFileListSort: (string, string) => void, setFileListSort: (?string, string) => void,
}; };
class FileList extends React.PureComponent<Props> { class FileList extends React.PureComponent<Props> {
static defaultProps = { static defaultProps = {
hideFilter: false, hideFilter: false,
sortBy: SORT_OPTIONS.DATE_NEW,
}; };
constructor(props: Props) { constructor(props: Props) {

View file

@ -15,7 +15,6 @@ import {
} from 'redux/actions/subscriptions'; } from 'redux/actions/subscriptions';
import { doSetClientSetting } from 'redux/actions/settings'; import { doSetClientSetting } from 'redux/actions/settings';
import { makeSelectClientSetting } from 'redux/selectors/settings'; import { makeSelectClientSetting } from 'redux/selectors/settings';
import { selectFileListSubscriptionSort } from 'lbry-redux';
import SubscriptionsPage from './view'; import SubscriptionsPage from './view';
const select = state => ({ const select = state => ({
@ -26,7 +25,6 @@ const select = state => ({
autoDownload: makeSelectClientSetting(settings.AUTO_DOWNLOAD)(state), autoDownload: makeSelectClientSetting(settings.AUTO_DOWNLOAD)(state),
allSubscriptions: selectSubscriptionClaims(state), allSubscriptions: selectSubscriptionClaims(state),
unreadSubscriptions: selectUnreadSubscriptions(state), unreadSubscriptions: selectUnreadSubscriptions(state),
sortBy: selectFileListSubscriptionSort(state),
viewMode: selectViewMode(state), viewMode: selectViewMode(state),
}); });

View file

@ -10,7 +10,7 @@ import FileList from 'component/fileList';
import HiddenNsfwClaims from 'component/hiddenNsfwClaims'; import HiddenNsfwClaims from 'component/hiddenNsfwClaims';
import { FormField } from 'component/common/form'; import { FormField } from 'component/common/form';
import FileCard from 'component/fileCard'; import FileCard from 'component/fileCard';
import { parseURI, PAGES } from 'lbry-redux'; import { parseURI } from 'lbry-redux';
type Props = { type Props = {
subscribedChannels: Array<string>, // The channels a user is subscribed to subscribedChannels: Array<string>, // The channels a user is subscribed to
@ -25,7 +25,6 @@ type Props = {
doSetViewMode: ViewMode => void, doSetViewMode: ViewMode => void,
doFetchMySubscriptions: () => void, doFetchMySubscriptions: () => void,
doSetClientSetting: (string, boolean) => void, doSetClientSetting: (string, boolean) => void,
sortBy: string,
}; };
export default class extends React.PureComponent<Props> { export default class extends React.PureComponent<Props> {
@ -45,19 +44,13 @@ export default class extends React.PureComponent<Props> {
} }
renderSubscriptions() { renderSubscriptions() {
const { viewMode, unreadSubscriptions, allSubscriptions, sortBy } = this.props; const { viewMode, unreadSubscriptions, allSubscriptions } = this.props;
if (viewMode === VIEW_ALL) { if (viewMode === VIEW_ALL) {
return ( return (
<React.Fragment> <React.Fragment>
<div className="card__title">{__('Your subscriptions')}</div> <div className="card__title">{__('Your subscriptions')}</div>
<FileList <FileList hideFilter sortByHeight fileInfos={allSubscriptions} />
hideFilter
sortByHeight
fileInfos={allSubscriptions}
sortBy={sortBy}
page={PAGES.SUBSCRIPTIONS}
/>
</React.Fragment> </React.Fragment>
); );
} }