Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support channel definitions from /file/list_homepage #1267

Merged
merged 1 commit into from May 24, 2018

Conversation

Projects
None yet
5 participants
@daovist
Copy link
Contributor

daovist commented Apr 3, 2018

This PR for issue #1049

Is ready to be reviewed by @liamcardenas

Uses existing reducers, actions, selectors

Moves component/common/category-list.jsx to its own top level component at component/categoryList because it needs props to fetchChannel and select claimsByChannel and claimsById

Fetches channels in componentDidMount when the category is a channel

Returns false in isCardVisible when !section -- this fixed the error I was getting; I'm not sure exactly how the code for the UI works

Adds const channel to the CategoryList render function, which is an empty array until the data comes in, and once the data comes in is an array of proper uris made with 'buildURIfromcategory` selector data

Maps the channel array to <FileCard> components when appropriate

Displays a ' for a channel (categoryLink, names=[]) when featuredUris[category].lengthis false inDiscoverPage`

Imports CategoryList from new location in Discover and Subscriptions pages

Fixes various linting errors I found along the way

Includes fake data for demo/testing purposes to be removed after review/updates

@lbryio lbryio deleted a comment from codacy-bot Apr 6, 2018

@codacy-bot

This comment has been minimized.

Copy link

codacy-bot commented Apr 6, 2018

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- src/renderer/redux/actions/content.js  1
         

See the complete overview on Codacy

@seanyesmunt seanyesmunt self-requested a review May 11, 2018

@lbry-bot lbry-bot assigned seanyesmunt and unassigned seanyesmunt May 11, 2018

@seanyesmunt
Copy link
Member

seanyesmunt left a comment

This is really close. I think some of the logic can be removed since we already have code that handles this. It just uses the same data that page 1 of the channel page uses.

key={category}
category={category.split('#')[0]}
categoryLink={category}
names={[]}

This comment has been minimized.

@seanyesmunt

seanyesmunt May 11, 2018

Member

This prop should just have a default value of []

@@ -1,7 +1,7 @@
// @flow
import React from 'react';
import Page from 'component/page';
import CategoryList from 'component/common/category-list';
import CategoryList from 'component/categoryList';

This comment has been minimized.

@seanyesmunt

seanyesmunt May 11, 2018

Member

These changes aren't needed anymore since subscriptions page isn't using this component

const { canScrollNext, canScrollPrevious } = this.state;
const channel =

This comment has been minimized.

@seanyesmunt

seanyesmunt May 11, 2018

Member

A better name for this is probably channelURIs

const { canScrollNext, canScrollPrevious } = this.state;
const channel =

This comment has been minimized.

@seanyesmunt

seanyesmunt May 11, 2018

Member

you should also be able to use makeSelectClaimsInChannelForCurrentPage, which is what the channel page uses. Just get the first page of content and you won't have to worry about this logic.

This comment has been minimized.

@daovist

daovist May 22, 2018

Author Contributor

I have tried using in the makeSelectClaimsInChannelForCurrentPage selector in place of the other two and the logic that goes with them, and I keep running into problems. I'm passing props.categoryLink as the uri, which I think should be fine based on console logging props. I have tried various forms of the makeSelect pattern I found in the RewardLink container-component to no avail, including rewriting the selectors, but there are so many not-working version I'm not sure what to push/show you.

This comment has been minimized.

@daovist

daovist May 22, 2018

Author Contributor
@@ -109,6 +117,9 @@ class CategoryList extends React.PureComponent<Props, State> {

// check if a card is fully visible horizontally
isCardVisible = (section: HTMLElement) => {
if (!section) {

This comment has been minimized.

@seanyesmunt
@@ -32,6 +35,11 @@ class CategoryList extends React.PureComponent<Props, State> {
}

componentDidMount() {
const { category, fetchChannel } = this.props;
if (category[0] === '@') {
fetchChannel(category);

This comment has been minimized.

@seanyesmunt

seanyesmunt May 11, 2018

Member

Use makeSelectFetchingChannelClaims to make sure we aren't already fetching for this channel.


type Props = {
category: string,
names: Array<string>,
categoryLink?: string,
claimsByChannel: {},
claimsById: {},

This comment has been minimized.

@seanyesmunt

seanyesmunt May 11, 2018

Member

You can use the Caim type that I recently created.

@lbry-bot lbry-bot assigned seanyesmunt and unassigned seanyesmunt May 11, 2018

@daovist daovist force-pushed the daovist:explore-channels branch from 4c31402 to d1846d1 May 13, 2018

@daovist daovist force-pushed the daovist:explore-channels branch from d1846d1 to 844bb14 May 22, 2018

@daovist

This comment has been minimized.

Copy link
Contributor Author

daovist commented May 22, 2018

This PR still contains sample data to demonstrate the functionality. I will remove it and clean up commit history following approval.

@seanyesmunt

This comment has been minimized.

Copy link
Member

seanyesmunt commented May 24, 2018

Lets merge this. @daovist once you remove the mock data I'll merge

@daovist daovist force-pushed the daovist:explore-channels branch 2 times, most recently from f576330 to 4f7a647 May 24, 2018

@daovist daovist force-pushed the daovist:explore-channels branch from 4f7a647 to 938a8e1 May 24, 2018

@seanyesmunt seanyesmunt merged commit ddb3106 into lbryio:master May 24, 2018

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.