How to use the topcoder-react-lib.challenge.filter function in topcoder-react-lib

To help you get started, we’ve selected a few topcoder-react-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github topcoder-platform / community-app / src / shared / containers / tc-communities / cognitive / home.jsx View on Github external
import communityActions from 'actions/tc-communities';
import Home from 'components/tc-communities/communities/cognitive/Home';
import moment from 'moment';
import PT from 'prop-types';
import React from 'react';
import resourcesActions from 'actions/page/communities/cognitive/resources';
import shortId from 'shortid';
import { USER_GROUP_MAXAGE } from 'config';

import { connect } from 'react-redux';
import { challenge as challengeUtils } from 'topcoder-react-lib';

/* Holds cache time [ms] for the data demanded by this container. */
const MAXAGE = 30 * 60 * 1000;

const Filter = challengeUtils.filter;

class HomeContainer extends React.Component {
  componentDidMount() {
    const {
      activeChallengesTimestamp,
      auth,
      communitiesList,
      getAllActiveChallenges,
      getCommunitiesList,
      loadingActiveChallenges,
    } = this.props;
    if (Date.now() - activeChallengesTimestamp > MAXAGE
    && !loadingActiveChallenges) {
      getAllActiveChallenges(auth.tokenV3);
    }
    if (Date.now() - communitiesList.timestamp > USER_GROUP_MAXAGE
github topcoder-platform / community-app / src / shared / components / Dashboard / CurrentActivity / index.jsx View on Github external
import React from 'react';
import PT from 'prop-types';
import _ from 'lodash';
import { TABS } from 'actions/page/dashboard';

import { challenge as challengeUtils } from 'topcoder-react-lib';

import Challenges from './Challenges';
import Communities from './Communities';
import Header from './Header';
import Srms from './Srms';

import './styles.scss';

const Filter = challengeUtils.filter;

/* eslint-disable react/no-unused-state */

export default class MyChallenges extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      activeTab: 0,
      viewMode: 'tile',
      selectedCommunityId: '',
      showMyCommunityOnly: false,
    };
    this.setViewMode = this.setViewMode.bind(this);
    this.setTab = this.setTab.bind(this);
    this.selectCommunity = this.selectCommunity.bind(this);
  }
github topcoder-platform / community-app / src / shared / components / challenge-listing / index.jsx View on Github external
import moment from 'moment';
import React from 'react';
import PT from 'prop-types';
import Sticky from 'react-stickynode';
import { challenge as challengeUtils } from 'topcoder-react-lib';
import Sidebar from 'containers/challenge-listing/Sidebar';
import { isReviewOpportunitiesBucket } from 'utils/challenge-listing/buckets';
import { config } from 'topcoder-react-utils';

import Listing from './Listing';
import ChallengeCardPlaceholder from './placeholders/ChallengeCard';
import SRMCard from './SRMCard';

import './style.scss';

const Filter = challengeUtils.filter;

// Number of challenge placeholder card to display
const CHALLENGE_PLACEHOLDER_COUNT = 8;

export default function ChallengeListing(props) {
  const {
    activeBucket,
    auth,
    challenges: propChallenges,
    communityFilter,
    communityName,
    defaultCommunityId,
    extraBucket,
    filterState,
    hideSrm,
    hideTcLinksInFooter,
github topcoder-platform / community-app / src / shared / components / challenge-listing / Sidebar / BucketSelector / index.jsx View on Github external
/**
 * Sidebar content in the regular mode: Renders a list of challenge buckets,
 * and custom user-saved filters, allowing to switch between them. It also
 * has a link switching the sidebar into filters editor mode.
 */

import PT from 'prop-types';
import React from 'react';
import { BUCKETS } from 'utils/challenge-listing/buckets';
import { challenge as challengeUtils } from 'topcoder-react-lib';

import Bucket from './Bucket';

import './style.scss';

const Filter = challengeUtils.filter;

const RSS_LINK = 'http://feeds.topcoder.com/challenges/feed?list=active&contestType=all';

export default function BucketSelector({
  activeBucket,
  activeSavedFilter,
  buckets,
  challenges,
  communityFilter,
  disabled,
  extraBucket,
  filterState,
  isAuth,
  savedFilters,
  selectBucket,
  selectSavedFilter,
github topcoder-platform / community-app / src / shared / components / challenge-listing / Filters / ChallengeFilters.jsx View on Github external
import React from 'react';
import PT from 'prop-types';
import SwitchWithLabel from 'components/SwitchWithLabel';
import { challenge as challengeUtils } from 'topcoder-react-lib';
import { COMPETITION_TRACKS as TRACKS } from 'utils/tc';

import ChallengeSearchBar from './ChallengeSearchBar';
import EditTrackPanel from './EditTrackPanel';
import FiltersIcon from './FiltersSwitch/filters-icon.svg';
import FiltersPanel from './FiltersPanel';
import FiltersSwitch from './FiltersSwitch';
import FiltersCardsType from './FiltersCardsType';

import './ChallengeFilters.scss';

const Filter = challengeUtils.filter;

export default function ChallengeFilters({
  communityFilters,
  communityName,
  defaultCommunityId,
  challenges,
  expanded,
  filterState,
  isAuth,
  auth,
  hideSrm,
  isCardTypeSet,
  isReviewOpportunitiesBucket,
  saveFilter,
  searchText,
  selectCommunity,
github topcoder-platform / community-app / src / shared / components / challenge-listing / Filters / ChallengeFilters.jsx View on Github external
import React from 'react';
import PT from 'prop-types';
import SwitchWithLabel from 'components/SwitchWithLabel';
import { challenge as challengeUtil } from 'topcoder-react-lib';
import { COMPETITION_TRACKS as TRACKS } from 'utils/tc';

import ChallengeSearchBar from './ChallengeSearchBar';
import EditTrackPanel from './EditTrackPanel';
import FiltersIcon from './FiltersSwitch/filters-icon.svg';
import FiltersPanel from './FiltersPanel';
import FiltersSwitch from './FiltersSwitch';
import FiltersCardsType from './FiltersCardsType';

import './ChallengeFilters.scss';

const Filter = challengeUtil.filter;

export default function ChallengeFilters({
  communityFilters,
  communityName,
  defaultCommunityId,
  challenges,
  expanded,
  filterState,
  isAuth,
  auth,
  hideSrm,
  isCardTypeSet,
  isReviewOpportunitiesBucket,
  saveFilter,
  searchText,
  selectCommunity,
github topcoder-platform / community-app / src / shared / containers / challenge-listing / Listing / index.jsx View on Github external
import React from 'react';
import PT from 'prop-types';
import shortId from 'shortid';
import { connect } from 'react-redux';
import ChallengeListing from 'components/challenge-listing';
import Banner from 'components/tc-communities/Banner';
import sidebarActions from 'actions/challenge-listing/sidebar';
import communityActions from 'actions/tc-communities';
import { BUCKETS } from 'utils/challenge-listing/buckets';
import { MetaTags } from 'topcoder-react-utils';
import { USER_GROUP_MAXAGE } from 'config';

import ogImage from '../../../../assets/images/og_image.jpg';
import style from './styles.scss';

const { combine, mapToBackend } = challengeUtils.filter;

let mounted = false;

const SEO_PAGE_TITLE = 'Topcoder Challenges';

export class ListingContainer extends React.Component {
  componentDidMount() {
    const {
      activeBucket,
      auth,
      communitiesList,
      communityId,
      getCommunitiesList,
      markHeaderMenu,
      selectBucket,
      selectCommunity,
github topcoder-platform / community-app / src / shared / containers / challenge-listing / Listing / index.jsx View on Github external
import React from 'react';
import PT from 'prop-types';
import shortId from 'shortid';
import { connect } from 'react-redux';
import ChallengeListing from 'components/challenge-listing';
import Banner from 'components/tc-communities/Banner';
import sidebarActions from 'actions/challenge-listing/sidebar';
import communityActions from 'actions/tc-communities';
import { BUCKETS } from 'utils/challenge-listing/buckets';
import { config, MetaTags } from 'topcoder-react-utils';
import { USER_GROUP_MAXAGE } from 'config';

import ogImage from '../../../../assets/images/og_image.jpg';
import style from './styles.scss';

const { combine, mapToBackend } = challengeUtils.filter;

let mounted = false;

const SEO_PAGE_TITLE = 'Topcoder Challenges';

export class ListingContainer extends React.Component {
  componentDidMount() {
    const {
      activeBucket,
      auth,
      communitiesList,
      communityId,
      getCommunitiesList,
      markHeaderMenu,
      selectBucket,
      selectCommunity,
github topcoder-platform / community-app / src / shared / components / challenge-listing / Filters / FiltersPanel / index.jsx View on Github external
import { challenge as challengeUtils } from 'topcoder-react-lib';
import React from 'react';
import PT from 'prop-types';
import Select from 'components/Select';
import moment from 'moment';
import { Button, PrimaryButton } from 'topcoder-react-ui-kit';
import Tooltip from 'components/Tooltip';
import { config, Link } from 'topcoder-react-utils';
import { COMPOSE, PRIORITY } from 'react-css-super-themr';
import { REVIEW_OPPORTUNITY_TYPES } from 'utils/tc';
import CheckmarkIcon from './CheckmarkIcon';
import DateRangePicker from '../DateRangePicker';
import style from './style.scss';
import UiSimpleRemove from '../../Icons/ui-simple-remove.svg';

const Filter = challengeUtils.filter;

export default function FiltersPanel({
  communityFilters,
  defaultCommunityId,
  filterState,
  challenges,
  hidden,
  isAuth,
  auth,
  isReviewOpportunitiesBucket,
  onClose,
  onSaveFilter,
  selectCommunity,
  selectedCommunityId,
  setFilterState,
  setSearchText,
github topcoder-platform / community-app / src / shared / components / challenge-listing / Sidebar / BucketSelector / Bucket / index.jsx View on Github external
/**
 * Regular sidebar row.
 */

import _ from 'lodash';
import { challenge as challengeUtils } from 'topcoder-react-lib';
import PT from 'prop-types';
import { connect } from 'react-redux';
import React from 'react';
import './style.scss';

const Filter = challengeUtils.filter;

function Bucket({
  active,
  bucket,
  challenges,
  disabled,
  onClick,
  allActiveChallengesLoaded,
  meta,
}) {
  let countEl;
  if (!bucket.hideCount && !disabled) {
    const filter = Filter.getFilterFunction(bucket.filter);
    let count;
    if (allActiveChallengesLoaded) {
      count = challenges.filter(filter).length;