Skip to content

fix: issue #76 #159

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 30 additions & 28 deletions src/containers/Challenges/Listing/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import PT from "prop-types";
import _ from "lodash";
import moment from "moment";
import Panel from "../../../components/Panel";
import ChallengeError from "../Listing/errors/ChallengeError";
import Pagination from "../../../components/Pagination";
import ChallengeItem from "./ChallengeItem";
import TextInput from "../../../components/TextInput";
Expand Down Expand Up @@ -101,38 +102,39 @@ const Listing = ({
</div>
</div>
</Panel.Header>
<Panel.Body>
{challenges.map((challenge, index) => (
<div key={challenge.id} styleName={index % 2 === 0 ? "even" : "odd"}>
<ChallengeItem
challenge={challenge}
onClickTag={(tag) => {
const filterChange = { tags: [tag] };
updateFilter(filterChange);
}}
onClickTrack={(track) => {
const filterChange = { tracks: [track] };
{challenges.length ?
<Panel.Body>
{challenges.map((challenge, index) => (
<div key={challenge.id} styleName={index % 2 === 0 ? "even" : "odd"}>
<ChallengeItem
challenge={challenge}
onClickTag={(tag) => {
const filterChange = { tags: [tag] };
updateFilter(filterChange);
}}
onClickTrack={(track) => {
const filterChange = { tracks: [track] };
updateFilter(filterChange);
}}
isLoggedIn={isLoggedIn}
/>
</div>
))}
<div styleName="pagination">
<Pagination
length={total}
pageSize={perPage}
pageIndex={utils.pagination.pageToPageIndex(page)}
onChange={(event) => {
const filterChange = {
page: utils.pagination.pageIndexToPage(event.pageIndex),
perPage: event.pageSize,
};
updateFilter(filterChange);
}}
isLoggedIn={isLoggedIn}
/>
</div>
))}
<div styleName="pagination">
<Pagination
length={total}
pageSize={perPage}
pageIndex={utils.pagination.pageToPageIndex(page)}
onChange={(event) => {
const filterChange = {
page: utils.pagination.pageIndexToPage(event.pageIndex),
perPage: event.pageSize,
};
updateFilter(filterChange);
}}
/>
</div>
</Panel.Body>
</Panel.Body> : <ChallengeError /> }
</Panel>
);
};
Expand Down
4 changes: 1 addition & 3 deletions src/containers/Challenges/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import PT from "prop-types";
import { connect } from "react-redux";
import Listing from "./Listing";
import actions from "../../actions";
import ChallengeError from "./Listing/errors/ChallengeError";
// import ChallengeRecommendedError from "./Listing/errors/ChallengeRecommendedError";
import * as constants from "../../constants";
import IconListView from "../../assets/icons/list-view.svg";
Expand Down Expand Up @@ -70,8 +69,7 @@ const Challenges = ({
</button>
</span>
</h1>
{challenges.length === 0 && initialized && <ChallengeError />}
{challenges.length > 0 && (
{initialized && (
<>
{/*noRecommendedChallenges && <ChallengeRecommendedError />*/}
<Listing
Expand Down